~ubuntu-branches/ubuntu/quantal/squirrelmail/quantal

« back to all changes in this revision

Viewing changes to themes/darkness.php

  • Committer: Bazaar Package Importer
  • Author(s): Thijs Kinkhorst
  • Date: 2008-09-28 16:33:48 UTC
  • mfrom: (11.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080928163348-hgxf8au2d4zspabg
Tags: 2:1.4.15-3
Cookies sent over HTTPS will now be confined to HTTPS only
(cookie secure flag) and more support for the HTTPOnly cookie
attribute. Patch taken from upstream release.
(CVE-2008-3663, closes: #499942)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 * Like black?
6
6
 *
7
7
 * @author Tyler Akins
8
 
 * @copyright © 2001-2006 The SquirrelMail Project Team
 
8
 * @copyright © 2001-2007 The SquirrelMail Project Team
9
9
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10
 
 * @version $Id: darkness.php,v 1.10.2.2 2006/02/03 22:27:56 jervfors Exp $
 
10
 * @version $Id: darkness.php 12948 2008-02-16 12:08:28Z jervfors $
11
11
 * @package squirrelmail
12
12
 * @subpackage themes
13
13
 */
42
42
// Always tremble background
43
43
// This might make people go insane.  Yes!  *Victory dance!*
44
44
function Darkness_HeaderPlugin() {
45
 
   global $PHP_SELF;
46
 
 
47
 
   if (substr($PHP_SELF, -18) == '/src/left_main.php') {
 
45
   if (defined('PAGE_NAME') && PAGE_NAME=='left_main') {
48
46
      echo '<meta http-equiv="Page-Enter" content="' .
49
47
         'blendTrans(Duration=2.0)" />' . "\n";
50
48
   }
51
49
 
52
 
?><script language="javascript">
 
50
?><script type="text/javascript">
53
51
darkness_color = 0;
54
52
darkness_dir = +1;
55
53
darkness_hex = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
75
73
$squirrelmail_plugin_hooks['generic_header']['theme_darkness'] =
76
74
    'Darkness_HeaderPlugin';
77
75
 
78
 
   /** seed the random number generator **/
79
 
   sq_mt_randomize();
 
76
/** seed the random number generator **/
 
77
sq_mt_randomize();
80
78
 
81
 
   $color[3] = '#000000';
82
 
   $color[4] = '#000000';
83
 
   $used = array(0);
84
 
   $targetDistance = $BackgroundTargetDistance;
85
 
   $Left = array(0, 5, 9, 10, 12);
86
 
   while (count($Left) > 0) {
87
 
      // Some background colors
88
 
      $r = mt_rand(24,64);
89
 
      $unique = true;
90
 
      foreach ($used as $col) {
91
 
         if (abs($r - $col) < $targetDistance)
 
79
$color[3] = '#000000';
 
80
$color[4] = '#000000';
 
81
$used = array(0);
 
82
$targetDistance = $BackgroundTargetDistance;
 
83
$Left = array(0, 5, 9, 10, 12);
 
84
while (count($Left) > 0) {
 
85
    // Some background colors
 
86
    $r = mt_rand(24,64);
 
87
    $unique = true;
 
88
    foreach ($used as $col) {
 
89
        if (abs($r - $col) < $targetDistance)
92
90
            $unique = false;
93
 
      }
94
 
      if ($unique) {
95
 
         $i = array_shift($Left);
96
 
         $color[$i] = sprintf('#%02X%02X%02X',$r,$r, $r);
97
 
         $used[] = $r;
98
 
         $targetDistance = $BackgroundTargetDistance;
99
 
      } else {
100
 
         $targetDistance -= $BackgroundAdjust;
101
 
      }
102
 
   }
103
 
 
104
 
   // Set the error color to some shade of red
105
 
   $r = mt_rand(196, 255);
106
 
   $g = mt_rand(144, ($r * .8));
107
 
   $color[2] = sprintf('#%02X%02X%02X', $r, $g, $g);
108
 
   $used = array(array($r, $g, $g));
109
 
 
110
 
   // Set normal text colors
111
 
   $cmin = 196;
112
 
   $cmax = 255;
113
 
   foreach (array(6, 8) as $i) {
114
 
      /** generate random color **/
115
 
      $r = mt_rand($cmin,$cmax);
116
 
      $g = mt_rand($cmin,$cmax);
117
 
      $b = mt_rand($cmin,$cmax);
118
 
      $color[$i] = sprintf('#%02X%02X%02X',$r,$g,$b);
119
 
      $used[] = array($r, $g, $b);
120
 
   }
121
 
 
122
 
   $Left = array(1, 7, 11, 13, 14, 15);
123
 
   $targetDistance = $TextTargetDistance;
124
 
   while (count($Left) > 0) {
125
 
      // Text colors -- Try to keep the colors distinct
126
 
      $cmin = 196;
127
 
      $cmax = 255;
128
 
 
129
 
      /** generate random color **/
130
 
      $r = mt_rand($cmin,$cmax);
131
 
      $g = mt_rand($cmin,$cmax);
132
 
      $b = mt_rand($cmin,$cmax);
133
 
 
134
 
      if (IsUnique($targetDistance, $r, $g, $b, $used)) {
135
 
         $i = array_shift($Left);
136
 
         $color[$i] = sprintf('#%02X%02X%02X',$r,$g,$b);
137
 
         $used[] = array($r, $g, $b);
138
 
         $targetDistance = $TextTargetDistance;
139
 
      } else {
140
 
         $targetDistance *= $TextAdjust;
141
 
      }
142
 
   }
143
 
 
144
 
 
145
 
/** Reference from  doc/themes.txt
146
 
 
147
 
b  0: Title Bar at the top of the page header
148
 
f  1: <not currently used>
149
 
f  2: Error messages, usually red
150
 
b  3: Left folder list background color
151
 
b  4: Normal background color
152
 
b  5: Header of the message index [From, Date, Subject]
153
 
f  6: Normal text on the left folder list
154
 
f  7: Links in the right frame, Folders with subfolders in left frame
155
 
f  8: Normal text [usually black]
156
 
b  9: Darker version of #0
157
 
b 10: Darker version of #9
158
 
f 11: Special folders color [Inbox, Trash, Sent]
159
 
b 12: Alternate color for message list [alters between 4 and this one]
160
 
f 13: Color for single-quoted text ('> text') when reading (default:  #800000)
161
 
f 14: Color for text with more than one quote (default: #FF0000)
162
 
 
163
 
**/
164
 
 
165
 
?>
 
 
b'\\ No newline at end of file'
 
91
    }
 
92
    if ($unique) {
 
93
        $i = array_shift($Left);
 
94
        $color[$i] = sprintf('#%02X%02X%02X',$r,$r, $r);
 
95
        $used[] = $r;
 
96
        $targetDistance = $BackgroundTargetDistance;
 
97
    } else {
 
98
        $targetDistance -= $BackgroundAdjust;
 
99
    }
 
100
}
 
101
 
 
102
// Set the error color to some shade of red
 
103
$r = mt_rand(196, 255);
 
104
$g = mt_rand(144, ($r * .8));
 
105
$color[2] = sprintf('#%02X%02X%02X', $r, $g, $g);
 
106
$used = array(array($r, $g, $g));
 
107
 
 
108
// Set normal text colors
 
109
$cmin = 196;
 
110
$cmax = 255;
 
111
foreach (array(6, 8) as $i) {
 
112
    /** generate random color **/
 
113
    $r = mt_rand($cmin,$cmax);
 
114
    $g = mt_rand($cmin,$cmax);
 
115
    $b = mt_rand($cmin,$cmax);
 
116
    $color[$i] = sprintf('#%02X%02X%02X',$r,$g,$b);
 
117
    $used[] = array($r, $g, $b);
 
118
}
 
119
 
 
120
$Left = array(1, 7, 11, 13, 14, 15);
 
121
$targetDistance = $TextTargetDistance;
 
122
while (count($Left) > 0) {
 
123
    // Text colors -- Try to keep the colors distinct
 
124
    $cmin = 196;
 
125
    $cmax = 255;
 
126
 
 
127
    /** generate random color **/
 
128
    $r = mt_rand($cmin,$cmax);
 
129
    $g = mt_rand($cmin,$cmax);
 
130
    $b = mt_rand($cmin,$cmax);
 
131
 
 
132
    if (IsUnique($targetDistance, $r, $g, $b, $used)) {
 
133
        $i = array_shift($Left);
 
134
        $color[$i] = sprintf('#%02X%02X%02X',$r,$g,$b);
 
135
        $used[] = array($r, $g, $b);
 
136
        $targetDistance = $TextTargetDistance;
 
137
    } else {
 
138
        $targetDistance *= $TextAdjust;
 
139
    }
 
140
}