Merge remote-tracking branch 'origin/QA_4_0' into QA_4_0
[phpmyadmin.git] / view_operations.php
blob8283f42d17bb4a076fa26ea75a4667f934fdc88a
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 * Runs common work
18 require './libraries/tbl_common.inc.php';
19 $url_query .= '&amp;goto=view_operations.php&amp;back=view_operations.php';
20 $url_params['goto'] = $url_params['back'] = 'view_operations.php';
22 /**
23 * Gets tables informations
26 require './libraries/tbl_info.inc.php';
27 $reread_info = false;
29 /**
30 * Updates if required
32 if (isset($_REQUEST['submitoptions'])) {
33 $_message = '';
34 $warning_messages = array();
36 if (isset($_REQUEST['new_name'])) {
37 if ($pma_table->rename($_REQUEST['new_name'])) {
38 $_message .= $pma_table->getLastMessage();
39 $result = true;
40 $GLOBALS['table'] = $pma_table->getName();
41 $reread_info = true;
42 $reload = true;
43 } else {
44 $_message .= $pma_table->getLastError();
45 $result = false;
50 if (isset($result)) {
51 // set to success by default, because result set could be empty
52 // (for example, a table rename)
53 $_type = 'success';
54 if (empty($_message)) {
55 $_message = $result
56 ? __('Your SQL query has been executed successfully')
57 : __('Error');
58 // $result should exist, regardless of $_message
59 $_type = $result ? 'success' : 'error';
61 if (! empty($warning_messages)) {
62 $_message = new PMA_Message;
63 $_message->addMessages($warning_messages);
64 $_message->isError(true);
65 unset($warning_messages);
67 echo PMA_Util::getMessage(
68 $_message, $sql_query, $_type, $is_view = true
70 unset($_message, $_type);
73 $url_params['goto'] = 'view_operations.php';
74 $url_params['back'] = 'view_operations.php';
76 /**
77 * Displays the page
80 <!-- Table operations -->
81 <div class="operations_half_width">
82 <form method="post" action="view_operations.php">
83 <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
84 <input type="hidden" name="reload" value="1" />
85 <fieldset>
86 <legend><?php echo __('Operations'); ?></legend>
88 <table>
89 <!-- Change view name -->
90 <tr><td><?php echo __('Rename view to'); ?></td>
91 <td><input type="text" size="20" name="new_name" onfocus="this.select()"
92 value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
93 </td>
94 </tr>
95 </table>
96 </fieldset>
97 <fieldset class="tblFooters">
98 <input type="submit" name="submitoptions" value="<?php echo __('Go'); ?>" />
99 </fieldset>
100 </form>
101 </div>