This repository has been archived by the owner on Jan 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·78 lines (65 loc) · 2.56 KB
/
index.php
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
<?php
/**
* @author: Potherca <[email protected]>
* @package: DarkHelmet
* @link: https://github.com/potherca/Dark-Helmet/
* @license: Copyright 2011, Potherca
*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
*
*/
namespace DarkHelmet
{
use DarkHelmet\Core\Exception;
use DarkHelmet\Core\Request;
use DarkHelmet\Core\Settings;
use DarkHelmet\Core\Controllers\Base as BaseController;
require_once('bootstrap.php');
$sUrl = $_SERVER['REQUEST_URI'];
$aPostFields = array();
if(isset($_POST['tags'])) {
$aPostFields = $_POST['tags'];
}
$oRequest = Request::get($sUrl, $aPostFields);
// This is a temporary solution so people get informed that the config files have moved.
if(!is_file(CONFIG_DIR . 'settings.xml') && is_file(PROJECT_DIR . 'settings.xml')) {
// Configuration files are not yet moved. Inform the world!
$oSettings = Settings::loadFromFile(PROJECT_DIR . 'settings.xml');
$sPredefined = '';
try {
$sPredefined = $oSettings->get('Connectors/Connector/Params/TagFilePath');
} catch(\Exception $ex) {
// Path not found, so not configured. Ignore.
}
$sOutput = '<h1>Important</h1>';
$sOutput .= '<p>The configuration files need to be moved from
the project root folder ( ' . PROJECT_DIR . ' )
into the conf folder.<br/>
This concerns the following files:<p>';
$sOutput .= '<ul>
<li><strong>settings.xml</strong></li>
<li><strong>credentials.xml</strong></li>
</ul>';
if($sPredefined !== '') {
$sOutput .= '<p>If you also want to move <strong>'.$sPredefined.'</strong>
into the conf folder, be sure to add the path to the file
name in settings.xml</p>';
}#if
$sOutput .= '<p>After you have moved the files, please reload this page.</p>';
} else {
$oSettings = Settings::loadFromFile(CONFIG_DIR . 'settings.xml');
$oSettings->credentialsFromFile(CONFIG_DIR . 'credentials.xml');
$sOutput = BaseController::getResponse($oRequest, $oSettings);
}#if
die ($sOutput);
}
#EOF