| 1 | <?php |
| 2 | /** |
| 3 | * validate.php |
| 4 | * |
| 5 | * Copyright (c) 1999-2000 The SquirrelMail Development Team |
| 6 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 7 | * |
| 8 | * $Id$ |
| 9 | */ |
| 10 | |
| 11 | if (defined ('validate_php')) { return; } |
| 12 | define ('validate_php', true); |
| 13 | |
| 14 | session_start(); |
| 15 | require_once('../functions/i18n.php'); |
| 16 | require_once('../functions/auth.php'); |
| 17 | require_once('../functions/strings.php'); |
| 18 | |
| 19 | is_logged_in(); |
| 20 | |
| 21 | /* Remove all slashes for form values. */ |
| 22 | if (get_magic_quotes_gpc()) { |
| 23 | global $REQUEST_METHOD; |
| 24 | |
| 25 | if ($REQUEST_METHOD == "POST") { |
| 26 | global $HTTP_POST_VARS; |
| 27 | RemoveSlashes($HTTP_POST_VARS); |
| 28 | } else if ($REQUEST_METHOD == "GET") { |
| 29 | global $HTTP_GET_VARS; |
| 30 | RemoveSlashes($HTTP_GET_VARS); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Auto-detection |
| 36 | * |
| 37 | * if $send (the form button's name) contains "\n" as the first char |
| 38 | * and the script is compose.php, then trim everything. Otherwise, we |
| 39 | * don't have to worry. |
| 40 | * |
| 41 | * This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug |
| 42 | */ |
| 43 | global $send, $PHP_SELF; |
| 44 | if (isset($send) |
| 45 | && (substr($send, 0, 1) == "\n") |
| 46 | && (substr($PHP_SELF, -12) == '/compose.php')) { |
| 47 | if ($REQUEST_METHOD == "POST") { |
| 48 | global $HTTP_POST_VARS; |
| 49 | TrimArray($HTTP_POST_VARS); |
| 50 | } else { |
| 51 | global $HTTP_GET_VARS; |
| 52 | TrimArray($HTTP_GET_VARS); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Everyone needs stuff from config, and config needs stuff from |
| 58 | * strings.php, so include them both here. Actually, strings is |
| 59 | * included at the top now as the string array functions have |
| 60 | * been moved into it. |
| 61 | * |
| 62 | * Include them down here instead of at the top so that all config |
| 63 | * variables overwrite any passed in variables (for security). |
| 64 | */ |
| 65 | require_once('../config/config.php'); |
| 66 | require_once('../src/load_prefs.php'); |
| 67 | require_once('../functions/page_header.php'); |
| 68 | require_once('../functions/prefs.php'); |
| 69 | |
| 70 | /* Set up the language (i18n.php was included by auth.php). */ |
| 71 | global $username, $data_dir; |
| 72 | set_up_language(getPref($data_dir, $username, 'language')); |
| 73 | ?> |