removing empty and unused save_option_header() function.
[squirrelmail.git] / include / validate.php
CommitLineData
f740c049 1<?php
895905c0 2
35586184 3/**
cab99c3a 4* validate.php
5*
6c84ba1e 6* Copyright (c) 1999-2005 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:
91e0dccc 18 * In 4.2 and below:
de702cb8 19 * session.auto_start and session objects are mutually exclusive.
20 *
91e0dccc 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.
de702cb8 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 31session_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 */
37global $theme;
38unset($theme);
39$theme=array();
40
86725763 41/* SquirrelMail required files. */
42require_once(SM_PATH . 'class/mime.class.php');
ccbe63ba 43require_once(SM_PATH . 'functions/global.php');
67b73d65 44require_once(SM_PATH . 'functions/strings.php');
ebabf3f5 45require_once(SM_PATH . 'config/config.php');
46
47/* set the name of the session cookie */
48if(isset($session_name) && $session_name) {
49 ini_set('session.name' , $session_name);
50} else {
51 ini_set('session.name' , 'SQMSESSID');
52}
fffe7fb2 53
748ba6c0 54sqsession_is_active();
cab99c3a 55
86725763 56require_once(SM_PATH . 'functions/i18n.php');
57require_once(SM_PATH . 'functions/auth.php');
f740c049 58
cab99c3a 59is_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*/
70global $send, $PHP_SELF;
71if (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 83require_once(SM_PATH . 'include/load_prefs.php');
86725763 84require_once(SM_PATH . 'functions/page_header.php');
85require_once(SM_PATH . 'functions/prefs.php');
d4e84069 86
cab99c3a 87/* Set up the language (i18n.php was included by auth.php). */
88global $username, $data_dir;
89set_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.
91e0dccc 94 * We are able to do this if ...
31afdbff 95 * safe_mode is disabled OR
96 * safe_mode_allowed_env_vars is empty (you are allowed to set any) OR
91e0dccc 97 * safe_mode_allowed_env_vars contains TZ
31afdbff 98 */
99$tzChangeAllowed = (!ini_get('safe_mode')) ||
91e0dccc 100 !strcmp(ini_get('safe_mode_allowed_env_vars'),'') ||
101 preg_match('/^([\w_]+,)*TZ/', ini_get('safe_mode_allowed_env_vars'));
31afdbff 102
91e0dccc 103if ( $timeZone != SMPREF_NONE && ($timeZone != "")
31afdbff 104 && $tzChangeAllowed ) {
4d14fc00 105 putenv("TZ=".$timeZone);
7bcc8f54 106}
bb7173fa 107
108?>