2016-10-22 14:57:10 +00:00
|
|
|
<?php
|
|
|
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package PhpMyAdmin
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
require_once './libraries/common.inc.php';
|
|
|
|
|
2017-04-20 10:55:30 +00:00
|
|
|
$pma_table = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
2016-10-22 14:57:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* functions implementation for this script
|
|
|
|
*/
|
|
|
|
require_once 'libraries/operations.lib.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runs common work
|
|
|
|
*/
|
|
|
|
require './libraries/tbl_common.inc.php';
|
|
|
|
$url_query .= '&goto=view_operations.php&back=view_operations.php';
|
|
|
|
$url_params['goto'] = $url_params['back'] = 'view_operations.php';
|
|
|
|
|
|
|
|
/**
|
2017-04-20 10:55:30 +00:00
|
|
|
* Gets tables informations
|
2016-10-22 14:57:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
require './libraries/tbl_info.inc.php';
|
|
|
|
$reread_info = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates if required
|
|
|
|
*/
|
|
|
|
if (isset($_REQUEST['submitoptions'])) {
|
|
|
|
$_message = '';
|
|
|
|
$warning_messages = array();
|
|
|
|
|
|
|
|
if (isset($_REQUEST['new_name'])) {
|
|
|
|
if ($pma_table->rename($_REQUEST['new_name'])) {
|
|
|
|
$_message .= $pma_table->getLastMessage();
|
|
|
|
$result = true;
|
|
|
|
$GLOBALS['table'] = $pma_table->getName();
|
|
|
|
$reread_info = true;
|
|
|
|
$reload = true;
|
|
|
|
} else {
|
|
|
|
$_message .= $pma_table->getLastError();
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($result)) {
|
|
|
|
// set to success by default, because result set could be empty
|
|
|
|
// (for example, a table rename)
|
|
|
|
$_type = 'success';
|
|
|
|
if (empty($_message)) {
|
|
|
|
$_message = $result
|
2017-04-20 10:55:30 +00:00
|
|
|
? __('Your SQL query has been executed successfully')
|
2016-10-22 14:57:10 +00:00
|
|
|
: __('Error');
|
|
|
|
// $result should exist, regardless of $_message
|
|
|
|
$_type = $result ? 'success' : 'error';
|
|
|
|
}
|
|
|
|
if (! empty($warning_messages)) {
|
2017-04-20 10:55:30 +00:00
|
|
|
$_message = new PMA_Message;
|
2016-10-22 14:57:10 +00:00
|
|
|
$_message->addMessages($warning_messages);
|
|
|
|
$_message->isError(true);
|
|
|
|
unset($warning_messages);
|
|
|
|
}
|
2017-04-20 10:55:30 +00:00
|
|
|
echo PMA_Util::getMessage(
|
|
|
|
$_message, $sql_query, $_type, $is_view = true
|
2016-10-22 14:57:10 +00:00
|
|
|
);
|
|
|
|
unset($_message, $_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
$url_params['goto'] = 'view_operations.php';
|
|
|
|
$url_params['back'] = 'view_operations.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays the page
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
<!-- Table operations -->
|
|
|
|
<div class="operations_half_width">
|
|
|
|
<form method="post" action="view_operations.php">
|
2017-04-20 10:55:30 +00:00
|
|
|
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
|
2016-10-22 14:57:10 +00:00
|
|
|
<input type="hidden" name="reload" value="1" />
|
|
|
|
<fieldset>
|
|
|
|
<legend><?php echo __('Operations'); ?></legend>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<!-- Change view name -->
|
|
|
|
<tr><td><?php echo __('Rename view to'); ?></td>
|
|
|
|
<td><input type="text" size="20" name="new_name" onfocus="this.select()"
|
2017-04-20 10:55:30 +00:00
|
|
|
value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
|
2016-10-22 14:57:10 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
<fieldset class="tblFooters">
|
|
|
|
<input type="hidden" name="submitoptions" value="1" />
|
|
|
|
<input type="submit" value="<?php echo __('Go'); ?>" />
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
$drop_view_url_params = array_merge(
|
|
|
|
$url_params,
|
|
|
|
array(
|
2017-04-20 10:55:30 +00:00
|
|
|
'sql_query' => 'DROP VIEW ' . PMA_Util::backquote($GLOBALS['table']),
|
2016-10-22 14:57:10 +00:00
|
|
|
'goto' => 'tbl_structure.php',
|
|
|
|
'reload' => '1',
|
|
|
|
'purge' => '1',
|
|
|
|
'message_to_show' => sprintf(
|
2017-04-20 10:55:30 +00:00
|
|
|
__('View %s has been dropped'),
|
2016-10-22 14:57:10 +00:00
|
|
|
htmlspecialchars($GLOBALS['table'])
|
|
|
|
),
|
|
|
|
'table' => $GLOBALS['table']
|
|
|
|
)
|
|
|
|
);
|
|
|
|
echo '<div class="operations_half_width">';
|
|
|
|
echo '<fieldset class="caution">';
|
2017-04-20 10:55:30 +00:00
|
|
|
echo '<legend>' . __('Delete data or table') . '</legend>';
|
2016-10-22 14:57:10 +00:00
|
|
|
|
|
|
|
echo '<ul>';
|
|
|
|
echo PMA_getDeleteDataOrTableLink(
|
|
|
|
$drop_view_url_params,
|
|
|
|
'DROP VIEW',
|
|
|
|
__('Delete the view (DROP)'),
|
2017-04-20 10:55:30 +00:00
|
|
|
''
|
2016-10-22 14:57:10 +00:00
|
|
|
);
|
|
|
|
echo '</ul>';
|
|
|
|
echo '</fieldset>';
|
|
|
|
echo '</div>';
|
2017-04-20 10:55:30 +00:00
|
|
|
|