Software: Apache. PHP/5.5.15 uname -a: Windows NT SVR-DMZ 6.1 build 7600 (Windows Server 2008 R2 Enterprise Edition) i586 SYSTEM Safe-mode: OFF (not secure) C:\phpMyAdmin1\libraries\ drwxrwxrwx |
Viewing file: Select action/file-type: ' . '' . ''; return $html_output; } /** * Get HTML output for rename database * * @param string $db database name * * @return string $html_output */ function PMA_getHtmlForRenameDatabase($db) { $html_output = ' '
. ''
. ' ';
return $html_output;
}
/**
* Get HTML for database drop link
*
* @param string $db database name
*
* @return string $html_output
*/
function PMA_getHtmlForDropDatabaseLink($db)
{
$this_sql_query = 'DROP DATABASE ' . PMA_Util::backquote($db);
$this_url_params = array(
'sql_query' => $this_sql_query,
'back' => 'db_operations.php',
'goto' => 'index.php',
'reload' => '1',
'purge' => '1',
'message_to_show' => sprintf(
__('Database %s has been dropped.'),
htmlspecialchars(PMA_Util::backquote($db))
),
'db' => null,
);
$html_output = ''
. ''
. ' ';
return $html_output;
}
/**
* Get HTML snippet for copy database
*
* @param string $db database name
*
* @return string $html_output
*/
function PMA_getHtmlForCopyDatabase($db)
{
$drop_clause = 'DROP TABLE / DROP VIEW';
$choices = array(
'structure' => __('Structure only'),
'data' => __('Structure and data'),
'dataonly' => __('Data only')
);
if (isset($_COOKIE)
&& isset($_COOKIE['pma_switch_to_new'])
&& $_COOKIE['pma_switch_to_new'] == 'true'
) {
$pma_switch_to_new = 'true';
}
$html_output = '';
$html_output .= ''
. ' ';
return $html_output;
}
/**
* Get HTML snippet for change database charset
*
* @param string $db database name
* @param string $table tabel name
*
* @return string $html_output
*/
function PMA_getHtmlForChangeDatabaseCharset($db, $table)
{
$html_output = ''
. ' ' . "\n";
return $html_output;
}
/**
* Get HTML snippet for export relational schema view
*
* @param string $url_query Query string for link
*
* @return string $html_output
*/
function PMA_getHtmlForExportRelationalSchemaView($url_query)
{
$html_output = ''
. ''
. ' ';
return $html_output;
}
/**
* Run the Procedure definitions and function definitions
*
* to avoid selecting alternatively the current and new db
* we would need to modify the CREATE definitions to qualify
* the db name
*
* @param string $db database name
*
* @return void
*/
function PMA_runProcedureAndFunctionDefinitions($db)
{
$procedure_names = $GLOBALS['dbi']->getProceduresOrFunctions($db, 'PROCEDURE');
if ($procedure_names) {
foreach ($procedure_names as $procedure_name) {
$GLOBALS['dbi']->selectDb($db);
$tmp_query = $GLOBALS['dbi']->getDefinition(
$db, 'PROCEDURE', $procedure_name
);
// collect for later display
$GLOBALS['sql_query'] .= "\n" . $tmp_query;
$GLOBALS['dbi']->selectDb($_REQUEST['newname']);
$GLOBALS['dbi']->query($tmp_query);
}
}
$function_names = $GLOBALS['dbi']->getProceduresOrFunctions($db, 'FUNCTION');
if ($function_names) {
foreach ($function_names as $function_name) {
$GLOBALS['dbi']->selectDb($db);
$tmp_query = $GLOBALS['dbi']->getDefinition(
$db, 'FUNCTION', $function_name
);
// collect for later display
$GLOBALS['sql_query'] .= "\n" . $tmp_query;
$GLOBALS['dbi']->selectDb($_REQUEST['newname']);
$GLOBALS['dbi']->query($tmp_query);
}
}
}
/**
* Get sql query and create database before copy
*
* @return string $sql_query
*/
function PMA_getSqlQueryAndCreateDbBeforeCopy()
{
// lower_case_table_names=1 `DB` becomes `db`
if (! PMA_DRIZZLE) {
$lowerCaseTableNames = $GLOBALS['dbi']->fetchValue(
'SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1
);
if ($lowerCaseTableNames === '1') {
$_REQUEST['newname'] = $GLOBALS['PMA_String']->strtolower(
$_REQUEST['newname']
);
}
}
$local_query = 'CREATE DATABASE IF NOT EXISTS '
. PMA_Util::backquote($_REQUEST['newname']);
if (isset($_REQUEST['db_collation'])) {
$local_query .= ' DEFAULT'
. PMA_generateCharsetQueryPart($_REQUEST['db_collation']);
}
$local_query .= ';';
$sql_query = $local_query;
// save the original db name because Tracker.class.php which
// may be called under $GLOBALS['dbi']->query() changes $GLOBALS['db']
// for some statements, one of which being CREATE DATABASE
$original_db = $GLOBALS['db'];
$GLOBALS['dbi']->query($local_query);
$GLOBALS['db'] = $original_db;
// Set the SQL mode to NO_AUTO_VALUE_ON_ZERO to prevent MySQL from creating
// export statements it cannot import
$sql_set_mode = "SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'";
$GLOBALS['dbi']->query($sql_set_mode);
// rebuild the database list because PMA_Table::moveCopy
// checks in this list if the target db exists
$GLOBALS['pma']->databases->build();
return $sql_query;
}
/**
* remove all foreign key constraints and return
* sql constraints query for full database
*
* @param array $tables_full array of all tables in given db or dbs
* @param ExportSql $export_sql_plugin export plugin instance
* @param boolean $move whether database name is empty or not
* @param string $db database name
*
* @return string sql constraints query for full databases
*/
function PMA_getSqlConstraintsQueryForFullDb(
$tables_full, $export_sql_plugin, $move, $db
) {
global $sql_constraints, $sql_drop_foreign_keys;
$sql_constraints_query_full_db = array();
foreach ($tables_full as $each_table => $tmp) {
/* Following globals are set in getTableDef */
$sql_constraints = '';
$sql_drop_foreign_keys = '';
$export_sql_plugin->getTableDef(
$db, $each_table, "\n", '', false, false, false, false
);
if ($move && ! empty($sql_drop_foreign_keys)) {
$GLOBALS['dbi']->query($sql_drop_foreign_keys);
}
// keep the constraint we just dropped
if (! empty($sql_constraints)) {
$sql_constraints_query_full_db[] = $sql_constraints;
}
}
return $sql_constraints_query_full_db;
}
/**
* Get views as an array and create SQL view stand-in
*
* @param array $tables_full array of all tables in given db or dbs
* @param ExportSql $export_sql_plugin export plugin instance
* @param string $db database name
*
* @return array $views
*/
function PMA_getViewsAndCreateSqlViewStandIn(
$tables_full, $export_sql_plugin, $db
) {
$views = array();
foreach ($tables_full as $each_table => $tmp) {
// to be able to rename a db containing views,
// first all the views are collected and a stand-in is created
// the real views are created after the tables
if (PMA_Table::isView($db, $each_table)) {
$views[] = $each_table;
// Create stand-in definition to resolve view dependencies
$sql_view_standin = $export_sql_plugin->getTableDefStandIn(
$db, $each_table, "\n"
);
$GLOBALS['dbi']->selectDb($_REQUEST['newname']);
$GLOBALS['dbi']->query($sql_view_standin);
$GLOBALS['sql_query'] .= "\n" . $sql_view_standin;
}
}
return $views;
}
/**
* Get sql query for copy/rename table and boolean for whether copy/rename or not
*
* @param array $tables_full array of all tables in given db or dbs
* @param string $sql_query sql query for all operations
* @param boolean $move whether database name is empty or not
* @param string $db database name
*
* @return array ($sql_query, $error)
*/
function PMA_getSqlQueryForCopyTable($tables_full, $sql_query, $move, $db)
{
$error = false;
foreach ($tables_full as $each_table => $tmp) {
// skip the views; we have creted stand-in definitions
if (PMA_Table::isView($db, $each_table)) {
continue;
}
$back = $sql_query;
$sql_query = '';
// value of $what for this table only
$this_what = $_REQUEST['what'];
// do not copy the data from a Merge table
// note: on the calling FORM, 'data' means 'structure and data'
if (PMA_Table::isMerge($db, $each_table)) {
if ($this_what == 'data') {
$this_what = 'structure';
}
if ($this_what == 'dataonly') {
$this_what = 'nocopy';
}
}
if ($this_what != 'nocopy') {
// keep the triggers from the original db+table
// (third param is empty because delimiters are only intended
// for importing via the mysql client or our Import feature)
$triggers = $GLOBALS['dbi']->getTriggers($db, $each_table, '');
if (! PMA_Table::moveCopy(
$db, $each_table, $_REQUEST['newname'], $each_table,
(isset($this_what) ? $this_what : 'data'),
$move, 'db_copy'
)) {
$error = true;
// $sql_query is filled by PMA_Table::moveCopy()
$sql_query = $back . $sql_query;
break;
}
// apply the triggers to the destination db+table
if ($triggers) {
$GLOBALS['dbi']->selectDb($_REQUEST['newname']);
foreach ($triggers as $trigger) {
$GLOBALS['dbi']->query($trigger['create']);
$GLOBALS['sql_query'] .= "\n" . $trigger['create'] . ';';
}
}
// this does not apply to a rename operation
if (isset($_REQUEST['add_constraints'])
&& ! empty($GLOBALS['sql_constraints_query'])
) {
$GLOBALS['sql_constraints_query_full_db'][]
= $GLOBALS['sql_constraints_query'];
unset($GLOBALS['sql_constraints_query']);
}
}
// $sql_query is filled by PMA_Table::moveCopy()
$sql_query = $back . $sql_query;
}
return array($sql_query, $error);
}
/**
* Run the EVENT definition for selected database
*
* to avoid selecting alternatively the current and new db
* we would need to modify the CREATE definitions to qualify
* the db name
*
* @param string $db database name
*
* @return void
*/
function PMA_runEventDefinitionsForDb($db)
{
$event_names = $GLOBALS['dbi']->fetchResult(
'SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \''
. PMA_Util::sqlAddSlashes($db, true) . '\';'
);
if ($event_names) {
foreach ($event_names as $event_name) {
$GLOBALS['dbi']->selectDb($db);
$tmp_query = $GLOBALS['dbi']->getDefinition($db, 'EVENT', $event_name);
// collect for later display
$GLOBALS['sql_query'] .= "\n" . $tmp_query;
$GLOBALS['dbi']->selectDb($_REQUEST['newname']);
$GLOBALS['dbi']->query($tmp_query);
}
}
}
/**
* Handle the views, return the boolean value whether table rename/copy or not
*
* @param array $views views as an array
* @param boolean $move whether database name is empty or not
* @param string $db database name
*
* @return boolean $_error whether table rename/copy or not
*/
function PMA_handleTheViews($views, $move, $db)
{
$_error = false;
// temporarily force to add DROP IF EXIST to CREATE VIEW query,
// to remove stand-in VIEW that was created earlier
// ( $_REQUEST['drop_if_exists'] is used in moveCopy() )
if (isset($_REQUEST['drop_if_exists'])) {
$temp_drop_if_exists = $_REQUEST['drop_if_exists'];
}
$_REQUEST['drop_if_exists'] = 'true';
foreach ($views as $view) {
$copying_succeeded = PMA_Table::moveCopy(
$db, $view, $_REQUEST['newname'], $view, 'structure', $move, 'db_copy'
);
if (! $copying_succeeded) {
$_error = true;
break;
}
}
unset($_REQUEST['drop_if_exists']);
if (isset($temp_drop_if_exists)) {
// restore previous value
$_REQUEST['drop_if_exists'] = $temp_drop_if_exists;
}
return $_error;
}
/**
* Create all accumulated constraaints
*
* @return void
*/
function PMA_createAllAccumulatedConstraints()
{
$GLOBALS['dbi']->selectDb($_REQUEST['newname']);
foreach ($GLOBALS['sql_constraints_query_full_db'] as $one_query) {
$GLOBALS['dbi']->query($one_query);
// and prepare to display them
$GLOBALS['sql_query'] .= "\n" . $one_query;
}
unset($GLOBALS['sql_constraints_query_full_db']);
}
/**
* Duplicate the bookmarks for the db (done once for each db)
*
* @param boolean $_error whether table rename/copy or not
* @param string $db database name
*
* @return void
*/
function PMA_duplicateBookmarks($_error, $db)
{
if (! $_error && $db != $_REQUEST['newname']) {
$get_fields = array('user', 'label', 'query');
$where_fields = array('dbase' => $db);
$new_fields = array('dbase' => $_REQUEST['newname']);
PMA_Table::duplicateInfo(
'bookmarkwork', 'bookmark', $get_fields,
$where_fields, $new_fields
);
}
}
/**
* Get the HTML snippet for order the table
*
* @param array $columns columns array
*
* @return string $html_out
*/
function PMA_getHtmlForOrderTheTable($columns)
{
$html_output = '';
$html_output .= ''
. ' ';
return $html_output;
}
/**
* Get the HTML snippet for move table
*
* @return string $html_output
*/
function PMA_getHtmlForMoveTable()
{
$html_output = '';
$html_output .= ''
. ' ';
return $html_output;
}
/**
* Get the HTML div for Table option
*
* @param string $comment Comment
* @param array $tbl_collation table collation
* @param string $tbl_storage_engine table storage engine
* @param boolean $is_myisam_or_aria whether MYISAM bool(false) |
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0312 ]-- |