diff --git a/ChangeLog b/ChangeLog index 90559dcb7..01986e603 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-11-23 Loïc Chapeaux + * light changes (function and constant names) in most of the scripts: + they're now about to fully fit the PEAR codding standards. + 2001-11-22 Loïc Chapeaux * header.inc.php3, lines 142-148: merged patch #479083 - display name of server after db/table thanks to diff --git a/db_create.php3 b/db_create.php3 index 5da92d55f..65da06495 100755 --- a/db_create.php3 +++ b/db_create.php3 @@ -24,16 +24,16 @@ $err_url = 'main.php3' if (get_magic_quotes_gpc()) { $db = stripslashes($db); } -if (MYSQL_INT_VERSION < 32306) { - check_reserved_words($db, $err_url); +if (PMA_MYSQL_INT_VERSION < 32306) { + PMA_checkReservedWords($db, $err_url); } /** * Executes the db creation sql query */ -$local_query = 'CREATE DATABASE ' . backquote($db); -$result = mysql_query('CREATE DATABASE ' . backquote($db)) or mysql_die('', $local_query, FALSE, $err_url); +$local_query = 'CREATE DATABASE ' . PMA_backquote($db); +$result = mysql_query('CREATE DATABASE ' . PMA_backquote($db)) or PMA_mysqlDie('', $local_query, FALSE, $err_url); /** diff --git a/db_details.php3 b/db_details.php3 index faa30b6f8..a7fe8f7ed 100755 --- a/db_details.php3 +++ b/db_details.php3 @@ -54,7 +54,7 @@ window.parent.frames['nav'].location.replace('./left.php3?lang== 32303) { +if (PMA_MYSQL_INT_VERSION >= 32303) { // Special speedup for newer MySQL Versions (in 4.0 format changed) - if ($cfgSkipLockedTables == TRUE && MYSQL_INT_VERSION >= 32330) { - $local_query = 'SHOW OPEN TABLES FROM ' . backquote($db); - $result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0); + if ($cfgSkipLockedTables == TRUE && PMA_MYSQL_INT_VERSION >= 32330) { + $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db); + $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); // Blending out tables in use if ($result != FALSE && mysql_num_rows($result) > 0) { while ($tmp = mysql_fetch_row($result)) { @@ -89,13 +89,13 @@ if (MYSQL_INT_VERSION >= 32303) { mysql_free_result($result); if (isset($sot_cache)) { - $local_query = 'SHOW TABLES FROM ' . backquote($db); - $result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0); + $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db); + $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); if ($result != FALSE && mysql_num_rows($result) > 0) { while ($tmp = mysql_fetch_row($result)) { if (!isset($sot_cache[$tmp[0]])) { - $local_query = 'SHOW TABLE STATUS FROM ' . backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\''; - $sts_result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0); + $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\''; + $sts_result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $sts_tmp = mysql_fetch_array($sts_result); $tables[] = $sts_tmp; } else { // table in use @@ -109,8 +109,8 @@ if (MYSQL_INT_VERSION >= 32303) { } } if (!isset($sot_ready)) { - $local_query = 'SHOW TABLE STATUS FROM ' . backquote($db); - $result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0); + $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db); + $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); if ($result != FALSE && mysql_num_rows($result) > 0) { while ($sts_tmp = mysql_fetch_array($result)) { $tables[] = $sts_tmp; @@ -119,7 +119,7 @@ if (MYSQL_INT_VERSION >= 32303) { } } $num_tables = (isset($tables) ? count($tables) : 0); -} // end if (MYSQL_INT_VERSION >= 32303) +} // end if (PMA_MYSQL_INT_VERSION >= 32303) else { $result = mysql_list_tables($db); $num_tables = @mysql_numrows($result); @@ -145,7 +145,7 @@ if ($num_tables == 0) { } // 2. Shows table informations on mysql >= 3.23 - staybyte - 11 June 2001 -else if (MYSQL_INT_VERSION >= 32300) { +else if (PMA_MYSQL_INT_VERSION >= 32300) { ?>
@@ -187,7 +187,7 @@ else if (MYSQL_INT_VERSION >= 32300) {     - + @@ -203,13 +203,13 @@ else if (MYSQL_INT_VERSION >= 32300) { - + - + = 32300) { $tblsize = $sts_data['Data_length'] + $sts_data['Index_length']; $sum_size += $tblsize; if ($tblsize > 0) { - list($formated_size, $unit) = format_byte_down($tblsize, 3, 1); + list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1); } else { - list($formated_size, $unit) = format_byte_down($tblsize, 3, 0); + list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 0); } } else if ($cfgShowStats) { $formated_size = ' - '; @@ -288,7 +288,7 @@ else if (MYSQL_INT_VERSION >= 32300) { } // Show Summary if ($cfgShowStats) { - list($sum_formated, $unit) = format_byte_down($sum_size, 3, 1); + list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1); } echo "\n"; ?> @@ -371,7 +371,7 @@ else {    - + @@ -383,13 +383,13 @@ else { - + - + - +
- 0) { -  :
+  :

 
= 40000 && function_exists('ini_get')) +$is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get')) ? ((strtolower(ini_get('file_uploads')) == 'on' || ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize'))) : (intval(@get_cfg_var('upload_max_filesize'))); if ($is_upload) { @@ -684,7 +684,7 @@ echo "\n"; // Bookmark Support if ($cfgBookmark['db'] && $cfgBookmark['table']) { - if (($bookmark_list = list_bookmarks($db, $cfgBookmark)) && count($bookmark_list) > 0) { + if (($bookmark_list = PMA_listBookmarks($db, $cfgBookmark)) && count($bookmark_list) > 0) { echo " $strOr $strBookmarkQuery :
\n"; echo '
' . "\n"; echo '   
        - " />   + " />   @@ -802,7 +802,7 @@ echo "\n";
= 32306) { +if (PMA_MYSQL_INT_VERSION >= 32306) { ?>
@@ -815,7 +815,7 @@ echo "\n"; = 40004) { +if (PMA_PHP_INT_VERSION >= 40004) { $is_zip = (isset($cfgZipDump) && $cfgZipDump && @function_exists('gzcompress')); $is_gzip = (isset($cfgGZipDump) && $cfgGZipDump && @function_exists('gzencode')); $is_bzip = (isset($cfgBZipDump) && $cfgBZipDump && @function_exists('bzcompress')); @@ -850,7 +850,7 @@ echo "\n";     --   - + @@ -905,7 +905,7 @@ echo "\n"; ' . htmlspecialchars($dblist[$i]) . ''; @@ -979,7 +979,7 @@ for ($i = 0; $i < $num_dbs; $i++) { = 32322) { +if (PMA_MYSQL_INT_VERSION >= 32322) { if ($tbl_type == 'MYISAM' or $tbl_type == 'BDB') { ?> @@ -993,9 +993,9 @@ if (MYSQL_INT_VERSION >= 32322) { if ($tbl_type == 'MYISAM') { ?> - +   - +  -  = 32322) { if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') { ?> - +   - + = 32322) { if ($tbl_type == 'MYISAM') { ?> - +   - +  -  = 32322) { if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') { ?> - +   - + = 32322) {     - +
 :  - +   - +
  • - +

  • - +
  • diff --git a/tbl_qbe.php3 b/tbl_qbe.php3 index e0b0a9116..7bca836a8 100755 --- a/tbl_qbe.php3 +++ b/tbl_qbe.php3 @@ -129,10 +129,10 @@ while ($i < $tbl_result_cnt) { // The fields list per selected tables if ($tbl_names[$tbl] == ' selected="selected"') { - $fld[$k++] = backquote($tbl) . '.*'; + $fld[$k++] = PMA_backquote($tbl) . '.*'; while ($j < $fld_results_cnt) { $fld[$k] = mysql_field_name($fld_results, $j); - $fld[$k] = backquote($tbl) . '.' . backquote($fld[$k]); + $fld[$k] = PMA_backquote($tbl) . '.' . PMA_backquote($fld[$k]); $k++; $j++; } // end while @@ -505,9 +505,9 @@ for ($y = 0; $y <= $row; $y++) { } else { $stripped_or = ${$or}[$x]; } - } else { - $stripped_or = ''; - } + } else { + $stripped_or = ''; + } ?> @@ -699,7 +699,7 @@ for ($x = 0; $x < sizeof($TableList); $x++) { if ($x) { $qry_from .= ', '; } - $qry_from .= backquote(urldecode($TableList[$x])); + $qry_from .= PMA_backquote(urldecode($TableList[$x])); } // end for if (!empty($qry_from)) { $encoded_qry .= urlencode('FROM ' . $qry_from . "\n"); diff --git a/tbl_rename.php3 b/tbl_rename.php3 index d22366d68..821735451 100755 --- a/tbl_rename.php3 +++ b/tbl_rename.php3 @@ -31,17 +31,17 @@ if (isset($new_name) && trim($new_name) != '') { } // Ensure the target is valid - if (count($dblist) > 0 && pmaIsInto($db, $dblist) == -1) { + if (count($dblist) > 0 && PMA_isInto($db, $dblist) == -1) { exit(); } - if (MYSQL_INT_VERSION < 32306) { - check_reserved_words($new_name, $err_url); + if (PMA_MYSQL_INT_VERSION < 32306) { + PMA_checkReservedWords($new_name, $err_url); } include('./header.inc.php3'); mysql_select_db($db); - $sql_query = 'ALTER TABLE ' . backquote($old_name) . ' RENAME ' . backquote($new_name); - $result = mysql_query($sql_query) or mysql_die('', '', '', $err_url); + $sql_query = 'ALTER TABLE ' . PMA_backquote($old_name) . ' RENAME ' . PMA_backquote($new_name); + $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $message = sprintf($strRenameTableOK, $old_name, $table); $reload = 1; } @@ -52,7 +52,7 @@ if (isset($new_name) && trim($new_name) != '') { */ else { include('./header.inc.php3'); - mysql_die($strTableEmpty, '', '', $err_url); + PMA_mysqlDie($strTableEmpty, '', '', $err_url); } diff --git a/tbl_replace.php3 b/tbl_replace.php3 index 050ef56f8..71e13c0f4 100755 --- a/tbl_replace.php3 +++ b/tbl_replace.php3 @@ -74,7 +74,7 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { if ($val == 'null') { // void } else { - $val = "'" . sql_addslashes(urldecode($val)) . "'"; + $val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'"; } } else { $val = "''"; @@ -85,7 +85,7 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { $f = 'field_' . md5($key); if (!empty($$f)) { $val = implode(',', $$f); - $val = "'" . sql_addslashes(urldecode($val)) . "'"; + $val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'"; } else { $val = "''"; } @@ -94,7 +94,7 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { if (get_magic_quotes_gpc()) { $val = "'" . str_replace('\\"', '"', $val) . "'"; } else { - $val = "'" . sql_addslashes($val) . "'"; + $val = "'" . PMA_sqlAddslashes($val) . "'"; } break; } // end switch @@ -102,17 +102,17 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { // No change for this column and no MySQL function is used -> next column if (empty($funcs[$encoded_key]) && isset($fields_prev) && isset($fields_prev[$encoded_key]) - && ("'" . sql_addslashes(urldecode($fields_prev[$encoded_key])) . "'" == $val)) { + && ("'" . PMA_sqlAddslashes(urldecode($fields_prev[$encoded_key])) . "'" == $val)) { continue; } else if (!empty($val)) { if (empty($funcs[$encoded_key])) { - $valuelist .= backquote($key) . ' = ' . $val . ', '; + $valuelist .= PMA_backquote($key) . ' = ' . $val . ', '; } else if ($val == '\'\'' && (ereg('^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$', $funcs[$encoded_key]))) { - $valuelist .= backquote($key) . ' = ' . $funcs[$encoded_key] . '(), '; + $valuelist .= PMA_backquote($key) . ' = ' . $funcs[$encoded_key] . '(), '; } else { - $valuelist .= backquote($key) . ' = ' . $funcs[$encoded_key] . "($val), "; + $valuelist .= PMA_backquote($key) . ' = ' . $funcs[$encoded_key] . "($val), "; } } } // end while @@ -120,8 +120,8 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { // Builds the sql upate query $valuelist = ereg_replace(', $', '', $valuelist); if (!empty($valuelist)) { - $query = 'UPDATE ' . backquote($table) . ' SET ' . $valuelist . ' WHERE' . $primary_key - . ((MYSQL_INT_VERSION >= 32300) ? ' LIMIT 1' : ''); + $query = 'UPDATE ' . PMA_backquote($table) . ' SET ' . $valuelist . ' WHERE' . $primary_key + . ((PMA_MYSQL_INT_VERSION >= 32300) ? ' LIMIT 1' : ''); $message = $strAffectedRows . ' '; } // No change -> move back to the calling script @@ -148,7 +148,7 @@ else { while (list($key, $val) = each($fields)) { $encoded_key = $key; $key = urldecode($key); - $fieldlist .= backquote($key) . ', '; + $fieldlist .= PMA_backquote($key) . ', '; switch (strtolower($val)) { case 'null': @@ -161,7 +161,7 @@ else { if ($val == 'null') { // void } else { - $val = "'" . sql_addslashes(urldecode($val)) . "'"; + $val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'"; } } else { $val = "''"; @@ -172,7 +172,7 @@ else { $f = 'field_' . md5($key); if (!empty($$f)) { $val = implode(',', $$f); - $val = "'" . sql_addslashes(urldecode($val)) . "'"; + $val = "'" . PMA_sqlAddslashes(urldecode($val)) . "'"; } else { $val = "''"; } @@ -181,7 +181,7 @@ else { if (get_magic_quotes_gpc()) { $val = "'" . str_replace('\\"', '"', $val) . "'"; } else { - $val = "'" . sql_addslashes($val) . "'"; + $val = "'" . PMA_sqlAddslashes($val) . "'"; } break; } // end switch @@ -199,7 +199,7 @@ else { // Builds the sql insert query $fieldlist = ereg_replace(', $', '', $fieldlist); $valuelist = ereg_replace(', $', '', $valuelist); - $query = 'INSERT INTO ' . backquote($table) . ' (' . $fieldlist . ') VALUES (' . $valuelist . ')'; + $query = 'INSERT INTO ' . PMA_backquote($table) . ' (' . $fieldlist . ') VALUES (' . $valuelist . ')'; $message = $strInsertedRows . ' '; } // end row insertion @@ -215,7 +215,7 @@ $result = mysql_query($query); if (!$result) { $error = mysql_error(); include('./header.inc.php3'); - mysql_die($error, '', '', $url_err); + PMA_mysqlDie($error, '', '', $url_err); } else { if (@mysql_affected_rows()) { $message .= @mysql_affected_rows(); diff --git a/tbl_select.php3 b/tbl_select.php3 index 9999b260f..067e9aff6 100755 --- a/tbl_select.php3 +++ b/tbl_select.php3 @@ -26,7 +26,7 @@ if (!isset($param) || $param[0] == '') { include('./header.inc.php3'); $result = @mysql_list_fields($db, $table); if (!$result) { - mysql_die('', 'mysql_list_fields(' . $db . ', ' . $table . ')', '', $err_url); + PMA_mysqlDie('', 'mysql_list_fields(' . $db . ', ' . $table . ')', '', $err_url); } else { // Gets the list and number of fields @@ -65,7 +65,7 @@ if (!isset($param) || $param[0] == '') {

  •   - +

    ' . $strOr . ' ' . $strDoAQuery; ?>
    @@ -130,16 +130,16 @@ if (!isset($param) || $param[0] == '') { */ else { // Builds the query - $sql_query = 'SELECT ' . backquote(urldecode($param[0])); + $sql_query = 'SELECT ' . PMA_backquote(urldecode($param[0])); $i = 0; $c = count($param); while ($i < $c) { if ($i > 0) { - $sql_query .= ',' . backquote(urldecode($param[$i])); + $sql_query .= ',' . PMA_backquote(urldecode($param[$i])); } $i++; } - $sql_query .= ' FROM ' . backquote($table); + $sql_query .= ' FROM ' . PMA_backquote($table); // The where clause if ($where != '') { $sql_query .= ' WHERE ' . ((get_magic_quotes_gpc()) ? stripslashes($where) : $where); @@ -158,7 +158,7 @@ else { if (get_magic_quotes_gpc()) { $fields[$i] = stripslashes($fields[$i]); } - $fields[$i] = sql_addslashes($fields[$i], TRUE); + $fields[$i] = PMA_sqlAddslashes($fields[$i], TRUE); } else if ($types[$i] == 'date' || $types[$i] == 'time') { $quot = '\''; @@ -176,12 +176,12 @@ else { $quot = ''; $cmp = '='; } // end if - $sql_query .= ' AND ' . backquote(urldecode($names[$i])) . " $cmp $quot$fields[$i]$quot"; + $sql_query .= ' AND ' . PMA_backquote(urldecode($names[$i])) . " $cmp $quot$fields[$i]$quot"; } // end if } // end for } // end if if ($orderField != '--nil--') { - $sql_query .= ' ORDER BY ' . backquote(urldecode($orderField)) . ' ' . $order; + $sql_query .= ' ORDER BY ' . PMA_backquote(urldecode($orderField)) . ' ' . $order; } // end if $url_query = 'lang=' . $lang diff --git a/user_details.php3 b/user_details.php3 index 76bbd6708..acba67a1a 100644 --- a/user_details.php3 +++ b/user_details.php3 @@ -32,13 +32,13 @@ $err_url = 'user_details.php3' * @global integer the server to use (refers to the number in the * configuration file) * - * @see checkDb() + * @see PMA_checkDb() * * @TODO "SHOW GRANTS" statements is available and buggyless since * MySQL 3.23.4 and it seems not to return privileges of the anonymous * user while these privileges applies to all users. */ -function tableGrants(&$host_db_result, $dbcheck = FALSE) { +function PMA_tableGrants(&$host_db_result, $dbcheck = FALSE) { global $lang, $server; ?> @@ -112,13 +112,13 @@ function tableGrants(&$host_db_result, $dbcheck = FALSE) { $bgcolor = ($i % 2) ? $GLOBALS['cfgBgcolorOne'] : $GLOBALS['cfgBgcolorTwo']; $revoke_url = 'sql.php3' . '?' . $url_query - . '&sql_query=' . urlencode('REVOKE ' . $priv . ' ON ' . backquote($db) . '.' . backquote($table) . ' FROM \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'') + . '&sql_query=' . urlencode('REVOKE ' . $priv . ' ON ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' FROM \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'') . '&zero_rows=' . urlencode(sprintf($GLOBALS['strRevokeMessage'], ' ' . $row['User'] . '@' . $row['Host'] . '')) . '&goto=user_details.php3'; if ($grantopt) { $revoke_grant_url = 'sql.php3' . '?' . $url_query - . '&sql_query=' . urlencode('REVOKE GRANT OPTION ON ' . backquote($db) . '.' . backquote($table) . ' FROM \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'') + . '&sql_query=' . urlencode('REVOKE GRANT OPTION ON ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' FROM \'' . $row['User'] . '\'@\'' . $row['Host'] . '\'') . '&zero_rows=' . urlencode(sprintf($GLOBALS['strRevokeGrantMessage'], ' ' . $row['User'] . '@' . $row['Host'] . '')) . '&goto=user_details.php3'; } @@ -200,7 +200,7 @@ function tableGrants(&$host_db_result, $dbcheck = FALSE) { echo "\n"; return TRUE; -} // end of the 'tableGrants()' function +} // end of the 'PMA_tableGrants()' function /** @@ -210,9 +210,9 @@ function tableGrants(&$host_db_result, $dbcheck = FALSE) { * * @return boolean true/false in case of success/failure * - * @see tableGrants() + * @see PMA_tableGrants() */ -function checkDb($dbcheck) +function PMA_checkDb($dbcheck) { $local_query = 'SELECT Host, User FROM mysql.user ORDER BY Host, User'; $result = mysql_query($local_query); @@ -221,10 +221,10 @@ function checkDb($dbcheck) if (!$host_usr_cnt) { return FALSE; } - tableGrants($result, $dbcheck); + PMA_tableGrants($result, $dbcheck); return TRUE; -} // end of the 'checkDb()' function +} // end of the 'PMA_checkDb()' function /** @@ -235,9 +235,9 @@ function checkDb($dbcheck) * * @return boolean always true * - * @see normalOperations() + * @see PMA_normalOperations() */ -function tablePrivileges($form, $row = FALSE) +function PMA_tablePrivileges($form, $row = FALSE) { ?> @@ -286,7 +286,7 @@ function tablePrivileges($form, $row = FALSE) echo "\n"; return TRUE; -} // end of the 'tablePrivileges()' function +} // end of the 'PMA_tablePrivileges()' function /** @@ -298,9 +298,9 @@ function tablePrivileges($form, $row = FALSE) * @global integer the server to use (refers to the number in the * configuration file) * - * @see tablePrivileges() + * @see PMA_tablePrivileges() */ -function normalOperations() +function PMA_normalOperations() { global $lang, $server; ?> @@ -311,7 +311,7 @@ function normalOperations()
      - +
    @@ -403,7 +403,7 @@ function normalOperations()
    @@ -415,7 +415,7 @@ function normalOperations() ' . "\n"; // } if (isset($dbgrant)) { - $result = mysql_query('SHOW TABLES FROM ' . backquote($dbgrant)); + $result = mysql_query('SHOW TABLES FROM ' . PMA_backquote($dbgrant)); if (@mysql_num_rows($result)) { while ($row = mysql_fetch_row($result)) { $selected = ((isset($tablegrant) && $row[0] == $tablegrant) ? ' selected="selected"' : ''); @@ -551,7 +551,7 @@ function grantOperations($grants) echo ' ' . '' . "\n"; } else { - $result = mysql_query('SHOW COLUMNS FROM ' . backquote($dbgrant) . '.' . backquote($tablegrant)); + $result = mysql_query('SHOW COLUMNS FROM ' . PMA_backquote($dbgrant) . '.' . PMA_backquote($tablegrant)); if (@mysql_num_rows($result)) { echo ' ' . ' @@ -594,7 +594,7 @@ function grantOperations($grants) echo "\n"; return TRUE; -} // end of the 'grantOperations()' function +} // end of the 'PMA_grantOperations()' function /** @@ -611,14 +611,14 @@ function grantOperations($grants) * @global string the host name to check grants for * @global string the username to check grants for * - * @see tablePrivileges() + * @see PMA_tablePrivileges() */ -function editOperations($host, $user) +function PMA_editOperations($host, $user) { global $lang, $server; global $host, $pma_user; - $result = mysql_query('SELECT * FROM mysql.user WHERE User = \'' . sql_addslashes($user) . '\' AND Host = \'' . sql_addslashes($host) . '\''); + $result = mysql_query('SELECT * FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($user) . '\' AND Host = \'' . PMA_sqlAddslashes($host) . '\''); $rows = @mysql_num_rows($result); if (!$rows) { @@ -677,7 +677,7 @@ function editOperations($host, $user)   -        +        @@ -709,7 +709,7 @@ function editOperations($host, $user)
    @@ -725,7 +725,7 @@ function editOperations($host, $user) echo "\n"; return TRUE; -} // end of the 'editOperations()' function +} // end of the 'PMA_editOperations()' function /** @@ -740,7 +740,7 @@ function editOperations($host, $user) * @global integer the server to use (refers to the number in the * configuration file) */ -function tableUsers($host = FALSE, $user = FALSE) +function PMA_tableUsers($host = FALSE, $user = FALSE) { global $lang, $server; @@ -749,8 +749,8 @@ function tableUsers($host = FALSE, $user = FALSE) $local_query .= ' WHERE 1 '; } if ($host) { - $local_query .= ' AND Host = \'' . sql_addslashes($host) . '\''; - $local_query .= ' AND User = \'' . sql_addslashes($user) . '\''; + $local_query .= ' AND Host = \'' . PMA_sqlAddslashes($host) . '\''; + $local_query .= ' AND User = \'' . PMA_sqlAddslashes($user) . '\''; } $local_query .= ' ORDER BY Host, User'; $result = mysql_query($local_query); @@ -894,7 +894,7 @@ function tableUsers($host = FALSE, $user = FALSE) echo "\n"; return TRUE; -} // end of the 'tableUsers()' function +} // end of the 'PMA_tableUsers()' function /** @@ -907,7 +907,7 @@ function tableUsers($host = FALSE, $user = FALSE) * @global integer the server to use (refers to the number in the * configuration file) */ -function confirm($the_host, $the_user) { +function PMA_confirm($the_host, $the_user) { global $lang, $server; if (get_magic_quotes_gpc() == 1) { @@ -933,7 +933,7 @@ function confirm($the_host, $the_user) { echo "\n"; include('./footer.inc.php3'); -} // end of the 'confirm()' function +} // end of the 'PMA_confirm()' function @@ -943,7 +943,7 @@ function confirm($the_host, $the_user) { */ $result = @mysql_query('USE mysql'); if (mysql_error()) { - mysql_die($GLOBALS['strNoRights'], '', FALSE, ''); + PMA_mysqlDie($GLOBALS['strNoRights'], '', FALSE, ''); } $result = @mysql_query('SELECT COUNT(Password) FROM mysql.user'); $password_field = (mysql_result($result, 0) ? 'Password' : 'password'); @@ -980,7 +980,7 @@ if (!isset($submit_updProfile)) { } if (isset($message)) { $show_query = 'y'; - show_message($message); + PMA_showMessage($message); } if (isset($db_bkp)) { @@ -998,7 +998,7 @@ if (isset($table_bkp)) { */ // Confirms an action if (isset($confirm) && $confirm) { - confirm($delete_host, $delete_user); + PMA_confirm($delete_host, $delete_user); exit(); } @@ -1019,7 +1019,7 @@ else if (isset($delete) && $delete $delete_host = stripslashes($delete_host); $delete_user = stripslashes($delete_user); } - $common_where = ' WHERE Host = \'' . sql_addslashes($delete_host) . '\' AND User = \'' . sql_addslashes($delete_user) . '\''; + $common_where = ' WHERE Host = \'' . PMA_sqlAddslashes($delete_host) . '\' AND User = \'' . PMA_sqlAddslashes($delete_user) . '\''; // Delete Grants First! $sql_query = 'DELETE FROM mysql.db' . $common_where; @@ -1039,9 +1039,9 @@ else if (isset($delete) && $delete $sql_query = $sql_query_cpy; unset($sql_query_cpy); if ($result) { - show_message(sprintf($strDeleteUserMessage, '' . $delete_user . '@' . $delete_host . '') . '
    ' . $strRememberReload); + PMA_showMessage(sprintf($strDeleteUserMessage, '' . $delete_user . '@' . $delete_host . '') . '
    ' . $strRememberReload); } else { - show_message($strDeleteFailed); + PMA_showMessage($strDeleteFailed); } } @@ -1088,12 +1088,12 @@ else if (isset($submit_addUser)) { } $sql_query = 'INSERT INTO mysql.user ' - . 'SET Host = \'' . sql_addslashes($host) . '\', User = \'' . sql_addslashes($pma_user) . '\', ' . $password_field . ' = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . sql_addslashes($pma_pw) . '\')') + . 'SET Host = \'' . PMA_sqlAddslashes($host) . '\', User = \'' . PMA_sqlAddslashes($pma_user) . '\', ' . $password_field . ' = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . PMA_sqlAddslashes($pma_pw) . '\')') . ', ' . $sql_query; - $result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url); + $result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url); unset($host); unset($pma_user); - show_message($strAddUserMessage . '
    ' . $strRememberReload); + PMA_showMessage($strAddUserMessage . '
    ' . $strRememberReload); } // end else } @@ -1117,7 +1117,7 @@ else if (isset($submit_updProfile)) { $new_server = stripslashes($new_server); } if ($new_server != '' && $new_server != $host) { - $common_upd .= 'Host = \'' . sql_addslashes($new_server) . '\''; + $common_upd .= 'Host = \'' . PMA_sqlAddslashes($new_server) . '\''; } else if (isset($new_server)) { unset($new_server); } @@ -1129,7 +1129,7 @@ else if (isset($submit_updProfile)) { } if ($new_user != '' && $new_user != $pma_user) { $common_upd .= (empty($common_upd) ? '' : ', ') - . 'User = \'' . sql_addslashes($new_user) . '\''; + . 'User = \'' . PMA_sqlAddslashes($new_user) . '\''; } else if (isset($new_user)) { unset($new_user); } @@ -1152,17 +1152,17 @@ else if (isset($submit_updProfile)) { } else { $sql_query = (empty($common_upd) ? '' : $common_upd . ', ') - . $password_field . ' = ' . (($new_pw == '') ? '\'\'' : 'PASSWORD(\'' . sql_addslashes($new_pw) . '\')'); + . $password_field . ' = ' . (($new_pw == '') ? '\'\'' : 'PASSWORD(\'' . PMA_sqlAddslashes($new_pw) . '\')'); } if (!empty($sql_query)) { - $common_where = ' WHERE Host = \'' . sql_addslashes($host) . '\' AND User = \'' . sql_addslashes($pma_user) . '\''; + $common_where = ' WHERE Host = \'' . PMA_sqlAddslashes($host) . '\' AND User = \'' . PMA_sqlAddslashes($pma_user) . '\''; $sql_query_cpy = ''; // Updates profile $sql_query = 'UPDATE user SET ' . $sql_query . $common_where; $sql_query_cpy = $sql_query; - $result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&edit=1'); + $result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&edit=1'); // Updates grants if (isset($new_server) || isset($new_user)) { @@ -1189,12 +1189,12 @@ else if (isset($submit_updProfile)) { echo '

    ' . "\n"; echo ' ' . $strHost . ' ' . $host . ' - ' . $strUser . ' ' . (($pma_user != '') ? $pma_user : $strAny) . "\n"; echo '

    ' . "\n"; - show_message($strUpdateProfileMessage . '
    ' . $strRememberReload); + PMA_showMessage($strUpdateProfileMessage . '
    ' . $strRememberReload); } else { echo '

    ' . "\n"; echo ' ' . $strHost . ' ' . $host . ' - ' . $strUser . ' ' . (($pma_user != '') ? $pma_user : $strAny) . "\n"; echo '

    ' . "\n"; - show_message($strNoModification); + PMA_showMessage($strNoModification); } } @@ -1224,9 +1224,9 @@ else if (isset($submit_chgPriv)) { $sql_query = 'UPDATE user SET ' . $sql_query - . ' WHERE Host = \'' . sql_addslashes($host) . '\' AND User = \'' . sql_addslashes($pma_user) . '\''; - $result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&edit=1'); - show_message(sprintf($strUpdatePrivMessage, '' . $pma_user . '@' . $host . '') . '
    ' . $strRememberReload); + . ' WHERE Host = \'' . PMA_sqlAddslashes($host) . '\' AND User = \'' . PMA_sqlAddslashes($pma_user) . '\''; + $result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&edit=1'); + PMA_showMessage(sprintf($strUpdatePrivMessage, '' . $pma_user . '@' . $host . '') . '
    ' . $strRememberReload); } // Revoke/Grant privileges @@ -1249,7 +1249,7 @@ else if (isset($grants) && $grants) { if (get_magic_quotes_gpc()) { $colgrant[$i] = stripslashes($colgrant[$i]); } - $col_list .= (empty($col_list) ? backquote($colgrant[$i]) : ', ' . backquote($colgrant[$i])); + $col_list .= (empty($col_list) ? PMA_backquote($colgrant[$i]) : ', ' . PMA_backquote($colgrant[$i])); } // end for unset($colgrant); $col_list = ' (' . $col_list . ')'; @@ -1279,15 +1279,15 @@ else if (isset($grants) && $grants) { } } // end if $sql_query .= ' ON ' - . (($anydb || $dbgrant == '') ? '*' : backquote($dbgrant)) + . (($anydb || $dbgrant == '') ? '*' : PMA_backquote($dbgrant)) . '.' - . (($anytable || $tablegrant == '') ? '*' : backquote($tablegrant)); + . (($anytable || $tablegrant == '') ? '*' : PMA_backquote($tablegrant)); - $sql_query .= ' TO ' . '\'' . sql_addslashes($pma_user) . '\'' . '@' . '\'' . sql_addslashes($host) . '\''; + $sql_query .= ' TO ' . '\'' . PMA_sqlAddslashes($pma_user) . '\'' . '@' . '\'' . PMA_sqlAddslashes($host) . '\''; $sql_query = 'GRANT ' . $sql_query . $priv_grant; - $result = @mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&grants=1'); - show_message($strAddPrivMessage . '.
    ' . $strRememberReload); + $result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&grants=1'); + PMA_showMessage($strAddPrivMessage . '.
    ' . $strRememberReload); } // end if } @@ -1298,8 +1298,8 @@ else if (isset($grants) && $grants) { */ // Edit an user properies if (isset($edit) && $edit) { - tableUsers($host, $pma_user); - editOperations($host, $pma_user); + PMA_tableUsers($host, $pma_user); + PMA_editOperations($host, $pma_user); } // Revoke/Grant privileges for an user @@ -1307,7 +1307,7 @@ else if (isset($grants) && $grants) { // Displays the full list of privileges for this host & user $infos['Host'] = $host; $infos['User'] = $pma_user; - tableGrants($infos); + PMA_tableGrants($infos); // Displays the list of privileges for user on the selected db/table/column $user_priv = array(); @@ -1317,7 +1317,7 @@ else if (isset($grants) && $grants) { $list_priv_new = array(); // Gets globals privileges - $result = mysql_query('SELECT * FROM mysql.user WHERE (Host = \'' . sql_addslashes($host) . '\' OR Host = \'%\') AND (User = \'' . sql_addslashes($pma_user) . '\' OR User = \'\')'); + $result = mysql_query('SELECT * FROM mysql.user WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\')'); $row = @mysql_fetch_array($result); if ($row) { while (list(,$priv) = each($list_priv)) { @@ -1340,7 +1340,7 @@ else if (isset($grants) && $grants) { if (get_magic_quotes_gpc()) { $dbgrant = stripslashes($dbgrant); } - $result = mysql_query('SELECT * FROM mysql.db WHERE (Host = \'' . sql_addslashes($host) . '\' OR Host = \'%\') AND (User = \'' . sql_addslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . sql_addslashes($dbgrant) . '\''); + $result = mysql_query('SELECT * FROM mysql.db WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . PMA_sqlAddslashes($dbgrant) . '\''); $row = @mysql_fetch_array($result); if ($row) { while (list(,$priv) = each($list_priv)) { @@ -1363,7 +1363,7 @@ else if (isset($grants) && $grants) { if (get_magic_quotes_gpc()) { $tablegrant = stripslashes($tablegrant); } - $result = mysql_query('SELECT * FROM mysql.tables_priv WHERE (Host = \'' . sql_addslashes($host) . '\' OR Host = \'%\') AND (User = \'' . sql_addslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . sql_addslashes($dbgrant) . '\' AND Table_name = \'' . sql_addslashes($tablegrant) . '\''); + $result = mysql_query('SELECT * FROM mysql.tables_priv WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . PMA_sqlAddslashes($dbgrant) . '\' AND Table_name = \'' . PMA_sqlAddslashes($tablegrant) . '\''); $row = @mysql_fetch_array($result); if ($row && $row['Table_priv']) { while (list(,$priv) = each($list_priv)) { @@ -1383,12 +1383,12 @@ else if (isset($grants) && $grants) { // TODO: column privileges - grantOperations($user_priv); + PMA_grantOperations($user_priv); } // Check database privileges else if (isset($check) && $check) { - checkDb($db); + PMA_checkDb($db); ?>
    • @@ -1408,8 +1408,8 @@ else { if (!isset($pma_user)) { $pma_user = FALSE; } - tableUsers($host, $pma_user) or mysql_die($strNoUsersFound, '', FALSE, ''); - normalOperations(); + PMA_tableUsers($host, $pma_user) or PMA_mysqlDie($strNoUsersFound, '', FALSE, ''); + PMA_normalOperations(); }