Fix moving of src directory
[squirrelmail.git] / include / validate.php
CommitLineData
f740c049 1<?php
895905c0 2
35586184 3/**
cab99c3a 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*/
f740c049 11
fffe7fb2 12/* include the mime class before the session start ! otherwise we can't store
13 * messages with a session_register.
14 */
15
86725763 16/* SquirrelMail required files. */
17require_once(SM_PATH . 'class/mime.class.php');
fffe7fb2 18
35586184 19session_start();
cab99c3a 20
86725763 21require_once(SM_PATH . 'functions/i18n.php');
22require_once(SM_PATH . 'functions/auth.php');
23require_once(SM_PATH . 'functions/strings.php');
24require_once(SM_PATH . 'functions/global.php');
f740c049 25
cab99c3a 26is_logged_in();
f740c049 27
cab99c3a 28/* Remove all slashes for form values. */
29if (get_magic_quotes_gpc()) {
30 global $REQUEST_METHOD;
f740c049 31
5be9f195 32 if ($REQUEST_METHOD == 'POST') {
cab99c3a 33 global $HTTP_POST_VARS;
34 RemoveSlashes($HTTP_POST_VARS);
5be9f195 35 } else if ($REQUEST_METHOD == 'GET') {
cab99c3a 36 global $HTTP_GET_VARS;
37 RemoveSlashes($HTTP_GET_VARS);
f7b1b3b1 38 }
cab99c3a 39}
f740c049 40
cab99c3a 41/**
42* Auto-detection
43*
44* if $send (the form button's name) contains "\n" as the first char
45* and the script is compose.php, then trim everything. Otherwise, we
46* don't have to worry.
47*
48* This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug
49*/
50global $send, $PHP_SELF;
51if (isset($send)
52 && (substr($send, 0, 1) == "\n")
53 && (substr($PHP_SELF, -12) == '/compose.php')) {
5be9f195 54 if ($REQUEST_METHOD == 'POST') {
cab99c3a 55 global $HTTP_POST_VARS;
56 TrimArray($HTTP_POST_VARS);
57 } else {
58 global $HTTP_GET_VARS;
59 TrimArray($HTTP_GET_VARS);
f7b1b3b1 60 }
cab99c3a 61}
f7b1b3b1 62
cab99c3a 63/**
64* Everyone needs stuff from config, and config needs stuff from
65* strings.php, so include them both here. Actually, strings is
66* included at the top now as the string array functions have
67* been moved into it.
68*
69* Include them down here instead of at the top so that all config
70* variables overwrite any passed in variables (for security).
71*/
5dfb4b0b 72
73/**
74 * Reset the $theme() array in case a value was passed via a cookie.
75 * This is until theming is rewritten.
76 */
77global $theme;
78unset($theme);
79$theme=array();
80
86725763 81require_once(SM_PATH . 'config/config.php');
08185f2a 82require_once(SM_PATH . 'include/load_prefs.php');
86725763 83require_once(SM_PATH . 'functions/page_header.php');
84require_once(SM_PATH . 'functions/prefs.php');
d4e84069 85
cab99c3a 86/* Set up the language (i18n.php was included by auth.php). */
87global $username, $data_dir;
88set_up_language(getPref($data_dir, $username, 'language'));
5be9f195 89
7bcc8f54 90$timeZone = getPref($data_dir, $username, 'timezone');
4d14fc00 91if ( $timeZone != SMPREF_NONE && ($timeZone != "")
92 && !ini_get("safe_mode")) {
93 putenv("TZ=".$timeZone);
7bcc8f54 94}
f8effb0c 95?>