f740c049 |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
cab99c3a |
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 | */ |
f740c049 |
11 | |
fffe7fb2 |
12 | /* include the mime class before the session start ! otherwise we can't store |
13 | * messages with a session_register. |
de702cb8 |
14 | * |
15 | * From http://www.php.net/manual/en/language.oop.serialization.php: |
16 | * In case this isn't clear: |
17 | * In 4.2 and below: |
18 | * session.auto_start and session objects are mutually exclusive. |
19 | * |
20 | * We need to load the classes before the session is started, |
21 | * except that the session could be started automatically |
22 | * via session.auto_start. So, we'll close the session, |
23 | * then load the classes, and reopen the session which should |
24 | * make everything happy. |
25 | * |
26 | * ** Note this means that for the 1.3.2 release, we should probably |
27 | * recommend that people set session.auto_start=0 to avoid this altogether. |
fffe7fb2 |
28 | */ |
de702cb8 |
29 | session_write_close(); |
30 | |
86725763 |
31 | /* SquirrelMail required files. */ |
32 | require_once(SM_PATH . 'class/mime.class.php'); |
fffe7fb2 |
33 | |
35586184 |
34 | session_start(); |
cab99c3a |
35 | |
86725763 |
36 | require_once(SM_PATH . 'functions/i18n.php'); |
37 | require_once(SM_PATH . 'functions/auth.php'); |
38 | require_once(SM_PATH . 'functions/strings.php'); |
39 | require_once(SM_PATH . 'functions/global.php'); |
f740c049 |
40 | |
cab99c3a |
41 | is_logged_in(); |
f740c049 |
42 | |
cab99c3a |
43 | /** |
44 | * Auto-detection |
45 | * |
46 | * if $send (the form button's name) contains "\n" as the first char |
47 | * and the script is compose.php, then trim everything. Otherwise, we |
48 | * don't have to worry. |
49 | * |
50 | * This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug |
51 | */ |
52 | global $send, $PHP_SELF; |
53 | if (isset($send) |
54 | && (substr($send, 0, 1) == "\n") |
55 | && (substr($PHP_SELF, -12) == '/compose.php')) { |
5be9f195 |
56 | if ($REQUEST_METHOD == 'POST') { |
cab99c3a |
57 | global $HTTP_POST_VARS; |
58 | TrimArray($HTTP_POST_VARS); |
59 | } else { |
60 | global $HTTP_GET_VARS; |
61 | TrimArray($HTTP_GET_VARS); |
f7b1b3b1 |
62 | } |
cab99c3a |
63 | } |
f7b1b3b1 |
64 | |
cab99c3a |
65 | /** |
66 | * Everyone needs stuff from config, and config needs stuff from |
67 | * strings.php, so include them both here. Actually, strings is |
68 | * included at the top now as the string array functions have |
69 | * been moved into it. |
70 | * |
71 | * Include them down here instead of at the top so that all config |
72 | * variables overwrite any passed in variables (for security). |
73 | */ |
5dfb4b0b |
74 | |
75 | /** |
76 | * Reset the $theme() array in case a value was passed via a cookie. |
77 | * This is until theming is rewritten. |
78 | */ |
79 | global $theme; |
80 | unset($theme); |
81 | $theme=array(); |
82 | |
86725763 |
83 | require_once(SM_PATH . 'config/config.php'); |
08185f2a |
84 | require_once(SM_PATH . 'include/load_prefs.php'); |
86725763 |
85 | require_once(SM_PATH . 'functions/page_header.php'); |
86 | require_once(SM_PATH . 'functions/prefs.php'); |
d4e84069 |
87 | |
cab99c3a |
88 | /* Set up the language (i18n.php was included by auth.php). */ |
89 | global $username, $data_dir; |
90 | set_up_language(getPref($data_dir, $username, 'language')); |
5be9f195 |
91 | |
7bcc8f54 |
92 | $timeZone = getPref($data_dir, $username, 'timezone'); |
31afdbff |
93 | |
94 | /* Check to see if we are allowed to set the TZ environment variable. |
95 | * We are able to do this if ... |
96 | * safe_mode is disabled OR |
97 | * safe_mode_allowed_env_vars is empty (you are allowed to set any) OR |
98 | * safe_mode_allowed_env_vars contains TZ |
99 | */ |
100 | $tzChangeAllowed = (!ini_get('safe_mode')) || |
101 | !strcmp(ini_get('safe_mode_allowed_env_vars'),'') || |
102 | preg_match('/^([\w_]+,)*TZ/', ini_get('safe_mode_allowed_env_vars')); |
103 | |
4d14fc00 |
104 | if ( $timeZone != SMPREF_NONE && ($timeZone != "") |
31afdbff |
105 | && $tzChangeAllowed ) { |
4d14fc00 |
106 | putenv("TZ=".$timeZone); |
7bcc8f54 |
107 | } |
f8effb0c |
108 | ?> |