/**
  * Please bootstrap first, than run the application!
  *
  * Run a application, let application accept a request, route the request,
  * dispatch to controller/action, render response and return response to client finally.
  *
  * @param array $get    Array of variables passed to the current script via the URL parameters.
  * @param array $post   Array of variables passed to the current script via the HTTP POST method.
  * @param array $cookie Array of variables passed to the current script via HTTP Cookies.
  *
  * @throws \LogicException If application not bootstrapped.
  * @return void
  */
 public static function run(array $get, array $post, array $cookie)
 {
     $cli = array();
     if (Sapi::isCli()) {
         $cli = Cli::parse((array) Registry::get('env')->argv);
         if (count($cli) < 1 || isset($cli['list'])) {
             Cli::absorb();
             exit(0);
         }
     }
     $conf = Registry::get('conf');
     $prefix = Str::ensureTrailing('\\', $conf['app']['name']);
     $repository = BASE_PATH . 'app/' . $conf['app']['name'] . '/Controller';
     if (isset($cli['controller']) && $cli['controller'] == 'core') {
         $prefix = 'Pimf\\';
         $repository = BASE_PATH . 'pimf-framework/core/Pimf/Controller';
     }
     $resolver = new Resolver(new Request($get, $post, $cookie, $cli), $repository, $prefix);
     $sessionized = Sapi::isWeb() && $conf['session']['storage'] !== '';
     if ($sessionized) {
         Session::load();
     }
     $pimf = $resolver->process();
     if ($sessionized) {
         Session::save();
         Cookie::send();
     }
     $pimf->render();
 }
 /**
  * Please bootstrap first, than run the application!
  * Run a application, let application accept a request, route the request,
  * dispatch to controller/action, render response and return response to client finally.
  *
  * @param array $get Array of variables passed to the current script via the URL parameters.
  * @param array $post Array of variables passed to the current script via the HTTP POST method.
  * @param array $cookie Array of variables passed to the current script via HTTP Cookies.
  * @param array $files An associative array FILES of items uploaded to the current script via the HTTP POST method.
  *
  * @return void
  */
 public static function run(array $get, array $post, array $cookie, array $files)
 {
     $cli = array();
     if (Sapi::isCli()) {
         $cli = Cli::parse((array) self::$env->argv);
         if (count($cli) < 1 || isset($cli['list'])) {
             Cli::absorb();
             exit(0);
         }
     }
     $prefix = Str::ensureTrailing('\\', Config::get('app.name'));
     $repository = BASE_PATH . 'app/' . Config::get('app.name') . '/Controller';
     if (isset($cli['controller']) && $cli['controller'] == 'core') {
         $prefix = 'Pimf\\';
         $repository = BASE_PATH . 'pimf-framework/core/Pimf/Controller';
     }
     $request = new Request($get, $post, $cookie, $cli, $files, self::$env);
     $resolver = new Resolver($request, $repository, $prefix, self::$router);
     $sessionized = Sapi::isWeb() && Config::get('session.storage') !== '';
     if ($sessionized) {
         Session::load();
     }
     $pimf = $resolver->process(self::$env, self::$em, self::$logger);
     if ($sessionized) {
         Session::save();
         Cookie::send();
     }
     $pimf->render();
 }
Esempio n. 3
0
 /**
  * Send the session ID cookie to the browser.
  *
  * @param  array $config
  *
  * @return void
  */
 protected function cookie($config)
 {
     $minutes = !$config['expire_on_close'] ? $config['lifetime'] : 0;
     Cookie::put($config['cookie'], $this->session['id'], $minutes, $config['path'], $config['domain'], $config['secure']);
 }
 /**
  * @param string $key
  */
 public function delete($key)
 {
     Crumb::forget(static::PAYLOAD);
 }
Esempio n. 5
0
 /**
  * Create the session payload and load the session.
  *
  * @return void
  */
 public static function load()
 {
     $session = Config::get('session');
     static::start($session['storage']);
     static::$instance->load(Cookie::get($session['cookie']));
 }
 /**
  * Create the session payload and load the session.
  *
  * @return void
  */
 public static function load()
 {
     $conf = Registry::get('conf');
     static::start($conf['session']['storage']);
     static::$instance->load(Cookie::get($conf['session']['cookie']));
 }