Bugfix
[squirrelmail.git] / src / validate.php
CommitLineData
f740c049 1<?php
895905c0 2
35586184 3/**
4 * validate.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * $Id$
10 */
f740c049 11
35586184 12/*****************************************************************/
13/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
14/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
15/*** + Base level indent should begin at left margin, as ***/
16/*** the require_once below looks. ***/
17/*** + All identation should consist of four space blocks ***/
18/*** + Tab characters are evil. ***/
19/*** + all comments should use "slash-star ... star-slash" ***/
20/*** style -- no pound characters, no slash-slash style ***/
21/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
22/*** ALWAYS USE { AND } CHARACTERS!!! ***/
23/*** + Please use ' instead of ", when possible. Note " ***/
24/*** should always be used in _( ) function calls. ***/
25/*** Thank you for your help making the SM code more readable. ***/
26/*****************************************************************/
f740c049 27
35586184 28session_start();
29require_once('../functions/i18n.php');
30require_once('../functions/auth.php');
31require_once('../functions/strings.php');
f740c049 32
f7b1b3b1 33 is_logged_in();
f740c049 34
f7b1b3b1 35 /* Remove all slashes for form values. */
36 if (get_magic_quotes_gpc()) {
37 global $REQUEST_METHOD;
f740c049 38
f7b1b3b1 39 if ($REQUEST_METHOD == "POST") {
40 global $HTTP_POST_VARS;
41 RemoveSlashes($HTTP_POST_VARS);
42 } else if ($REQUEST_METHOD == "GET") {
43 global $HTTP_GET_VARS;
44 RemoveSlashes($HTTP_GET_VARS);
45 }
46 }
f740c049 47
f7b1b3b1 48 /**
49 * Auto-detection
50 *
51 * if $send (the form button's name) contains "\n" as the first char
52 * and the script is compose.php, then trim everything. Otherwise, we
53 * don't have to worry.
54 *
55 * This is for a RedHat package bug and a Konqueror (pre 2.1.1?) bug
56 */
57 global $send, $PHP_SELF;
58 if (isset($send)
59 && (substr($send, 0, 1) == "\n")
60 && (substr($PHP_SELF, -12) == '/compose.php')) {
61 if ($REQUEST_METHOD == "POST") {
62 global $HTTP_POST_VARS;
63 TrimArray($HTTP_POST_VARS);
64 } else {
65 global $HTTP_GET_VARS;
66 TrimArray($HTTP_GET_VARS);
67 }
68 }
69
23d6bd09 70 /**
71 * Everyone needs stuff from config, and config needs stuff from
72 * strings.php, so include them both here. Actually, strings is
73 * included at the top now as the string array functions have
74 * been moved into it.
75 *
76 * Include them down here instead of at the top so that all config
77 * variables overwrite any passed in variables (for security).
78 */
f7b1b3b1 79 require_once('../config/config.php');
80 require_once('../src/load_prefs.php');
81 require_once('../functions/page_header.php');
82 require_once('../functions/prefs.php');
d4e84069 83
f7b1b3b1 84 /* Set up the language (i18n.php was included by auth.php). */
85 global $username, $data_dir;
86 set_up_language(getPref($data_dir, $username, 'language'));
59e95aca 87?>