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 2000-2014 The SquirrelMail Project Team
  10.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  11.  * @version $Id: random.php 14420 2014-01-01 20:33:20Z pdontthink $
  12.  * @package squirrelmail
  13.  * @subpackage themes
  14.  */
  15.  
  16. /** Prevent direct script loading */
  17. if (isset($_SERVER['SCRIPT_FILENAME']&& $_SERVER['SCRIPT_FILENAME'== __FILE__{
  18.     die();
  19. }
  20.  
  21. /** load required functions */
  22. include_once(SM_PATH 'functions/global.php');
  23.  
  24. global $theme;
  25.  
  26. if (!sqsession_is_registered('random_theme_good_theme')) {
  27.     $good_themes array();
  28.     foreach ($theme as $data{
  29.         if (substr($data['PATH']-18!= '/themes/random.php'{
  30.             $good_themes[$data['PATH'];
  31.         }
  32.     }
  33.     if (count($good_themes== 0{
  34.         $good_themes['../themes/default.php';
  35.     }
  36.     $which mt_rand(0count($good_themes));
  37.     $random_theme_good_theme $good_themes[$which];
  38.     // remove current sm_path from theme name
  39.     $path=preg_quote(SM_PATH,'/');
  40.     $random_theme_good_theme=preg_replace("/^$path/",'',$random_theme_good_theme);
  41.     // store it in session
  42.     sqsession_register($random_theme_good_theme'random_theme_good_theme');
  43. else {
  44.     // get random theme stored in session
  45.     sqgetGlobalVar('random_theme_good_theme',$random_theme_good_theme);
  46. }
  47.  
  48. @include_once (SM_PATH $random_theme_good_theme);

Documentation generated on Sun, 20 Apr 2014 04:19:05 +0200 by phpDocumentor 1.4.3