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.17 2006/07/15 12:01:31 tokul Exp $
  12.  * @package squirrelmail
  13.  * @subpackage themes
  14.  */
  15.  
  16. /** Prevent direct script loading */
  17. if ((isset($_SERVER['SCRIPT_FILENAME']&& $_SERVER['SCRIPT_FILENAME'== __FILE__||
  18.     (isset($HTTP_SERVER_SERVER['SCRIPT_FILENAME']&& $HTTP_SERVER_SERVER['SCRIPT_FILENAME'== __FILE__) ) {
  19.     die();
  20. }
  21.  
  22. /** load required functions */
  23. include_once(SM_PATH 'functions/global.php');
  24. include_once(SM_PATH 'functions/strings.php');
  25.  
  26. /** Initialize the random number generator */
  27.  
  28. global $theme;
  29.  
  30. if (!sqsession_is_registered('random_theme_good_theme')) {
  31.     $good_themes array();
  32.     foreach ($theme as $data{
  33.         if (substr($data['PATH']-18!= '/themes/random.php'{
  34.             $good_themes[$data['PATH'];
  35.         }
  36.     }
  37.     if (count($good_themes== 0{
  38.         $good_themes['../themes/default.php';
  39.     }
  40.     $which mt_rand(0count($good_themes));
  41.     $random_theme_good_theme $good_themes[$which];
  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
  46.         sqsession_register($random_theme_good_theme'random_theme_good_theme');
  47. else {
  48.     // get random theme stored in session
  49.         sqgetGlobalVar('random_theme_good_theme',$random_theme_good_theme);
  50. }
  51.  
  52. @include_once (SM_PATH $random_theme_good_theme);

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