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