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