Autoloader improvements
This commit is contained in:
parent
8f77bce210
commit
b55589eea3
@ -73,7 +73,6 @@ if (!empty($_POST['function'])||!empty($_GET['function'])) {
|
||||
###
|
||||
|
||||
define('LYCHEE_ACCESS_ADMIN', true);
|
||||
require(__DIR__ . '/access/Admin.php');
|
||||
|
||||
$admin = new Admin($database, $plugins, $settings);
|
||||
$admin->check($_POST['function']);
|
||||
|
@ -6,10 +6,23 @@
|
||||
# @copyright 2014 by Tobias Reich
|
||||
###
|
||||
|
||||
function lycheeAutoloader($class_name) {
|
||||
require __DIR__ . '/modules/' . $class_name . '.php';
|
||||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
|
||||
function lycheeAutoloaderModules($class_name) {
|
||||
|
||||
$file = LYCHEE . 'php/modules/' . $class_name . '.php';
|
||||
if (file_exists($file)!==false) require $file;
|
||||
|
||||
}
|
||||
|
||||
spl_autoload_register('lycheeAutoloader');
|
||||
function lycheeAutoloaderAccess($class_name) {
|
||||
|
||||
$file = LYCHEE . 'php/access/' . $class_name . '.php';
|
||||
if (file_exists($file)!==false) require $file;
|
||||
|
||||
}
|
||||
|
||||
spl_autoload_register('lycheeAutoloaderModules');
|
||||
spl_autoload_register('lycheeAutoloaderAccess');
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user