Continue to replace warning level with error level

This commit is contained in:
Marc Delisle
2011-05-04 06:14:28 -04:00
parent 0bb27cc5fb
commit baf339f802
7 changed files with 16 additions and 73 deletions

View File

@@ -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();
* </code>
*
* 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
*

View File

@@ -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;
}

View File

@@ -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);
}
?>

View File

@@ -38,7 +38,7 @@ function process_formset(FormDisplay $form_display) {
}
$id = $id ? "{$separator}id=$id" : '';
?>
<div class="warning">
<div class="error">
<h4><?php echo __('Warning') ?></h4>
<?php echo __('Submitted form contains errors') ?><br />
<a href="?page=<?php echo $page . $formset . $id . $separator ?>mode=revert"><?php echo __('Try to revert erroneous fields to their default values') ?></a>

View File

@@ -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('<br />', $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'));
}

View File

@@ -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());
}
/**

View File

@@ -187,15 +187,6 @@ echo sprintf(__('Welcome to %s'),
<h1>Notice message box header!</h1>
notice message box content!
</div>
<div class="warning">
warning message box content!
</div>
<div class="warning">
<h1>Warning message box header!</h1>
warning message box content!
</div>
<div class="error">
error message box content!
</div>