f740c049 |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
cab99c3a |
4 | * validate.php |
5 | * |
76911253 |
6 | * Copyright (c) 1999-2003 The SquirrelMail Project Team |
cab99c3a |
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 | */ |
ebabf3f5 |
29 | |
de702cb8 |
30 | session_write_close(); |
31 | |
a1a4a6e4 |
32 | /** |
33 | * Reset the $theme() array in case a value was passed via a cookie. |
34 | * This is until theming is rewritten. |
35 | */ |
36 | global $theme; |
37 | unset($theme); |
38 | $theme=array(); |
39 | |
86725763 |
40 | /* SquirrelMail required files. */ |
41 | require_once(SM_PATH . 'class/mime.class.php'); |
ccbe63ba |
42 | require_once(SM_PATH . 'functions/global.php'); |
67b73d65 |
43 | require_once(SM_PATH . 'functions/strings.php'); |
ebabf3f5 |
44 | require_once(SM_PATH . 'config/config.php'); |
45 | |
46 | /* set the name of the session cookie */ |
47 | if(isset($session_name) && $session_name) { |
48 | ini_set('session.name' , $session_name); |
49 | } else { |
50 | ini_set('session.name' , 'SQMSESSID'); |
51 | } |
fffe7fb2 |
52 | |
35586184 |
53 | session_start(); |
cab99c3a |
54 | |
86725763 |
55 | require_once(SM_PATH . 'functions/i18n.php'); |
56 | require_once(SM_PATH . 'functions/auth.php'); |
f740c049 |
57 | |
cab99c3a |
58 | is_logged_in(); |
f740c049 |
59 | |
cab99c3a |
60 | /** |
61 | * Auto-detection |
62 | * |
63 | * if $send (the form button's name) contains "\n" as the first char |
64 | * and the script is compose.php, then trim everything. Otherwise, we |
65 | * don't have to worry. |
66 | * |
67 | * This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug |
68 | */ |
69 | global $send, $PHP_SELF; |
70 | if (isset($send) |
71 | && (substr($send, 0, 1) == "\n") |
72 | && (substr($PHP_SELF, -12) == '/compose.php')) { |
5be9f195 |
73 | if ($REQUEST_METHOD == 'POST') { |
cab99c3a |
74 | global $HTTP_POST_VARS; |
75 | TrimArray($HTTP_POST_VARS); |
76 | } else { |
77 | global $HTTP_GET_VARS; |
78 | TrimArray($HTTP_GET_VARS); |
f7b1b3b1 |
79 | } |
cab99c3a |
80 | } |
f7b1b3b1 |
81 | |
08185f2a |
82 | require_once(SM_PATH . 'include/load_prefs.php'); |
86725763 |
83 | require_once(SM_PATH . 'functions/page_header.php'); |
84 | require_once(SM_PATH . 'functions/prefs.php'); |
d4e84069 |
85 | |
cab99c3a |
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')); |
5be9f195 |
89 | |
7bcc8f54 |
90 | $timeZone = getPref($data_dir, $username, 'timezone'); |
31afdbff |
91 | |
92 | /* Check to see if we are allowed to set the TZ environment variable. |
93 | * We are able to do this if ... |
94 | * safe_mode is disabled OR |
95 | * safe_mode_allowed_env_vars is empty (you are allowed to set any) OR |
96 | * safe_mode_allowed_env_vars contains TZ |
97 | */ |
98 | $tzChangeAllowed = (!ini_get('safe_mode')) || |
99 | !strcmp(ini_get('safe_mode_allowed_env_vars'),'') || |
100 | preg_match('/^([\w_]+,)*TZ/', ini_get('safe_mode_allowed_env_vars')); |
101 | |
4d14fc00 |
102 | if ( $timeZone != SMPREF_NONE && ($timeZone != "") |
31afdbff |
103 | && $tzChangeAllowed ) { |
4d14fc00 |
104 | putenv("TZ=".$timeZone); |
7bcc8f54 |
105 | } |
f8effb0c |
106 | ?> |