copyright update
[squirrelmail.git] / themes / random.php
CommitLineData
fc632e34 1<?php
fc632e34 2
d4f79d96 3/**
c4309fbd 4 * Name: Random Theme Every Login
c4309fbd 5 * Date: December 24, 2001
6 * Comment: Guess what this does!
d4f79d96 7 *
4b4abf93 8 * @author Tyler Akins
47ccfad4 9 * @copyright &copy; 2000-2006 The SquirrelMail Project Team
4b4abf93 10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
11 * @version $Id$
7ce971d0 12 * @package squirrelmail
c4309fbd 13 * @subpackage themes
d4f79d96 14 */
fc632e34 15
c4309fbd 16/** Initialize the random number generator */
d4f79d96 17sq_mt_randomize();
0b97a708 18
19require_once(SM_PATH . 'functions/global.php');
eb548244 20
a4edbd9f 21global $theme;
eb548244 22
d7c82551 23if (!sqsession_is_registered('random_theme_good_theme')) {
d4f79d96 24 $good_themes = array();
25 foreach ($theme as $data) {
26 if (substr($data['PATH'], -18) != '/themes/random.php') {
fc632e34 27 $good_themes[] = $data['PATH'];
d4f79d96 28 }
29 }
8905fa13 30 if (count($good_themes) == 0) {
31 $good_themes[] = '../themes/default.php';
32 }
d4f79d96 33 $which = mt_rand(0, count($good_themes));
34 $random_theme_good_theme = $good_themes[$which];
e8927b2f 35 // remove current sm_path from theme name
36 $path=preg_quote(SM_PATH,'/');
37 $random_theme_good_theme=preg_replace("/^$path/",'',$random_theme_good_theme);
38 // store it in session
0b97a708 39 sqsession_register($random_theme_good_theme, 'random_theme_good_theme');
a4edbd9f 40} else {
41 // get random theme stored in session
42 sqgetGlobalVar('random_theme_good_theme',$random_theme_good_theme);
d4f79d96 43}
eb548244 44
e8927b2f 45@include_once (SM_PATH . $random_theme_good_theme);
fc632e34 46
eb548244 47?>