Revision 9
Added by Manuela about 7 years ago
branches/main/admin/interface/version.php | ||
---|---|---|
48 | 48 |
|
49 | 49 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
50 | 50 |
if(!defined('VERSION')) { define('VERSION', '2.10.1-dev'); } |
51 |
if(!defined('REVISION')) { define('REVISION', '8'); }
|
|
51 |
if(!defined('REVISION')) { define('REVISION', '9'); }
|
|
52 | 52 |
if(!defined('SP')) { define('SP', ''); } |
53 | 53 |
|
branches/main/framework/Autoloader.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/* |
|
4 |
* Copyright (C) 2017 Manuela v.d.Decken <manuela@isteam.de> |
|
5 |
* |
|
6 |
* DO NOT ALTER OR REMOVE COPYRIGHT OR THIS HEADER |
|
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/>. |
|
19 |
*/ |
|
20 |
/** |
|
21 |
* Description of Autoloader |
|
22 |
* |
|
23 |
* @package Core |
|
24 |
* @copyright Manuela v.d.Decken <manuela@isteam.de> |
|
25 |
* @author Manuela v.d.Decken <manuela@isteam.de> |
|
26 |
* @license GNU General Public License 3.0 |
|
27 |
* @version 0.0.1 |
|
28 |
* @revision $Id$ |
|
29 |
* @since File available since 05.07.2017 |
|
30 |
* @deprecated no / since 0000/00/00 |
|
31 |
* @description xxx |
|
32 |
*/ |
|
33 |
//declare(strict_types = 1); |
|
34 |
declare(encoding = 'UTF-8'); |
|
35 |
|
|
36 |
namespace bin; |
|
37 |
|
|
38 |
// use |
|
39 |
|
|
40 |
/** |
|
41 |
* short description of class |
|
42 |
*/ |
|
43 |
class Autoloader |
|
44 |
{ |
|
45 |
|
|
46 |
protected static $sInstallPath = ''; |
|
47 |
protected static $aTransNs = [ |
|
48 |
'bin' => 'framework', |
|
49 |
'addon' => 'modules', |
|
50 |
'acp' => 'admin' |
|
51 |
]; |
|
52 |
|
|
53 |
public static function autoLoad($sClassName) |
|
54 |
{ |
|
55 |
$aMatches = \preg_split('=[\\\\/]=', $sClassName, null, \PREG_SPLIT_NO_EMPTY); |
|
56 |
// insert default NS if no one is given |
|
57 |
if (\sizeof($aMatches) == 1) { \array_unshift($aMatches, 'framework'); } |
|
58 |
// translate namespaces into real dir entries |
|
59 |
$aMatches[0] = \str_replace(\array_keys(self::$aTransNs), self::$aTransNs, $aMatches[0]); |
|
60 |
// first seek in namespace |
|
61 |
$sFilePath = self::$sInstallPath.\implode('/', $aMatches).'.php'; |
|
62 |
if (\is_readable($sFilePath)) { |
|
63 |
include $sFilePath; |
|
64 |
} else { |
|
65 |
// second seek in namespace with file prefix 'class.' |
|
66 |
$sTmp = \array_pop($aMatches); |
|
67 |
$sFilePath = self::$sInstallPath.\implode('/', $aMatches).'/class.'.$sTmp.'.php'; |
|
68 |
\array_push($aMatches, $sTmp); |
|
69 |
if (\is_readable($sFilePath)) { |
|
70 |
include $sFilePath; |
|
71 |
} |
|
72 |
} |
|
73 |
} |
|
74 |
/** |
|
75 |
* register this autoloader |
|
76 |
*/ |
|
77 |
public static function doRegister() |
|
78 |
{ |
|
79 |
self::$sInstallPath = \rtrim(\str_replace('\\', '/', \dirname(__DIR__)), '/').'/'; |
|
80 |
\spl_autoload_register([self, 'autoLoad']); |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* unregister this autoloader |
|
85 |
*/ |
|
86 |
public static function unRegister() |
|
87 |
{ |
|
88 |
\spl_autoload_unregister([self, 'autoLoad']); |
|
89 |
} |
|
90 |
|
|
91 |
} |
|
92 | 0 |
branches/main/framework/CoreAutoloader.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/* |
|
4 |
* Copyright (C) 2017 Manuela v.d.Decken <manuela@isteam.de> |
|
5 |
* |
|
6 |
* DO NOT ALTER OR REMOVE COPYRIGHT OR THIS HEADER |
|
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/>. |
|
19 |
*/ |
|
20 |
/** |
|
21 |
* Description of Autoloader |
|
22 |
* |
|
23 |
* @package Core |
|
24 |
* @copyright Manuela v.d.Decken <manuela@isteam.de> |
|
25 |
* @author Manuela v.d.Decken <manuela@isteam.de> |
|
26 |
* @license GNU General Public License 3.0 |
|
27 |
* @version 0.0.1 |
|
28 |
* @revision $Id$ |
|
29 |
* @since File available since 05.07.2017 |
|
30 |
* @deprecated no / since 0000/00/00 |
|
31 |
* @description xxx |
|
32 |
*/ |
|
33 |
//declare(strict_types = 1); |
|
34 |
declare(encoding = 'UTF-8'); |
|
35 |
|
|
36 |
namespace bin; |
|
37 |
|
|
38 |
// use |
|
39 |
|
|
40 |
/** |
|
41 |
* short description of class |
|
42 |
*/ |
|
43 |
class CoreAutoloader |
|
44 |
{ |
|
45 |
|
|
46 |
private static $sInstallPath = ''; |
|
47 |
private static $aPatterns = []; |
|
48 |
private static $aReplacements = []; |
|
49 |
|
|
50 |
private static $aTransNs = [ |
|
51 |
'bin/interfaces' => 'framework', |
|
52 |
'bin' => 'framework', |
|
53 |
'addon' => 'modules', |
|
54 |
'acp' => 'admin' |
|
55 |
]; |
|
56 |
|
|
57 |
public static function autoLoad($sClassName) |
|
58 |
{ |
|
59 |
$aMatches = \preg_split( |
|
60 |
'=/=', |
|
61 |
\str_replace('\\', '/',$sClassName.'.php'), |
|
62 |
null, |
|
63 |
\PREG_SPLIT_NO_EMPTY |
|
64 |
); |
|
65 |
// insert default NS if no one is given |
|
66 |
if (\sizeof($aMatches) == 1) { \array_unshift($aMatches, 'framework'); } |
|
67 |
// extract default filename |
|
68 |
$sClassFileName = \array_pop($aMatches); |
|
69 |
// translate namespaces into the real dir entries |
|
70 |
$sClassDirName = self::$sInstallPath.\preg_replace( |
|
71 |
self::$aPatterns, |
|
72 |
self::$aReplacements, |
|
73 |
\implode('/', $aMatches).'/' |
|
74 |
); |
|
75 |
// first seek normal filename |
|
76 |
$sFilePath = $sClassDirName.$sClassFileName; |
|
77 |
if (\is_readable($sFilePath)) { |
|
78 |
include $sFilePath; |
|
79 |
} else { |
|
80 |
// second seek filename with prefix 'class.' |
|
81 |
$sFilePath = $sClassDirName.'class.'.$sClassFileName; |
|
82 |
if (\is_readable($sFilePath)) { |
|
83 |
include $sFilePath; |
|
84 |
} |
|
85 |
} |
|
86 |
} |
|
87 |
/** |
|
88 |
* register this autoloader |
|
89 |
*/ |
|
90 |
public static function doRegister() |
|
91 |
{ |
|
92 |
self::$sInstallPath = \rtrim(\str_replace('\\', '/', \dirname(__DIR__)), '/').'/'; |
|
93 |
foreach (self::$aTransNs as $sPattern => $sReplacement) { |
|
94 |
self::$aPatterns[] = '@^'.$sPattern.'@su'; |
|
95 |
self::$aReplacements[] = $sReplacement; |
|
96 |
} |
|
97 |
\spl_autoload_register([__CLASS__, 'autoLoad']); |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* unregister this autoloader |
|
102 |
*/ |
|
103 |
public static function unRegister() |
|
104 |
{ |
|
105 |
\spl_autoload_unregister([__CLASS__, 'autoLoad']); |
|
106 |
} |
|
107 |
|
|
108 |
} |
|
0 | 109 |
branches/main/framework/initialize.php | ||
---|---|---|
313 | 313 |
$_SERVER['DOCUMENT_ROOT'] = DOCUMENT_ROOT; |
314 | 314 |
} |
315 | 315 |
// activate Autoloader |
316 |
if (!class_exists('\bin\Autoloader')) { |
|
317 |
include __DIR__.'/Autoloader.php'; |
|
316 |
if (!class_exists('\bin\CoreAutoloader')) {
|
|
317 |
include __DIR__.'/CoreAutoloader.php';
|
|
318 | 318 |
} |
319 |
\bin\Autoloader::doRegister(); |
|
319 |
\bin\CoreAutoloader::doRegister();
|
|
320 | 320 |
|
321 |
if (file_exists(WB_PATH.'/framework/class.database.php')) {
|
|
321 |
if (class_exists('database')) {
|
|
322 | 322 |
// sanitize $_SERVER['HTTP_REFERER'] |
323 | 323 |
SanitizeHttpReferer(WB_URL); |
324 | 324 |
date_default_timezone_set('UTC'); |
... | ... | |
333 | 333 |
if (!function_exists('PHPMailerAutoload') && is_readable($sTmp)) { |
334 | 334 |
include $sTmp; |
335 | 335 |
} |
336 |
// Create database class |
|
337 |
$database = new database(); |
|
336 | 338 |
|
337 |
// if (!class_exists('database', false)){ |
|
338 |
// // load database class |
|
339 |
// require(__DIR__.'/class.database.php'); |
|
340 |
// Create database class |
|
341 |
$database = new database(); |
|
342 |
// } |
|
343 |
|
|
344 | 339 |
// activate frontend OutputFilterApi (initialize.php) |
345 | 340 |
if (is_readable(WB_PATH .'/modules/output_filter/OutputFilterApi.php')) { |
346 | 341 |
if (!function_exists('OutputFilterApi')) { |
... | ... | |
426 | 421 |
} |
427 | 422 |
$sCachePath = dirname(__DIR__).'/temp/cache/'; |
428 | 423 |
if (!file_exists($sCachePath)) { |
429 |
if (!mkdir($sCachePath)) { $sCachePath = dirname(__DIR__).'/temp/'; } |
|
424 |
if (!mkdir($sCachePath, 0777, true)) { $sCachePath = dirname(__DIR__).'/temp/'; }
|
|
430 | 425 |
} |
431 | 426 |
// Load Language file(s) |
432 | 427 |
$sCurrLanguage = ''; |
... | ... | |
448 | 443 |
require $slangFile; |
449 | 444 |
} |
450 | 445 |
} |
451 |
// if (!class_exists('Translate', false)) { |
|
452 |
// include __DIR__.'/Translate.php'; |
|
453 |
// } |
|
454 | 446 |
$oTrans = Translate::getInstance(); |
455 | 447 |
$oTrans->initialize(array('EN', DEFAULT_LANGUAGE, LANGUAGE), $sCachePath); // 'none' |
456 | 448 |
// Get users timezone |
Also available in: Unified diff
added and activated class bin\CoreAutoloader