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