Add ability to show plugin list in columns. This should probably be adapted to other...
[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
4b5049de 9 * @copyright &copy; 2000-2007 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
2c34672a 16/** Prevent direct script loading */
f627180c 17if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) {
2c34672a 18 die();
19}
20
21/** load required functions */
22include_once(SM_PATH . 'functions/global.php');
23include_once(SM_PATH . 'functions/strings.php');
24
c4309fbd 25/** Initialize the random number generator */
d4f79d96 26sq_mt_randomize();
0b97a708 27
a4edbd9f 28global $theme;
eb548244 29
d7c82551 30if (!sqsession_is_registered('random_theme_good_theme')) {
d4f79d96 31 $good_themes = array();
32 foreach ($theme as $data) {
33 if (substr($data['PATH'], -18) != '/themes/random.php') {
fc632e34 34 $good_themes[] = $data['PATH'];
d4f79d96 35 }
36 }
8905fa13 37 if (count($good_themes) == 0) {
38 $good_themes[] = '../themes/default.php';
39 }
d4f79d96 40 $which = mt_rand(0, count($good_themes));
41 $random_theme_good_theme = $good_themes[$which];
e8927b2f 42 // remove current sm_path from theme name
43 $path=preg_quote(SM_PATH,'/');
44 $random_theme_good_theme=preg_replace("/^$path/",'',$random_theme_good_theme);
45 // store it in session
0b97a708 46 sqsession_register($random_theme_good_theme, 'random_theme_good_theme');
a4edbd9f 47} else {
48 // get random theme stored in session
49 sqgetGlobalVar('random_theme_good_theme',$random_theme_good_theme);
d4f79d96 50}
eb548244 51
e8927b2f 52@include_once (SM_PATH . $random_theme_good_theme);