avoid stupid IE6 bug with frames and scrollbars
[squirrelmail.git] / include / validate.php
... / ...
CommitLineData
1<?php
2
3/**
4* validate.php
5*
6* Copyright (c) 1999-2002 The SquirrelMail Project Team
7* Licensed under the GNU GPL. For full terms see the file COPYING.
8*
9* $Id$
10*/
11
12/* include the mime class before the session start ! otherwise we can't store
13 * messages with a session_register.
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.
28 */
29session_write_close();
30
31/* SquirrelMail required files. */
32require_once(SM_PATH . 'class/mime.class.php');
33
34session_start();
35
36require_once(SM_PATH . 'functions/i18n.php');
37require_once(SM_PATH . 'functions/auth.php');
38require_once(SM_PATH . 'functions/strings.php');
39require_once(SM_PATH . 'functions/global.php');
40
41is_logged_in();
42
43/**
44* Auto-detection
45*
46* if $send (the form button's name) contains "\n" as the first char
47* and the script is compose.php, then trim everything. Otherwise, we
48* don't have to worry.
49*
50* This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug
51*/
52global $send, $PHP_SELF;
53if (isset($send)
54 && (substr($send, 0, 1) == "\n")
55 && (substr($PHP_SELF, -12) == '/compose.php')) {
56 if ($REQUEST_METHOD == 'POST') {
57 global $HTTP_POST_VARS;
58 TrimArray($HTTP_POST_VARS);
59 } else {
60 global $HTTP_GET_VARS;
61 TrimArray($HTTP_GET_VARS);
62 }
63}
64
65/**
66* Everyone needs stuff from config, and config needs stuff from
67* strings.php, so include them both here. Actually, strings is
68* included at the top now as the string array functions have
69* been moved into it.
70*
71* Include them down here instead of at the top so that all config
72* variables overwrite any passed in variables (for security).
73*/
74
75/**
76 * Reset the $theme() array in case a value was passed via a cookie.
77 * This is until theming is rewritten.
78 */
79global $theme;
80unset($theme);
81$theme=array();
82
83require_once(SM_PATH . 'config/config.php');
84require_once(SM_PATH . 'include/load_prefs.php');
85require_once(SM_PATH . 'functions/page_header.php');
86require_once(SM_PATH . 'functions/prefs.php');
87
88/* Set up the language (i18n.php was included by auth.php). */
89global $username, $data_dir;
90set_up_language(getPref($data_dir, $username, 'language'));
91
92$timeZone = getPref($data_dir, $username, 'timezone');
93if ( $timeZone != SMPREF_NONE && ($timeZone != "")
94 && !ini_get("safe_mode")) {
95 putenv("TZ=".$timeZone);
96}
97?>