autoload.php 835 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. ###
  3. # @name Autoload
  4. # @copyright 2015 by Tobias Reich
  5. ###
  6. if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
  7. function lycheeAutoloaderModules($class_name) {
  8. $modules = array('Album', 'Database', 'Import', 'Log', 'Module', 'Photo', 'Plugins', 'Session', 'Settings');
  9. if (!in_array($class_name, $modules)) return false;
  10. $file = LYCHEE . 'php/modules/' . $class_name . '.php';
  11. if (file_exists($file)!==false) require $file;
  12. }
  13. function lycheeAutoloaderAccess($class_name) {
  14. $access = array('Access', 'Admin', 'Guest', 'Installation');
  15. if (!in_array($class_name, $access)) return false;
  16. $file = LYCHEE . 'php/access/' . $class_name . '.php';
  17. if (file_exists($file)!==false) require $file;
  18. }
  19. spl_autoload_register('lycheeAutoloaderModules');
  20. spl_autoload_register('lycheeAutoloaderAccess');
  21. ?>