From da1e70e1fbfbd9db218ee037fe285e2bab2cdcf5 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Wed, 30 May 2012 13:49:41 +0100 Subject: [PATCH] Integrated authentication libraries with PMA_Header class --- libraries/Header.class.php | 7 ++++++- libraries/auth/config.auth.lib.php | 17 +++++++---------- libraries/auth/cookie.auth.lib.php | 22 +++++++--------------- libraries/auth/http.auth.lib.php | 18 ++++++------------ libraries/common.inc.php | 9 +++++---- libraries/header_printview.inc.php | 6 ------ themes/original/css/common.css.php | 9 +++++---- themes/pmahomme/css/common.css.php | 9 +++++---- 8 files changed, 41 insertions(+), 56 deletions(-) diff --git a/libraries/Header.class.php b/libraries/Header.class.php index c45a1f1db3..c2d6e96ae7 100644 --- a/libraries/Header.class.php +++ b/libraries/Header.class.php @@ -29,10 +29,15 @@ class PMA_Header { private $_bodyId; private $_menuEnabled; private $_isPrintView; + private $_isAjax; public static $headerIsSent; private function __construct() { + $this->_isAjax = false; + if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { + $this->_isAjax = true; + } $this->_bodyId = ''; $this->_title = 'phpMyAdmin'; $this->_menu = new PMA_Menu( @@ -101,7 +106,7 @@ class PMA_Header { $retval = ''; if (! self::$headerIsSent) { $this->sendHttpHeaders(); - if ($GLOBALS['is_ajax_request'] === false) { + if ($this->_isAjax === false) { $retval .= $this->_getHtmlStart(); $retval .= $this->_getMetaTags(); $retval .= $this->_getLinkTags(); diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php index 461a2862ef..3ca75f76df 100644 --- a/libraries/auth/config.auth.lib.php +++ b/libraries/auth/config.auth.lib.php @@ -68,21 +68,18 @@ function PMA_auth_set_user() function PMA_auth_fails() { $conn_error = PMA_DBI_getError(); - if (!$conn_error) { + if (! $conn_error) { $conn_error = __('Cannot connect: invalid settings.'); } - // Defines the charset to be used - header('Content-Type: text/html; charset=utf-8'); /* HTML header */ - $page_title = __('Access denied'); - include './libraries/header_meta_style.inc.php'; - include './libraries/header_scripts.inc.php'; - ?> + $GLOBALS['page_title'] = __('Access denied'); + $header = PMA_Header::getInstance(); + $header->setTitle(__('Access denied')); + $header->disableMenu(); + $header->display(); - - - +?>

diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index 0d1c48533a..afb936540f 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -154,20 +154,12 @@ function PMA_auth() $cell_align = ($GLOBALS['text_dir'] == 'ltr') ? 'left' : 'right'; - // Defines the charset to be used - header('Content-Type: text/html; charset=utf-8'); + $GLOBALS['page_title'] = 'phpMyAdmin'; + $header = PMA_Header::getInstance(); + $header->setBodyId('loginform'); + $header->disableMenu(); + $header->display(); - /* HTML header; do not show here the PMA version to improve security */ - $page_title = 'phpMyAdmin '; - include './libraries/header_meta_style.inc.php'; - // if $page_title is set, this script uses it as the title: - include './libraries/header_scripts.inc.php'; - ?> - - - - - ' . $page_title . '' + 'phpMyAdmin' ); ?> @@ -306,7 +298,7 @@ function PMA_auth()