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