3
* Xibo - Digital Signage - http://www.xibo.org.uk
4
* Copyright (C) 2009-2014 Alex Harrington and Daniel Garner
6
* This file is part of Xibo.
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
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.
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/>.
22
use Xibo\Helper\Install;
23
use Xibo\Helper\Theme;
26
DEFINE('MAX_EXECUTION', true);
29
ini_set('display_errors', 0);
31
require_once('lib/app/kit.class.php');
32
require_once('config/config.class.php');
33
require_once('config/db_config.php');
34
require_once("lib/app/app_functions.php");
35
require_once('lib/app/debug.class.php');
36
require_once("lib/app/pdoconnect.class.php");
37
require_once("lib/app/translationengine.class.php");
38
require_once("lib/app/thememanager.class.php");
39
require_once("lib/app/helpmanager.class.php");
40
require_once("lib/app/datemanager.class.php");
41
require_once("lib/app/formmanager.class.php");
42
require_once("lib/pages/base.class.php");
43
require_once('lib/pages/install.class.php');
44
require_once("lib/data/data.class.php");
45
require_once("lib/modules/module.interface.php");
46
require_once("lib/modules/module.class.php");
47
require_once("lib/modules/modulefactory.class.php");
48
require_once('modules/module_user_general.php');
51
new Theme(new User(new Database()), 'default');
52
Theme::SetPagename('install');
54
// Does the settings file exist
55
$settingsExists = false;
57
if (file_exists('settings.php')) {
58
include_once('settings.php');
59
// Set-up the translations for get text
60
TranslationEngine::InitLocale('en_GB');
62
$settingsExists = true;
65
TranslationEngine::InitLocale();
68
// Define an auto-load function
69
spl_autoload_register(function ($class) {
70
\Kit::ClassLoader($class);
73
$xibo_step = \Kit::GetParam('step', _REQUEST, _INT, 1);
76
$install = new Install();
82
die(__('The CMS has already been installed. Please contact your system administrator.'));
84
// Welcome to the installer (this should only show once)
86
$content = $install->Step1();
91
die(__('The CMS has already been installed. Please contact your system administrator.'));
93
// Collect details about the database
94
$content = $install->Step2();
99
die(__('The CMS has already been installed. Please contact your system administrator.'));
101
// Check and validate DB details
102
if (defined('MAX_EXECUTION') && MAX_EXECUTION)
108
// Redirect to step 4
109
header('Location: install.php?step=4');
111
catch (Exception $e) {
112
$install->errorMessage = $e->getMessage();
115
$content = $install->Step2();
120
// DB installed and we are ready to collect some more details
121
// We should get the admin username and password
122
$content = $install->Step4();
126
// Create a user account
130
// Redirect to step 6
131
header('Location: install.php?step=6');
133
catch (Exception $e) {
134
$install->errorMessage = $e->getMessage();
137
$content = $install->Step4();
142
$content = $install->Step6();
146
// Create a user account
150
// Redirect to step 6
151
header('Location: install.php?step=8');
153
catch (Exception $e) {
154
$install->errorMessage = $e->getMessage();
157
$content = $install->Step6();
162
require_once('lib/app/session.class.php');
164
$session = new Session();
165
// Step 8 ends the execution
170
Theme::Set('step', $xibo_step);
171
Theme::Set('stepContent', $content);
173
// Include the header
174
$this->getState()->html .= Theme::RenderReturn('install_header');
175
$this->getState()->html .= Theme::RenderReturn('install_footer');