예제 #1
0
파일: Url.php 프로젝트: taekunger/kodekit
 public static function app()
 {
     return Config::app('url.app');
 }
예제 #2
0
파일: DB.php 프로젝트: taekunger/kodekit
 /**
  * Build the database from the specified SQL file <code>dbfile</code> if the <code>dbrestore</code> flag is set
  * @return boolean
  */
 public function buildDB()
 {
     $filename = path("resources.databases") . "/" . Config::app('mysql>dbfile');
     $dbrestore = Config::app('mysql>dbrestore');
     $op_data = '';
     if (file_exists($filename) && $dbrestore === true) {
         $lines = file($filename);
         foreach ($lines as $line) {
             if (substr($line, 0, 2) == '--' || $line == '') {
                 //This IF Remove Comment Inside SQL FILE
                 continue;
             }
             $op_data .= $line;
             if (substr(trim($line), -1, 1) == ';') {
                 //Breack Line Upto ';' NEW QUERY
                 $this->exec($op_data);
                 $op_data = '';
             }
         }
         if ($this->isError()) {
             return false;
         } else {
             return true;
         }
     }
     return true;
 }
예제 #3
0
 public static function error($code)
 {
     if (is_numeric($code)) {
         $txt = '';
         switch ($code) {
             case 404:
                 // Page was not found:
                 header('HTTP/1.1 404 Not Found');
                 $txt = twig(Config::app('url.error.404'));
                 break;
             case 403:
                 // Access forbidden:
                 header('HTTP/1.1 403 Forbidden');
                 $txt = twig(Config::app('url.error.403'));
                 break;
             case 500:
                 // Server error
                 header('HTTP/1.1 500 Internal Server Error');
                 $txt = twig(Config::app('url.error.500'));
                 break;
             case 301:
                 // The page moved permanently should be used for
                 // all redrictions, because search engines know
                 // what's going on and can easily update their urls.
                 header('HTTP/1.1 301 Page Moved Permanently');
                 $txt = twig(Config::app('url.error.301'));
                 break;
             case 401:
                 header('HTTP/1.1 401 Unauthorized: Access is denied due to invalid credentials');
                 $txt = twig(Config::app('url.error.401'));
                 break;
         }
         die($txt);
     }
 }
예제 #4
0
 public function __destruct()
 {
     $app_middleware = Config::app('app_middleware');
     if (is_callable($app_middleware)) {
         return call_user_func($app_middleware, [$this, 'run']);
     } else {
         if (!empty($app_middleware) && is_string($app_middleware)) {
             $middleware = "App\\Http\\Middlewares\\{$app_middleware}Middleware";
             $middleware = new $middleware();
             return call_user_func([$middleware, 'control'], [$this, 'run']);
         } else {
             return $this->run();
         }
     }
 }