Some fixup:
[squirrelmail.git] / src / validate.php
CommitLineData
f740c049 1<?php
f7b1b3b1 2 /**
2d367c68 3 ** validate.php
4 **
5 ** Copyright (c) 1999-2001 The SquirrelMail Development Team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** $Id$
9 **/
f740c049 10
f7b1b3b1 11 if (defined ('validate_php')) { return; }
12 define ('validate_php', true);
f740c049 13
f7b1b3b1 14 session_start();
15 require_once('../functions/i18n.php');
16 require_once('../functions/auth.php');
23d6bd09 17 require_once('../functions/strings.php');
f740c049 18
f7b1b3b1 19 is_logged_in();
f740c049 20
f7b1b3b1 21 /* Remove all slashes for form values. */
22 if (get_magic_quotes_gpc()) {
23 global $REQUEST_METHOD;
f740c049 24
f7b1b3b1 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 }
f740c049 33
f7b1b3b1 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 */
43 global $send, $PHP_SELF;
44 if (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
23d6bd09 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 */
f7b1b3b1 65 require_once('../config/config.php');
66 require_once('../src/load_prefs.php');
67 require_once('../functions/page_header.php');
68 require_once('../functions/prefs.php');
d4e84069 69
f7b1b3b1 70 /* Set up the language (i18n.php was included by auth.php). */
71 global $username, $data_dir;
72 set_up_language(getPref($data_dir, $username, 'language'));
59e95aca 73?>