~alexharrington/xibo/pyclient-1.1.0a22

« back to all changes in this revision

Viewing changes to server/lib/include.php

  • Committer: Alex Harrington
  • Date: 2009-12-31 11:38:50 UTC
  • Revision ID: alex@longhill.org.uk-20091231113850-bz5flhqq2gsw0qxf
Converted to 2.0 repo format and fixed lineendings

Show diffs side-by-side

added added

removed removed

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