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