diff --git a/libraries/Error.class.php b/libraries/Error.class.php index 5706d87c8..a01e26aa2 100644 --- a/libraries/Error.class.php +++ b/libraries/Error.class.php @@ -413,15 +413,19 @@ class PMA_Error public function display() { echo '
'; - echo '' . $this->getType() . ''; - echo ' in ' . $this->getFile() . '#' . $this->getLine(); - echo "
\n"; + if (! $this->isUserError()) { + echo '' . $this->getType() . ''; + echo ' in ' . $this->getFile() . '#' . $this->getLine(); + echo "
\n"; + } echo $this->getMessage(); - echo "
\n"; - echo "
\n"; - echo "Backtrace
\n"; - echo "
\n"; - echo $this->displayBacktrace(); + if (! $this->isUserError()) { + echo "
\n"; + echo "
\n"; + echo "Backtrace
\n"; + echo "
\n"; + echo $this->displayBacktrace(); + } echo '
'; $this->isDisplayed(true); } diff --git a/libraries/Error_Handler.class.php b/libraries/Error_Handler.class.php index 62f2c2363..4e4b2eab5 100644 --- a/libraries/Error_Handler.class.php +++ b/libraries/Error_Handler.class.php @@ -126,15 +126,15 @@ class PMA_Error_Handler case E_WARNING: case E_CORE_WARNING: case E_COMPILE_WARNING: + case E_USER_ERROR: + case E_RECOVERABLE_ERROR: // just collect the error // display is called from outside break; - case E_USER_ERROR: case E_ERROR: case E_PARSE: case E_CORE_ERROR: case E_COMPILE_ERROR: - case E_RECOVERABLE_ERROR: default: // FATAL error, dislay it and exit $this->_dispFatalError($error); @@ -276,8 +276,12 @@ class PMA_Error_Handler { if ($GLOBALS['cfg']['Error_Handler']['display']) { foreach ($this->getErrors() as $error) { - if (! $error->isDisplayed()) { - $error->display(); + if ($error instanceof PMA_Error) { + if (! $error->isDisplayed()) { + $error->display(); + } + } else { + var_dump($error); } } } else { @@ -295,10 +299,17 @@ class PMA_Error_Handler protected function _checkSavedErrors() { if (isset($_SESSION['errors'])) { + // restore saved errors - $this->_errors = array_merge($_SESSION['errors'], $this->_errors); + foreach ($_SESSION['errors'] as $hash => $error) { + if ($error instanceof PMA_Error && ! isset($this->_errors[$hash])) { + $this->_errors[$hash] = $error; + } + } + //$this->_errors = array_merge($_SESSION['errors'], $this->_errors); // delet stored errors + $_SESSION['errors'] = array(); unset($_SESSION['errors']); } } diff --git a/libraries/Theme.class.php b/libraries/Theme.class.php index 4671814ec..453993034 100644 --- a/libraries/Theme.class.php +++ b/libraries/Theme.class.php @@ -133,7 +133,6 @@ class PMA_Theme { * @uses PMA_Theme::setImgPath() * @uses PMA_Theme::getName() * @uses $GLOBALS['cfg']['ThemePath'] - * @uses $GLOBALS['PMA_errors'] * @uses $GLOBALS['strThemeNoValidImgPath'] * @uses is_dir() * @uses sprintf() @@ -147,13 +146,9 @@ class PMA_Theme { $this->setImgPath($GLOBALS['cfg']['ThemePath'] . '/original/img/'); return true; } else { - $GLOBALS['PMA_errors'][] = - sprintf($GLOBALS['strThemeNoValidImgPath'], $this->getName()); - /* trigger_error( sprintf($GLOBALS['strThemeNoValidImgPath'], $this->getName()), - E_USER_WARNING); - */ + E_USER_ERROR); return false; } } diff --git a/libraries/Theme_Manager.class.php b/libraries/Theme_Manager.class.php index 1de54919d..e78887df5 100644 --- a/libraries/Theme_Manager.class.php +++ b/libraries/Theme_Manager.class.php @@ -109,12 +109,10 @@ class PMA_Theme_Manager if (! $this->checkTheme($GLOBALS['cfg']['ThemeDefault'])) { - $GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strThemeDefaultNotFound'], - htmlspecialchars($GLOBALS['cfg']['ThemeDefault'])); trigger_error( sprintf($GLOBALS['strThemeDefaultNotFound'], htmlspecialchars($GLOBALS['cfg']['ThemeDefault'])), - E_USER_WARNING); + E_USER_ERROR); $GLOBALS['cfg']['ThemeDefault'] = false; } @@ -149,12 +147,9 @@ class PMA_Theme_Manager function setActiveTheme($theme = null) { if (! $this->checkTheme($theme)) { - $GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strThemeNotFound'], - htmlspecialchars($theme)); - /* Following code can lead to path disclossure, because headers will be sent later */ -/* trigger_error( + trigger_error( sprintf($GLOBALS['strThemeNotFound'], htmlspecialchars($theme)), - E_USER_WARNING);*/ + E_USER_ERROR); return false; } @@ -220,13 +215,10 @@ class PMA_Theme_Manager /*private*/ function _checkThemeFolder($folder) { if (! is_dir($folder)) { - $GLOBALS['PMA_errors'][] = - sprintf($GLOBALS['strThemePathNotFound'], - htmlspecialchars($folder)); trigger_error( sprintf($GLOBALS['strThemePathNotFound'], htmlspecialchars($folder)), - E_USER_WARNING); + E_USER_ERROR); return false; } diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php index a1f777545..cdea1084d 100644 --- a/libraries/auth/config.auth.lib.php +++ b/libraries/auth/config.auth.lib.php @@ -99,7 +99,7 @@ function PMA_auth_fails() $GLOBALS['is_header_sent'] = TRUE; if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) { - echo '

' . $GLOBALS['strAccessDenied'] . '

' . "\n"; + trigger_error($GLOBALS['strAccessDenied'], E_USER_NOTICE); } else { // Check whether user has configured something if ($_SESSION['PMA_Config']->source_mtime == 0) { @@ -116,11 +116,7 @@ function PMA_auth_fails() } PMA_mysqlDie($conn_error, '', true, '', false); } - if (! empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) { - foreach ($GLOBALS['PMA_errors'] as $error) { - echo '
' . $error . '
' . "\n"; - } - } + $GLOBALS['error_handler']->dispUserErrors(); ?> diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index 6471719ac..05084a8c4 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -105,7 +105,7 @@ if (function_exists('mcrypt_encrypt') || PMA_dl('mcrypt')) { /** * display warning in main.php */ - define('PMA_WARN_FOR_MCRYPT', 1); + trigger_error(PMA_sanitize(sprintf($strCantLoad, 'mcrypt')), E_USER_WARNING); } @@ -123,7 +123,6 @@ if (function_exists('mcrypt_encrypt') || PMA_dl('mcrypt')) { * @uses $GLOBALS['target'] * @uses $GLOBALS['db'] * @uses $GLOBALS['table'] - * @uses $GLOBALS['PMA_errors'] * @uses $GLOBALS['convcharset'] * @uses $GLOBALS['lang'] * @uses $GLOBALS['strWelcome'] @@ -261,8 +260,8 @@ if (top != self) {
target="_top" class="login">
-'; if ($GLOBALS['cfg']['ReplaceHelpImg']) { @@ -330,13 +329,9 @@ if (top != self) { // show the "Cookies required" message only if cookies are disabled // (we previously tried to set some cookies) if (empty($_COOKIE)) { - echo '
' . $GLOBALS['strCookiesRequired'] . '
' . "\n"; - } - if (! empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) { - foreach ($GLOBALS['PMA_errors'] as $error) { - echo '
' . $error . '
' . "\n"; - } + trigger_error($GLOBALS['strCookiesRequired'], E_USER_NOTICE); } + $GLOBALS['error_handler']->dispUserErrors(); ?>