/** Create response from request * @param \System\Http\Request $request * @return self */ public static function from_request(\System\Http\Request $rq, array $attrs = array()) { def($attrs['format'], null); def($attrs['start_time'], microtime(true)); if (empty($attrs['format'])) { try { $attrs['format'] = \System\Settings::get("output", 'format_default'); } catch (\System\Error $e) { $attrs['format'] = 'html'; } } if (!isset($attrs['layout'])) { $attrs['layout'] = $rq->layout; } $res = new self($attrs); $res->data['request'] = $rq; $res->data['locales'] = \System\Locales::create($res, $rq->lang)->make_syswide(); return $res; }
* @package init */ preloadFudjanCore(true); session_start(); if (file_exists(BASE_DIR . \System\Loader::FILE_MODULES)) { require_once BASE_DIR . \System\Loader::FILE_MODULES; } $request = System\Http\Request::from_hit(); $request->load_config(); System\Cache::init(); System\Database::init(); $request->init(); $response = $request->create_response(); if ($response) { $response->init(); if ($response->is_readable()) { try { $response->locales->load_messages(); } catch (\System\Error\Locales $e) { $default = \System\Locales::get_default_lang(); $err = new \System\Error\SeeOther(); $err->location = $request->path . '?lang=' . $default; throw $err; } $response->create_flow()->exec()->render()->send(); } else { throw new \System\Error\AccessDenied(); } } else { throw new \System\Error\NotFound(); }