function __construct()
 {
     $this->smarty =& new klangSmarty();
     array_push($this->smarty->plugins_dir, kconf::kodform_plugin_dir);
     $this->query =& get_kdb_connection();
     $this->log =& get_logger();
 }
Esempio n. 2
0
function __ini_app(\Owl\Application $app)
{
    $app->middleware(function ($request, $response) {
        $start = microtime(true);
        yield;
        $use_time = (microtime(true) - $start) * 1000;
        $response->withHeader('x-run-time', (int) $use_time);
    });
    $router = new \Owl\Mvc\Router(['namespace' => '\\Controller']);
    $app->middleware(function ($request, $response) use($router) {
        $router->execute($request, $response);
    });
    $app->setExceptionHandler(function ($exception, $request, $response) {
        if ($exception instanceof \Owl\Http\Exception) {
            $status = $exception->getCode();
        } else {
            $status = 500;
            log_exception(get_logger('default'), $exception);
        }
        $response->withStatus($status);
        if (DEBUG) {
            foreach (__exception_headers($exception, 8) as $key => $value) {
                $response->withHeader($key, $value);
            }
        }
        if (!$request->isAjax()) {
            $view = new \Owl\Mvc\View(ROOT_DIR . '/View');
            $response->write($view->render('_error', ['exception' => $exception]));
        }
    });
    return $app;
}
Esempio n. 3
0
 function __construct(&$cpass)
 {
     parent::__construct("change_pass", &$cpass->smarty);
     $this->cpass =& $cpass;
     $this->query =& get_kdb_connection();
     $this->log =& get_logger();
 }
 function __construct(&$smarty)
 {
     parent::__construct("dis_user", &$smarty);
     $this->query = get_kdb_connection();
     $this->log =& get_logger();
 }
Esempio n. 5
0
 function __construct()
 {
     $this->log =& get_logger();
     $this->smarty =& new klangSmarty();
 }
Esempio n. 6
0
 function __construct($form_action = null, &$log = null, &$query = null)
 {
     $this->form_action = $form_action;
     //here you can set logging
     if ($log == null) {
         $this->log =& get_logger();
     } else {
         $this->log =& $log;
     }
     if ($query == null) {
         $this->query =& get_kdb_connection();
     } else {
         $this->query =& $query;
     }
     //to check xhtml coment out code below
     //this will disable authentification
     $this->set_session();
     if (!$this->check()) {
         $this->login();
         $this->save_session();
     }
 }
Esempio n. 7
0
function writelog($msg, $level = 'debug')
{
    $level = strtolower($level);
    $logger = get_logger();
    $logger->{$level}($msg);
}
Esempio n. 8
0
 function __construct(&$smarty)
 {
     parent::__construct("new_group", &$smarty);
     $this->query =& get_kdb_connection();
     $this->log =& get_logger();
 }