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