예제 #1
0
 public function init()
 {
     if ($this->checkForMagicQuotes && ini_get('magic_quotes_gpc')) {
         $this->_get = new ArrayFilter(ServerTools::decodeMagicQuotes($_GET));
         $this->_post = new ArrayFilter(ServerTools::decodeMagicQuotes($_POST));
         $this->_cookies = new ArrayFilter(ServerTools::decodeMagicQuotes($_COOKIE));
     } else {
         $this->_get = new ArrayFilter($_GET);
         $this->_post = new ArrayFilter($_POST);
         $this->_cookies = new ArrayFilter($_COOKIE);
     }
     $this->_server = new ArrayFilter($_SERVER);
     $this->_files = new ArrayFilter($_FILES);
     $this->_setBasePaths();
     $this->_setBaseUrls();
     $r = new Request($this->_retrieveUrl(), $this->_get, $this->_post);
     $r->files = $this->_files;
     $r->cookies = $this->_cookies;
     $r->server = $this->_server;
     $r->method = strtoupper($this->_server->get('REQUEST_METHOD'));
     // Removed GET config parameters (Grout_*) and move them to config array
     $get = $this->_get->getData();
     $config = array();
     foreach ($get as $key => $value) {
         if (substr($key, 0, 6) === 'Grout_') {
             $config[$key] = $value;
         }
     }
     foreach ($config as $key => $value) {
         unset($get[$key]);
     }
     $r->get->setData($get);
     $r->config->setData($config);
     if ($urlPrefix = $r->config->get('Grout_UrlPrefix')) {
         $this->app->url .= $urlPrefix;
         $r->url = substr($r->url, strlen($urlPrefix));
     }
     return $r;
 }
 public function toNewCommandString($mergeArgs)
 {
     return WebConsoleTools::constructCommandString($this->command, array_merge($this->args->getData(), $mergeArgs));
 }
예제 #3
0
파일: Module.php 프로젝트: cyantree/grout
 /** @return Route */
 public function addErrorRoute($code, $page, $pageData = null)
 {
     $f = new ArrayFilter($pageData);
     if (!$f->has('responseCode')) {
         $f->set('responseCode', $code);
     }
     $url = null;
     $activated = false;
     $priority = 0;
     if ($code == ResponseCode::CODE_404) {
         $url = '%%url,.*%%';
         $activated = true;
         $priority = -1;
     }
     $codeDigit = substr($code, 0, 3);
     return $this->addNamedRoute('GroutError' . $codeDigit, $url, $page, $f->getData(), $priority, $activated);
 }