User can now have different theme per server (RFE #1231599).

This commit is contained in:
Michal Čihař
2005-07-10 18:42:00 +00:00
parent ff0fe8ebaf
commit fc1be828b6
9 changed files with 41 additions and 15 deletions

View File

@@ -8,6 +8,10 @@ $Source$
2005-07-10 Michal Čihař <michal@cihar.com>
* libraries/auth/http.auth.lib.php: Support FastGCI in http auth (patch
#1192219)
* Documentation.html, config.inc.php, left.php, queryframe.php,
libraries/common.lib.php, libraries/config_import.lib.php,
libraries/header_meta_style.inc.php, libraries/select_theme.lib.php:
User can now have different theme per server (RFE #1231599).
2005-07-10 Marc Delisle <lem9@users.sourceforge.net>
* libraries/display_tbl.lib.php: bug #1235473 display_tbl.lib.php,

View File

@@ -1839,6 +1839,12 @@ Defaults to FALSE (drop-down). <br />
<br /><br />
</dd>
<dt><b>$cfg['ThemePerServer'] </b>boolean</dt>
<dd>
Whether to allow different theme for each server.
<br /><br />
</dd>
<dt><b>$cfg['DefaultQueryTable']</b> string</dt>
<dt><b>$cfg['DefaultQueryDatabase']</b> string</dt>
<dd>

View File

@@ -577,6 +577,7 @@ $cfg['ThemeManager'] = TRUE; // if you want to use selectable th
$cfg['ThemeDefault'] = 'original'; // set up default theme, if ThemePath not empty
// you can set up here an valid path to themes or 'original' for
// the original pma-theme
$cfg['ThemePerServer'] = FALSE; // allow diferent theme for each configured server
//-----------------------------------------------------------------------------

View File

@@ -289,11 +289,11 @@ if (($num_dbs > 1 || !empty($cfg['LeftFrameTableSeparator'])) && !$cfg['LeftFram
var isServer = <?php echo ($server > 0) ? 'true' : 'false'; ?>;
document.writeln('<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&amp;js_frame=left&amp;js_capable=' + capable + '&amp;js_isDOM=' + isDOM + '&amp;js_isIE4=' + isIE4 + '" />');
document.writeln('<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=left&amp;js_capable=' + capable + '&amp;js_isDOM=' + isDOM + '&amp;js_isIE4=' + isIE4 + '" />');
//-->
</script>
<noscript>
<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&amp;js_frame=left&amp;js_capable=0&amp;js_isDOM=0&amp;js_isIE4=0" />
<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=left&amp;js_capable=0&amp;js_isDOM=0&amp;js_isIE4=0" />
</noscript>
<script src="libraries/left.js" type="text/javascript" language="javascript1.2"></script>

View File

@@ -142,7 +142,7 @@ if (isset($cfg['FileRevision'])) {
} else {
$cfg['FileRevision'] = array(1, 1);
}
if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 56)) {
if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 58)) {
require_once('./libraries/config_import.lib.php');
}
@@ -328,8 +328,14 @@ if (strtolower($cfg['OBGzip']) == 'auto') {
* and if the directory $ThemePath/$theme/img/ exists
* If not, it will use default images
*/
// Allow different theme per server
$theme_cookie_name = 'pma_theme';
if ($GLOBALS['cfg']['ThemePerServer'] && isset($server)) {
$theme_cookie_name .= '-' . $server;
}
//echo $theme_cookie_name;
// Theme Manager
if (!$cfg['ThemeManager'] || !isset($_COOKIE['pma_theme']) || empty($_COOKIE['pma_theme'])){
if (!$cfg['ThemeManager'] || !isset($_COOKIE[$theme_cookie_name]) || empty($_COOKIE[$theme_cookie_name])){
$GLOBALS['theme'] = $cfg['ThemeDefault'];
$ThemeDefaultOk = FALSE;
if ($cfg['ThemePath']!='' && $cfg['ThemePath'] != FALSE) {
@@ -352,7 +358,7 @@ if (!$cfg['ThemeManager'] || !isset($_COOKIE['pma_theme']) || empty($_COOKIE['pm
if (isset($_POST['set_theme'])) {
$GLOBALS['theme'] = PMA_securePath($_POST['set_theme']);
} else {
$GLOBALS['theme'] = PMA_securePath($_COOKIE['pma_theme']);
$GLOBALS['theme'] = PMA_securePath($_COOKIE[$theme_cookie_name]);
}
}

View File

@@ -756,6 +756,9 @@ if (!isset($cfg['ThemePath'])) {
$cfg['ThemeManager'] = TRUE;
}
}
if (!isset($cfg['ThemePerServer'])){
$cfg['ThemePerServer'] = FALSE;
}
if (!isset($cfg['DefaultQueryTable'])) {
$cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1';

View File

@@ -61,10 +61,10 @@ if (!empty($GLOBALS['cfg']['PmaAbsoluteUri'])) {
}
} // end if... else if...
} // end if
document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['lang']; ?>&amp;js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&amp;js_isDOM=' + isDOM + '" />');
document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&amp;js_isDOM=' + isDOM + '" />');
//-->
</script>
<noscript>
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['lang']; ?>&amp;js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>" />
</noscript>
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/print.css?<?php echo PMA_generate_common_url(); ?>" media="print" />

View File

@@ -79,25 +79,31 @@ if ($PMA_ThemeAvailable == TRUE) { // themeManager is available
asort($available_themes_choices);
// Allow different theme per server
$theme_cookie_name = 'pma_theme';
if ($GLOBALS['cfg']['ThemePerServer']) {
$theme_cookie_name .= '-' . $server;
}
if (isset($set_theme)) { // if user submit a theme
setcookie('pma_theme', $set_theme, time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
setcookie($theme_cookie_name, $set_theme, time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
} else { // else check if user have a theme cookie
if (!isset($_COOKIE['pma_theme']) || empty($_COOKIE['pma_theme'])) {
if (!isset($_COOKIE[$theme_cookie_name]) || empty($_COOKIE[$theme_cookie_name])) {
if ($PMA_ThemeDefault == TRUE) {
if (basename($PHP_SELF) == 'index.php') {
setcookie('pma_theme', $cfg['ThemeDefault'], time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
setcookie($theme_cookie_name, $cfg['ThemeDefault'], time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
$pmaTheme=$cfg['ThemeDefault'];
}else{
if (basename($PHP_SELF) == 'index.php') {
setcookie('pma_theme', 'original', time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
setcookie($theme_cookie_name, 'original', time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
$pmaTheme='original';
}
} else {
$pmaTheme=$_COOKIE['pma_theme'];
$pmaTheme=$_COOKIE[$theme_cookie_name];
if (basename($PHP_SELF) == 'index.php') {
setcookie('pma_theme', $pmaTheme, time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
setcookie($theme_cookie_name, $pmaTheme, time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
}
}
} // end if

View File

@@ -52,7 +52,7 @@ echo "<?xml version=\"1.0\" encoding=\"" . $GLOBALS['charset'] . "\"?".">"; // r
<title>phpMyAdmin</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
<base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> />
<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&amp;js_frame=left&amp;num_dbs=0" />
<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&amp;js_frame=left&amp;num_dbs=0" />
<?php
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
?>