00001 <?php
00002
00003
00004
00034 require_once('./libraries/grab_globals.lib.php');
00035 global $PHP_SELF;
00039 $PMA_ThemeDefault = FALSE;
00040 $PMA_ThemeAvailable = FALSE;
00041 if ($cfg['ThemeManager']){
00042 $PMA_ThemeAvailable = TRUE;
00043 }
00044
00045 if ($PMA_ThemeAvailable == TRUE){
00046 $tmp_path_default = $cfg['ThemePath'] . '/' .$cfg['ThemeDefault'];
00047 if (isset($cfg['ThemeDefault']) && is_dir($tmp_path_default)){
00048 $PMA_ThemeDefault = TRUE;
00049 }
00050 }
00051
00052 if ($PMA_ThemeAvailable == TRUE) {
00053 if ($handleThemes = opendir($cfg['ThemePath'])) {
00054 while (FALSE !== ($PMA_Theme = readdir($handleThemes))) {
00055 if ($PMA_Theme != "." && $PMA_Theme != ".." && $PMA_Theme != 'CVS') {
00056 if (@is_dir($cfg['ThemePath'].'/'.$PMA_Theme)) {
00057
00058 unset($theme_name, $theme_generation, $theme_version);
00059 @include($cfg['ThemePath'] . '/' . $PMA_Theme . '/info.inc.php');
00060
00061
00062 if (!isset($theme_name, $theme_version, $theme_generation))
00063 continue;
00064
00065 if ($theme_generation != PMA_THEME_GENERATION)
00066 continue;
00067
00068 if ($theme_version < PMA_THEME_VERSION)
00069 continue;
00070
00071 $available_themes_choices[]=$PMA_Theme;
00072 $available_themes_choices_names[$PMA_Theme] = $theme_name;
00073 }
00074 }
00075 }
00076 }
00077 closedir($handleThemes);
00078 asort($available_themes_choices);
00079 }
00080
00081
00082 $theme_cookie_name = 'pma_theme';
00083 if ($GLOBALS['cfg']['ThemePerServer']) {
00084 $theme_cookie_name .= '-' . $server;
00085 }
00086
00087 if (isset($set_theme)) {
00088 setcookie($theme_cookie_name, $set_theme, time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
00089 } else {
00090 if (!isset($_COOKIE[$theme_cookie_name]) || empty($_COOKIE[$theme_cookie_name])) {
00091 if ($PMA_ThemeDefault == TRUE) {
00092 if (basename($PHP_SELF) == 'index.php') {
00093 setcookie($theme_cookie_name, $cfg['ThemeDefault'], time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
00094 }
00095 $pmaTheme=$cfg['ThemeDefault'];
00096 }else{
00097 if (basename($PHP_SELF) == 'index.php') {
00098 setcookie($theme_cookie_name, 'original', time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
00099 }
00100 $pmaTheme='original';
00101 }
00102 } else {
00103 $pmaTheme=$_COOKIE[$theme_cookie_name];
00104 if (basename($PHP_SELF) == 'index.php') {
00105 setcookie($theme_cookie_name, $pmaTheme, time() + 60*60*24*30, $GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
00106 }
00107 }
00108 }
00109 ?>