2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 use PhpMyAdmin\Message
;
9 use PhpMyAdmin\Operations
;
10 use PhpMyAdmin\Response
;
18 require_once './libraries/common.inc.php';
20 $pma_table = new Table($GLOBALS['table'], $GLOBALS['db']);
23 * Load JavaScript files
25 $response = Response
::getInstance();
26 $header = $response->getHeader();
27 $scripts = $header->getScripts();
28 $scripts->addFile('tbl_operations.js');
33 require './libraries/tbl_common.inc.php';
34 $url_query .= '&goto=view_operations.php&back=view_operations.php';
35 $url_params['goto'] = $url_params['back'] = 'view_operations.php';
40 $_message = new Message
;
42 if (isset($_REQUEST['submitoptions'])) {
44 if (isset($_REQUEST['new_name'])) {
45 if ($pma_table->rename($_REQUEST['new_name'])) {
46 $_message->addText($pma_table->getLastMessage());
48 $GLOBALS['table'] = $pma_table->getName();
49 /* Force reread after rename */
50 $pma_table->getStatusInfo(null, true);
53 $_message->addText($pma_table->getLastError());
58 $warning_messages = Operations
::getWarningMessagesArray();
62 // set to success by default, because result set could be empty
63 // (for example, a table rename)
64 if (empty($_message->getString())) {
67 __('Your SQL query has been executed successfully.')
70 $_message->addText(__('Error'));
72 // $result should exist, regardless of $_message
73 $_type = $result ?
'success' : 'error';
75 if (! empty($warning_messages)) {
76 $_message->addMessagesString($warning_messages);
77 $_message->isError(true);
78 unset($warning_messages);
80 echo Util
::getMessage(
81 $_message, $sql_query, $_type
84 unset($_message, $_type);
86 $url_params['goto'] = 'view_operations.php';
87 $url_params['back'] = 'view_operations.php';
93 <!-- Table operations
-->
95 <form method
="post" action
="view_operations.php">
96 <?php
echo Url
::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']); ?
>
97 <input type
="hidden" name
="reload" value
="1" />
99 <legend
><?php
echo __('Operations'); ?
></legend
>
102 <!-- Change view name
-->
103 <tr
><td
><?php
echo __('Rename view to'); ?
></td
>
104 <td
><input type
="text" name
="new_name" onfocus
="this.select()"
105 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>"
111 <fieldset
class="tblFooters">
112 <input type
="hidden" name
="submitoptions" value
="1" />
113 <input type
="submit" value
="<?php echo __('Go'); ?>" />
118 $drop_view_url_params = array_merge(
121 'sql_query' => 'DROP VIEW ' . Util
::backquote(
124 'goto' => 'tbl_structure.php',
127 'message_to_show' => sprintf(
128 __('View %s has been dropped.'),
129 htmlspecialchars($GLOBALS['table'])
131 'table' => $GLOBALS['table']
135 echo '<fieldset class="caution">';
136 echo '<legend>' , __('Delete data or table') , '</legend>';
139 echo Operations
::getDeleteDataOrTablelink(
140 $drop_view_url_params,
142 __('Delete the view (DROP)'),