Exemple #1
0
    default:
        ini_set('display_errors', 'off');
        error_reporting(E_ERROR);
        break;
}
require_once PUBLIC_HTML . '/../zinux/zinux.php';
/**
 * This is out execption handler
 * @param Exception $exception
 */
function toratan_exception_handler($exception)
{
    $mp = new \zinux\kernel\utilities\pipe("__ERRORS__");
    try {
        $mp->write($exception);
    } catch (\Exception $e) {
        unset($e);
        modules\defaultModule\controllers\errorController::$__EXTERN_ERROR = $exception;
    }
    # we need to use api because httpRequest will contain error(/error will set error header)
    # cannot user `header()` we because of the URI change!! we want the error URI remain same.
    @\zinux\kernel\application\api::call("/error");
    exit;
}
# set exception handler
set_exception_handler('toratan_exception_handler');
# create an application with given module directory
$app = new \zinux\kernel\application\application(PUBLIC_HTML . '/../modules');
# process the application instance
$app->SetCacheDirectory(PUBLIC_HTML . '/../cache')->SetBootstrap(new application\dbBootstrap())->SetConfigIniliazer(new \zinux\kernel\utilities\iniParser(PROJECT_ROOT . "/config/default.cfg", RUNNING_ENV))->SetInitializer(new \vendors\activerecord\ARInitializer())->SetInitializer(new \vendors\PHPMailer\PHPMailerInitializer())->Startup()->Run()->Shutdown();