root/tags/5.0.3/index.php

Revision 120, 2.8 kB (checked in by hannes, 4 years ago)

merging changesets [98] to [119] from trunk; creating RC5

Line 
1 <?php
2
3 /**
4  * Package: Spam Board 5
5  * File: index.php
6  * Description: wrapper file calling all the others directly or indirectly
7  *
8  * Copyright (C) 2007 Hannes Schueller
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as
12  * published by the Free Software Foundation, version 3 of the
13  * License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program (see LICENCE). If not,
22  * see <http://www.gnu.org/licenses/>.
23  **/
24
25 // disable output of error messages and warnings
26 ini_set('display_errors', 'Off');
27
28 // if install script is present, redirect there
29 if (is_file('install.php')) {
30     header('Location: install.php');
31 }
32
33 // load classes on demand; in spite of being spread over two directories, class names obviously have to be unique
34 function __autoload($class) {
35     if (is_file('classes/pages/' . $class . '.php')) {
36         require_once('classes/pages/' . $class . '.php');
37     } elseif (is_file('classes/misc/' . $class . '.php')) {
38         require_once('classes/misc/' . $class . '.php');
39     } else { die('Class ' . $class . ' not found.'); }
40 }
41
42 // global settings file
43 require_once('includes/config/settings.php');
44
45 // import version number
46 require_once('includes/config/version.php');
47
48 // bots definition
49 require_once('includes/config/bots.php');
50
51 // get memberstages
52 require_once('includes/config/memberstages.php');
53
54 // cryptography module
55 require_once('includes/config/crypt.php');
56
57 // load formatting functions
58 $F = new Format();
59
60 // language file
61 require('includes/lang/' . $SETTINGS['language'] . '.php');
62
63 // input validation
64 require_once('includes/input.php');
65
66 // open SQL connection
67 $C = new Connection();
68
69 // initialize session
70 require_once('includes/session.php');
71
72 // check if too many failed login attempts
73 require_once('includes/checklogin.php');
74
75 // override global language setting with user preference if present
76 if ($_SESSION['lang'] != '') {
77     include('includes/lang/' . $_SESSION['lang'] . '.php');
78     $LANGUAGE = $_SESSION['lang'];
79 } else {
80     $LANGUAGE = $SETTINGS['language'];
81 }
82
83 // construct requested page
84 $inc = ucfirst($show);
85 $page = new $inc($id);
86
87 /* send output to browser;
88  * NOTHING is sent before apart from header data. The complete XML tree is only constructed in memory before to ensure it will be well-formed. Obviously, such a guarantee can't be given if it's sent 'on the fly'. */
89 $page->out();
90
91 // close database connection
92 $C = NULL;
93
94 // destroy global formatting object
95 unset($F);
96
97 // everything done - page object no longer needed
98 unset($page);
99
100 ?>
Note: See TracBrowser for help on using the browser.