1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
<?php
/*
* Xibo - Digital Signage - http://www.xibo.org.uk
* Copyright (C) 2006-2012 Daniel Garner and James Packer
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
define('WEBSITE_VERSION', 68);
// No errors reported until we read the settings from the DB
error_reporting(0);
ini_set('display_errors', 0);
ini_set('gd.jpeg_ignore_warning', 1);
// Required Library Files
require_once("lib/app/pdoconnect.class.php");
require_once("lib/app/translationengine.class.php");
require_once("lib/app/debug.class.php");
require_once("lib/app/kit.class.php");
require_once("lib/app/pagemanager.class.php");
require_once("lib/app/menumanager.class.php");
require_once("lib/app/modulemanager.class.php");
require_once("lib/app/permissionmanager.class.php");
require_once("lib/app/formmanager.class.php");
require_once("lib/app/helpmanager.class.php");
require_once("lib/app/responsemanager.class.php");
require_once("lib/app/datemanager.class.php");
require_once("lib/app/app_functions.php");
require_once("lib/modules/module.interface.php");
require_once("lib/modules/module.class.php");
require_once("lib/data/data.class.php");
require_once("lib/app/session.class.php");
require_once("lib/app/thememanager.class.php");
// Required Config Files
require_once("config/config.class.php");
require_once("config/db_config.php");
// Sort out Magic Quotes
if (get_magic_quotes_gpc())
{
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
/*
* Before we do anything else, lets check to see if we have a settings.php file
* Without that file we can deduce that
* a) This is a first time install
* b) This is a corrupt or failed install
*/
if (!file_exists("settings.php"))
{
Kit::Redirect("install.php");
die();
}
if (file_exists("upgrade.php"))
{
Kit::Redirect("upgrade.php");
die();
}
// parse and init the settings.php
Config::Load();
// Test our DB connection through PDO
try {
PDOConnect::init();
}
catch (PDOException $e) {
die('Database connection problem. ' . $e->getMessage());
}
// create a database class instance (legacy)
$db = new database();
if (!$db->connect_db($dbhost, $dbuser, $dbpass))
{
die('Database connection problem.');
}
if (!$db->select_db($dbname))
{
die('Database connection problem.');
}
date_default_timezone_set(Config::GetSetting("defaultTimezone"));
// Error Handling (our error handler requires a DB connection
set_error_handler(array(new Debug(), "ErrorHandler"));
// Define the VERSION
Config::Version();
// Does the version in the DB match the version of the code?
if (DBVERSION != WEBSITE_VERSION)
die(sprintf('Incompatible database version detected. Please ensure your database and website versions match. You have database %d and website %d', DBVERSION, WEBSITE_VERSION));
// What is the production mode of the server?
if(Config::GetSetting('SERVER_MODE') == 'Test')
ini_set('display_errors', 1);
// Debugging?
if(Config::GetSetting("debug") == "On")
error_reporting(E_ALL);
// Setup the translations for gettext
TranslationEngine::InitLocale();
// Create login control system
require_once('modules/' . Config::GetSetting("userModule"));
$user = new User($db);
$session = new Session();
// Work out the location of this service
$serviceLocation = Kit::GetXiboRoot();
// OAuth
require_once('lib/oauth.inc.php');
// Page variable set? Otherwise default to index
$page = Kit::GetParam('p', _REQUEST, _WORD, 'index');
// Assign the page name to the session
$session->set_page(session_id(), $page);
// Create Page
try {
$pageManager = new PageManager($db, $user, $page);
$pageManager->Authenticate();
$pageManager->Render();
}
catch (Exception $e) {
print $e->getMessage();
}
die();
?>
|