Impleneted versioning and naming for themes (RFEs #991642 and #991645).

This commit is contained in:
Michal Čihař
2004-08-12 17:38:43 +00:00
parent 4af60bec2c
commit ae85313a36
8 changed files with 75 additions and 21 deletions

View File

@@ -312,28 +312,36 @@ if (!isset($_COOKIE['pma_theme']) || empty($_COOKIE['pma_theme'])){
}
}
if ($ThemeDefaultOk == TRUE){
$pmaThemeImage = './' . $cfg['ThemePath'] . '/' . $cfg['ThemeDefault'] . '/img/';
$tmp_layout_file = './' . $cfg['ThemePath'] . '/' . $cfg['ThemeDefault'] . '/layout.inc.php';
if (@file_exists($tmp_layout_file)) {
include($tmp_layout_file);
}
$GLOBALS['theme'] = $cfg['ThemeDefault'];
} else {
$pmaThemeImage = './' . $cfg['ThemePath'] . '/original/img/';
$GLOBALS['theme'] = 'original';
}
} else {
// if we just changed theme, we must take the new one so that
// index.php takes the correct one for height computing
if (isset($_POST['set_theme'])) {
$GLOBALS['theme'] = $_POST['set_theme'];
$GLOBALS['theme'] = PMA_securePath($_POST['set_theme']);
} else {
$GLOBALS['theme'] = $_COOKIE['pma_theme'];
}
$pmaThemeImage = './' . $cfg['ThemePath'] . '/' . $GLOBALS['theme'] . '/img/';
$tmp_layout_file = './' . $cfg['ThemePath'] . '/' . PMA_securePath($GLOBALS['theme']) . '/layout.inc.php';
if (@file_exists($tmp_layout_file)) {
include($tmp_layout_file);
$GLOBALS['theme'] = PMA_securePath($_COOKIE['pma_theme']);
}
}
// check for theme requires/name
unset($theme_name, $theme_version);
@include($cfg['ThemePath'] . '/' . $GLOBALS['theme'] . '/info.inc.php');
// did it set correctly?
if (!isset($theme_name, $theme_version))
$GLOBALS['theme'] = 'original'; // invalid theme
if ($theme_version < PMA_THEME_VERSION)
$GLOBALS['theme'] = 'original'; // too old version
$pmaThemeImage = './' . $cfg['ThemePath'] . '/' . $GLOBALS['theme'] . '/img/';
$tmp_layout_file = './' . $cfg['ThemePath'] . '/' . $GLOBALS['theme'] . '/layout.inc.php';
if (@file_exists($tmp_layout_file)) {
include($tmp_layout_file);
}
if (!is_dir($pmaThemeImage)) {
$pmaThemeImage = './' . $cfg['ThemePath'] . '/original/img/';
}