Translated using Weblate (Polish)
[phpmyadmin.git] / view_operations.php
blob7a84355f19c2eca54b63874da624169e8d90c946
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package PhpMyAdmin
6 */
8 /**
11 require_once './libraries/common.inc.php';
13 $pma_table = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
15 /**
16 * functions implementation for this script
18 require_once 'libraries/operations.lib.php';
20 /**
21 * Runs common work
23 require './libraries/tbl_common.inc.php';
24 $url_query .= '&amp;goto=view_operations.php&amp;back=view_operations.php';
25 $url_params['goto'] = $url_params['back'] = 'view_operations.php';
27 /**
28 * Gets tables informations
31 require './libraries/tbl_info.inc.php';
32 $reread_info = false;
34 /**
35 * Updates if required
37 if (isset($_REQUEST['submitoptions'])) {
38 $_message = '';
39 $warning_messages = array();
41 if (isset($_REQUEST['new_name'])) {
42 if ($pma_table->rename($_REQUEST['new_name'])) {
43 $_message .= $pma_table->getLastMessage();
44 $result = true;
45 $GLOBALS['table'] = $pma_table->getName();
46 $reread_info = true;
47 $reload = true;
48 } else {
49 $_message .= $pma_table->getLastError();
50 $result = false;
55 if (isset($result)) {
56 // set to success by default, because result set could be empty
57 // (for example, a table rename)
58 $_type = 'success';
59 if (empty($_message)) {
60 $_message = $result
61 ? __('Your SQL query has been executed successfully')
62 : __('Error');
63 // $result should exist, regardless of $_message
64 $_type = $result ? 'success' : 'error';
66 if (! empty($warning_messages)) {
67 $_message = new PMA_Message;
68 $_message->addMessages($warning_messages);
69 $_message->isError(true);
70 unset($warning_messages);
72 echo PMA_Util::getMessage(
73 $_message, $sql_query, $_type, $is_view = true
75 unset($_message, $_type);
78 $url_params['goto'] = 'view_operations.php';
79 $url_params['back'] = 'view_operations.php';
81 /**
82 * Displays the page
85 <!-- Table operations -->
86 <div class="operations_half_width">
87 <form method="post" action="view_operations.php">
88 <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
89 <input type="hidden" name="reload" value="1" />
90 <fieldset>
91 <legend><?php echo __('Operations'); ?></legend>
93 <table>
94 <!-- Change view name -->
95 <tr><td><?php echo __('Rename view to'); ?></td>
96 <td><input type="text" size="20" name="new_name" onfocus="this.select()"
97 value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
98 </td>
99 </tr>
100 </table>
101 </fieldset>
102 <fieldset class="tblFooters">
103 <input type="hidden" name="submitoptions" value="1" />
104 <input type="submit" value="<?php echo __('Go'); ?>" />
105 </fieldset>
106 </form>
107 </div>
108 <?php
109 $drop_view_url_params = array_merge(
110 $url_params,
111 array(
112 'sql_query' => 'DROP VIEW ' . PMA_Util::backquote($GLOBALS['table']),
113 'goto' => 'tbl_structure.php',
114 'reload' => '1',
115 'purge' => '1',
116 'message_to_show' => sprintf(
117 __('View %s has been dropped'),
118 htmlspecialchars($GLOBALS['table'])
120 'table' => $GLOBALS['table']
123 echo '<div class="operations_half_width">';
124 echo '<fieldset class="caution">';
125 echo '<legend>' . __('Delete data or table') . '</legend>';
127 echo '<ul>';
128 echo PMA_getDeleteDataOrTableLink(
129 $drop_view_url_params,
130 'DROP VIEW',
131 __('Delete the view (DROP)'),
134 echo '</ul>';
135 echo '</fieldset>';
136 echo '</div>';