/* $Id$ */
- $strings_php = true;
- $fix_form_endlines = false;
-
- // Remove all slashes for form values
- if (get_magic_quotes_gpc())
- {
- global $REQUEST_METHOD;
- if ($REQUEST_METHOD == "POST")
- {
- global $HTTP_POST_VARS;
- RemoveSlashes($HTTP_POST_VARS);
- }
- elseif ($REQUEST_METHOD == "GET")
- {
- global $HTTP_GET_VARS;
- RemoveSlashes($HTTP_GET_VARS);
- }
- }
-
- // Auto-detection
- //
- // if $send (the form button's name) contains "\n" as the first char
- // and the script is compose.php, then trim everything. Otherwise,
- // we don't have to worry.
- global $send, $PHP_SELF;
- if (isset($send) && substr($send, 0, 1) == "\n" &&
- substr($PHP_SELF, -12) == "/compose.php")
- {
- if ($REQUEST_METHOD == "POST") {
- TrimArray($HTTP_POST_VARS);
- } else {
- TrimArray($HTTP_GET_VARS);
- }
- }
-
- //**************************************************************************
- // Trims every element in the array
- //**************************************************************************
- function TrimArray(&$array) {
- foreach ($array as $k => $v) {
- global $$k;
- if (is_array($$k)) {
- foreach ($$k as $k2 => $v2) {
- $$k[$k2] = substr($v2, 1);
- }
- } else {
- $$k = substr($v, 1);
- }
- }
- }
-
-
- //**************************************************************************
- // Removes slashes from every element in the array
- //**************************************************************************
- function RemoveSlashes($array)
- {
- foreach ($array as $k => $v)
- {
- global $$k;
- if (is_array($$k))
- {
- foreach ($$k as $k2 => $v2)
- {
- $newArray[stripslashes($k2)] = stripslashes($v2);
- }
- $$k = $newArray;
- }
- else
- {
- $$k = stripslashes($v);
- }
- }
- }
+ if (defined('strings_php'))
+ return;
+ define('strings_php', true);
//*************************************************************************
function getLineOfAddrs($array) {
if (is_array($array)) {
$to_line = implode(', ', $array);
- $to_line = trim(ereg_replace(',,+', ',', $to_line));
+ $to_line = trim(ereg_replace(', (, )+', ', ', $to_line));
} else {
$to_line = '';
}
function translateText(&$body, $wrap_at, $charset) {
global $where, $what; // from searching
- global $url_parser_php;
+ global $color; // color theme
- if (!isset($url_parser_php)) {
- include '../functions/url_parser.php';
- }
+ require_once('../functions/url_parser.php');
$body_ary = explode("\n", $body);
$PriorQuotes = 0;
}
}
- 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 */
- $version = '1.0.3 [cvs]';
+ global $version;
+ $version = '1.2.0 [cvs]';
function find_mailbox_name ($mailbox) {
}
- function replace_spaces ($string) {
- return str_replace(' ', ' ', $string);
- }
-
- function replace_escaped_spaces ($string) {
- return str_replace(' ', ' ', $string);
- }
-
function get_location () {
# This determines the location to forward to relative
# to your server. If this doesnt work correctly for
#
# 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
return $String;
}
+
+ function quoteIMAP($str)
+ {
+ return ereg_replace('(["\\])', '\\\\1', $str);
+ }
-?>
+?>
\ No newline at end of file