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