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$ |
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'); |
1d80c108 |
46 | require_once(SM_PATH . 'functions/noframes.php'); |
ebabf3f5 |
47 | |
48 | /* set the name of the session cookie */ |
49 | if(isset($session_name) && $session_name) { |
50 | ini_set('session.name' , $session_name); |
51 | } else { |
52 | ini_set('session.name' , 'SQMSESSID'); |
53 | } |
fffe7fb2 |
54 | |
748ba6c0 |
55 | sqsession_is_active(); |
cab99c3a |
56 | |
86725763 |
57 | require_once(SM_PATH . 'functions/i18n.php'); |
58 | require_once(SM_PATH . 'functions/auth.php'); |
f740c049 |
59 | |
cab99c3a |
60 | is_logged_in(); |
f740c049 |
61 | |
cab99c3a |
62 | /** |
63 | * Auto-detection |
64 | * |
65 | * if $send (the form button's name) contains "\n" as the first char |
66 | * and the script is compose.php, then trim everything. Otherwise, we |
67 | * don't have to worry. |
68 | * |
69 | * This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug |
70 | */ |
71 | global $send, $PHP_SELF; |
72 | if (isset($send) |
73 | && (substr($send, 0, 1) == "\n") |
74 | && (substr($PHP_SELF, -12) == '/compose.php')) { |
5be9f195 |
75 | if ($REQUEST_METHOD == 'POST') { |
cab99c3a |
76 | global $HTTP_POST_VARS; |
77 | TrimArray($HTTP_POST_VARS); |
78 | } else { |
79 | global $HTTP_GET_VARS; |
80 | TrimArray($HTTP_GET_VARS); |
f7b1b3b1 |
81 | } |
cab99c3a |
82 | } |
f7b1b3b1 |
83 | |
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 | ?> |