Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

autoloader.inc.php 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * class autoloader
  4. *
  5. * PHP version 5
  6. *
  7. * @category PHP
  8. * @package PSI
  9. * @author Michael Cramer <BigMichi1@users.sourceforge.net>
  10. * @copyright 2009 phpSysInfo
  11. * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  12. * @version SVN: $Id: autoloader.inc.php 660 2012-08-27 11:08:40Z namiltd $
  13. * @link http://phpsysinfo.sourceforge.net
  14. */
  15. error_reporting(E_ALL | E_STRICT);
  16. /**
  17. * automatic loading classes when using them
  18. *
  19. * @param string $class_name name of the class which must be loaded
  20. *
  21. * @return void
  22. */
  23. function __autoload($class_name)
  24. {
  25. //$class_name = str_replace('-', '', $class_name);
  26. /* case-insensitive folders */
  27. $dirs = array('/plugins/'.strtolower($class_name).'/', '/includes/mb/', '/includes/ups/');
  28. foreach ($dirs as $dir) {
  29. if (file_exists(APP_ROOT.$dir.'class.'.strtolower($class_name).'.inc.php')) {
  30. include_once APP_ROOT.$dir.'class.'.strtolower($class_name).'.inc.php';
  31. return;
  32. }
  33. }
  34. /* case-sensitive folders */
  35. $dirs = array('/includes/', '/includes/interface/', '/includes/to/', '/includes/to/device/', '/includes/os/', '/includes/plugin/', '/includes/xml/', '/includes/web/', '/includes/error/', '/includes/js/', '/includes/output/');
  36. foreach ($dirs as $dir) {
  37. if (file_exists(APP_ROOT.$dir.'class.'.$class_name.'.inc.php')) {
  38. include_once APP_ROOT.$dir.'class.'.$class_name.'.inc.php';
  39. return;
  40. }
  41. }
  42. $error = Error::singleton();
  43. $error->addError("_autoload(\"".$class_name."\")", "autoloading of class file (class.".$class_name.".inc.php) failed!");
  44. $error->errorsAsXML();
  45. }
  46. /**
  47. * sets a user-defined error handler function
  48. *
  49. * @param integer $level contains the level of the error raised, as an integer.
  50. * @param string $message contains the error message, as a string.
  51. * @param string $file which contains the filename that the error was raised in, as a string.
  52. * @param integer $line which contains the line number the error was raised at, as an integer.
  53. *
  54. * @return void
  55. */
  56. function errorHandlerPsi($level, $message, $file, $line)
  57. {
  58. $error = Error::singleton();
  59. $error->addPhpError("errorHandlerPsi : ", "Level : ".$level." Message : ".$message." File : ".$file." Line : ".$line);
  60. }
  61. set_error_handler('errorHandlerPsi');