5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
11 if (defined ('validate_php')) {
14 define ('validate_php', true);
18 include ('../functions/auth.php');
20 // Everyone needs stuff from config, and config needs stuff from
21 // strings.php, so include them both here.
22 include ('../functions/strings.php');
23 include ('../config/config.php');
28 // Remove all slashes for form values
29 if (get_magic_quotes_gpc())
31 global $REQUEST_METHOD;
32 if ($REQUEST_METHOD == "POST")
34 global $HTTP_POST_VARS;
35 RemoveSlashes($HTTP_POST_VARS);
37 elseif ($REQUEST_METHOD == "GET")
39 global $HTTP_GET_VARS;
40 RemoveSlashes($HTTP_GET_VARS);
46 // if $send (the form button's name) contains "\n" as the first char
47 // and the script is compose.php, then trim everything. Otherwise,
48 // we don't have to worry.
50 // This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug
51 global $send, $PHP_SELF;
52 if (isset($send) && substr($send, 0, 1) == "\n" &&
53 substr($PHP_SELF, -12) == '/compose.php')
55 if ($REQUEST_METHOD == "POST") {
56 global $HTTP_POST_VARS;
57 TrimArray($HTTP_POST_VARS);
59 global $HTTP_GET_VARS;
60 TrimArray($HTTP_GET_VARS);
64 //**************************************************************************
65 // Trims every element in the array
66 //**************************************************************************
67 function TrimArray(&$array) {
68 foreach ($array as $k => $v) {
71 foreach ($
$k as $k2 => $v2) {
72 $
$k[$k2] = substr($v2, 1);
77 // Re-assign back to array
83 //**************************************************************************
84 // Removes slashes from every element in the array
85 //**************************************************************************
86 function RemoveSlashes(&$array)
88 foreach ($array as $k => $v)
93 foreach ($
$k as $k2 => $v2)
95 $newArray[stripslashes($k2)] = stripslashes($v2);
101 $
$k = stripslashes($v);
103 // Re-assign back to the array