Simplified autoloader

This commit is contained in:
Tobias Reich 2016-01-19 14:58:08 +01:00
parent 33e16041af
commit 0a9b0d0078

View File

@ -7,23 +7,19 @@
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
function lycheeAutoloaderModules($class_name) {
function lycheeAutoloaderModules($class) {
$modules = array('Album', 'Database', 'Import', 'Log', 'Module', 'Photo', 'Plugins', 'Session', 'Settings');
if (!in_array($class_name, $modules)) return false;
$file = LYCHEE . 'php/modules/' . $class . '.php';
$file = LYCHEE . 'php/modules/' . $class_name . '.php';
if (file_exists($file)!==false) require $file;
if (file_exists($file)===true) require $file;
}
function lycheeAutoloaderAccess($class_name) {
function lycheeAutoloaderAccess($class) {
$access = array('Access', 'Admin', 'Guest', 'Installation');
if (!in_array($class_name, $access)) return false;
$file = LYCHEE . 'php/access/' . $class . '.php';
$file = LYCHEE . 'php/access/' . $class_name . '.php';
if (file_exists($file)!==false) require $file;
if (file_exists($file)===true) require $file;
}