From baf339f802ae65d3776e40bdb9291d4efe13b0e1 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 4 May 2011 06:14:28 -0400 Subject: [PATCH] Continue to replace warning level with error level --- libraries/Message.class.php | 37 ------------------------------- libraries/sqlparser.lib.php | 4 ++-- setup/frames/index.inc.php | 2 +- setup/lib/form_processing.lib.php | 2 +- setup/lib/index.lib.php | 24 ++++++++++---------- test/PMA_Message_test.php | 11 --------- test/theme.php | 9 -------- 7 files changed, 16 insertions(+), 73 deletions(-) diff --git a/libraries/Message.class.php b/libraries/Message.class.php index 30648682c..3b0d0c51c 100644 --- a/libraries/Message.class.php +++ b/libraries/Message.class.php @@ -19,9 +19,6 @@ * * // get special notice 'Some locale notice' * $message = PMA_Message::notice('strSomeLocaleNotice'); - * - * // display raw warning message 'This is a warning!' - * PMA_Message::rawWarning('This is a warning!')->display(); * * * more advanced usage example: @@ -63,7 +60,6 @@ class PMA_Message { const SUCCESS = 1; // 0001 const NOTICE = 2; // 0010 - const WARNING = 4; // 0100 const ERROR = 8; // 1000 const SANITIZE_NONE = 0; // 0000 0000 @@ -79,7 +75,6 @@ class PMA_Message static public $level = array ( PMA_Message::SUCCESS => 'success', PMA_Message::NOTICE => 'notice', - PMA_Message::WARNING => 'warning', PMA_Message::ERROR => 'error', ); @@ -213,22 +208,6 @@ class PMA_Message return new PMA_Message($string, PMA_Message::ERROR); } - /** - * get PMA_Message of type warning - * - * shorthand for getting a simple warning message - * - * @static - * @uses PMA_Message as returned object - * @uses PMA_Message::WARNING - * @param string $string a localized string e.g. 'strSetupWarning' - * @return PMA_Message - */ - static public function warning($string) - { - return new PMA_Message($string, PMA_Message::WARNING); - } - /** * get PMA_Message of type notice * @@ -337,22 +316,6 @@ class PMA_Message return PMA_Message::raw($message, PMA_Message::ERROR); } - /** - * get PMA_Message of type warning with custom content - * - * shorthand for getting a customized warning message - * - * @static - * @uses PMA_Message::raw() - * @uses PMA_Message::WARNING - * @param string $message - * @return PMA_Message - */ - static public function rawWarning($message) - { - return PMA_Message::raw($message, PMA_Message::WARNING); - } - /** * get PMA_Message of type notice with custom content * diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 893aef092..cbad1d675 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -360,7 +360,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { $pos = $pos_quote_separator; } if (class_exists('PMA_Message')) { - PMA_Message::warning(__('Automatically appended backtick to the end of query!'))->display(); + PMA_Message::notice(__('Automatically appended backtick to the end of query!'))->display(); } } else { $debugstr = __('Unclosed quote') . ' @ ' . $startquotepos. "\n" @@ -1960,7 +1960,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { if ($seen_create_table && $in_create_table_fields) { $current_identifier = $identifier; - // warning: we set this one even for non TIMESTAMP type + // we set this one even for non TIMESTAMP type $create_table_fields[$current_identifier]['timestamp_not_null'] = FALSE; } diff --git a/setup/frames/index.inc.php b/setup/frames/index.inc.php index 00723cdfb..910360638 100644 --- a/setup/frames/index.inc.php +++ b/setup/frames/index.inc.php @@ -61,7 +61,7 @@ if (!$is_https) { $text .= ' ' . PMA_lang($strInsecureConnectionMsg2, 'https://' . htmlspecialchars($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])); } - messages_set('warning', 'no_https', __('Insecure connection'), $text); + messages_set('notice', 'no_https', __('Insecure connection'), $text); } ?> diff --git a/setup/lib/form_processing.lib.php b/setup/lib/form_processing.lib.php index 7bad38c59..17f58a60e 100644 --- a/setup/lib/form_processing.lib.php +++ b/setup/lib/form_processing.lib.php @@ -38,7 +38,7 @@ function process_formset(FormDisplay $form_display) { } $id = $id ? "{$separator}id=$id" : ''; ?> -
+


diff --git a/setup/lib/index.lib.php b/setup/lib/index.lib.php index 5d42910a2..aa0d0448c 100644 --- a/setup/lib/index.lib.php +++ b/setup/lib/index.lib.php @@ -19,7 +19,7 @@ if (!defined('PHPMYADMIN')) { function messages_begin() { if (!isset($_SESSION['messages']) || !is_array($_SESSION['messages'])) { - $_SESSION['messages'] = array('error' => array(), 'warning' => array(), 'notice' => array()); + $_SESSION['messages'] = array('error' => array(), 'notice' => array()); } else { // reset message states foreach ($_SESSION['messages'] as &$messages) { @@ -35,7 +35,7 @@ function messages_begin() * Adds a new message to message list * * @param string $id unique message identifier - * @param string $type one of: notice, warning, error + * @param string $type one of: notice, error * @param string $title language string id (in $str array) * @param string $message message text */ @@ -314,7 +314,7 @@ function perform_config_checks() && $cf->getValue("Servers/$i/user") != '' && $cf->getValue("Servers/$i/password") != '') { $title = PMA_lang(PMA_lang_name('Servers/1/auth_type')) . " ($server_name)"; - messages_set('warning', "Servers/$i/auth_type", $title, + messages_set('notice', "Servers/$i/auth_type", $title, PMA_lang($strServerAuthConfigMsg, $i) . ' ' . PMA_lang($strSecurityInfoMsg, $i)); } @@ -327,7 +327,7 @@ function perform_config_checks() if ($cf->getValue("Servers/$i/AllowRoot") && $cf->getValue("Servers/$i/AllowNoPassword")) { $title = PMA_lang(PMA_lang_name('Servers/1/AllowNoPassword')) . " ($server_name)"; - messages_set('warning', "Servers/$i/AllowNoPassword", $title, + messages_set('notice', "Servers/$i/AllowNoPassword", $title, __('You allow for connecting to the server without a password.') . ' ' . PMA_lang($strSecurityInfoMsg, $i)); } @@ -358,7 +358,7 @@ function perform_config_checks() $blowfish_warnings[] = PMA_lang(__('Key should contain letters, numbers [em]and[/em] special characters.')); } if (!empty($blowfish_warnings)) { - messages_set('warning', 'blowfish_warnings' . count($blowfish_warnings), + messages_set('error', 'blowfish_warnings' . count($blowfish_warnings), PMA_lang(PMA_lang_name('blowfish_secret')), implode('
', $blowfish_warnings)); } @@ -380,7 +380,7 @@ function perform_config_checks() // should be disabled // if ($cf->getValue('AllowArbitraryServer')) { - messages_set('warning', 'AllowArbitraryServer', + messages_set('notice', 'AllowArbitraryServer', PMA_lang(PMA_lang_name('AllowArbitraryServer')), PMA_lang($strAllowArbitraryServerWarning)); } @@ -393,7 +393,7 @@ function perform_config_checks() || $cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime')) { $message_type = $cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime') ? 'error' - : 'warning'; + : 'notice'; messages_set($message_type, 'LoginCookieValidity', PMA_lang(PMA_lang_name('LoginCookieValidity')), PMA_lang($strLoginCookieValidityWarning)); @@ -404,7 +404,7 @@ function perform_config_checks() // should be at most 1800 (30 min) // if ($cf->getValue('LoginCookieValidity') > 1800) { - messages_set('warning', 'LoginCookieValidity', + messages_set('notice', 'LoginCookieValidity', PMA_lang(PMA_lang_name('LoginCookieValidity')), PMA_lang($strLoginCookieValidityWarning2)); } @@ -446,7 +446,7 @@ function perform_config_checks() // if ($cf->getValue('GZipDump') && (@!function_exists('gzopen') || @!function_exists('gzencode'))) { - messages_set('warning', 'GZipDump', + messages_set('error', 'GZipDump', PMA_lang(PMA_lang_name('GZipDump')), PMA_lang($strGZipDumpWarning, 'gzencode')); } @@ -463,7 +463,7 @@ function perform_config_checks() $functions .= @function_exists('bzcompress') ? '' : ($functions ? ', ' : '') . 'bzcompress'; - messages_set('warning', 'BZipDump', + messages_set('error', 'BZipDump', PMA_lang(PMA_lang_name('BZipDump')), PMA_lang($strBZipDumpWarning, $functions)); } @@ -473,7 +473,7 @@ function perform_config_checks() // requires zip_open in import // if ($cf->getValue('ZipDump') && !@function_exists('zip_open')) { - messages_set('warning', 'ZipDump_import', + messages_set('error', 'ZipDump_import', PMA_lang(PMA_lang_name('ZipDump')), PMA_lang($strZipDumpImportWarning, 'zip_open')); } @@ -483,7 +483,7 @@ function perform_config_checks() // requires gzcompress in export // if ($cf->getValue('ZipDump') && !@function_exists('gzcompress')) { - messages_set('warning', 'ZipDump_export', + messages_set('error', 'ZipDump_export', PMA_lang(PMA_lang_name('ZipDump')), PMA_lang($strZipDumpExportWarning, 'gzcompress')); } diff --git a/test/PMA_Message_test.php b/test/PMA_Message_test.php index 27e4b7fa5..ed7694e3d 100644 --- a/test/PMA_Message_test.php +++ b/test/PMA_Message_test.php @@ -79,15 +79,6 @@ class PMA_Message_test extends PHPUnit_Extensions_OutputTestCase $this->assertEquals('Error', PMA_Message::error()->getString()); } - /** - * test warning method - */ - public function testWarning() - { - $this->object = new PMA_Message('test<&>', PMA_Message::WARNING); - $this->assertEquals($this->object, PMA_Message::warning('test<&>')); - } - /** * test notice method */ @@ -359,8 +350,6 @@ class PMA_Message_test extends PHPUnit_Extensions_OutputTestCase $this->assertEquals('success', $this->object->getLevel()); $this->object->setNumber(PMA_Message::ERROR); $this->assertEquals('error', $this->object->getLevel()); - $this->object->setNumber(PMA_Message::WARNING); - $this->assertEquals('warning', $this->object->getLevel()); } /** diff --git a/test/theme.php b/test/theme.php index 098feed77..d49a5777b 100644 --- a/test/theme.php +++ b/test/theme.php @@ -187,15 +187,6 @@ echo sprintf(__('Welcome to %s'),

Notice message box header!

notice message box content!
- -
- warning message box content! -
-
-

Warning message box header!

- warning message box content! -
-
error message box content!