Example #1
0
 public function initialize()
 {
     // check if user is logged in
     $authentication = Authentication::getInstance();
     $request = Request::getInstance();
     if ($authentication->isLogin() && !$authentication->isRole(SystemUser::ROLE_BACKEND)) {
         $this->log->info("Failed access for " . $authentication->getUserName() . " (not enough privileges for admin section) from " . $request->getValue('REMOTE_ADDR', Request::SERVER));
         throw new Exception('Access denied');
     }
     // check if admin section is restricted by ip-addresses
     $ip_allow = $this->director->getConfig()->admin_section_ip_allow;
     if ($ip_allow) {
         $ips = explode(",", $ip_allow);
         if (!in_array($request->getValue('REMOTE_ADDR', Request::SERVER), $ips)) {
             $this->log->info("Failed access for " . $authentication->getUserName() . " (ip not in list for admin access) from " . $request->getValue('REMOTE_ADDR', Request::SERVER));
             throw new Exception('Access denied');
         }
     }
     // create tree object
     $treefile = Director::getConfigPath() . $this->director->getConfig()->admin_menu;
     $useLogin = $this->director->getConfig()->dsn;
     $this->tree = new AdminTree($treefile, $useLogin);
     $this->tree->setPrefix($this->urlPrefix);
     // check if path is set. is not, get the startpage path
     $path = $request->getPath();
     $currentId = $this->tree->isSiteRoot() ? $this->tree->getStartNodeId() : $this->tree->getIdFromPath($path);
     // current id does not exist. try to search login pages
     if (!$currentId && $this->tree->pathExists($path)) {
         $this->tree->setCurrentIdExists($this->tree->getIdFromPath($path, Tree::TREE_ORIGINAL));
     }
     $this->tree->setCurrentId($currentId);
 }
Example #2
0
 protected function getRequest()
 {
     if (!$this->request) {
         $this->request = \Request::getInstance();
     }
     return $this->request;
 }
Example #3
0
 public function run()
 {
     self::$basePath = dirname($_SERVER['SCRIPT_NAME']);
     if (self::$basePath == '/' || self::$basePath == '\\') {
         self::$basePath = '';
     }
     self::$etcPath = \hmvc\HApplication::$rootPath . 'etc/';
     self::$themesPath = \hmvc\HApplication::$rootPath . 'themes/';
     $this->src = 'Apps';
     $this->_initConfig();
     self::$request = Request::getInstance();
     //init route
     self::$_router = new Router();
     self::$response = new Response();
     //register autoloader
     self::$_psr_loader = new \hmvc\ClassLoader\Autoloader();
     $this->_autoLoader();
     self::$_psr_loader->register();
     self::$appsPath = \hmvc\HApplication::$rootPath . $this->src . '/';
     set_error_handler("hmvc_error");
     set_exception_handler("hmvc_exceptionHandler");
     $this->startBootstrap();
     self::$_router->dispatch();
     $this->endBootstrap();
 }
Example #4
0
 public function testThemeGridAreaLayoutContainer()
 {
     $layout = \Concrete\Core\Area\Layout\ThemeGridLayout::add();
     $layout->addLayoutColumn()->setAreaLayoutColumnSpan(4);
     $column = $layout->addLayoutColumn();
     $column->setAreaLayoutColumnSpan(2);
     $column->setAreaLayoutColumnOffset(2);
     $layout->addLayoutColumn()->setAreaLayoutColumnSpan(6);
     $elemental = \Concrete\Core\Page\Theme\Theme::add('elemental');
     Page::addHomePage();
     Core::make('cache/request')->disable();
     $c = Page::getByID(1);
     $c->setTheme($elemental);
     $c = Page::getByID(1);
     $req = Request::getInstance();
     $req->setCurrentPage($c);
     $layout = \Concrete\Core\Area\Layout\Layout::getByID(1);
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\ThemeGridLayout', $layout);
     $columns = $layout->getAreaLayoutColumns();
     $this->assertEquals(3, count($columns));
     $formatter = $layout->getFormatter();
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\Formatter\\ThemeGridFormatter', $formatter);
     $this->assertEquals('<div class="row"></div>', (string) $formatter->getLayoutContainerHtmlObject());
     $req->clearCurrentPage();
 }
 public function generateResponse($route = null, $params = array(), $internal = false)
 {
     $router = new Router();
     $request = Request::getInstance();
     $request->setInternal($internal);
     if ($route) {
         $route = $router->getRoute($route);
     } else {
         $route = $router->getDefaultRoute();
     }
     $controller = $route->getController();
     $action = $route->getAction();
     $controller = new $controller();
     $r = new ReflectionMethod($controller, $action);
     $paramsOfFunction = $r->getParameters();
     $paramsToPass = array();
     $indexParams = 0;
     foreach ($paramsOfFunction as $param) {
         if ($param->getClass() != NULL && $param->getClass()->getName() == 'Request') {
             $paramsToPass[] = $request;
         } else {
             if (isset($params[$indexParams])) {
                 $paramsToPass[] = $params[$indexParams++];
             } else {
                 $paramsToPass[] = null;
             }
         }
     }
     if (!empty($paramsToPass)) {
         return call_user_func_array(array($controller, $action), $paramsToPass);
     }
     return $controller->{$action}();
 }
Example #6
0
 public function route()
 {
     $reader = Request::getInstance();
     $subdomain = trim($reader->getString('subdomain'));
     $responseReg = ResponseRegistery::getInstance();
     if (empty($subdomain)) {
         $responseReg->controller = 'main';
         return;
     }
     if (!$this->validSubDomain($subdomain)) {
         $responseReg->controller = 'main';
         $responseReg->page = 'WebLogNotFound';
         return;
     }
     $site_id = $this->getSiteId($subdomain);
     $responseReg->site_id = $site_id;
     if (!$site_id) {
         $responseReg->controller = 'main';
         $responseReg->page = 'WebLogNotFound';
         return;
     } else {
         $responseReg->controller = 'site';
         return;
     }
 }
Example #7
0
 /**
  * Parses the access token response and returns a TokenInterface.
  *
  *
  * @param string $responseBody
  *
  * @return TokenInterface
  *
  * @throws TokenResponseException
  */
 protected function parseAccessTokenResponse($responseBody)
 {
     $request = \Request::getInstance();
     if ($request->get('error')) {
         $reason = $request->get('error_description');
         throw new TokenResponseException($reason);
     }
     $data = json_decode($responseBody, true);
     if (null === $data || !is_array($data)) {
         throw new TokenResponseException('Unable to parse response.');
     } elseif (isset($data['error'])) {
         throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
     }
     $token = new StdOAuth2Token();
     $token->setAccessToken($data['access_token']);
     $token->setLifetime($data['expires_in']);
     if (isset($data['refresh_token'])) {
         $token->setRefreshToken($data['refresh_token']);
         unset($data['refresh_token']);
     }
     unset($data['access_token']);
     unset($data['expires_in']);
     $data['state'] = $request->get('state');
     $token->setExtraParams($data);
     return $token;
 }
Example #8
0
 static function exceptionHandler(\Exception $exception)
 {
     self::$exception = $exception;
     $request = Request::getInstance();
     $refererURL = $request->getReferer();
     $requestURI = \ManiaLib\Utils\URI::getCurrent();
     $debug = \ManiaLib\Application\Config::getInstance()->debug;
     if ($exception instanceof SilentUserException) {
         $message = static::computeShortMessage($exception) . '  ' . $requestURI;
         $userMessage = $exception->getMessage();
     } elseif ($exception instanceof UserException) {
         $message = static::computeShortMessage($exception) . '  ' . $requestURI;
         \ManiaLib\Utils\Logger::user($message);
         $userMessage = $exception->getMessage();
     } else {
         $requestURILine = sprintf(static::$messageConfigs['default']['line'], 'Request URI', $requestURI);
         $message = static::computeMessage($exception, static::$messageConfigs['default'], array($requestURILine));
         \ManiaLib\Utils\Logger::error($message);
         $userMessage = null;
     }
     $response = Response::getInstance();
     if ($message) {
         $response->message = $debug ? $message : $userMessage;
     }
     if ($debug) {
         $response->width = 300;
         $response->height = 150;
     }
     $response->backLink = $refererURL;
     $response->registerErrorView();
     $response->registerException($exception);
 }
Example #9
0
 public function invoke(URLComponent $url)
 {
     $class_name = $url->getController();
     $method = $url->getAction();
     $class = $this->app . '\\action\\' . $class_name;
     //Response对象
     $response = Response::getInstance();
     //Request对象
     $request = Request::getInstance();
     #实例化控制器,使用反射
     $reflection = new \ReflectionClass($class);
     $instacne = $reflection->newInstance();
     //先执行初始化方法init
     if ($reflection->hasMethod('init')) {
         $init = $reflection->getMethod('init');
         $data = $init->invokeArgs($instacne, array($request, $response));
         if ($data) {
             //如果有返回数据则输出
             $response->setBody($data);
             $response->send();
             return true;
         }
     }
     if ($reflection->hasMethod($method)) {
         $method = $reflection->getMethod($method);
     } elseif ($reflection->hasMethod('getMiss')) {
         $method = $reflection->getMethod('getMiss');
     } else {
         throw new RouteException('Method does not exist.');
     }
     $data = $method->invokeArgs($instacne, array($request, $response));
     #输出
     $response->setBody($data);
     $response->send();
 }
 /**
  * Check whether value is empty or doesn't match regex rule. 
  * @author anza
  * @param string $value to be checked
  * @param string $name what name during exception
  * @param string $rule regex rule to check
  * @throws FormValidationException
  */
 public static function validate($value, $name, $rule)
 {
     if (empty($value) || !preg_match($rule, $value)) {
         Request::getInstance()->replace($value, null);
         throw new FormValidationException($name);
     }
 }
Example #11
0
 private function init()
 {
     $this->session = Session::getInstance();
     $this->request = Request::getInstance();
     $this->router = Router::getInstance();
     $this->view = View::getInstance();
 }
Example #12
0
 /**
  * Things to do before every page load.
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // AJAX request, so no page layout.
     if (Request::isXhr()) {
         $this->via_ajax = true;
         $this->set_layout(null);
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
         // Open base layout for normal
     } else {
         $layout = $GLOBALS['template_factory']->open('layouts/base');
         $this->set_layout($layout);
         PageLayout::setTitle(_('Anmeldesets'));
         // Get only own courses if user doesn't have permission to edit institute-wide coursesets.
         $this->onlyOwnCourses = true;
         if ($GLOBALS['perm']->have_perm('admin') || $GLOBALS['perm']->have_perm('dozent') && get_config('ALLOW_DOZENT_COURSESET_ADMIN')) {
             // We have access to institute-wide course sets, so all courses may be assigned.
             $this->onlyOwnCourses = false;
             Navigation::activateItem('/tools/coursesets/sets');
         } else {
             throw new AccessDeniedException();
         }
     }
     PageLayout::addSqueezePackage('admission');
     $this->set_content_type('text/html;charset=windows-1252');
     $views = new ViewsWidget();
     $views->setTitle(_('Aktionen'));
     $views->addLink(_('Anmeldeset anlegen'), $this->url_for('admission/courseset/configure'))->setActive($action == 'configure');
     Sidebar::Get()->addWidget($views);
 }
Example #13
0
 /**
  * common tasks for all actions
  */
 function before_filter(&$action, &$args)
 {
     global $perm;
     parent::before_filter($action, $args);
     if (Request::get('termin_id')) {
         $this->dates[0] = new SingleDate(Request::option('termin_id'));
         $this->course_id = $this->dates[0]->range_id;
     }
     if (Request::get('issue_id')) {
         $this->issue_id = Request::option('issue_id');
         $this->dates = array_values(array_map(function ($data) {
             $d = new SingleDate();
             $d->fillValuesFromArray($data);
             return $d;
         }, IssueDB::getDatesforIssue(Request::option('issue_id'))));
         $this->course_id = $this->dates[0]->range_id;
     }
     if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
         throw new Trails_Exception(400);
     }
     PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen");
     PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _("Veranstaltungstermine absagen"));
     $this->set_content_type('text/html;charset=windows-1252');
     if (Request::isXhr()) {
         $this->set_layout(null);
         $this->response->add_header('X-Title', PageLayout::getTitle());
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
     }
 }
Example #14
0
 /**
  * Before filter, set up the page by initializing the session and checking
  * all conditions.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!Config::Get()->LITERATURE_ENABLE) {
         throw new AccessDeniedException(_('Die Literaturverwaltung ist nicht aktiviert.'));
     }
     $this->attributes['textarea'] = array('style' => 'width:98%', 'rows' => 2);
     $this->attributes['select'] = array();
     $this->attributes['date'] = array();
     $this->attributes['combo'] = array('style' => 'width:45%; display: inline;');
     $this->attributes['lit_select'] = array('style' => 'font-size:8pt;width:100%');
     // on AJAX request set no page layout.
     if (Request::isXhr()) {
         $this->via_ajax = true;
         $this->set_layout(null);
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
     }
     $this->set_content_type('text/html;charset=windows-1252');
     /*      checkObject(); // do we have an open object?
             checkObjectModule('literature');
             object_set_visit_module('literature');/**/
 }
Example #15
0
 /**
  * constructor;
  * 
  * @access public
  * @param array $aConfig configuration array 
  * @return void
  */
 public function __construct(array $aConfig = array())
 {
     // write configs into registry
     $this->saveConfigToRegistry($aConfig);
     // add a CLI wrapper to enable requests from command line
     true === filter_var(Registry::get('MVC_CLI'), FILTER_VALIDATE_BOOLEAN) ? $this->cliWrapper() : false;
     Log::WRITE(str_repeat('#', 10) . "\tnew Request" . "\t" . php_sapi_name() . "\t" . (array_key_exists('REQUEST_METHOD', $_SERVER) ? $_SERVER['REQUEST_METHOD'] : '') . ' ' . (array_key_exists('REQUEST_URI', $_SERVER) ? $_SERVER['REQUEST_URI'] : ''));
     // handle Errors
     new Error();
     // handle Routing
     new Router();
     // Run target Controller's __preconstruct()
     self::runTargetClassPreconstruct(Request::getInstance()->getQueryArray());
     // Set Session
     self::setSession();
     // Run Intrusion Detection System (phpids)
     new IDS();
     // consider Policy Rules
     // e.g. maybe the requested target controller may not be called due to some reason
     // and should be protected from any requesting
     new Policy();
     // Run the requested target Controller
     new Controller(Request::getInstance());
     Event::RUN('mvc.application.construct.finished');
 }
 public function __construct()
 {
     $this->url = URL::getInstance();
     $this->template = Template::getInstance();
     $this->request = Request::getInstance();
     $this->values = Values::getInstance();
 }
 /**
  * Analyse et definit la requete utilisateur
  *
  */
 function parseRequest()
 {
     $this->request =& Request::getInstance();
     if (!is_a($this->request, 'Request')) {
         trigger_error('Unable to parse current request... error', E_USER_ERROR);
     }
 }
 /**
  * ブログの設定変更処理
  */
 private function settingEdit($white_list, $action)
 {
     $request = Request::getInstance();
     $blog_settings_model = Model::load('BlogSettings');
     $blog_id = $this->getBlogId();
     // 初期表示時に編集データの取得&設定
     if (!$request->get('blog_setting') || !Session::get('sig') || Session::get('sig') !== $request->get('sig')) {
         Session::set('sig', App::genRandomString());
         $blog_setting = $blog_settings_model->findByBlogId($blog_id);
         $request->set('blog_setting', $blog_setting);
         return;
     }
     // 更新処理
     $errors = array();
     $errors['blog_setting'] = $blog_settings_model->validate($request->get('blog_setting'), $blog_setting_data, $white_list);
     if (empty($errors['blog_setting'])) {
         // コメント確認からコメントを確認せずそのまま表示に変更した場合既存の承認待ちを全て承認済みに変更する
         $blog_setting = $blog_settings_model->findByBlogId($blog_id);
         if ($blog_setting['comment_confirm'] == Config::get('COMMENT.COMMENT_CONFIRM.CONFIRM') && $blog_setting_data['comment_confirm'] == Config::get('COMMENT.COMMENT_CONFIRM.THROUGH')) {
             Model::load('Comments')->updateApproval($blog_id);
         }
         // ブログの設定情報更新処理
         if ($blog_settings_model->updateByBlogId($blog_setting_data, $blog_id)) {
             // 一覧ページへ遷移
             $this->setInfoMessage(__("I have updated the configuration information of the blog"));
             $this->redirect(array('action' => $action));
         }
     }
     // エラー情報の設定
     $this->setErrorMessage(__('Input error exists'));
     $this->set('errors', $errors);
 }
Example #19
0
 /**
  * handle admin overview request
  */
 private function handleAdminOverview()
 {
     $view = ViewManager::getInstance();
     $log = Logger::getInstance();
     $logfile = $log->getLogFile();
     if ($view->isType(self::VIEW_FILE)) {
         $request = Request::getInstance();
         $extension = ".log";
         $filename = $request->getDomain() . $extension;
         header("Content-type: application/{$extension}");
         header("Content-Length: " . filesize($logfile));
         // stupid bastards of microsnob: ie does not like attachment option
         $browser = $request->getValue('HTTP_USER_AGENT', Request::SERVER);
         if (strstr($browser, 'MSIE')) {
             header("Content-Disposition: filename=\"{$filename}\"");
         } else {
             header("Content-Disposition: attachment; filename=\"{$filename}\"");
         }
         readfile($logfile);
         exit;
     } else {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setVariable('logfile', nl2br(file_get_contents($logfile)), false);
         $url = new Url(true);
         $url->setParameter($view->getUrlId(), self::VIEW_FILE);
         $template->setVariable('href_export', $url->getUrl(true), false);
         $this->template[$this->director->theme->getConfig()->main_tag] = $template;
     }
 }
Example #20
0
 /**
  * Builds the request, tries to find the controller, executes pre action, action, post action, or 404
  */
 public function __construct()
 {
     $request = Request::getInstance();
     $request->findRoute();
     $this->controllerName = self::CONTROLLER_PREFIX . ucfirst($request->getController());
     $this->actionName = self::ACTION_PREFIX . $request->getAction();
     $this->arguments = $request->getRouteExtras();
     try {
         $this->controller = new $this->controllerName();
     } catch (Exception_ClassNotFound $e) {
         self::display404();
     }
     if (method_exists($this->controller, $this->actionName)) {
         // If the controller and action exist, we run that.
         $this->controller->preAction();
         self::loadController($this->controller, $this->actionName, $this->arguments);
         $this->controller->postAction();
     } else {
         if (method_exists($this->controller, self::NO_ACTION)) {
             // If the controller exists, but the action doesn't, and we have a noAction, run that
             $this->controller->preAction();
             self::loadController($this->controller, self::NO_ACTION, $this->arguments);
             $this->controller->postAction();
         } else {
             // Oh no, I can't find anything! Just run the 404 stuff!
             self::display404();
         }
     }
 }
Example #21
0
 /**
  * Factory for fetching the Presenter
  *
  * @param string  $view
  * @param string  $method
  * @param boolean $autoFilter
  * @param string  $view
  *
  * @return \Fuel\Display\Presenter
  *
  * @throws \RuntimeException if the the presenter class could not be loaded
  */
 public static function forge($uri, $method = 'view', $autoFilter = true, $view = null)
 {
     // was a custom view string passed?
     if ($view === null) {
         $view = $uri;
     }
     // get the current request namespace
     $currentNamespace = \Request::getInstance()->getRoute()->namespace;
     // pop the last one off, and add the Presenter namespace
     $currentNamespace = explode('\\', $currentNamespace);
     end($currentNamespace);
     $currentNamespace[key($currentNamespace)] = 'Presenter';
     $currentNamespace = implode('\\', $currentNamespace);
     // get the segments from the presenter string passed
     $segments = explode('/', $uri);
     while (count($segments)) {
         $class = $currentNamespace . '\\' . implode('\\', array_map('ucfirst', $segments));
         if (class_exists($class)) {
             $presenter = new $class(\View::getInstance(), $method, $autoFilter, $view);
             break;
         }
         array_pop($segments);
     }
     // bail out if the presenter class could not be loaded
     if (!isset($presenter)) {
         throw new \RuntimeException('FOU-012: Presenter class identified by [' . $uri . '] could not be found.');
     } elseif (!$presenter instanceof \Fuel\Display\Presenter) {
         throw new \RuntimeException('FOU-013: Presenter class [' . get_class($presenter) . '] does not extend "Fuel\\Display\\Presenter".');
     }
     return $presenter;
 }
Example #22
0
 public function __construct()
 {
     $this->request = Request::getInstance();
     $this->dispatcher = new Dispatcher();
     $this->view = new View();
     $this->response = new Response();
 }
Example #23
0
 final function __construct()
 {
     $this->request = Request::getInstance();
     $this->response = Response::getInstance();
     $this->session = Session::getInstance();
     $this->onConstruct();
 }
Example #24
0
 public function __construct()
 {
     $this->_view = View::getInstance();
     $this->_request = Request::getInstance();
     $this->_validator = Validator::getInstance();
     $this->_translator = Translator::getInstance();
 }
Example #25
0
 public function run()
 {
     array_unshift($this->args, Request::getInstance());
     ob_start();
     return call_user_func_array($this->callback, $this->args);
     ob_end_flush();
 }
Example #26
0
 function run()
 {
     if ($this->running) {
         throw new \Exception(get_called_class() . '::run() was previously called!');
     }
     $this->running = true;
     $request = Request::getInstance();
     if ($request->exists(self::PATH_INFO_OVERRIDE_PARAM)) {
         $this->pathInfo = $request->get(self::PATH_INFO_OVERRIDE_PARAM, '/');
         $request->delete(self::PATH_INFO_OVERRIDE_PARAM);
     } else {
         $this->pathInfo = \ManiaLib\Utils\Arrays::getNotNull($_SERVER, 'PATH_INFO', '/');
     }
     list($this->controller, $this->action) = Route::getActionAndControllerFromRoute($this->pathInfo);
     $this->calledURL = $request->createLink();
     $viewsNS =& Config::getInstance()->viewsNS;
     $currentViewsNS = Config::getInstance()->namespace . '\\Views\\';
     if (!in_array($currentViewsNS, $viewsNS)) {
         array_unshift($viewsNS, $currentViewsNS);
     }
     try {
         Controller::factory($this->controller)->launch($this->action);
         Response::getInstance()->render();
     } catch (\Exception $e) {
         call_user_func(Bootstrapper::$errorHandlingCallback, $e);
         Response::getInstance()->render();
     }
 }
Example #27
0
 public function preview()
 {
     $request = \Request::getInstance();
     $c = \Page::getByID($this->request->get('cID'));
     $cp = new \Permissions($c);
     if ($cp->canViewPageVersions()) {
         $c->loadVersionObject(\Core::make('helper/security')->sanitizeInt($_REQUEST['cvID']));
         $spoofed_request = \Request::createFromGlobals();
         if ($device_handle = $request->headers->get('x-device-handle')) {
             if ($device = \Core::make('device/manager')->get($device_handle)) {
                 if ($agent = $device->getUserAgent()) {
                     $spoofed_request->headers->set('User-Agent', $agent);
                 }
             }
         }
         $spoofed_request->setCustomRequestUser(-1);
         $spoofed_request->setCurrentPage($c);
         \Request::setInstance($spoofed_request);
         $controller = $c->getPageController();
         $controller->runTask('view', array());
         $view = $controller->getViewObject();
         $response = new \Response();
         $content = $view->render();
         // Reset just in case.
         \Request::setInstance($request);
         $response->setContent($content);
         $response->send();
         exit;
     }
 }
Example #28
0
 /**
  * @return RequestContext
  */
 public function getContext()
 {
     if (!$this->context) {
         $this->context = new RequestContext();
         $this->context->fromRequest(\Request::getInstance());
     }
     return $this->context;
 }
Example #29
0
 /**
  * 构造
  */
 function __construct()
 {
     $this->_exception = Exceptions::getInstance();
     $this->_request = Request::getInstance();
     $app = App::getInstance();
     $this->_controller = $app->controller;
     $this->_action = $app->action;
 }
Example #30
0
 public function testArrayAccess()
 {
     $request = Request::getInstance();
     $this->assertNull($request['null']);
     $this->assertSame($request['a'], 'test');
     $this->assertSame($request['b'], '\\h1"');
     $this->assertSame($request['c'], '-23');
 }