From 585f991656019cf2e028ba34556f4372e94f7eda Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Tue, 16 Oct 2007 09:30:13 +0000 Subject: [PATCH] make use of PMA_Message --- libraries/Table.class.php | 2 +- libraries/db_common.inc.php | 2 +- libraries/import.lib.php | 12 +++++++----- libraries/sql_query_form.lib.php | 7 +++---- libraries/sqlparser.lib.php | 3 +-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libraries/Table.class.php b/libraries/Table.class.php index b713373fe..e1da36eaf 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -6,7 +6,7 @@ */ /** - * + * @todo make use of PMA_Message and PMA_Error */ class PMA_Table { diff --git a/libraries/db_common.inc.php b/libraries/db_common.inc.php index 418a799cd..af1307029 100644 --- a/libraries/db_common.inc.php +++ b/libraries/db_common.inc.php @@ -51,7 +51,7 @@ if (isset($submitcollation) && !empty($db_collation)) { list($db_charset) = explode('_', $db_collation); $sql_query = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation); $result = PMA_DBI_query($sql_query); - $message = $strSuccess; + $message = PMA_Message::success(); unset($db_charset, $db_collation); } diff --git a/libraries/import.lib.php b/libraries/import.lib.php index 4a259c9b8..fefe617e8 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -78,7 +78,10 @@ function PMA_detectCompression($filepath) */ function PMA_importRunQuery($sql = '', $full = '', $controluser = false) { - global $import_run_buffer, $go_sql, $complete_query, $display_query, $sql_query, $cfg, $my_die, $error, $reload, $timeout_passed, $skip_queries, $executed_queries, $max_sql_len, $read_multiply, $cfg, $sql_query_disabled, $db, $run_query, $is_superuser, $message, $show_error_header; + global $import_run_buffer, $go_sql, $complete_query, $display_query, + $sql_query, $cfg, $my_die, $error, $reload, $timeout_passed, + $skip_queries, $executed_queries, $max_sql_len, $read_multiply, + $cfg, $sql_query_disabled, $db, $run_query, $is_superuser; $read_multiply = 1; if (isset($import_run_buffer)) { // Should we skip something? @@ -91,10 +94,9 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false) $sql_query .= $import_run_buffer['full']; } if (!$cfg['AllowUserDropDatabase'] - && !$is_superuser - && preg_match('@^[[:space:]]*DROP[[:space:]]+(IF EXISTS[[:space:]]+)?DATABASE @i', $import_run_buffer['sql'])) { - $message = $GLOBALS['strNoDropDatabases']; - $show_error_header = TRUE; + && !$is_superuser + && preg_match('@^[[:space:]]*DROP[[:space:]]+(IF EXISTS[[:space:]]+)?DATABASE @i', $import_run_buffer['sql'])) { + $GLOBALS['message'] = PMA_Message::error('strNoDropDatabases'); $error = TRUE; } else { $executed_queries++; diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php index 7b8419bbb..358607ab9 100644 --- a/libraries/sql_query_form.lib.php +++ b/libraries/sql_query_form.lib.php @@ -520,7 +520,7 @@ function PMA_sqlQueryFormUpload(){ echo ''; if ($files === FALSE) { - $errors[$GLOBALS['strError']] = $GLOBALS['strWebServerUploadDirectoryError']; + $errors[] = PMA_Message::error('strWebServerUploadDirectoryError'); } elseif (!empty($files)) { echo '
'; echo '' . $GLOBALS['strWebServerUploadDirectory'] .':' . "\n"; @@ -544,9 +544,8 @@ function PMA_sqlQueryFormUpload(){ echo '
' . "\n"; echo ''; - foreach ($errors as $error => $message) { - echo '
' . $error . '
'; - echo '
' . $message . '
'; + foreach ($errors as $error) { + $error->display(); } } ?> diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 4c816cd9d..bb543c9f9 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -124,7 +124,6 @@ if (! defined('PMA_MINIMUM_COMMON')) { // Revised, Robbat2 - 13 Janurary 2003, 2:59PM function PMA_SQP_throwError($message, $sql) { - global $SQP_errorString; $SQP_errorString = '

'.$GLOBALS['strSQLParserUserError'] . '

' . "\n" . '
' . "\n"
@@ -2370,7 +2369,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
                 case 'quote_backtick':
                     // here we check for punct_user to handle correctly
                     // DEFINER = `username`@`%`
-                    // where @ is the punct_user and `%` is the quote_backtick 
+                    // where @ is the punct_user and `%` is the quote_backtick
                     if ($typearr[3] != 'punct_qualifier' && $typearr[3] != 'alpha_variable' && $typearr[3] != 'punct_user') {
                         $after     .= ' ';
                     }