4 * Name: Random Theme Every Login
6 * Date: December 24, 2001
7 * Comment: Guess what this does!
9 * Copyright (c) 2000-2005 The SquirrelMail Project Team
10 * Licensed under the GNU GPL. For full terms see the file COPYING.
13 * @package squirrelmail
17 /** Initialize the random number generator */
20 require_once(SM_PATH
. 'functions/global.php');
24 if (!sqsession_is_registered('random_theme_good_theme')) {
25 $good_themes = array();
26 foreach ($theme as $data) {
27 if (substr($data['PATH'], -18) != '/themes/random.php') {
28 $good_themes[] = $data['PATH'];
31 if (count($good_themes) == 0) {
32 $good_themes[] = '../themes/default.php';
34 $which = mt_rand(0, count($good_themes));
35 $random_theme_good_theme = $good_themes[$which];
36 // remove current sm_path from theme name
37 $path=preg_quote(SM_PATH
,'/');
38 $random_theme_good_theme=preg_replace("/^$path/",'',$random_theme_good_theme);
39 // store it in session
40 sqsession_register($random_theme_good_theme, 'random_theme_good_theme');
42 // get random theme stored in session
43 sqgetGlobalVar('random_theme_good_theme',$random_theme_good_theme);
46 @include_once
(SM_PATH
. $random_theme_good_theme);