allow 0 as name for database, table collumn, alias and index
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -21,6 +21,21 @@ $Source$
|
|||||||
* libraries/display_export.lib.php, css/phpmyadmin.css.php,
|
* libraries/display_export.lib.php, css/phpmyadmin.css.php,
|
||||||
themes/*/css/theme_right.css.php:
|
themes/*/css/theme_right.css.php:
|
||||||
'fixed' layout of export screen for buggy safari and opera
|
'fixed' layout of export screen for buggy safari and opera
|
||||||
|
* db_operations.php, export.php, index.php, left.php,
|
||||||
|
libraries\auth\cookie.auth.lib.php, libraries\common.lib.php,
|
||||||
|
libraries\db_details_common.inc.php, libraries\db_table_exists.lib.php,
|
||||||
|
libraries\display_export.lib.php, libraries\display_tbl.lib.php,
|
||||||
|
libraries\export\sql.php, libraries\footer.inc.php,
|
||||||
|
libraries\header.inc.php, libraries\left_header.inc.php,
|
||||||
|
libraries\mult_submits.inc.php, libraries\mysql_charsets.lib.php,
|
||||||
|
libraries\relation.lib.php, libraries\server_common.inc.php,
|
||||||
|
libraries\sql_query_form.lib.php, libraries\sqlparser.lib.php,
|
||||||
|
libraries\tbl_indexes.lib.php, libraries\tbl_move_copy.php,
|
||||||
|
libraries\url_generating.lib.php, querywindow.php, scripts\setup.php,
|
||||||
|
server_databases.php, server_privileges.php, server_processlist.php,
|
||||||
|
sql.php, tbl_addfield.php, tbl_alter.php, tbl_change.php, tbl_create.php,
|
||||||
|
tbl_indexes.php, tbl_replace.php:
|
||||||
|
allow 0 as name for database, table collumn, alias and index
|
||||||
|
|
||||||
2006-01-12 Marc Delisle <lem9@users.sourceforge.net>
|
2006-01-12 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* Documentation.html: typo, thanks to Cédric Corazza
|
* Documentation.html: typo, thanks to Cédric Corazza
|
||||||
|
@@ -33,7 +33,7 @@ if (isset($db) &&
|
|||||||
$move = FALSE;
|
$move = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($newname) || empty($newname)) {
|
if (!isset($newname) || !strlen($newname)) {
|
||||||
$message = $strDatabaseEmpty;
|
$message = $strDatabaseEmpty;
|
||||||
} else {
|
} else {
|
||||||
if ($move ||
|
if ($move ||
|
||||||
|
@@ -23,9 +23,9 @@ require('./libraries/export/' . PMA_securePath($type) . '.php');
|
|||||||
// Generate error url
|
// Generate error url
|
||||||
if ($export_type == 'server') {
|
if ($export_type == 'server') {
|
||||||
$err_url = 'server_export.php?' . PMA_generate_common_url();
|
$err_url = 'server_export.php?' . PMA_generate_common_url();
|
||||||
} elseif ($export_type == 'database' && !empty($db)) {
|
} elseif ($export_type == 'database' && isset($db) && strlen($db)) {
|
||||||
$err_url = 'db_details_export.php?' . PMA_generate_common_url($db);
|
$err_url = 'db_details_export.php?' . PMA_generate_common_url($db);
|
||||||
} elseif ($export_type == 'table' && !empty($db) && !empty($table)) {
|
} elseif ($export_type == 'table' && isset($db) && strlen($db) && isset($table) && strlen($table)) {
|
||||||
$err_url = 'tbl_properties_export.php?' . PMA_generate_common_url($db, $table);
|
$err_url = 'tbl_properties_export.php?' . PMA_generate_common_url($db, $table);
|
||||||
} else {
|
} else {
|
||||||
die('Bad parameters!');
|
die('Bad parameters!');
|
||||||
|
@@ -79,9 +79,9 @@ foreach( $drops as $each_drop ) {
|
|||||||
}
|
}
|
||||||
unset( $drops, $each_drop );
|
unset( $drops, $each_drop );
|
||||||
|
|
||||||
if ( empty( $GLOBALS['db'] ) ) {
|
if ( ! isset($GLOBALS['db']) || ! strlen($GLOBALS['db']) ) {
|
||||||
$main_target = $GLOBALS['cfg']['DefaultTabServer'];
|
$main_target = $GLOBALS['cfg']['DefaultTabServer'];
|
||||||
} elseif ( empty( $GLOBALS['table'] ) ) {
|
} elseif ( ! isset($GLOBALS['table']) || ! strlen($GLOBALS['table']) ) {
|
||||||
$_GET['db'] = $GLOBALS['db'];
|
$_GET['db'] = $GLOBALS['db'];
|
||||||
$main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
|
$main_target = $GLOBALS['cfg']['DefaultTabDatabase'];
|
||||||
} else {
|
} else {
|
||||||
|
4
left.php
4
left.php
@@ -35,7 +35,7 @@ if ($server > 0) {
|
|||||||
// it defines $num_dbs and $dblist
|
// it defines $num_dbs and $dblist
|
||||||
PMA_availableDatabases();
|
PMA_availableDatabases();
|
||||||
|
|
||||||
if ( empty( $db ) && count( $dblist ) === 1 ) {
|
if ( ( ! isset($db) || ! strlen($db) ) && count( $dblist ) === 1 ) {
|
||||||
reset( $dblist );
|
reset( $dblist );
|
||||||
$db = current( $dblist );
|
$db = current( $dblist );
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ $href_left = '<a onclick="if ( toggle(\'%d\') ) return false;"'
|
|||||||
|
|
||||||
$element_counter = 0;
|
$element_counter = 0;
|
||||||
|
|
||||||
if ( $GLOBALS['cfg']['LeftFrameLight'] && ! empty( $db ) ) {
|
if ( $GLOBALS['cfg']['LeftFrameLight'] && isset($db) && strlen($db) ) {
|
||||||
// show selected databasename as link to DefaultTabDatabase-page
|
// show selected databasename as link to DefaultTabDatabase-page
|
||||||
// with table count in ()
|
// with table count in ()
|
||||||
$common_url_query = PMA_generate_common_url( $db );
|
$common_url_query = PMA_generate_common_url( $db );
|
||||||
|
@@ -467,10 +467,10 @@ function PMA_auth_set_user()
|
|||||||
|
|
||||||
// any parameters to pass?
|
// any parameters to pass?
|
||||||
$url_params = array();
|
$url_params = array();
|
||||||
if ( ! empty($GLOBALS['db']) ) {
|
if ( isset($GLOBALS['db']) && strlen($GLOBALS['db']) ) {
|
||||||
$url_params['db'] = $GLOBALS['db'];
|
$url_params['db'] = $GLOBALS['db'];
|
||||||
}
|
}
|
||||||
if ( ! empty($GLOBALS['table']) ) {
|
if ( isset($GLOBALS['table']) && strlen($GLOBALS['table']) ) {
|
||||||
$url_params['table'] = $GLOBALS['table'];
|
$url_params['table'] = $GLOBALS['table'];
|
||||||
}
|
}
|
||||||
// Language change from the login panel needs to be remembered
|
// Language change from the login panel needs to be remembered
|
||||||
|
@@ -264,7 +264,7 @@ function PMA_safe_db_list($only_db_check, $controllink, $dblist_cnt, $userlink,
|
|||||||
// with regular expressions.
|
// with regular expressions.
|
||||||
while ($row = PMA_DBI_fetch_assoc($rs)) {
|
while ($row = PMA_DBI_fetch_assoc($rs)) {
|
||||||
// loic1: all databases cases - part 1
|
// loic1: all databases cases - part 1
|
||||||
if (empty($row['Db']) || $row['Db'] == '%') {
|
if ( !isset($row['Db']) || ! strlen($row['Db']) || $row['Db'] == '%') {
|
||||||
$uva_mydbs['%'] = 1;
|
$uva_mydbs['%'] = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1151,7 +1151,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
|
|||||||
{
|
{
|
||||||
// '0' is also empty for php :-(
|
// '0' is also empty for php :-(
|
||||||
if ($do_it
|
if ($do_it
|
||||||
&& (!empty($a_name) || $a_name == '0') && $a_name != '*') {
|
&& strlen($a_name) && $a_name != '*') {
|
||||||
|
|
||||||
if (is_array($a_name)) {
|
if (is_array($a_name)) {
|
||||||
$result = array();
|
$result = array();
|
||||||
@@ -1312,7 +1312,7 @@ if (typeof(window.parent) != 'undefined'
|
|||||||
$message = PMA_sanitize($message);
|
$message = PMA_sanitize($message);
|
||||||
|
|
||||||
// Corrects the tooltip text via JS if required
|
// Corrects the tooltip text via JS if required
|
||||||
if (!empty($GLOBALS['table']) && $cfg['ShowTooltip']) {
|
if ( isset($GLOBALS['table']) && strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
|
||||||
$result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\'');
|
$result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\'');
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$tbl_status = PMA_DBI_fetch_assoc($result);
|
$tbl_status = PMA_DBI_fetch_assoc($result);
|
||||||
@@ -2152,7 +2152,7 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
|
|||||||
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
||||||
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
|
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
|
||||||
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
|
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
|
||||||
if (!empty($alias)) {
|
if (strlen($alias)) {
|
||||||
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
|
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
|
||||||
if ($alias == $meta->name) {
|
if ($alias == $meta->name) {
|
||||||
$column_for_condition = $true_column;
|
$column_for_condition = $true_column;
|
||||||
@@ -2463,8 +2463,8 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
|
|||||||
*/
|
*/
|
||||||
function PMA_getDbLink($database = null)
|
function PMA_getDbLink($database = null)
|
||||||
{
|
{
|
||||||
if (empty($database)) {
|
if (!strlen($database)) {
|
||||||
if (empty($GLOBALS['db'])) {
|
if (!strlen($GLOBALS['db'])) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$database = $GLOBALS['db'];
|
$database = $GLOBALS['db'];
|
||||||
@@ -2508,17 +2508,17 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
|
|||||||
*/
|
*/
|
||||||
function PMA_setCookie($cookie, $value, $default = null)
|
function PMA_setCookie($cookie, $value, $default = null)
|
||||||
{
|
{
|
||||||
if (!empty($value) && null !== $default && $value === $default) {
|
if (strlen($value) && null !== $default && $value === $default) {
|
||||||
// remove cookie, default value is used
|
// remove cookie, default value is used
|
||||||
return PMA_removeCookie($cookie);
|
return PMA_removeCookie($cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($value) && isset($_COOKIE[$cookie])) {
|
if (! strlen($value) && isset($_COOKIE[$cookie])) {
|
||||||
// remove cookie, value is empty
|
// remove cookie, value is empty
|
||||||
return PMA_removeCookie($cookie);
|
return PMA_removeCookie($cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($_COOKIE[$cookie]) || $_COOKIE[$cookie] !== $value) {
|
if (! isset($_COOKIE[$cookie]) || $_COOKIE[$cookie] !== $value) {
|
||||||
// set cookie with new value
|
// set cookie with new value
|
||||||
return setcookie($cookie, $value, time() + 60*60*24*30,
|
return setcookie($cookie, $value, time() + 60*60*24*30,
|
||||||
$GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
|
$GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
|
||||||
|
@@ -30,10 +30,10 @@ $err_url = $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db);
|
|||||||
*/
|
*/
|
||||||
if (!isset($is_db) || !$is_db) {
|
if (!isset($is_db) || !$is_db) {
|
||||||
// Not a valid db name -> back to the welcome page
|
// Not a valid db name -> back to the welcome page
|
||||||
if (!empty($db)) {
|
if (isset($db) && strlen($db)) {
|
||||||
$is_db = PMA_DBI_select_db($db);
|
$is_db = PMA_DBI_select_db($db);
|
||||||
}
|
}
|
||||||
if (empty($db) || !$is_db) {
|
if (!isset($db) || !strlen($db) || !$is_db) {
|
||||||
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@@ -8,10 +8,10 @@
|
|||||||
*/
|
*/
|
||||||
if (!isset($is_db) || !$is_db) {
|
if (!isset($is_db) || !$is_db) {
|
||||||
// Not a valid db name -> back to the welcome page
|
// Not a valid db name -> back to the welcome page
|
||||||
if (!empty($db)) {
|
if (isset($db) && strlen($db)) {
|
||||||
$is_db = @PMA_DBI_select_db($db);
|
$is_db = @PMA_DBI_select_db($db);
|
||||||
}
|
}
|
||||||
if (empty($db) || !$is_db) {
|
if (!isset($db) || !strlen($db) || !$is_db) {
|
||||||
if (!defined('IS_TRANSFORMATION_WRAPPER')) {
|
if (!defined('IS_TRANSFORMATION_WRAPPER')) {
|
||||||
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
||||||
}
|
}
|
||||||
@@ -20,15 +20,15 @@ if (!isset($is_db) || !$is_db) {
|
|||||||
} // end if (ensures db exists)
|
} // end if (ensures db exists)
|
||||||
if (!isset($is_table) || !$is_table) {
|
if (!isset($is_table) || !$is_table) {
|
||||||
// Not a valid table name -> back to the db_details.php
|
// Not a valid table name -> back to the db_details.php
|
||||||
if (!empty($table)) {
|
if (isset($table) && strlen($table)) {
|
||||||
$is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
|
$is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
|
||||||
}
|
}
|
||||||
if (empty($table)
|
if (! isset($table) && ! strlen($table)
|
||||||
|| !($is_table && @PMA_DBI_num_rows($is_table))) {
|
|| !($is_table && @PMA_DBI_num_rows($is_table))) {
|
||||||
$redirect = TRUE;
|
$redirect = TRUE;
|
||||||
if (!defined('IS_TRANSFORMATION_WRAPPER')) {
|
if (!defined('IS_TRANSFORMATION_WRAPPER')) {
|
||||||
$redirect = TRUE;
|
$redirect = TRUE;
|
||||||
if (!empty($table)) {
|
if (isset($table) && strlen($table)) {
|
||||||
PMA_DBI_free_result($is_table);
|
PMA_DBI_free_result($is_table);
|
||||||
// SHOW TABLES doesn't show temporary tables, so try select (as it can happen just in case temporary table, it should be fast):
|
// SHOW TABLES doesn't show temporary tables, so try select (as it can happen just in case temporary table, it should be fast):
|
||||||
$is_table2 = PMA_DBI_try_query('SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, TRUE) . '`;', NULL, PMA_DBI_QUERY_STORE);
|
$is_table2 = PMA_DBI_try_query('SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, TRUE) . '`;', NULL, PMA_DBI_QUERY_STORE);
|
||||||
|
@@ -36,7 +36,7 @@ function PMA_exportIsActive($what, $val) {
|
|||||||
<?php
|
<?php
|
||||||
$hide_structure = false;
|
$hide_structure = false;
|
||||||
$hide_sql = false;
|
$hide_sql = false;
|
||||||
$hide_xml = empty($db);
|
$hide_xml = (bool) (isset($db) && strlen($db));
|
||||||
if ($export_type == 'server') {
|
if ($export_type == 'server') {
|
||||||
echo PMA_generate_common_hidden_inputs('', '', 1);
|
echo PMA_generate_common_hidden_inputs('', '', 1);
|
||||||
} elseif ($export_type == 'database') {
|
} elseif ($export_type == 'database') {
|
||||||
@@ -769,7 +769,7 @@ function show_checked_option() {
|
|||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php if ( ! empty( $table ) && ! isset( $num_tables ) ) { ?>
|
<?php if ( isset($table) && strlen($table) && ! isset( $num_tables ) ) { ?>
|
||||||
<div class="formelementrow">
|
<div class="formelementrow">
|
||||||
<?php
|
<?php
|
||||||
echo sprintf( $strDumpXRows,
|
echo sprintf( $strDumpXRows,
|
||||||
|
@@ -30,7 +30,7 @@ if (!isset($pos)) {
|
|||||||
* the "display printable view" option.
|
* the "display printable view" option.
|
||||||
* Of course '0'/'1' means the feature won't/will be enabled.
|
* Of course '0'/'1' means the feature won't/will be enabled.
|
||||||
*
|
*
|
||||||
* @param string the synthetic value for display_mode (see <20>1 a few
|
* @param string the synthetic value for display_mode (see <20>1 a few
|
||||||
* lines above for explanations)
|
* lines above for explanations)
|
||||||
* @param integer the total number of rows returned by the sql query
|
* @param integer the total number of rows returned by the sql query
|
||||||
* without any programmatically appended "LIMIT" clause
|
* without any programmatically appended "LIMIT" clause
|
||||||
@@ -157,7 +157,7 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
|
|||||||
$the_total = $unlim_num_rows;
|
$the_total = $unlim_num_rows;
|
||||||
}
|
}
|
||||||
else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
|
else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1')
|
||||||
&& (!empty($db) && !empty($table))) {
|
&& (isset($db) && strlen($db) && !empty($table))) {
|
||||||
$the_total = PMA_countRecords($db, $table, TRUE);
|
$the_total = PMA_countRecords($db, $table, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,7 +741,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
|||||||
&& isset($analyzed_sql[0]['select_expr'][$i]['column'])
|
&& isset($analyzed_sql[0]['select_expr'][$i]['column'])
|
||||||
&& $analyzed_sql[0]['select_expr'][$i]['expr'] !=
|
&& $analyzed_sql[0]['select_expr'][$i]['expr'] !=
|
||||||
$analyzed_sql[0]['select_expr'][$i]['column']
|
$analyzed_sql[0]['select_expr'][$i]['column']
|
||||||
&& !empty($fields_meta[$i]->table)) ) {
|
&& isset($fields_meta[$i]->table) && strlen($fields_meta[$i]->table)) ) {
|
||||||
$sort_tbl = PMA_backquote($fields_meta[$i]->table) . ' . ';
|
$sort_tbl = PMA_backquote($fields_meta[$i]->table) . ' . ';
|
||||||
} else {
|
} else {
|
||||||
$sort_tbl = '';
|
$sort_tbl = '';
|
||||||
@@ -1229,7 +1229,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
||||||
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
|
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
|
||||||
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
|
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
|
||||||
if (!empty($alias)) {
|
if (isset($alias) && strlen($alias)) {
|
||||||
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
|
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
|
||||||
if ($alias == $meta->name) {
|
if ($alias == $meta->name) {
|
||||||
$meta->name = $true_column;
|
$meta->name = $true_column;
|
||||||
@@ -1240,7 +1240,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
|
|
||||||
if (isset($map[$meta->name])) {
|
if (isset($map[$meta->name])) {
|
||||||
// Field to display from the foreign table?
|
// Field to display from the foreign table?
|
||||||
if (!empty($map[$meta->name][2])) {
|
if (isset($map[$meta->name][2]) && strlen($map[$meta->name][2])) {
|
||||||
$dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
|
$dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
|
||||||
. ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
|
. ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
|
||||||
. ' WHERE ' . PMA_backquote($map[$meta->name][1])
|
. ' WHERE ' . PMA_backquote($map[$meta->name][1])
|
||||||
@@ -1355,7 +1355,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
||||||
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
|
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
|
||||||
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
|
$alias = $analyzed_sql[0]['select_expr'][$select_expr_position]['alias'];
|
||||||
if (!empty($alias)) {
|
if (isset($alias) && strlen($alias)) {
|
||||||
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
|
$true_column = $analyzed_sql[0]['select_expr'][$select_expr_position]['column'];
|
||||||
if ($alias == $meta->name) {
|
if ($alias == $meta->name) {
|
||||||
$meta->name = $true_column;
|
$meta->name = $true_column;
|
||||||
@@ -1366,7 +1366,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
|
|
||||||
if (isset($map[$meta->name])) {
|
if (isset($map[$meta->name])) {
|
||||||
// Field to display from the foreign table?
|
// Field to display from the foreign table?
|
||||||
if (!empty($map[$meta->name][2])) {
|
if (isset($map[$meta->name][2]) && strlen($map[$meta->name][2])) {
|
||||||
$dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
|
$dispsql = 'SELECT ' . PMA_backquote($map[$meta->name][2])
|
||||||
. ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
|
. ' FROM ' . PMA_backquote($map[$meta->name][3]) . '.' . PMA_backquote($map[$meta->name][0])
|
||||||
. ' WHERE ' . PMA_backquote($map[$meta->name][1])
|
. ' WHERE ' . PMA_backquote($map[$meta->name][1])
|
||||||
@@ -1756,7 +1756,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
|||||||
$tabs = '(\'' . join('\',\'', $target) . '\')';
|
$tabs = '(\'' . join('\',\'', $target) . '\')';
|
||||||
|
|
||||||
if ($cfgRelation['displaywork']) {
|
if ($cfgRelation['displaywork']) {
|
||||||
if (empty($table)) {
|
if (! isset($table) || ! strlen($table)) {
|
||||||
$exist_rel = FALSE;
|
$exist_rel = FALSE;
|
||||||
} else {
|
} else {
|
||||||
$exist_rel = PMA_getForeigners($db, $table, '', 'both');
|
$exist_rel = PMA_getForeigners($db, $table, '', 'both');
|
||||||
|
@@ -560,7 +560,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
|||||||
// a binary field
|
// a binary field
|
||||||
// Note: with mysqli, under MySQL 4.1.3, we get the flag
|
// Note: with mysqli, under MySQL 4.1.3, we get the flag
|
||||||
// "binary" for those field types (I don't know why)
|
// "binary" for those field types (I don't know why)
|
||||||
} else if (stristr($field_flags[$j], 'BINARY')
|
} elseif (stristr($field_flags[$j], 'BINARY')
|
||||||
&& isset($GLOBALS['hexforbinary'])
|
&& isset($GLOBALS['hexforbinary'])
|
||||||
&& $fields_meta[$j]->type != 'datetime'
|
&& $fields_meta[$j]->type != 'datetime'
|
||||||
&& $fields_meta[$j]->type != 'date'
|
&& $fields_meta[$j]->type != 'date'
|
||||||
|
@@ -21,7 +21,7 @@ require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
|
|||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
if ( ! isset( $GLOBALS['no_history'] ) && ! empty( $GLOBALS['db'] ) && empty( $GLOBALS['error_message'] ) ) {
|
if ( ! isset( $GLOBALS['no_history'] ) && isset( $GLOBALS['db'] ) && strlen($GLOBALS['db']) && empty( $GLOBALS['error_message'] ) ) {
|
||||||
$table = isset( $GLOBALS['table'] ) ? $GLOBALS['table'] : '';
|
$table = isset( $GLOBALS['table'] ) ? $GLOBALS['table'] : '';
|
||||||
// updates current settings
|
// updates current settings
|
||||||
?>
|
?>
|
||||||
|
@@ -166,7 +166,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
|||||||
$GLOBALS['strServer'],
|
$GLOBALS['strServer'],
|
||||||
's_host.png' );
|
's_host.png' );
|
||||||
|
|
||||||
if (!empty($GLOBALS['db'])) {
|
if (isset($GLOBALS['db']) && strlen($GLOBALS['db'])) {
|
||||||
|
|
||||||
echo $separator;
|
echo $separator;
|
||||||
printf( $item,
|
printf( $item,
|
||||||
@@ -176,7 +176,7 @@ if (empty($GLOBALS['is_header_sent'])) {
|
|||||||
$GLOBALS['strDatabase'],
|
$GLOBALS['strDatabase'],
|
||||||
's_db.png' );
|
's_db.png' );
|
||||||
|
|
||||||
if (!empty($GLOBALS['table'])) {
|
if (isset($GLOBALS['table']) && strlen($GLOBALS['table'])) {
|
||||||
require_once('./libraries/tbl_properties_table_info.inc.php');
|
require_once('./libraries/tbl_properties_table_info.inc.php');
|
||||||
|
|
||||||
echo $separator;
|
echo $separator;
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ( empty( $query_url ) ) {
|
if ( empty( $query_url ) ) {
|
||||||
$db = empty( $db ) ? '' : $db;
|
$db = ! isset( $db ) ? '' : $db;
|
||||||
$table = empty( $table ) ? '' : $table;
|
$table = ! isset( $table ) ? '' : $table;
|
||||||
$query_url = PMA_generate_common_url( $db, $table );
|
$query_url = PMA_generate_common_url( $db, $table );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,16 +8,16 @@
|
|||||||
*/
|
*/
|
||||||
if (!empty($submit_mult)
|
if (!empty($submit_mult)
|
||||||
&& ($submit_mult != $strWithChecked)
|
&& ($submit_mult != $strWithChecked)
|
||||||
&& ( !empty($selected_db)
|
&& ( ( isset($selected_db) && strlen($selected_db) )
|
||||||
|| !empty($selected_tbl)
|
|| ( isset($selected_tbl) && strlen($selected_tbl) )
|
||||||
|| !empty($selected_fld)
|
|| ( isset($selected_fld) && strlen($selected_fld) )
|
||||||
|| !empty($rows_to_delete)
|
|| !empty($rows_to_delete)
|
||||||
)) {
|
)) {
|
||||||
|
|
||||||
if (!empty($selected_db)) {
|
if (isset($selected_db) && strlen($selected_db)) {
|
||||||
$selected = $selected_db;
|
$selected = $selected_db;
|
||||||
$what = 'drop_db';
|
$what = 'drop_db';
|
||||||
} elseif (!empty($selected_tbl)) {
|
} elseif (isset($selected_tbl) && strlen($selected_tbl)) {
|
||||||
if ($submit_mult == $strPrintView) {
|
if ($submit_mult == $strPrintView) {
|
||||||
require('./tbl_printview.php');
|
require('./tbl_printview.php');
|
||||||
} else {
|
} else {
|
||||||
@@ -54,7 +54,7 @@ if (!empty($submit_mult)
|
|||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
}
|
}
|
||||||
} elseif (!empty($selected_fld)) {
|
} elseif (isset($selected_fld) && strlen($selected_fld)) {
|
||||||
$selected = $selected_fld;
|
$selected = $selected_fld;
|
||||||
switch ($submit_mult) {
|
switch ($submit_mult) {
|
||||||
case $strDrop:
|
case $strDrop:
|
||||||
@@ -126,12 +126,11 @@ if (!empty($submit_mult)
|
|||||||
if ( !empty($submit_mult) && !empty($what)) {
|
if ( !empty($submit_mult) && !empty($what)) {
|
||||||
$js_to_run = 'functions.js';
|
$js_to_run = 'functions.js';
|
||||||
unset($message);
|
unset($message);
|
||||||
if (!empty($table)) {
|
if (isset($table) && strlen($table)) {
|
||||||
require('./libraries/tbl_properties_common.php');
|
require('./libraries/tbl_properties_common.php');
|
||||||
$url_query .= '&goto=tbl_properties.php&back=tbl_properties.php';
|
$url_query .= '&goto=tbl_properties.php&back=tbl_properties.php';
|
||||||
require('./libraries/tbl_properties_table_info.inc.php');
|
require('./libraries/tbl_properties_table_info.inc.php');
|
||||||
}
|
} elseif (isset($db) && strlen($db)) {
|
||||||
elseif (!empty($db)) {
|
|
||||||
require('./libraries/db_details_common.inc.php');
|
require('./libraries/db_details_common.inc.php');
|
||||||
require('./libraries/db_details_db_info.inc.php');
|
require('./libraries/db_details_db_info.inc.php');
|
||||||
}
|
}
|
||||||
@@ -408,7 +407,7 @@ elseif ($mult_btn == $strYes) {
|
|||||||
if ($query_type == 'drop_tbl') {
|
if ($query_type == 'drop_tbl') {
|
||||||
if (!empty($sql_query)) {
|
if (!empty($sql_query)) {
|
||||||
$sql_query .= ';';
|
$sql_query .= ';';
|
||||||
} else if (!empty($sql_query_views)) {
|
} elseif (!empty($sql_query_views)) {
|
||||||
$sql_query = $sql_query_views . ';';
|
$sql_query = $sql_query_views . ';';
|
||||||
unset($sql_query_views);
|
unset($sql_query_views);
|
||||||
}
|
}
|
||||||
|
@@ -122,7 +122,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
|
|||||||
// for databases.
|
// for databases.
|
||||||
PMA_DBI_select_db( $db );
|
PMA_DBI_select_db( $db );
|
||||||
$return = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE "collation_database"', 0, 1 );
|
$return = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE "collation_database"', 0, 1 );
|
||||||
if ( ! empty( $GLOBALS['db'] ) && $db !== $GLOBALS['db'] ) {
|
if ( isset( $GLOBALS['db'] ) && $db !== $GLOBALS['db'] ) {
|
||||||
PMA_DBI_select_db( $GLOBALS['db'] );
|
PMA_DBI_select_db( $GLOBALS['db'] );
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
|
@@ -295,7 +295,7 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') {
|
|||||||
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
|
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . '
|
||||||
WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'
|
WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'
|
||||||
AND master_table = \'' . PMA_sqlAddslashes($table) . '\' ';
|
AND master_table = \'' . PMA_sqlAddslashes($table) . '\' ';
|
||||||
if (!empty($column)) {
|
if (isset($column) && strlen($column)) {
|
||||||
$rel_query .= ' AND master_field = \'' . PMA_sqlAddslashes($column) . '\'';
|
$rel_query .= ' AND master_field = \'' . PMA_sqlAddslashes($column) . '\'';
|
||||||
}
|
}
|
||||||
$relations = PMA_query_as_cu($rel_query);
|
$relations = PMA_query_as_cu($rel_query);
|
||||||
@@ -311,7 +311,7 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') {
|
|||||||
unset($relations);
|
unset($relations);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($source == 'both' || $source == 'innodb') && !empty($table)) {
|
if (($source == 'both' || $source == 'innodb') && isset($table) && strlen($table)) {
|
||||||
$show_create_table_query = 'SHOW CREATE TABLE '
|
$show_create_table_query = 'SHOW CREATE TABLE '
|
||||||
. PMA_backquote($db) . '.' . PMA_backquote($table);
|
. PMA_backquote($db) . '.' . PMA_backquote($table);
|
||||||
$show_create_table_res = PMA_DBI_query($show_create_table_query);
|
$show_create_table_res = PMA_DBI_query($show_create_table_query);
|
||||||
@@ -372,7 +372,8 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') {
|
|||||||
|
|
||||||
if (isset($GLOBALS['information_schema_relations'][$table])) {
|
if (isset($GLOBALS['information_schema_relations'][$table])) {
|
||||||
foreach ($GLOBALS['information_schema_relations'][$table] as $field => $relations) {
|
foreach ($GLOBALS['information_schema_relations'][$table] as $field => $relations) {
|
||||||
if ((empty($column) || $column == $field) && empty($foreign[$field])) {
|
if ( ( ! isset($column) || ! strlen($column) || $column == $field )
|
||||||
|
&& ( ! isset($foreign[$field]) || ! strlen($foreign[$field]) ) ) {
|
||||||
$foreign[$field] = $relations;
|
$foreign[$field] = $relations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -513,7 +514,7 @@ function PMA_getComments($db, $table = '') {
|
|||||||
$comment[$col] = $row['comment'];
|
$comment[$col] = $row['comment'];
|
||||||
// if this version supports native comments and this function
|
// if this version supports native comments and this function
|
||||||
// was called with a table parameter
|
// was called with a table parameter
|
||||||
if (PMA_MYSQL_INT_VERSION >= 40100 && !empty($table)) {
|
if (PMA_MYSQL_INT_VERSION >= 40100 && isset($table) && strlen($table)) {
|
||||||
// if native comment found, use it instead of pmadb
|
// if native comment found, use it instead of pmadb
|
||||||
if (!empty($native_comment[$col])) {
|
if (!empty($native_comment[$col])) {
|
||||||
$comment[$col] = $native_comment[$col];
|
$comment[$col] = $native_comment[$col];
|
||||||
@@ -579,7 +580,7 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
|
|||||||
}
|
}
|
||||||
|
|
||||||
// native mode is only for column comments so we need a table name
|
// native mode is only for column comments so we need a table name
|
||||||
if ($mode == 'native' && !empty($table)) {
|
if ($mode == 'native' && isset($table) && strlen($table)) {
|
||||||
$query = 'ALTER TABLE ' . PMA_backquote($table) . ' CHANGE '
|
$query = 'ALTER TABLE ' . PMA_backquote($table) . ' CHANGE '
|
||||||
. PMA_generateAlterTable($col, $col, '', '', '', '', FALSE, '', FALSE, '', $comment, '', '');
|
. PMA_generateAlterTable($col, $col, '', '', '', '', FALSE, '', FALSE, '', $comment, '', '');
|
||||||
PMA_DBI_try_query($query, NULL, PMA_DBI_QUERY_STORE);
|
PMA_DBI_try_query($query, NULL, PMA_DBI_QUERY_STORE);
|
||||||
|
@@ -20,7 +20,7 @@ if (empty($viewing_mode)) {
|
|||||||
/**
|
/**
|
||||||
* Set parameters for links
|
* Set parameters for links
|
||||||
*/
|
*/
|
||||||
$url_query = PMA_generate_common_url((!empty($db) ? $db : ''));
|
$url_query = PMA_generate_common_url((isset($db) ? $db : ''));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the urls to return to in case of error in a sql statement
|
* Defines the urls to return to in case of error in a sql statement
|
||||||
|
@@ -81,12 +81,11 @@ function PMA_sqlQueryForm( $query = true, $display_tab = false ) {
|
|||||||
|
|
||||||
$table = '';
|
$table = '';
|
||||||
$db = '';
|
$db = '';
|
||||||
if ( empty( $GLOBALS['db'] ) ) {
|
if ( ! isset( $GLOBALS['db'] ) || ! strlen($GLOBALS['db']) ) {
|
||||||
// prepare for server related
|
// prepare for server related
|
||||||
$goto = empty( $GLOBALS['goto'] ) ?
|
$goto = empty( $GLOBALS['goto'] ) ?
|
||||||
'server_sql.php' : $GLOBALS['goto'];
|
'server_sql.php' : $GLOBALS['goto'];
|
||||||
}
|
} elseif ( ! isset( $GLOBALS['table'] ) || ! strlen($GLOBALS['table']) ) {
|
||||||
elseif ( empty( $GLOBALS['table'] ) ) {
|
|
||||||
// prepare for db related
|
// prepare for db related
|
||||||
$db = $GLOBALS['db'];
|
$db = $GLOBALS['db'];
|
||||||
$goto = empty( $GLOBALS['goto'] ) ?
|
$goto = empty( $GLOBALS['goto'] ) ?
|
||||||
@@ -198,13 +197,12 @@ function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
|
|||||||
$table = '';
|
$table = '';
|
||||||
$db = '';
|
$db = '';
|
||||||
$fields_list = array();
|
$fields_list = array();
|
||||||
if ( empty( $GLOBALS['db'] ) ) {
|
if ( ! isset( $GLOBALS['db'] ) || ! strlen($GLOBALS['db']) ) {
|
||||||
// prepare for server related
|
// prepare for server related
|
||||||
$legend = sprintf( $GLOBALS['strRunSQLQueryOnServer'],
|
$legend = sprintf( $GLOBALS['strRunSQLQueryOnServer'],
|
||||||
htmlspecialchars(
|
htmlspecialchars(
|
||||||
$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host'] ) );
|
$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host'] ) );
|
||||||
}
|
} elseif ( ! isset( $GLOBALS['table'] ) || ! strlen($GLOBALS['table']) ) {
|
||||||
elseif ( empty( $GLOBALS['table'] ) ) {
|
|
||||||
// prepare for db related
|
// prepare for db related
|
||||||
$db = $GLOBALS['db'];
|
$db = $GLOBALS['db'];
|
||||||
// if you want navigation:
|
// if you want navigation:
|
||||||
@@ -288,7 +286,7 @@ function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
|
|||||||
foreach ( $fields_list as $field ) {
|
foreach ( $fields_list as $field ) {
|
||||||
echo '<option value="'
|
echo '<option value="'
|
||||||
.PMA_backquote( htmlspecialchars( $field['Field'] ) ) . '"';
|
.PMA_backquote( htmlspecialchars( $field['Field'] ) ) . '"';
|
||||||
if ( ! empty( $field['Field'] ) && isset($field['Comment']) ) {
|
if ( isset( $field['Field'] ) && strlen($field['Field']) && isset($field['Comment']) ) {
|
||||||
echo ' title="' . htmlspecialchars( $field['Comment'] ) . '"';
|
echo ' title="' . htmlspecialchars( $field['Comment'] ) . '"';
|
||||||
}
|
}
|
||||||
echo '>' . htmlspecialchars( $field['Field'] ) . '</option>' . "\n";
|
echo '>' . htmlspecialchars( $field['Field'] ) . '</option>' . "\n";
|
||||||
|
@@ -1094,7 +1094,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
'column' => ''
|
'column' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($alias_for_select_expr)) {
|
if (isset($alias_for_select_expr) && strlen($alias_for_select_expr)) {
|
||||||
// we had found an alias for this select expression
|
// we had found an alias for this select expression
|
||||||
$subresult['select_expr'][$current_select_expr]['alias'] = $alias_for_select_expr;
|
$subresult['select_expr'][$current_select_expr]['alias'] = $alias_for_select_expr;
|
||||||
unset($alias_for_select_expr);
|
unset($alias_for_select_expr);
|
||||||
@@ -1156,7 +1156,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
'table_alias' => '',
|
'table_alias' => '',
|
||||||
'table_true_name' => ''
|
'table_true_name' => ''
|
||||||
);
|
);
|
||||||
if (!empty($alias_for_table_ref)) {
|
if (isset($alias_for_table_ref) && strlen($alias_for_table_ref)) {
|
||||||
$subresult['table_ref'][$current_table_ref]['table_alias'] = $alias_for_table_ref;
|
$subresult['table_ref'][$current_table_ref]['table_alias'] = $alias_for_table_ref;
|
||||||
unset($alias_for_table_ref);
|
unset($alias_for_table_ref);
|
||||||
}
|
}
|
||||||
@@ -1193,7 +1193,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
$alias = $subresult['table_ref'][$tr]['table_alias'];
|
$alias = $subresult['table_ref'][$tr]['table_alias'];
|
||||||
$truename = $subresult['table_ref'][$tr]['table_true_name'];
|
$truename = $subresult['table_ref'][$tr]['table_true_name'];
|
||||||
for ($se=0; $se <= $current_select_expr; $se++) {
|
for ($se=0; $se <= $current_select_expr; $se++) {
|
||||||
if (!empty($alias) && $subresult['select_expr'][$se]['table_true_name']
|
if (isset($alias) && strlen($alias) && $subresult['select_expr'][$se]['table_true_name']
|
||||||
== $alias) {
|
== $alias) {
|
||||||
$subresult['select_expr'][$se]['table_true_name']
|
$subresult['select_expr'][$se]['table_true_name']
|
||||||
= $truename;
|
= $truename;
|
||||||
|
@@ -215,7 +215,8 @@ function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data, $di
|
|||||||
echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n";
|
echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($indexes_data[$index_name][$seq_index]['Sub_part'])) {
|
if ( isset($indexes_data[$index_name][$seq_index]['Sub_part'])
|
||||||
|
&& strlen($indexes_data[$index_name][$seq_index]['Sub_part']) ) {
|
||||||
echo ' <td>' . $col_name . '</td>' . "\n";
|
echo ' <td>' . $col_name . '</td>' . "\n";
|
||||||
echo ' <td align="right">' . "\n"
|
echo ' <td align="right">' . "\n"
|
||||||
. ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n"
|
. ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n"
|
||||||
|
@@ -97,7 +97,9 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
$source = PMA_backquote($source_db) . '.' . PMA_backquote($source_table);
|
$source = PMA_backquote($source_db) . '.' . PMA_backquote($source_table);
|
||||||
if (empty($target_db)) $target_db = $source_db;
|
if ( ! isset($target_db) || ! strlen($target_db) ) {
|
||||||
|
$target_db = $source_db;
|
||||||
|
}
|
||||||
|
|
||||||
// Doing a select_db could avoid some problems with replicated databases,
|
// Doing a select_db could avoid some problems with replicated databases,
|
||||||
// when moving table from replicated one to not replicated one
|
// when moving table from replicated one to not replicated one
|
||||||
|
@@ -39,10 +39,10 @@ function PMA_generate_common_hidden_inputs( $db = '', $table = '', $indent = 0,
|
|||||||
$skip =& $_skip;
|
$skip =& $_skip;
|
||||||
} else {
|
} else {
|
||||||
$params = array();
|
$params = array();
|
||||||
if ( ! empty( $db ) ) {
|
if ( isset($db) && strlen($db) ) {
|
||||||
$params['db'] = $db;
|
$params['db'] = $db;
|
||||||
}
|
}
|
||||||
if ( ! empty( $table ) ) {
|
if ( isset($table) && strlen($table) ) {
|
||||||
$params['table'] = $table;
|
$params['table'] = $table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,10 +138,10 @@ function PMA_generate_common_url ($db = '', $table = '', $delim = '&')
|
|||||||
$questionmark = '?';
|
$questionmark = '?';
|
||||||
} else {
|
} else {
|
||||||
$params = array();
|
$params = array();
|
||||||
if ( ! empty( $db ) ) {
|
if ( isset($db) && strlen($db) ) {
|
||||||
$params['db'] = $db;
|
$params['db'] = $db;
|
||||||
}
|
}
|
||||||
if ( ! empty( $table ) ) {
|
if ( isset($table) && strlen($table) ) {
|
||||||
$params['table'] = $table;
|
$params['table'] = $table;
|
||||||
}
|
}
|
||||||
$questionmark = '';
|
$questionmark = '';
|
||||||
|
@@ -8,7 +8,7 @@ require_once('./libraries/common.lib.php');
|
|||||||
* Gets the variables sent to this script, retains the db name that may have
|
* Gets the variables sent to this script, retains the db name that may have
|
||||||
* been defined as startup option and include a core library
|
* been defined as startup option and include a core library
|
||||||
*/
|
*/
|
||||||
if (!empty($db)) {
|
if (isset($db) && strlen($db)) {
|
||||||
$db_start = $db;
|
$db_start = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,13 +235,11 @@ require_once './libraries/bookmark.lib.php';
|
|||||||
if (isset($no_js) && $no_js) {
|
if (isset($no_js) && $no_js) {
|
||||||
// ... we redirect to appropriate query sql page
|
// ... we redirect to appropriate query sql page
|
||||||
// works only full if $db and $table is also stored/grabbed from $_COOKIE
|
// works only full if $db and $table is also stored/grabbed from $_COOKIE
|
||||||
if ( ! empty( $table ) ) {
|
if ( isset( $table ) && strlen($table) ) {
|
||||||
require './tbl_properties.php';
|
require './tbl_properties.php';
|
||||||
}
|
} elseif ( isset($db) && strlen($db) ) {
|
||||||
elseif ( ! empty( $db ) ) {
|
|
||||||
require './db_details.php';
|
require './db_details.php';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
require './server_sql.php';
|
require './server_sql.php';
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
@@ -342,8 +340,8 @@ foreach ( $_input_query_history as $sql => $history ) {
|
|||||||
}
|
}
|
||||||
unset( $_input_query_history, $sql, $history );
|
unset( $_input_query_history, $sql, $history );
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="db" value="<?php echo (empty($db) ? '' : htmlspecialchars($db)); ?>" />
|
<input type="hidden" name="db" value="<?php echo (! isset($db) ? '' : htmlspecialchars($db)); ?>" />
|
||||||
<input type="hidden" name="table" value="<?php echo (empty($table) ? '' : htmlspecialchars($table)); ?>" />
|
<input type="hidden" name="table" value="<?php echo (! isset($table) ? '' : htmlspecialchars($table)); ?>" />
|
||||||
|
|
||||||
<input type="hidden" name="query_history_latest" value="" />
|
<input type="hidden" name="query_history_latest" value="" />
|
||||||
<input type="hidden" name="query_history_latest_db" value="" />
|
<input type="hidden" name="query_history_latest_db" value="" />
|
||||||
|
@@ -1217,7 +1217,7 @@ switch ($action) {
|
|||||||
message('error', 'Empty username while using config authentication method!');
|
message('error', 'Empty username while using config authentication method!');
|
||||||
$err = TRUE;
|
$err = TRUE;
|
||||||
}
|
}
|
||||||
if (!empty($new_server['pmadb'])) {
|
if ( isset($new_server['pmadb']) && strlen($new_server['pmadb'])) {
|
||||||
// Just use defaults, should be okay for most users
|
// Just use defaults, should be okay for most users
|
||||||
$pmadb = array();
|
$pmadb = array();
|
||||||
$pmadb['bookmarktable'] = 'pma_bookmark';
|
$pmadb['bookmarktable'] = 'pma_bookmark';
|
||||||
|
@@ -75,7 +75,7 @@ if (isset($drop_selected_dbs_x)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!empty($drop_selected_dbs) || isset($query_type)) && ($is_superuser || $cfg['AllowUserDropDatabase'])) {
|
if ((!empty($drop_selected_dbs) || isset($query_type)) && ($is_superuser || $cfg['AllowUserDropDatabase'])) {
|
||||||
if (empty($selected_db) && ! (isset($query_type) && !empty($selected))) {
|
if ((! isset($selected_db) || ! strlen($selected_db)) && ! (isset($query_type) && !empty($selected))) {
|
||||||
$message = $strNoDatabasesSelected;
|
$message = $strNoDatabasesSelected;
|
||||||
} else {
|
} else {
|
||||||
$action = 'server_databases.php';
|
$action = 'server_databases.php';
|
||||||
|
@@ -14,11 +14,11 @@ require('./libraries/server_common.inc.php');
|
|||||||
/**
|
/**
|
||||||
* Checks if a dropdown box has been used for selecting a database / table
|
* Checks if a dropdown box has been used for selecting a database / table
|
||||||
*/
|
*/
|
||||||
if (!empty($pred_dbname)) {
|
if (isset($pred_dbname) && strlen($pred_dbname)) {
|
||||||
$dbname = $pred_dbname;
|
$dbname = $pred_dbname;
|
||||||
unset($pred_dbname);
|
unset($pred_dbname);
|
||||||
}
|
}
|
||||||
if (!empty($pred_tablename)) {
|
if (isset($pred_tablename) && strlen($pred_tablename)) {
|
||||||
$tablename = $pred_tablename;
|
$tablename = $pred_tablename;
|
||||||
unset($pred_tablename);
|
unset($pred_tablename);
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE)
|
|||||||
} else {
|
} else {
|
||||||
$privs[] = $current_grant[1];
|
$privs[] = $current_grant[1];
|
||||||
}
|
}
|
||||||
} else if (!empty($GLOBALS[$current_grant[0]]) && is_array($GLOBALS[$current_grant[0]]) && empty($GLOBALS[$current_grant[0] . '_none'])) {
|
} elseif (!empty($GLOBALS[$current_grant[0]]) && is_array($GLOBALS[$current_grant[0]]) && empty($GLOBALS[$current_grant[0] . '_none'])) {
|
||||||
if ($enableHTML) {
|
if ($enableHTML) {
|
||||||
$priv_string = '<dfn title="' . $current_grant[2] . '">' . $current_grant[1] . '</dfn>';
|
$priv_string = '<dfn title="' . $current_grant[2] . '">' . $current_grant[1] . '</dfn>';
|
||||||
} else {
|
} else {
|
||||||
@@ -946,10 +946,10 @@ if (!empty($update_privs)) {
|
|||||||
//
|
//
|
||||||
// It looks curious but reflects the way MySQL works
|
// It looks curious but reflects the way MySQL works
|
||||||
|
|
||||||
if (empty($dbname)) {
|
if (! isset($dbname) || ! strlen($dbname)) {
|
||||||
$db_and_table = '*.*';
|
$db_and_table = '*.*';
|
||||||
} else {
|
} else {
|
||||||
if ( !empty( $tablename ) ) {
|
if ( isset( $tablename ) && strlen($tablename) ) {
|
||||||
$db_and_table = PMA_backquote( PMA_unescape_mysql_wildcards( $dbname ) ) . '.';
|
$db_and_table = PMA_backquote( PMA_unescape_mysql_wildcards( $dbname ) ) . '.';
|
||||||
$db_and_table .= PMA_backquote( $tablename );
|
$db_and_table .= PMA_backquote( $tablename );
|
||||||
} else {
|
} else {
|
||||||
@@ -973,7 +973,7 @@ if (!empty($update_privs)) {
|
|||||||
|
|
||||||
// FIXME: similar code appears twice in this script
|
// FIXME: similar code appears twice in this script
|
||||||
if ( ( isset($Grant_priv) && $Grant_priv == 'Y')
|
if ( ( isset($Grant_priv) && $Grant_priv == 'Y')
|
||||||
|| ( empty($dbname) && PMA_MYSQL_INT_VERSION >= 40002
|
|| ( ( ! isset($dbname) || ! strle($dbname) ) && PMA_MYSQL_INT_VERSION >= 40002
|
||||||
&& ( isset($max_questions) || isset($max_connections)
|
&& ( isset($max_questions) || isset($max_connections)
|
||||||
|| isset($max_updates) || isset($max_user_connections))))
|
|| isset($max_updates) || isset($max_user_connections))))
|
||||||
{
|
{
|
||||||
@@ -1022,10 +1022,10 @@ if (!empty($update_privs)) {
|
|||||||
*/
|
*/
|
||||||
if (!empty($revokeall)) {
|
if (!empty($revokeall)) {
|
||||||
|
|
||||||
if (empty($dbname)) {
|
if ( ! isset($dbname) || ! strlen($dbname) ) {
|
||||||
$db_and_table = '*.*';
|
$db_and_table = '*.*';
|
||||||
} else {
|
} else {
|
||||||
if ( empty( $tablename ) ) {
|
if ( ! isset( $tablename ) || ! strlen($tablename) ) {
|
||||||
$db_and_table = PMA_backquote( $dbname ) . '.';
|
$db_and_table = PMA_backquote( $dbname ) . '.';
|
||||||
$db_and_table .= '*';
|
$db_and_table .= '*';
|
||||||
} else {
|
} else {
|
||||||
@@ -1046,7 +1046,7 @@ if (!empty($revokeall)) {
|
|||||||
}
|
}
|
||||||
$sql_query = $sql_query0 . (isset($sql_query1) ? ' ' . $sql_query1 : '');
|
$sql_query = $sql_query0 . (isset($sql_query1) ? ' ' . $sql_query1 : '');
|
||||||
$message = sprintf($GLOBALS['strRevokeMessage'], '\'' . $username . '\'@\'' . $hostname . '\'');
|
$message = sprintf($GLOBALS['strRevokeMessage'], '\'' . $username . '\'@\'' . $hostname . '\'');
|
||||||
if (empty($tablename)) {
|
if ( ! isset($tablename) || ! strlen($tablename) ) {
|
||||||
unset($dbname);
|
unset($dbname);
|
||||||
} else {
|
} else {
|
||||||
unset($tablename);
|
unset($tablename);
|
||||||
@@ -1242,7 +1242,7 @@ $link_revoke .= '</a>';
|
|||||||
/**
|
/**
|
||||||
* Displays the page
|
* Displays the page
|
||||||
*/
|
*/
|
||||||
if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) {
|
||||||
if ( ! isset( $username ) ) {
|
if ( ! isset( $username ) ) {
|
||||||
// No username is given --> display the overview
|
// No username is given --> display the overview
|
||||||
echo '<h2>' . "\n"
|
echo '<h2>' . "\n"
|
||||||
@@ -1545,14 +1545,14 @@ if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
|||||||
echo '<h2>' . "\n"
|
echo '<h2>' . "\n"
|
||||||
. ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" alt="" />' : '' )
|
. ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" alt="" />' : '' )
|
||||||
. $GLOBALS['strUser'] . ' <i><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '">\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</a></i>' . "\n";
|
. $GLOBALS['strUser'] . ' <i><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '">\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</a></i>' . "\n";
|
||||||
if ( ! empty( $dbname ) ) {
|
if ( isset( $dbname ) && strlen($dbname) ) {
|
||||||
if ( $dbname_is_wildcard ) {
|
if ( $dbname_is_wildcard ) {
|
||||||
echo ' - ' . $GLOBALS['strDatabases'];
|
echo ' - ' . $GLOBALS['strDatabases'];
|
||||||
} else {
|
} else {
|
||||||
echo ' - ' . $GLOBALS['strDatabase'];
|
echo ' - ' . $GLOBALS['strDatabase'];
|
||||||
}
|
}
|
||||||
echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&db=' . urlencode($dbname) . '&reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n";
|
echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&db=' . urlencode($dbname) . '&reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n";
|
||||||
if ( ! empty( $tablename ) ) {
|
if ( isset( $tablename ) && strlen($tablename) ) {
|
||||||
echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&db=' . urlencode($dbname) . '&table=' . urlencode($tablename) . '&reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n";
|
echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&db=' . urlencode($dbname) . '&table=' . urlencode($tablename) . '&reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1570,16 +1570,18 @@ if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
|||||||
. PMA_generate_common_hidden_inputs('', '', 3)
|
. PMA_generate_common_hidden_inputs('', '', 3)
|
||||||
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
|
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
|
||||||
. '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n";
|
. '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n";
|
||||||
if ( ! empty( $dbname ) ) {
|
if ( isset( $dbname ) && strlen($dbname) ) {
|
||||||
echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
|
echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
|
||||||
if ( ! empty( $tablename ) ) {
|
if ( isset( $tablename ) && strlen($tablename) ) {
|
||||||
echo ' <input type="hidden" name="tablename" value="' . htmlspecialchars($tablename) . '" />' . "\n";
|
echo ' <input type="hidden" name="tablename" value="' . htmlspecialchars($tablename) . '" />' . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PMA_displayPrivTable((empty($dbname) ? '*' : $dbname), ((empty($dbname) || empty($tablename)) ? '*' : $tablename), TRUE, 3);
|
PMA_displayPrivTable((( ! isset( $dbname ) || ! strlen($dbname) ) ? '*' : $dbname),
|
||||||
|
((( ! isset( $dbname ) || ! strlen($dbname) ) || ( ! isset( $tablename ) || ! strlen($tablename) )) ? '*' : $tablename),
|
||||||
|
TRUE, 3);
|
||||||
echo '</form>' . "\n";
|
echo '</form>' . "\n";
|
||||||
|
|
||||||
if ( empty( $tablename ) && empty( $dbname_is_wildcard ) ) {
|
if ( ( ! isset( $tablename ) || ! strlen($tablename) ) && empty( $dbname_is_wildcard ) ) {
|
||||||
|
|
||||||
// no table name was given, display all table specific rights
|
// no table name was given, display all table specific rights
|
||||||
// but only if $dbname contains no wildcards
|
// but only if $dbname contains no wildcards
|
||||||
@@ -1590,13 +1592,13 @@ if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
|||||||
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
|
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
|
||||||
. '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"
|
. '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"
|
||||||
. '<fieldset>' . "\n"
|
. '<fieldset>' . "\n"
|
||||||
. '<legend>' . (empty($dbname) ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges']) . '</legend>' . "\n"
|
. '<legend>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges']) . '</legend>' . "\n"
|
||||||
. '<table class="data">' . "\n"
|
. '<table class="data">' . "\n"
|
||||||
. '<thead>' . "\n"
|
. '<thead>' . "\n"
|
||||||
. '<tr><th>' . (empty($dbname) ? $GLOBALS['strDatabase'] : $GLOBALS['strTable']) . '</th>' . "\n"
|
. '<tr><th>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strDatabase'] : $GLOBALS['strTable']) . '</th>' . "\n"
|
||||||
. ' <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n"
|
. ' <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n"
|
||||||
. ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n"
|
. ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n"
|
||||||
. ' <th>' . (empty($dbname) ? $GLOBALS['strTblPrivileges'] : $GLOBALS['strColumnPrivileges']) . '</th>' . "\n"
|
. ' <th>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strTblPrivileges'] : $GLOBALS['strColumnPrivileges']) . '</th>' . "\n"
|
||||||
. ' <th colspan="2">' . $GLOBALS['strAction'] . '</th>' . "\n"
|
. ' <th colspan="2">' . $GLOBALS['strAction'] . '</th>' . "\n"
|
||||||
. '</tr>' . "\n"
|
. '</tr>' . "\n"
|
||||||
. '</thead>' . "\n"
|
. '</thead>' . "\n"
|
||||||
@@ -1613,7 +1615,7 @@ if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
|||||||
|
|
||||||
// we also want privielgs for this user not in table `db` but in other table
|
// we also want privielgs for this user not in table `db` but in other table
|
||||||
$tables = PMA_DBI_fetch_result('SHOW TABLES FROM `mysql`;');
|
$tables = PMA_DBI_fetch_result('SHOW TABLES FROM `mysql`;');
|
||||||
if ( empty( $dbname ) ) {
|
if ( ( ! isset( $dbname ) || ! strlen($dbname) ) ) {
|
||||||
|
|
||||||
// no db name given, so we want all privs for the given user
|
// no db name given, so we want all privs for the given user
|
||||||
|
|
||||||
@@ -1775,14 +1777,14 @@ if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
|||||||
$found_rows = array();
|
$found_rows = array();
|
||||||
//while ( $row = PMA_DBI_fetch_assoc( $res ) ) {
|
//while ( $row = PMA_DBI_fetch_assoc( $res ) ) {
|
||||||
foreach ( $db_rights as $row ) {
|
foreach ( $db_rights as $row ) {
|
||||||
$found_rows[] = empty($dbname) ? $row['Db'] : $row['Table_name'];
|
$found_rows[] = ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $row['Table_name'];
|
||||||
|
|
||||||
echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"
|
echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"
|
||||||
. ' <td>' . htmlspecialchars(empty($dbname) ? $row['Db'] : $row['Table_name']) . '</td>' . "\n"
|
. ' <td>' . htmlspecialchars(( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $row['Table_name']) . '</td>' . "\n"
|
||||||
. ' <td><tt>' . "\n"
|
. ' <td><tt>' . "\n"
|
||||||
. ' ' . join(',' . "\n" . ' ', PMA_extractPrivInfo($row, TRUE)) . "\n"
|
. ' ' . join(',' . "\n" . ' ', PMA_extractPrivInfo($row, TRUE)) . "\n"
|
||||||
. ' </tt></td>' . "\n"
|
. ' </tt></td>' . "\n"
|
||||||
. ' <td>' . (((empty($dbname) && $row['Grant_priv'] == 'Y') || (!empty($dbname) && in_array('Grant', explode(',', $row['Table_priv'])))) ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n"
|
. ' <td>' . (((( ! isset( $dbname ) || ! strlen($dbname) ) && $row['Grant_priv'] == 'Y') || (isset($dbname) && strlen($dbname) && in_array('Grant', explode(',', $row['Table_priv'])))) ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n"
|
||||||
. ' <td>';
|
. ' <td>';
|
||||||
if ( ! empty( $row['Table_privs'] ) || ! empty ( $row['Column_priv'] ) ) {
|
if ( ! empty( $row['Table_privs'] ) || ! empty ( $row['Column_priv'] ) ) {
|
||||||
echo $GLOBALS['strYes'];
|
echo $GLOBALS['strYes'];
|
||||||
@@ -1793,15 +1795,15 @@ if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
|||||||
. ' <td>';
|
. ' <td>';
|
||||||
printf( $link_edit, urlencode( $username ),
|
printf( $link_edit, urlencode( $username ),
|
||||||
urlencode( $hostname ),
|
urlencode( $hostname ),
|
||||||
urlencode( empty($dbname) ? $row['Db'] : $dbname ),
|
urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $dbname ),
|
||||||
urlencode( empty($dbname) ? '' : $row['Table_name'] ) );
|
urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? '' : $row['Table_name'] ) );
|
||||||
echo '</td>' . "\n"
|
echo '</td>' . "\n"
|
||||||
. ' <td>';
|
. ' <td>';
|
||||||
if ( ! empty( $row['can_delete'] ) || ! empty( $row['Table_name'] ) ) {
|
if ( ! empty( $row['can_delete'] ) || isset( $row['Table_name'] ) && strlen($row['Table_name']) ) {
|
||||||
printf( $link_revoke, urlencode( $username ),
|
printf( $link_revoke, urlencode( $username ),
|
||||||
urlencode( $hostname ),
|
urlencode( $hostname ),
|
||||||
urlencode( empty( $dbname ) ? $row['Db'] : $dbname ),
|
urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $dbname ),
|
||||||
urlencode( empty( $dbname ) ? '' : $row['Table_name'] ) );
|
urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? '' : $row['Table_name'] ) );
|
||||||
}
|
}
|
||||||
echo '</td>' . "\n"
|
echo '</td>' . "\n"
|
||||||
. '</tr>' . "\n";
|
. '</tr>' . "\n";
|
||||||
@@ -1812,7 +1814,7 @@ if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
|||||||
echo '</tbody>' . "\n"
|
echo '</tbody>' . "\n"
|
||||||
. '</table>' . "\n";
|
. '</table>' . "\n";
|
||||||
|
|
||||||
if (empty($dbname)) {
|
if ( ! isset( $dbname ) || ! strlen($dbname) ) {
|
||||||
|
|
||||||
// no database name was give, display select db
|
// no database name was give, display select db
|
||||||
|
|
||||||
@@ -1869,7 +1871,7 @@ if ( empty( $adduser ) && empty( $checkprivs ) ) {
|
|||||||
. '</form>' . "\n";
|
. '</form>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty($dbname) && ! $user_does_not_exists ) {
|
if ( ( ! isset( $dbname ) || ! strlen($dbname) ) && ! $user_does_not_exists ) {
|
||||||
echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n"
|
echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n"
|
||||||
. PMA_generate_common_hidden_inputs('', '', 3)
|
. PMA_generate_common_hidden_inputs('', '', 3)
|
||||||
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
|
. '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n"
|
||||||
|
@@ -77,7 +77,7 @@ foreach ( $serverProcesses AS $process ) {
|
|||||||
<td class="value"><?php echo $process['Id']; ?></td>
|
<td class="value"><?php echo $process['Id']; ?></td>
|
||||||
<td><?php echo $process['User']; ?></td>
|
<td><?php echo $process['User']; ?></td>
|
||||||
<td><?php echo $process['Host']; ?></td>
|
<td><?php echo $process['Host']; ?></td>
|
||||||
<td><?php echo (empty($process['db']) ? '<i>' . $strNone . '</i>' : $process['db']); ?></td>
|
<td><?php echo (( ! isset( $process['db'] ) || ! strlen($process['db']) ) ? '<i>' . $strNone . '</i>' : $process['db']); ?></td>
|
||||||
<td><?php echo $process['Command']; ?></td>
|
<td><?php echo $process['Command']; ?></td>
|
||||||
<td class="value"><?php echo $process['Time']; ?></td>
|
<td class="value"><?php echo $process['Time']; ?></td>
|
||||||
<td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
|
<td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
|
||||||
|
27
sql.php
27
sql.php
@@ -24,7 +24,7 @@ if (!empty($goto)) {
|
|||||||
} // end if (security checkings)
|
} // end if (security checkings)
|
||||||
|
|
||||||
if (empty($goto)) {
|
if (empty($goto)) {
|
||||||
$goto = (empty($table)) ? $cfg['DefaultTabDatabase'] : $cfg['DefaultTabTable'];
|
$goto = (! isset($table) || ! strlen($table)) ? $cfg['DefaultTabDatabase'] : $cfg['DefaultTabTable'];
|
||||||
$is_gotofile = TRUE;
|
$is_gotofile = TRUE;
|
||||||
} // end if
|
} // end if
|
||||||
if (!isset($err_url)) {
|
if (!isset($err_url)) {
|
||||||
@@ -156,11 +156,10 @@ if ($is_select) {
|
|||||||
if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name'])) {
|
if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name'])) {
|
||||||
$table = $analyzed_sql[0]['table_ref'][0]['table_true_name'];
|
$table = $analyzed_sql[0]['table_ref'][0]['table_true_name'];
|
||||||
}
|
}
|
||||||
if (isset($analyzed_sql[0]['table_ref'][0]['db'])
|
if ( isset($analyzed_sql[0]['table_ref'][0]['db'])
|
||||||
&& !empty($analyzed_sql[0]['table_ref'][0]['db'])) {
|
&& strlen($analyzed_sql[0]['table_ref'][0]['db']) ) {
|
||||||
$db = $analyzed_sql[0]['table_ref'][0]['db'];
|
$db = $analyzed_sql[0]['table_ref'][0]['db'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$db = $prev_db;
|
$db = $prev_db;
|
||||||
}
|
}
|
||||||
// Nijel: don't change reload, if we already decided to reload in import
|
// Nijel: don't change reload, if we already decided to reload in import
|
||||||
@@ -189,7 +188,7 @@ if (isset($btnDrop) && $btnDrop == $strNo) {
|
|||||||
$goto = $back;
|
$goto = $back;
|
||||||
}
|
}
|
||||||
if ($is_gotofile) {
|
if ($is_gotofile) {
|
||||||
if (strpos(' ' . $goto, 'db_details') == 1 && !empty($table)) {
|
if (strpos(' ' . $goto, 'db_details') == 1 && isset($table) && strlen($table) ) {
|
||||||
unset($table);
|
unset($table);
|
||||||
}
|
}
|
||||||
$active_page = $goto;
|
$active_page = $goto;
|
||||||
@@ -577,9 +576,9 @@ else {
|
|||||||
if (isset($purge) && $purge == '1') {
|
if (isset($purge) && $purge == '1') {
|
||||||
require_once('./libraries/relation_cleanup.lib.php');
|
require_once('./libraries/relation_cleanup.lib.php');
|
||||||
|
|
||||||
if (isset($table) && isset($db) && !empty($table) && !empty($db)) {
|
if (isset($table) && isset($db) && strlen($table) && strlen($db)) {
|
||||||
PMA_relationsCleanupTable($db, $table);
|
PMA_relationsCleanupTable($db, $table);
|
||||||
} elseif (isset($db) && !empty($db)) {
|
} elseif (isset($db) && strlen($db)) {
|
||||||
PMA_relationsCleanupDatabase($db);
|
PMA_relationsCleanupDatabase($db);
|
||||||
} else {
|
} else {
|
||||||
// garvin: VOID. No DB/Table gets deleted.
|
// garvin: VOID. No DB/Table gets deleted.
|
||||||
@@ -589,7 +588,7 @@ else {
|
|||||||
// garvin: If a column gets dropped, do relation magic.
|
// garvin: If a column gets dropped, do relation magic.
|
||||||
if (isset($cpurge) && $cpurge == '1' && isset($purgekey)
|
if (isset($cpurge) && $cpurge == '1' && isset($purgekey)
|
||||||
&& isset($db) && isset($table)
|
&& isset($db) && isset($table)
|
||||||
&& !empty($db) && !empty($table) && !empty($purgekey)) {
|
&& strlen($db) && strlen($table) && !empty($purgekey)) {
|
||||||
require_once('./libraries/relation_cleanup.lib.php');
|
require_once('./libraries/relation_cleanup.lib.php');
|
||||||
PMA_relationsCleanupColumn($db, $table, $purgekey);
|
PMA_relationsCleanupColumn($db, $table, $purgekey);
|
||||||
|
|
||||||
@@ -694,23 +693,21 @@ else {
|
|||||||
} else {
|
} else {
|
||||||
$js_to_run = 'functions.js';
|
$js_to_run = 'functions.js';
|
||||||
unset($message);
|
unset($message);
|
||||||
if (!empty($table)) {
|
if (isset($table) && strlen($table)) {
|
||||||
require('./libraries/tbl_properties_common.php');
|
require('./libraries/tbl_properties_common.php');
|
||||||
$url_query .= '&goto=tbl_properties.php&back=tbl_properties.php';
|
$url_query .= '&goto=tbl_properties.php&back=tbl_properties.php';
|
||||||
require('./libraries/tbl_properties_table_info.inc.php');
|
require('./libraries/tbl_properties_table_info.inc.php');
|
||||||
require('./libraries/tbl_properties_links.inc.php');
|
require('./libraries/tbl_properties_links.inc.php');
|
||||||
}
|
} elseif (isset($db) && strlen($db)) {
|
||||||
elseif (!empty($db)) {
|
|
||||||
require('./libraries/db_details_common.inc.php');
|
require('./libraries/db_details_common.inc.php');
|
||||||
require('./libraries/db_details_db_info.inc.php');
|
require('./libraries/db_details_db_info.inc.php');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
require('./libraries/server_common.inc.php');
|
require('./libraries/server_common.inc.php');
|
||||||
require('./libraries/server_links.inc.php');
|
require('./libraries/server_links.inc.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($db)) {
|
if (isset($db) && strlen($db)) {
|
||||||
require_once('./libraries/relation.lib.php');
|
require_once('./libraries/relation.lib.php');
|
||||||
$cfgRelation = PMA_getRelationsParam();
|
$cfgRelation = PMA_getRelationsParam();
|
||||||
}
|
}
|
||||||
|
@@ -93,12 +93,12 @@ if (isset($submit_num_fields)) {
|
|||||||
$primary_cnt = count($field_primary);
|
$primary_cnt = count($field_primary);
|
||||||
for ($i = 0; $i < $primary_cnt; $i++) {
|
for ($i = 0; $i < $primary_cnt; $i++) {
|
||||||
$j = $field_primary[$i];
|
$j = $field_primary[$i];
|
||||||
if (!empty($field_name[$j])) {
|
if (isset($field_name[$j]) && strlen($field_name[$j])) {
|
||||||
$primary .= PMA_backquote($field_name[$j]) . ', ';
|
$primary .= PMA_backquote($field_name[$j]) . ', ';
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
$primary = preg_replace('@, $@', '', $primary);
|
$primary = preg_replace('@, $@', '', $primary);
|
||||||
if (!empty($primary)) {
|
if (strlen($primary)) {
|
||||||
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD PRIMARY KEY (' . $primary . ');';
|
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD PRIMARY KEY (' . $primary . ');';
|
||||||
$result = PMA_DBI_query($sql_query);
|
$result = PMA_DBI_query($sql_query);
|
||||||
$sql_query_cpy .= "\n" . $sql_query . ';';
|
$sql_query_cpy .= "\n" . $sql_query . ';';
|
||||||
@@ -111,12 +111,12 @@ if (isset($submit_num_fields)) {
|
|||||||
$index_cnt = count($field_index);
|
$index_cnt = count($field_index);
|
||||||
for ($i = 0; $i < $index_cnt; $i++) {
|
for ($i = 0; $i < $index_cnt; $i++) {
|
||||||
$j = $field_index[$i];
|
$j = $field_index[$i];
|
||||||
if (!empty($field_name[$j])) {
|
if (isset($field_name[$j]) && strlen($field_name[$j])) {
|
||||||
$index .= PMA_backquote($field_name[$j]) . ', ';
|
$index .= PMA_backquote($field_name[$j]) . ', ';
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
$index = preg_replace('@, $@', '', $index);
|
$index = preg_replace('@, $@', '', $index);
|
||||||
if (!empty($index)) {
|
if (strlen($index)) {
|
||||||
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX (' . $index . ')';
|
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX (' . $index . ')';
|
||||||
$result = PMA_DBI_query($sql_query);
|
$result = PMA_DBI_query($sql_query);
|
||||||
$sql_query_cpy .= "\n" . $sql_query . ';';
|
$sql_query_cpy .= "\n" . $sql_query . ';';
|
||||||
@@ -129,12 +129,12 @@ if (isset($submit_num_fields)) {
|
|||||||
$unique_cnt = count($field_unique);
|
$unique_cnt = count($field_unique);
|
||||||
for ($i = 0; $i < $unique_cnt; $i++) {
|
for ($i = 0; $i < $unique_cnt; $i++) {
|
||||||
$j = $field_unique[$i];
|
$j = $field_unique[$i];
|
||||||
if (!empty($field_name[$j])) {
|
if (isset($field_name[$j]) && strlen($field_name[$j])) {
|
||||||
$unique .= PMA_backquote($field_name[$j]) . ', ';
|
$unique .= PMA_backquote($field_name[$j]) . ', ';
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
$unique = preg_replace('@, $@', '', $unique);
|
$unique = preg_replace('@, $@', '', $unique);
|
||||||
if (!empty($unique)) {
|
if (strlen($unique)) {
|
||||||
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE (' . $unique . ')';
|
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE (' . $unique . ')';
|
||||||
$result = PMA_DBI_query($sql_query);
|
$result = PMA_DBI_query($sql_query);
|
||||||
$sql_query_cpy .= "\n" . $sql_query . ';';
|
$sql_query_cpy .= "\n" . $sql_query . ';';
|
||||||
@@ -151,7 +151,7 @@ if (isset($submit_num_fields)) {
|
|||||||
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
|
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
|
||||||
} // end for
|
} // end for
|
||||||
$fulltext = preg_replace('@, $@', '', $fulltext);
|
$fulltext = preg_replace('@, $@', '', $fulltext);
|
||||||
if (!empty($fulltext)) {
|
if (strlen($fulltext)) {
|
||||||
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
|
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
|
||||||
$result = PMA_DBI_query($sql_query);
|
$result = PMA_DBI_query($sql_query);
|
||||||
$sql_query_cpy .= "\n" . $sql_query . ';';
|
$sql_query_cpy .= "\n" . $sql_query . ';';
|
||||||
@@ -167,7 +167,7 @@ if (isset($submit_num_fields)) {
|
|||||||
// garvin: Update comment table, if a comment was set.
|
// garvin: Update comment table, if a comment was set.
|
||||||
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) {
|
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) {
|
||||||
foreach ($field_comments AS $fieldindex => $fieldcomment) {
|
foreach ($field_comments AS $fieldindex => $fieldcomment) {
|
||||||
if (!empty($field_name[$fieldindex])) {
|
if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) {
|
||||||
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb');
|
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ if (isset($submit_num_fields)) {
|
|||||||
// garvin: Update comment table for mime types [MIME]
|
// garvin: Update comment table for mime types [MIME]
|
||||||
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
|
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
|
||||||
foreach ($field_mimetype AS $fieldindex => $mimetype) {
|
foreach ($field_mimetype AS $fieldindex => $mimetype) {
|
||||||
if (!empty($field_name[$fieldindex])) {
|
if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) {
|
||||||
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
|
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -83,7 +83,7 @@ if (isset($do_save_data)) {
|
|||||||
// garvin: Update comment table, if a comment was set.
|
// garvin: Update comment table, if a comment was set.
|
||||||
if (PMA_MYSQL_INT_VERSION < 40100 && isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
|
if (PMA_MYSQL_INT_VERSION < 40100 && isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
|
||||||
foreach ($field_comments AS $fieldindex => $fieldcomment) {
|
foreach ($field_comments AS $fieldindex => $fieldcomment) {
|
||||||
if (!empty($field_name[$fieldindex])) {
|
if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) {
|
||||||
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex], 'pmadb');
|
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex], 'pmadb');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ if (isset($do_save_data)) {
|
|||||||
// garvin: Update comment table for mime types [MIME]
|
// garvin: Update comment table for mime types [MIME]
|
||||||
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
|
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
|
||||||
foreach ($field_mimetype AS $fieldindex => $mimetype) {
|
foreach ($field_mimetype AS $fieldindex => $mimetype) {
|
||||||
if (!empty($field_name[$fieldindex])) {
|
if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) {
|
||||||
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
|
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -376,7 +376,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// UPDATE case with an empty and not NULL value under PHP4
|
// UPDATE case with an empty and not NULL value under PHP4
|
||||||
else if (empty($vrow[$rowfield]) && is_null($vrow[$rowfield])) {
|
elseif (empty($vrow[$rowfield]) && is_null($vrow[$rowfield])) {
|
||||||
$vrow[$rowfield] = date('Y-m-d H:i:s', time());
|
$vrow[$rowfield] = date('Y-m-d H:i:s', time());
|
||||||
} // end if... else if...
|
} // end if... else if...
|
||||||
}
|
}
|
||||||
|
@@ -78,13 +78,13 @@ if (isset($submit_num_fields)) {
|
|||||||
$primary_cnt = (isset($field_primary) ? count($field_primary) : 0);
|
$primary_cnt = (isset($field_primary) ? count($field_primary) : 0);
|
||||||
for ($i = 0; $i < $primary_cnt; $i++) {
|
for ($i = 0; $i < $primary_cnt; $i++) {
|
||||||
$j = $field_primary[$i];
|
$j = $field_primary[$i];
|
||||||
if (!empty($field_name[$j])) {
|
if (isset($field_name[$j]) && strlen($field_name[$j])) {
|
||||||
$primary .= PMA_backquote($field_name[$j]) . ', ';
|
$primary .= PMA_backquote($field_name[$j]) . ', ';
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
unset($primary_cnt);
|
unset($primary_cnt);
|
||||||
$primary = preg_replace('@, $@', '', $primary);
|
$primary = preg_replace('@, $@', '', $primary);
|
||||||
if (!empty($primary)) {
|
if (strlen($primary)) {
|
||||||
$sql_query .= ', PRIMARY KEY (' . $primary . ')';
|
$sql_query .= ', PRIMARY KEY (' . $primary . ')';
|
||||||
$query_cpy .= ',' . "\n" . ' PRIMARY KEY (' . $primary . ')';
|
$query_cpy .= ',' . "\n" . ' PRIMARY KEY (' . $primary . ')';
|
||||||
}
|
}
|
||||||
@@ -95,13 +95,13 @@ if (isset($submit_num_fields)) {
|
|||||||
$index_cnt = (isset($field_index) ? count($field_index) : 0);
|
$index_cnt = (isset($field_index) ? count($field_index) : 0);
|
||||||
for ($i = 0;$i < $index_cnt; $i++) {
|
for ($i = 0;$i < $index_cnt; $i++) {
|
||||||
$j = $field_index[$i];
|
$j = $field_index[$i];
|
||||||
if (!empty($field_name[$j])) {
|
if (isset($field_name[$j]) && strlen($field_name[$j])) {
|
||||||
$index .= PMA_backquote($field_name[$j]) . ', ';
|
$index .= PMA_backquote($field_name[$j]) . ', ';
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
unset($index_cnt);
|
unset($index_cnt);
|
||||||
$index = preg_replace('@, $@', '', $index);
|
$index = preg_replace('@, $@', '', $index);
|
||||||
if (!empty($index)) {
|
if (strlen($index)) {
|
||||||
$sql_query .= ', INDEX (' . $index . ')';
|
$sql_query .= ', INDEX (' . $index . ')';
|
||||||
$query_cpy .= ',' . "\n" . ' INDEX (' . $index . ')';
|
$query_cpy .= ',' . "\n" . ' INDEX (' . $index . ')';
|
||||||
}
|
}
|
||||||
@@ -112,13 +112,13 @@ if (isset($submit_num_fields)) {
|
|||||||
$unique_cnt = (isset($field_unique) ? count($field_unique) : 0);
|
$unique_cnt = (isset($field_unique) ? count($field_unique) : 0);
|
||||||
for ($i = 0; $i < $unique_cnt; $i++) {
|
for ($i = 0; $i < $unique_cnt; $i++) {
|
||||||
$j = $field_unique[$i];
|
$j = $field_unique[$i];
|
||||||
if (!empty($field_name[$j])) {
|
if (isset($field_name[$j]) && strlen($field_name[$j])) {
|
||||||
$unique .= PMA_backquote($field_name[$j]) . ', ';
|
$unique .= PMA_backquote($field_name[$j]) . ', ';
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
unset($unique_cnt);
|
unset($unique_cnt);
|
||||||
$unique = preg_replace('@, $@', '', $unique);
|
$unique = preg_replace('@, $@', '', $unique);
|
||||||
if (!empty($unique)) {
|
if (strlen($unique)) {
|
||||||
$sql_query .= ', UNIQUE (' . $unique . ')';
|
$sql_query .= ', UNIQUE (' . $unique . ')';
|
||||||
$query_cpy .= ',' . "\n" . ' UNIQUE (' . $unique . ')';
|
$query_cpy .= ',' . "\n" . ' UNIQUE (' . $unique . ')';
|
||||||
}
|
}
|
||||||
@@ -129,13 +129,13 @@ if (isset($submit_num_fields)) {
|
|||||||
$fulltext_cnt = (isset($field_fulltext) ? count($field_fulltext) : 0);
|
$fulltext_cnt = (isset($field_fulltext) ? count($field_fulltext) : 0);
|
||||||
for ($i = 0; $i < $fulltext_cnt; $i++) {
|
for ($i = 0; $i < $fulltext_cnt; $i++) {
|
||||||
$j = $field_fulltext[$i];
|
$j = $field_fulltext[$i];
|
||||||
if (!empty($field_name[$j])) {
|
if (isset($field_name[$j]) && strlen($field_name[$j])) {
|
||||||
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
|
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
|
|
||||||
$fulltext = preg_replace('@, $@', '', $fulltext);
|
$fulltext = preg_replace('@, $@', '', $fulltext);
|
||||||
if (!empty($fulltext)) {
|
if (strlen($fulltext)) {
|
||||||
$sql_query .= ', FULLTEXT (' . $fulltext . ')';
|
$sql_query .= ', FULLTEXT (' . $fulltext . ')';
|
||||||
$query_cpy .= ',' . "\n" . ' FULLTEXT (' . $fulltext . ')';
|
$query_cpy .= ',' . "\n" . ' FULLTEXT (' . $fulltext . ')';
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ if (isset($submit_num_fields)) {
|
|||||||
// garvin: Update comment table, if a comment was set.
|
// garvin: Update comment table, if a comment was set.
|
||||||
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) {
|
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) {
|
||||||
foreach ($field_comments AS $fieldindex => $fieldcomment) {
|
foreach ($field_comments AS $fieldindex => $fieldcomment) {
|
||||||
if (!empty($field_name[$fieldindex])) {
|
if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) {
|
||||||
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb');
|
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ if (isset($submit_num_fields)) {
|
|||||||
// garvin: Update comment table for mime types [MIME]
|
// garvin: Update comment table for mime types [MIME]
|
||||||
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
|
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
|
||||||
foreach ($field_mimetype AS $fieldindex => $mimetype) {
|
foreach ($field_mimetype AS $fieldindex => $mimetype) {
|
||||||
if (!empty($field_name[$fieldindex])) {
|
if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) {
|
||||||
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
|
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,11 +218,11 @@ if ($abort == FALSE) {
|
|||||||
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
|
PMA_mysqlDie($strTableEmpty, '', '', $err_url);
|
||||||
}
|
}
|
||||||
// No valid number of fields
|
// No valid number of fields
|
||||||
else if (empty($num_fields) || !is_int($num_fields)) {
|
elseif (empty($num_fields) || !is_int($num_fields)) {
|
||||||
PMA_mysqlDie($strFieldsEmpty, '', '', $err_url);
|
PMA_mysqlDie($strFieldsEmpty, '', '', $err_url);
|
||||||
}
|
}
|
||||||
// Does table exist?
|
// Does table exist?
|
||||||
else if (!(PMA_DBI_get_fields($db, $table) === FALSE)) {
|
elseif (!(PMA_DBI_get_fields($db, $table) === FALSE)) {
|
||||||
PMA_mysqlDie(sprintf($strTableAlreadyExists, htmlspecialchars($table)), '', '', $err_url);
|
PMA_mysqlDie(sprintf($strTableAlreadyExists, htmlspecialchars($table)), '', '', $err_url);
|
||||||
}
|
}
|
||||||
// Table name and number of fields are valid -> show the form
|
// Table name and number of fields are valid -> show the form
|
||||||
|
@@ -21,10 +21,10 @@ $index_types_cnt = count($index_types);
|
|||||||
*/
|
*/
|
||||||
if (!defined('PMA_IDX_INCLUDED')) {
|
if (!defined('PMA_IDX_INCLUDED')) {
|
||||||
// Not a valid db name -> back to the welcome page
|
// Not a valid db name -> back to the welcome page
|
||||||
if ( !empty($db) ) {
|
if ( isset($db) && strlen($db) ) {
|
||||||
$is_db = PMA_DBI_select_db($db);
|
$is_db = PMA_DBI_select_db($db);
|
||||||
}
|
}
|
||||||
if ( empty($db) || !$is_db ) {
|
if ( !isset($db) || !strlen($db) || !$is_db ) {
|
||||||
$uri_params = array( 'reload' => '1' );
|
$uri_params = array( 'reload' => '1' );
|
||||||
if ( isset($message) ) {
|
if ( isset($message) ) {
|
||||||
$uri_params['message'] = $message;
|
$uri_params['message'] = $message;
|
||||||
@@ -34,11 +34,11 @@ if (!defined('PMA_IDX_INCLUDED')) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// Not a valid table name -> back to the default db_details sub-page
|
// Not a valid table name -> back to the default db_details sub-page
|
||||||
if ( !empty($table) ) {
|
if ( isset($table) && strlen($table) ) {
|
||||||
$is_table = PMA_DBI_query('SHOW TABLES LIKE \''
|
$is_table = PMA_DBI_query('SHOW TABLES LIKE \''
|
||||||
. PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE);
|
. PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE);
|
||||||
}
|
}
|
||||||
if ( empty($table)
|
if ( ! isset($table) || ! strlen($table)
|
||||||
|| !( $is_table && PMA_DBI_num_rows($is_table) ) ) {
|
|| !( $is_table && PMA_DBI_num_rows($is_table) ) ) {
|
||||||
$uri_params = array( 'reload' => '1', 'db' => $db );
|
$uri_params = array( 'reload' => '1', 'db' => $db );
|
||||||
if ( isset($message) ) {
|
if ( isset($message) ) {
|
||||||
|
@@ -70,7 +70,7 @@ if (isset($after_insert) && $after_insert == 'new_insert') {
|
|||||||
$goto .= '&primary_key[]=' . urlencode(PMA_getUvaCondition($res, count($row), $meta, $row));
|
$goto .= '&primary_key[]=' . urlencode(PMA_getUvaCondition($res, count($row), $meta, $row));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($goto == 'sql.php') {
|
} elseif ($goto == 'sql.php') {
|
||||||
$goto = 'sql.php?'
|
$goto = 'sql.php?'
|
||||||
. PMA_generate_common_url($db, $table, '&')
|
. PMA_generate_common_url($db, $table, '&')
|
||||||
. '&pos=' . $pos
|
. '&pos=' . $pos
|
||||||
@@ -79,11 +79,11 @@ if (isset($after_insert) && $after_insert == 'new_insert') {
|
|||||||
. '&repeat_cells=' . $repeat_cells
|
. '&repeat_cells=' . $repeat_cells
|
||||||
. '&dontlimitchars=' . $dontlimitchars
|
. '&dontlimitchars=' . $dontlimitchars
|
||||||
. '&sql_query=' . urlencode($sql_query);
|
. '&sql_query=' . urlencode($sql_query);
|
||||||
} else if (!empty($goto)) {
|
} elseif (!empty($goto)) {
|
||||||
// Security checkings
|
// Security checkings
|
||||||
$is_gotofile = preg_replace('@^([^?]+).*$@', '\\1', $goto);
|
$is_gotofile = preg_replace('@^([^?]+).*$@', '\\1', $goto);
|
||||||
if (!@file_exists('./' . $is_gotofile)) {
|
if (!@file_exists('./' . $is_gotofile)) {
|
||||||
$goto = (empty($table)) ? 'db_details.php' : 'tbl_properties.php';
|
$goto = (! isset($table) || ! strlen($table)) ? 'db_details.php' : 'tbl_properties.php';
|
||||||
$is_gotofile = TRUE;
|
$is_gotofile = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$is_gotofile = ($is_gotofile == $goto);
|
$is_gotofile = ($is_gotofile == $goto);
|
||||||
@@ -261,7 +261,7 @@ if ($total_affected_rows != 0) {
|
|||||||
$message .= $last_message;
|
$message .= $last_message;
|
||||||
|
|
||||||
if ($is_gotofile) {
|
if ($is_gotofile) {
|
||||||
if ($goto == 'db_details.php' && !empty($table)) {
|
if ($goto == 'db_details.php' && isset($table)) {
|
||||||
unset($table);
|
unset($table);
|
||||||
}
|
}
|
||||||
$js_to_run = 'functions.js';
|
$js_to_run = 'functions.js';
|
||||||
|
Reference in New Issue
Block a user