Added a conversion from < to &lt; when viewing "non-HTML" email for
[squirrelmail.git] / functions / strings.php
index dea7319aa1730b1431b3ed1fddd77e582e62c2db..dcef5bd0c11200de57a3626f18b4b0f020335fd8 100644 (file)
 
    function translateText(&$body, $wrap_at, $charset) {
       global $where, $what; // from searching
+      global $color; // color theme
 
       include '../functions/url_parser.php';
       
              }
          }
          
-         if ($Quotes > 1)
-            $line = '<FONT COLOR="FF0000">'.$line.'</FONT>';
-         elseif ($Quotes)
-            $line = '<FONT COLOR="800000">'.$line.'</FONT>';
+         if ($Quotes > 1) {
+           if (! isset($color[14]))
+              $color[14] = '#FF0000';
+            $line = '<FONT COLOR="' . $color[14] . '">' . $line . '</FONT>';
+        } elseif ($Quotes) {
+           if (! isset($color[13]))
+              $color[13] = '#800000';
+            $line = '<FONT COLOR="' . $color[13] . '">' . $line . '</FONT>';
+        }
 
          $body_ary[$i] = $line;
       }
 
    /* SquirrelMail version number -- DO NOT CHANGE */
    global $version;
-   $version = '1.1.0 [cvs]';
+   $version = '1.2.0 [cvs]';
 
 
    function find_mailbox_name ($mailbox) {
       #
       #   http://www.myhost.com/squirrelmail/src/login.php
    
-      global $PHP_SELF, $SERVER_NAME, $HTTPS, $HTTP_HOST, $SERVER_PORT;
+      global $PHP_SELF, $SERVER_NAME, $HTTP_HOST, $SERVER_PORT,
+         $HTTP_SERVER_VARS;
 
       // Get the path
       $path = substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'));
    
       // Check if this is a HTTPS or regular HTTP request
       $proto = 'http://';
-      if(isset($HTTPS) && !strcasecmp($HTTPS, 'on') ) {
+      // If you have 'SSLOptions +StdEnvVars' in your apache config
+      // OR if you have HTTPS in your HTTP_SERVER_VARS
+      // OR if you are on port 443
+      $getEnvVar = getenv('HTTPS');
+      if ((isset($getEnvVar) && !strcasecmp($getEnvVar, 'on')) ||
+          (isset($HTTP_SERVER_VARS['HTTPS'])) ||
+         (isset($HTTP_SERVER_VARS['SERVER_PORT']) &&
+          $HTTP_SERVER_VARS['SERVER_PORT'] == 443)) {
         $proto = 'https://';
       }
    
       
       // getrusage
       if (function_exists('getrusage')) {
-         $dat = getrusage();
-          $Str = '';
-          foreach ($dat as $k => $v)
-          {
-              $Str .= $k . $v;
-          }
-          sq_mt_seed(md5($Str));
+         // Avoid warnings with Win32
+         $dat = @getrusage();
+        if (isset($dat) && is_array($dat))
+        {
+            $Str = '';
+            foreach ($dat as $k => $v)
+            {
+               $Str .= $k . $v;
+            }
+            sq_mt_seed(md5($Str));
+        }
       }
       
       // Apache-specific