PageRenderTime 49ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/branches/GSoC-config/squirrelmail/themes/greenhouse_effect.php

#
PHP | 49 lines | 21 code | 7 blank | 21 comment | 19 complexity | e52b909bc4320fdf4e76b0082bf3cddf MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0
  1. <?php
  2. /**
  3. * Name: Greenhouse Effect
  4. * Date: October 20, 2001
  5. * Comment: This theme generates random colors, featuring a
  6. * light greenish background.
  7. *
  8. * @author Joey Bump
  9. * @copyright &copy; 2000-2007 The SquirrelMail Project Team
  10. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  11. * @version $Id: greenhouse_effect.php 12271 2007-02-18 12:46:47Z kink $
  12. * @package squirrelmail
  13. * @subpackage themes
  14. */
  15. /** Prevent direct script loading */
  16. if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) {
  17. die();
  18. }
  19. /** load sq_mt_randomize() */
  20. include_once(SM_PATH . 'functions/strings.php');
  21. /** seed the random number generator **/
  22. sq_mt_randomize();
  23. for ($i = 0; $i <= 15; $i++) {
  24. /* background/foreground toggle **/
  25. if (($i == 0) || ($i == 3) || ($i == 4) || ($i == 5)
  26. || ($i == 9) || ($i == 10) || ($i == 12)) {
  27. /* background */
  28. $g = mt_rand(248,255);
  29. $r = mt_rand(110,248);
  30. $b = mt_rand(109,$r);
  31. } else {
  32. /* text */
  33. $cmin = 0;
  34. $cmax = 96;
  35. /** generate random color **/
  36. $b = mt_rand($cmin,$cmax);
  37. $g = mt_rand($cmin,$cmax);
  38. $r = mt_rand($cmin,$cmax);
  39. }
  40. /** set array element as hex string with hashmark (for HTML output) **/
  41. $color[$i] = sprintf('#%02X%02X%02X',$r,$g,$b);
  42. }