Source for file random.php

Documentation is available at random.php

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

Documentation generated on Sat, 07 Oct 2006 16:33:07 +0300 by phpDocumentor 1.3.0RC6