bootstrap.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. define('DS', DIRECTORY_SEPARATOR);
  3. define('APP_PATH_LIB', dirname(__FILE__));
  4. define('APP_PATH_ROOT', realpath(APP_PATH_LIB . DS . '..'));
  5. define('APP_PATH_WWW', APP_PATH_ROOT);
  6. define('APP_PATH_CONFIG', APP_PATH_ROOT . DS . 'config');
  7. define('APP_PATH_SCHEMA', APP_PATH_ROOT . DS . 'schema');
  8. // @usage: throw (new AlertSuccessException("Success"))->setBody([ 'id' => 123 ]);
  9. // ... catch (AlertSuccessException $e) { $e->getBody(); ... }
  10. class AlertExceptionBase extends Exception {
  11. public $_body;
  12. public function setBody($body) { $this->_body = $body; return $this; }
  13. public function getBody() { return $this->_body; }
  14. }
  15. class AlertWarningException extends AlertExceptionBase {}
  16. class AlertDangerException extends AlertExceptionBase {}
  17. class AlertSuccessException extends AlertExceptionBase {}
  18. class AlertInfoException extends AlertExceptionBase {}
  19. require_once APP_PATH_LIB . '/' . 'Lib.php';
  20. Lib::loadClass('DBG');
  21. Lib::loadClass('V');
  22. Lib::loadClass('Config');
  23. Lib::loadClass('DB');
  24. Lib::loadClass('DataSourceException');
  25. Lib::loadClass('ACL');
  26. Lib::loadClass('User');
  27. Lib::loadClass('SE_Layout');
  28. Lib::loadClass('S');
  29. Lib::loadClass('Http');
  30. Lib::loadClass('HttpException');
  31. Lib::loadClass('StorageException');
  32. Lib::loadClass('Router');
  33. Lib::loadClass('Request');
  34. Lib::loadClass('SchemaException');
  35. Lib::loadClass('Schema_TableFactory');