| 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 | /* include the mime class before the session start ! otherwise we can't store |
| 13 | * messages with a session_register. |
| 14 | */ |
| 15 | |
| 16 | /* SquirrelMail required files. */ |
| 17 | require_once(SM_PATH . 'class/mime.class.php'); |
| 18 | |
| 19 | session_start(); |
| 20 | |
| 21 | require_once(SM_PATH . 'functions/i18n.php'); |
| 22 | require_once(SM_PATH . 'functions/auth.php'); |
| 23 | require_once(SM_PATH . 'functions/strings.php'); |
| 24 | require_once(SM_PATH . 'functions/global.php'); |
| 25 | |
| 26 | is_logged_in(); |
| 27 | |
| 28 | /* Remove all slashes for form values. */ |
| 29 | if (get_magic_quotes_gpc()) { |
| 30 | global $REQUEST_METHOD; |
| 31 | |
| 32 | if ($REQUEST_METHOD == 'POST') { |
| 33 | global $HTTP_POST_VARS; |
| 34 | RemoveSlashes($HTTP_POST_VARS); |
| 35 | } else if ($REQUEST_METHOD == 'GET') { |
| 36 | global $HTTP_GET_VARS; |
| 37 | RemoveSlashes($HTTP_GET_VARS); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Auto-detection |
| 43 | * |
| 44 | * if $send (the form button's name) contains "\n" as the first char |
| 45 | * and the script is compose.php, then trim everything. Otherwise, we |
| 46 | * don't have to worry. |
| 47 | * |
| 48 | * This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug |
| 49 | */ |
| 50 | global $send, $PHP_SELF; |
| 51 | if (isset($send) |
| 52 | && (substr($send, 0, 1) == "\n") |
| 53 | && (substr($PHP_SELF, -12) == '/compose.php')) { |
| 54 | if ($REQUEST_METHOD == 'POST') { |
| 55 | global $HTTP_POST_VARS; |
| 56 | TrimArray($HTTP_POST_VARS); |
| 57 | } else { |
| 58 | global $HTTP_GET_VARS; |
| 59 | TrimArray($HTTP_GET_VARS); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Everyone needs stuff from config, and config needs stuff from |
| 65 | * strings.php, so include them both here. Actually, strings is |
| 66 | * included at the top now as the string array functions have |
| 67 | * been moved into it. |
| 68 | * |
| 69 | * Include them down here instead of at the top so that all config |
| 70 | * variables overwrite any passed in variables (for security). |
| 71 | */ |
| 72 | |
| 73 | /** |
| 74 | * Reset the $theme() array in case a value was passed via a cookie. |
| 75 | * This is until theming is rewritten. |
| 76 | */ |
| 77 | global $theme; |
| 78 | unset($theme); |
| 79 | $theme=array(); |
| 80 | |
| 81 | require_once(SM_PATH . 'config/config.php'); |
| 82 | require_once(SM_PATH . 'include/load_prefs.php'); |
| 83 | require_once(SM_PATH . 'functions/page_header.php'); |
| 84 | require_once(SM_PATH . 'functions/prefs.php'); |
| 85 | |
| 86 | /* Set up the language (i18n.php was included by auth.php). */ |
| 87 | global $username, $data_dir; |
| 88 | set_up_language(getPref($data_dir, $username, 'language')); |
| 89 | |
| 90 | $timeZone = getPref($data_dir, $username, 'timezone'); |
| 91 | if ( $timeZone != SMPREF_NONE && ($timeZone != "") |
| 92 | && !ini_get("safe_mode")) { |
| 93 | putenv("TZ=".$timeZone); |
| 94 | } |
| 95 | ?> |