Workaround for the "catalan" bug. This leaves blank language
[squirrelmail.git] / src / validate.php
1 <?php
2
3 /**
4 * validate.php
5 *
6 * Copyright (c) 1999-2001 The SquirrelMail Development Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * $Id$
10 */
11
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 /*****************************************************************/
27
28 session_start();
29 require_once('../functions/i18n.php');
30 require_once('../functions/auth.php');
31 require_once('../functions/strings.php');
32
33 is_logged_in();
34
35 /* Remove all slashes for form values. */
36 if (get_magic_quotes_gpc()) {
37 global $REQUEST_METHOD;
38
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 }
47
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
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 */
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');
83
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'));
87 ?>