예제 #1
0
파일: Config.php 프로젝트: jura-php/jura
 public static function load($group, $save = true)
 {
     $paths = array();
     $paths[] = J_PATH . "config" . DS . $group . EXT;
     $paths[] = J_PATH . "config" . DS . strtolower(Request::env()) . DS . $group . EXT;
     if (URI::isManager()) {
         $paths[] = J_MANAGERPATH . DS . "config" . DS . $group . EXT;
         $paths[] = J_MANAGERPATH . DS . "config" . DS . strtolower(Request::env()) . DS . $group . EXT;
     } else {
         $paths[] = J_APPPATH . "config" . DS . $group . EXT;
         $paths[] = J_APPPATH . "config" . DS . strtolower(Request::env()) . DS . $group . EXT;
     }
     $items = array();
     foreach ($paths as $path) {
         if (file_exists($path)) {
             $result = (require $path);
             if (is_array($result)) {
                 $items = array_merge($items, $result);
             }
         }
     }
     if (count($items) > 0) {
         if ($save) {
             static::$items[$group] = $items;
         }
         return $items;
     }
 }
예제 #2
0
파일: URL.php 프로젝트: jura-php/jura
 /**
  * Returns the root URL of the project. If addManager = false, don't append 'manager/' if we are calling this function from a manager route.
  * @param  boolean $addManager
  * @return string
  */
 public static function root($addManager = true)
 {
     $root = Request::rootURL();
     if ($addManager && URI::isManager()) {
         $root .= "manager/";
     }
     return $root;
 }
예제 #3
0
파일: URI.php 프로젝트: jura-php/jura
 public static function current()
 {
     if (!is_null(self::$uri)) {
         return self::$uri;
     }
     $uri = trim(Request::pathInfo(), "/");
     $uri = $uri ? $uri : "/";
     self::$uri = $uri;
     $segments = array_diff(explode("/", trim($uri, "/")), array(""));
     if (array_get($segments, 0) == "manager") {
         self::$isManager = true;
         array_shift($segments);
     }
     self::$segments = $segments;
     return $uri;
 }
예제 #4
0
파일: core.php 프로젝트: jura-php/jura
            $allowed = true;
            break;
        }
    }
    if (!$allowed || count($pieces) == 0) {
        return Response::code(403);
    }
    $path = implode(DS, $pieces);
    if (!File::exists(J_PATH . $path) || is_dir(J_PATH . $path)) {
        return Response::code(404);
    }
    $im = new Image(J_PATH . $path);
    $im->resize((int) Request::get("width"), (int) Request::get("height"), Request::get("method", "fit"), Request::get("background", 0xffffff));
    $im->header();
});
Router::register("*", "(:all)", function () {
    Response::code(404);
    if (Request::isLocal()) {
        echo "URI: " . URI::full() . "<br>\n";
        echo "Path Info: " . Request::pathInfo() . "\n";
    }
    return;
});
if (URI::isManager()) {
    Structure::routes();
}
Request::$route = Router::route(Request::method(), URI::current());
Event::fire(J_EVENT_RESPONSE_START);
echo Request::$route->call();
Event::fire(J_EVENT_RESPONSE_END);
//echo "<br><br>" . round(elapsed_time() * 1000000) / 1000 . "ms";