Revision 23
Added by Manuela over 8 years ago
| initialize.php | ||
|---|---|---|
| 1 | 1 |
<?php |
| 2 |
/** |
|
| 2 |
|
|
| 3 |
/* |
|
| 4 |
* Copyright (C) 2017 Manuela v.d.Decken <manuela@isteam.de> |
|
| 3 | 5 |
* |
| 4 |
* @category framework |
|
| 5 |
* @package initialize |
|
| 6 |
* @author WebsiteBaker Project |
|
| 7 |
* @copyright Ryan Djurovich |
|
| 8 |
* @copyright WebsiteBaker Org. e.V. |
|
| 9 |
* @link http://websitebaker.org/ |
|
| 10 |
* @license http://www.gnu.org/licenses/gpl.html |
|
| 11 |
* @platform WebsiteBaker 2.8.3 |
|
| 12 |
* @requirements PHP 5.3.6 and higher |
|
| 13 |
* @version $Id$ |
|
| 14 |
* @filesource $HeadURL$ |
|
| 15 |
* @lastmodified $Date$ |
|
| 6 |
* DO NOT ALTER OR REMOVE COPYRIGHT OR THIS HEADER |
|
| 16 | 7 |
* |
| 8 |
* This program is free software: you can redistribute it and/or modify |
|
| 9 |
* it under the terms of the GNU General Public License as published by |
|
| 10 |
* the Free Software Foundation, version 2 of the License. |
|
| 11 |
* |
|
| 12 |
* This program is distributed in the hope that it will be useful, |
|
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 15 |
* GNU General Public License 2 for more details. |
|
| 16 |
* |
|
| 17 |
* You should have received a copy of the GNU General Public License 2 |
|
| 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 17 | 19 |
*/ |
| 20 |
/** |
|
| 21 |
* @package Core |
|
| 22 |
* @copyright Ryan Djurovich |
|
| 23 |
* @author Ryan Djurovich |
|
| 24 |
* @author Manuela v.d.Decken <manuela@isteam.de> |
|
| 25 |
* @license GNU General Public License 2.0 |
|
| 26 |
* @version 1.0.1 |
|
| 27 |
* @revision $Id$ |
|
| 28 |
* @deprecated no / since 0000/00/00 |
|
| 29 |
* @description xxx |
|
| 30 |
*/ |
|
| 18 | 31 |
// $aPhpFunctions = get_defined_functions(); |
| 19 | 32 |
/** |
| 20 | 33 |
* sanitize $_SERVER['HTTP_REFERER'] |
| ... | ... | |
| 274 | 287 |
if (!class_exists('\bin\CoreAutoloader')) {
|
| 275 | 288 |
include __DIR__.'/CoreAutoloader.php'; |
| 276 | 289 |
} |
| 277 |
\bin\CoreAutoloader::doRegister(); |
|
| 290 |
\bin\CoreAutoloader::doRegister(dirname(__DIR__)); |
|
| 291 |
\bin\CoreAutoloader::addNamespace([ // add several needed namespaces |
|
| 292 |
'bin' => 'framework', |
|
| 293 |
'addon' => 'modules', |
|
| 294 |
'vendor' => 'include', |
|
| 295 |
'vendor\\jscalendar' => 'include/jscalendar', |
|
| 296 |
'bin\\db' => 'framework/db', |
|
| 297 |
'bin\\security' => 'framework', |
|
| 298 |
'bin\\interfaces' => 'framework', |
|
| 299 |
]); |
|
| 300 |
|
|
| 278 | 301 |
// *** initialize Exception handling |
| 279 | 302 |
if(!function_exists('globalExceptionHandler')) {
|
| 280 | 303 |
include(__DIR__.'/globalExceptionHandler.php'); |
| ... | ... | |
| 305 | 328 |
// --------------------------- |
| 306 | 329 |
// get Database connection data from configuration |
| 307 | 330 |
defined('ADMIN_DIRECTORY') ? '' : define('ADMIN_DIRECTORY', 'admin');
|
| 308 |
if (!preg_match('/xx[a-z0-9_][a-z0-9_\-\.]+/i', 'xx'.ADMIN_DIRECTORY)) {
|
|
| 309 |
throw new RuntimeException('Invalid admin-directory: ' . ADMIN_DIRECTORY);
|
|
| 331 |
if ( |
|
| 332 |
!(preg_match('/xx[a-z0-9_][a-z0-9_\-\.]+/i', 'xx'.ADMIN_DIRECTORY) &&
|
|
| 333 |
is_dir(dirname(__DIR__).'/'.ADMIN_DIRECTORY)) |
|
| 334 |
) {
|
|
| 335 |
throw new RuntimeException('Invalid admin-directory set: ' . ADMIN_DIRECTORY);
|
|
| 310 | 336 |
} |
| 337 |
// add Namespace 'acp' to Autoloader |
|
| 338 |
\bin\CoreAutoloader::addNamespace('acp', ADMIN_DIRECTORY);
|
|
| 311 | 339 |
defined('ADMIN_URL') ? '' : define('ADMIN_URL', WB_URL.'/'.ADMIN_DIRECTORY);
|
| 312 | 340 |
defined('ADMIN_PATH') ? '' : define('ADMIN_PATH', WB_PATH.'/'.ADMIN_DIRECTORY);
|
| 313 | 341 |
if ( !defined('WB_REL')){
|
| ... | ... | |
| 318 | 346 |
define('DOCUMENT_ROOT', preg_replace('/'.preg_quote(str_replace('\\', '/', WB_REL), '/').'$/', '', str_replace('\\', '/', WB_PATH)));
|
| 319 | 347 |
$_SERVER['DOCUMENT_ROOT'] = DOCUMENT_ROOT; |
| 320 | 348 |
} |
| 321 |
// add Namespace 'acp' to Autoloader |
|
| 322 |
\bin\CoreAutoloader::addNamespace('acp', ADMIN_DIRECTORY);
|
|
| 323 | 349 |
|
| 324 | 350 |
if (class_exists('database')) {
|
| 325 | 351 |
// sanitize $_SERVER['HTTP_REFERER'] |
Also available in: Unified diff
CoreAutoloader::addNamespace() + ::doRegister() modified.
initialize:: register Autoloader fitted to modified methods