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