From 8996ff60a19957a08c04e7e0d97c242701f48c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 23 Nov 2005 15:03:57 +0000 Subject: [PATCH] Functionalised server selection and use it in cookie auth (RFE #1362727). --- ChangeLog | 4 +++ libraries/auth/cookie.auth.lib.php | 36 ++------------------- libraries/left_header.inc.php | 7 ++-- libraries/select_server.lib.php | 52 ++++++++++++++++++------------ main.php | 4 +-- 5 files changed, 45 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3f4999c1..e849ccf35 100755 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,10 @@ $Source$ information. * libraries/display_select_lang.lib.php, libraries/auth/cookie.auth.lib.php: Use fieldset for language selection. + * main.php, libraries/left_header.inc.php, + libraries/select_server.lib.php, libraries/auth/cookie.auth.lib.php: + Functionalised server selection and use it in cookie auth (RFE + #1362727). 2005-11-22 Sebastian Mendel * added test/theme.php: for testing themes diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index 8076abb35..95724f6a1 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -201,40 +201,8 @@ echo sprintf( $GLOBALS['strWelcome'], ?> > $val) { - if (!empty($val['host'])) { - echo ' ' . "\n"; - } // end if (!empty($val['host'])) - } // end while + require_once('./libraries/select_server.lib.php'); + PMA_select_server(FALSE, FALSE); ?> diff --git a/libraries/left_header.inc.php b/libraries/left_header.inc.php index 4af01693f..0b361fa7b 100644 --- a/libraries/left_header.inc.php +++ b/libraries/left_header.inc.php @@ -80,8 +80,11 @@ if ($GLOBALS['cfg']['MainPageIconic']) { } echo '' . "\n"; -if ( $GLOBALS['cfg']['LeftDisplayServers'] ) { - $show_server_left = TRUE; +/** + * Displays the MySQL servers choice form + */ +if ( $GLOBALS['cfg']['LeftDisplayServers'] && count($cfg['Servers']) > 1 ) { include('./libraries/select_server.lib.php'); + PMA_select_server(TRUE, TRUE); } // end if LeftDisplayServers ?> diff --git a/libraries/select_server.lib.php b/libraries/select_server.lib.php index 307d5ba9f..ffb8c57f2 100644 --- a/libraries/select_server.lib.php +++ b/libraries/select_server.lib.php @@ -4,20 +4,30 @@ * $Id$ */ -if (count($cfg['Servers']) > 1) { - if ($show_server_left) { - echo '
' . $strServer . ':
'; - } else { - ?> -
- - -
- + $val) { if (!empty($val['host'])) { @@ -43,8 +53,8 @@ if (count($cfg['Servers']) > 1) { $label .= ' (' . $val['user'] . ')'; } - if ($cfg['DisplayServersList']){ - if ($selected && !$show_server_left) { + if ($list){ + if ($selected && !$left) { echo '» ' . htmlspecialchars($label) . '
'; }else{ echo '» ' . htmlspecialchars($label) . '
'; @@ -56,23 +66,25 @@ if (count($cfg['Servers']) > 1) { } // end if (!empty($val['host'])) } // end while - if ( ! $cfg['DisplayServersList'] ) { + if ($form) { + if ( ! $list ) { ?>
'; + } else { + echo '
'; + } } } ?> diff --git a/main.php b/main.php index 6d1c152d7..1be923775 100644 --- a/main.php +++ b/main.php @@ -126,9 +126,9 @@ if (($server > 0) && isset($mode) && ($mode == 'reload')) { /** * Displays the MySQL servers choice form */ -if (!$cfg['LeftDisplayServers']) { - $show_server_left = FALSE; +if (!$cfg['LeftDisplayServers'] && count($cfg['Servers']) > 1) { include('./libraries/select_server.lib.php'); + PMA_select_server(TRUE, FALSE); } // nested table needed