Go to the source code of this file.
Functions | |
| theme_rotate_jump ($num) | |
| theme_list ($strict=0) | |
| theme_guidelines_check ($theme) | |
|
|
First check if the printer mode is asked. If not, proceed to the usual /** theme selection if (sane_all("printer") == 1) { define(SV_THEME, "printer"); define(PRINTER, 1); return true; } if (isset($HTTP_COOKIE_VARS["SV_THEME"])) { # the user selected a theme if ($HTTP_COOKIE_VARS["SV_THEME"]=="random") { # the user selected random theme # we set randomly a theme and a cookie for a day if (isset($HTTP_COOKIE_VARS["SV_THEME_RANDOM"])) { define(SV_THEME, sane_cookie("SV_THEME_RANDOM")); } else { $theme = theme_list(1); mt_srand ((double)microtime()*1000000); $num = mt_rand(0,count($theme)-1); $random_theme = $theme[$num]; setcookie("SV_THEME_RANDOM", $random_theme, time() + 60*60*24, $GLOBALS['sys_home'],$GLOBALS['sys_default_domain']); define('SV_THEME', $random_theme); } } elseif ($HTTP_COOKIE_VARS["SV_THEME"]=="rotate") { # the user want a rotation between themes if (isset($HTTP_COOKIE_VARS["SV_THEME_ROTATE"])) { define(SV_THEME, sane_cookie("SV_THEME_ROTATE")); } else { $theme = theme_list(1); # we get a number and set a cookie with this number # if this number exist, +1 to his value if (!isset($HTTP_COOKIE_VARS["SV_THEME_ROTATE_NUMERIC"])) { $num = "0"; } else { $num = sane_cookie("SV_THEME_ROTATE_NUMERIC")+1; # if the num is a value superior of the number of themes # we reset to 0 if ($num==count($theme)) { $num = "0"; } } setcookie("SV_THEME_ROTATE_NUMERIC", $num, time() + 60*60*24*365, $GLOBALS['sys_home'],$GLOBALS['sys_default_domain']); # we associate this number with a theme $rotate_theme = $theme[$num]; setcookie("SV_THEME_ROTATE", $rotate_theme, time() + 60*60*24, $GLOBALS['sys_home'],$GLOBALS['sys_default_domain']); define(SV_THEME, $rotate_theme); } } else { # the user picked a particular theme define(SV_THEME, sane_cookie("SV_THEME")); } } else { # no theme was defined, we use the default one define(SV_THEME, $sys_themedefault); } Check whether a theme follows latest GUIDELINES Definition at line 169 of file theme.php. 00170 { 00171 # Get from the README the latest GUIDELINES number 00172 preg_match("/VERSION: (.*)/", utils_read_file($GLOBALS['sys_www_topdir']."/css/README"), $latest); 00173 # Get from the css the current GUIDELINES number 00174 preg_match("/\/\* GUIDELINES VERSION FOLLOWED: (.*) \*\//", utils_read_file($GLOBALS['sys_www_topdir']."/css/".$theme.".css"), $current); 00175 00176 if ($latest[1] != $current[1]) 00177 { 00178 return false; 00179 } 00180 00181 return true; 00182 }
|
|
|
Definition at line 52 of file theme.php. References $GLOBALS, $theme, and utils_get_content(). Referenced by html_select_theme_box(), and theme_rotate_jump(). 00053 { 00054 if ($strict) 00055 { utils_get_content("forbidden_theme"); } 00056 00057 # Feed the array 00058 $theme = array(); 00059 $dir = opendir($GLOBALS['sys_www_topdir']."/css/"); 00060 while ($file = readdir($dir)) 00061 { 00062 # take only correct css files 00063 if (preg_match("/^(.*)\.css$/", $file, $matches)) 00064 { 00065 # base.css and printer.css are always ignored 00066 if ($matches[1] != "base" && $matches[1] != "printer") { 00067 if (!$strict) 00068 { 00069 $theme[] = $matches[1]; 00070 } 00071 elseif (!preg_match($GLOBALS['forbid_theme_regexp'], $matches[1])) 00072 { 00073 $theme[] = $matches[1]; 00074 } 00075 } 00076 } 00077 } 00078 closedir($dir); 00079 00080 # Sort themes 00081 asort($theme); 00082 00083 # No result? Return only the default theme. 00084 # (If there were no result, there is a problem anyway somewhere in the 00085 # installation) 00086 if (!count($theme)) 00087 { 00088 $theme[] = $GLOBALS['sys_themedefault']; 00089 } 00090 return $theme; 00091 }
|
|
|
Definition at line 28 of file theme.php. References $theme, theme_list(), and utils_get_content(). 00029 { 00030 00031 utils_get_content("forbidden_theme"); 00032 $theme = theme_list(1); 00033 00034 $num++; 00035 00036 # if the num is a value superior of the number of themes 00037 # we reset to 0 00038 if ($num == count($theme)) 00039 { $num = "0"; } 00040 00041 # keep in mind the new number 00042 setcookie("SV_THEME_ROTATE_NUMERIC", $num, time() + 60*60*24*365, $GLOBALS['sys_home']); 00043 00044 # associate this number with a theme 00045 setcookie("SV_THEME_ROTATE", $theme[$num], time() + 60*60*24, $GLOBALS['sys_home']); 00046 }
|
1.4.4