예제 #1
0
파일: bootstrap.php 프로젝트: alkemann/h2l
/**
 * May be set as exception handler, i.e. set_exception_handler('alkemann\h2l\handleError');
 *
 * @param \Throwable $e
 */
function handleError(\Throwable $e)
{
    if ($e instanceof \alkemann\h2l\exceptions\InvalidUrl) {
        Log::info("InvalidUrl: " . $e->getMessage());
        echo (new Error(404, $e->getMessage()))->render();
        return;
    }
    if ($e instanceof \Exception) {
        Log::error(get_class($e) . ": " . $e->getMessage());
    } elseif ($e instanceof \Error) {
        Log::alert(get_class($e) . ": " . $e->getMessage());
    }
    if (DEBUG && isset($e->xdebug_message)) {
        header("Content-type: text/html");
        echo '<table>' . $e->xdebug_message . '</table><br>';
        dbp('xdebug_message');
        d($e);
    } elseif (DEBUG) {
        header("Content-type: text/html");
        echo '<h1>' . $e->getMessage() . '</h1>';
        d($e);
    } else {
        (new Error(500, $e->getMessage()))->render();
    }
}
예제 #2
0
파일: index.php 프로젝트: alkemann/h.l.app
define('FIRST_APP_CONSTANT', 'FIRST_APP_CONSTANT');
//** auto defines - dont change these
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', realpath(dirname(dirname(__FILE__))));
define('WEBROOT_DIR', basename(dirname(__FILE__)));
define('WWW_ROOT', dirname(__FILE__) . DS);
define('CONTENT_PATH', ROOT . DS . 'content' . DS);
define('LAYOUT_PATH', CONTENT_PATH . 'layout' . DS);
define('LIBS_PATH', ROOT . DS . 'vendor' . DS);
define('RESOURCE_DIR', 'resources');
define('LOGS_PATH', ROOT . DS . RESOURCE_DIR . DS . 'logs' . DS);
define('LOCALES_PATH', ROOT . DS . RESOURCE_DIR . DS . 'locales' . DS);
define('CONFIG_PATH', ROOT . DS . RESOURCE_DIR . DS . 'configs' . DS);
define('HL_PATH', LIBS_PATH . 'alkemann/h.l/src' . DS);
require_once CONFIG_PATH . 'defines.php';
require_once LIBS_PATH . 'autoload.php';
require_once HL_PATH . 'bootstrap.php';
require_once CONFIG_PATH . 'routes.php';
if (DEBUG) {
    dbp(['_config', '_classes']);
}
$request = new alkemann\hl\core\Request();
try {
    $response = $request->response();
    if ($response) {
        $response->render();
    }
} catch (Exception $e) {
    alkemann\hl\core\handleError($e, $request);
}
예제 #3
0
<?php

use Symfony\Component\ClassLoader\UniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
define('ROOTDIR', __DIR__ . '/../../../..');
define('LIBDIR', __DIR__);
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony' => array(ROOTDIR . '/vendor/symfony/src', ROOTDIR . '/vendor/bundles'), 'RedpillLinpro' => ROOTDIR . '/vendor/bundles', 'Doctrine\\Common' => ROOTDIR . '/vendor/doctrine-common/lib', 'Doctrine\\DBAL' => ROOTDIR . '/vendor/doctrine-dbal/lib', 'Doctrine' => ROOTDIR . '/vendor/doctrine/lib', 'al13_debug' => ROOTDIR . '/vendor'));
// intl
if (!function_exists('intl_get_error_code')) {
    require_once ROOTDIR . '/vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
    $loader->registerPrefixFallbacks(array(ROOTDIR . '/vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
}
$loader->register();
AnnotationRegistry::registerLoader(function ($class) use($loader) {
    $loader->loadClass($class);
    return class_exists($class, false);
});
AnnotationRegistry::registerFile(ROOTDIR . '/vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
require_once ROOTDIR . '/vendor/Vgid/Client.php';
require_once ROOTDIR . '/vendor/al13_debug/config/bootstrap.php';
dbc('Doctrine\\Common\\Annotations\\AnnotationReader');
dbc('ReflectionClass');
dbp('_entitymanager');
dbp('_gamineservice');