~ubuntu-branches/ubuntu/hardy/squirrelmail/hardy-updates

« back to all changes in this revision

Viewing changes to include/validate.php

  • Committer: Bazaar Package Importer
  • Author(s): Sam Johnston
  • Date: 2004-02-04 01:42:12 UTC
  • Revision ID: james.westby@ubuntu.com-20040204014212-ek9533qvd2vo1wa1
Tags: upstream-1.5.0
ImportĀ upstreamĀ versionĀ 1.5.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
* validate.php
 
5
*
 
6
* Copyright (c) 1999-2003 The SquirrelMail Project Team
 
7
* Licensed under the GNU GPL. For full terms see the file COPYING.
 
8
*
 
9
* $Id: validate.php,v 1.13 2003/12/01 21:56:48 cigamit Exp $
 
10
* @package squirrelmail
 
11
*/
 
12
 
 
13
/** include the mime class before the session start ! otherwise we can't store
 
14
 * messages with a session_register.
 
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.
 
29
 */
 
30
 
 
31
session_write_close();
 
32
 
 
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
 
 
41
/* SquirrelMail required files. */
 
42
require_once(SM_PATH . 'class/mime.class.php');
 
43
require_once(SM_PATH . 'functions/global.php');
 
44
require_once(SM_PATH . 'functions/strings.php');
 
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
}
 
53
 
 
54
sqsession_is_active();
 
55
 
 
56
require_once(SM_PATH . 'functions/i18n.php');
 
57
require_once(SM_PATH . 'functions/auth.php');
 
58
 
 
59
is_logged_in();
 
60
 
 
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')) {
 
74
    if ($REQUEST_METHOD == 'POST') {
 
75
        global $HTTP_POST_VARS;
 
76
        TrimArray($HTTP_POST_VARS);
 
77
    } else {
 
78
        global $HTTP_GET_VARS;
 
79
        TrimArray($HTTP_GET_VARS);
 
80
    }
 
81
}
 
82
 
 
83
require_once(SM_PATH . 'include/load_prefs.php');
 
84
require_once(SM_PATH . 'functions/page_header.php');
 
85
require_once(SM_PATH . 'functions/prefs.php');
 
86
 
 
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'));
 
90
 
 
91
$timeZone = getPref($data_dir, $username, 'timezone');
 
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
 
 
103
if ( $timeZone != SMPREF_NONE && ($timeZone != "") 
 
104
    && $tzChangeAllowed ) {
 
105
    putenv("TZ=".$timeZone);
 
106
}
 
107
?>