示例#1
0
 /**
  * Begin the runtime.
  */
 public function run()
 {
     $app = $this->app;
     include DIR_APPLICATION . '/bootstrap/app.php';
     if ($this->app->isInstalled()) {
         /*
          * ----------------------------------------------------------------------------
          * Now that we have languages out of the way, we can run our package on_start
          * methods
          * ----------------------------------------------------------------------------
          */
         $app->setupPackages();
         /*
          * ----------------------------------------------------------------------------
          * Legacy Definitions. This has to come after packages because this
          * essentially loads the entity manager, and the entity manager loads classes
          * found in its config, which may be classes that haven't been autoloaded by initialPackages. It also
          * has to come after setupPackages() in case an autoloader is configured in on_start()
          * ----------------------------------------------------------------------------
          */
         $this->initializeLegacyURLDefinitions($app);
         /*
          * Handle automatic updating. Must come after setupPackages() because some things setup autoloaders in on_start() of their package
          * controller
          */
         $app->handleAutomaticUpdates();
         // This is a crappy place for this, but it has to come AFTER the packages because sometimes packages
         // want to replace legacy "tools" URLs with the new MVC, and the tools paths are so greedy they don't
         // work unless they come at the end.
         $this->registerLegacyRoutes();
         /* ----------------------------------------------------------------------------
          * Register legacy routes
          * ----------------------------------------------------------------------------
          */
         $this->registerLegacyRoutes();
         /* ----------------------------------------------------------------------------
          * Register legacy config values
          * ----------------------------------------------------------------------------
          */
         $this->registerLegacyConfigValues();
         /*
          * ----------------------------------------------------------------------------
          * Load all permission keys into our local cache.
          * ----------------------------------------------------------------------------
          */
         Key::loadAll();
     }
     /*
      * ----------------------------------------------------------------------------
      * Fire an event for intercepting the dispatch
      * ----------------------------------------------------------------------------
      */
     Events::dispatch('on_before_dispatch');
     $request = Request::createFromGlobals();
     return $this->server->handleRequest($request);
 }
示例#2
0
 /**
  * @param null $key
  * @param null $default_value
  * @return mixed|null
  */
 public function request($key = null, $default_value = null)
 {
     if ($key == null) {
         return $_REQUEST;
     }
     $req = Request::createFromGlobals();
     if ($req->query->has($key)) {
         return $req->query->get($key);
     } else {
         if ($req->request->has($key)) {
             return $req->request->get($key);
         }
     }
     return $default_value;
 }