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");
22 // Remove all slashes for form values
23 if (get_magic_quotes_gpc())
25 global $REQUEST_METHOD;
26 if ($REQUEST_METHOD == "POST")
28 global $HTTP_POST_VARS;
29 RemoveSlashes($HTTP_POST_VARS);
31 elseif ($REQUEST_METHOD == "GET")
33 global $HTTP_GET_VARS;
34 RemoveSlashes($HTTP_GET_VARS);
40 // if $send (the form button's name) contains "\n" as the first char
41 // and the script is compose.php, then trim everything. Otherwise,
42 // we don't have to worry.
44 // This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug
45 global $send, $PHP_SELF;
46 if (isset($send) && substr($send, 0, 1) == "\n" &&
47 substr($PHP_SELF, -12) == '/compose.php')
49 if ($REQUEST_METHOD == "POST") {
50 global $HTTP_POST_VARS;
51 TrimArray($HTTP_POST_VARS);
53 global $HTTP_GET_VARS;
54 TrimArray($HTTP_GET_VARS);
58 //**************************************************************************
59 // Trims every element in the array
60 //**************************************************************************
61 function TrimArray(&$array) {
62 foreach ($array as $k => $v) {
65 foreach ($
$k as $k2 => $v2) {
66 $
$k[$k2] = substr($v2, 1);
71 // Re-assign back to array
77 //**************************************************************************
78 // Removes slashes from every element in the array
79 //**************************************************************************
80 function RemoveSlashes(&$array)
82 foreach ($array as $k => $v)
87 foreach ($
$k as $k2 => $v2)
89 $newArray[stripslashes($k2)] = stripslashes($v2);
95 $
$k = stripslashes($v);
97 // Re-assign back to the array