random.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Name: Random Theme Every Login
  4. * @author Tyler Akins
  5. * Date: December 24, 2001
  6. * Comment: Guess what this does!
  7. *
  8. * Copyright (c) 2000-2004 The SquirrelMail Project Team
  9. * Licensed under the GNU GPL. For full terms see the file COPYING.
  10. *
  11. * $Id$
  12. * @package squirrelmail
  13. * @subpackage themes
  14. */
  15. /** Initialize the random number generator */
  16. sq_mt_randomize();
  17. require_once(SM_PATH . 'functions/global.php');
  18. global $theme;
  19. if (!sqsession_is_registered('random_theme_good_theme')) {
  20. $good_themes = array();
  21. foreach ($theme as $data) {
  22. if (substr($data['PATH'], -18) != '/themes/random.php') {
  23. $good_themes[] = $data['PATH'];
  24. }
  25. }
  26. if (count($good_themes) == 0) {
  27. $good_themes[] = '../themes/default.php';
  28. }
  29. $which = mt_rand(0, count($good_themes));
  30. $random_theme_good_theme = $good_themes[$which];
  31. sqsession_register($random_theme_good_theme, 'random_theme_good_theme');
  32. } else {
  33. // get random theme stored in session
  34. sqgetGlobalVar('random_theme_good_theme',$random_theme_good_theme);
  35. }
  36. @include_once ($random_theme_good_theme);
  37. ?>