Exemple #1
0
 protected function check_request_token()
 {
     $request = $this->request;
     $post_request_token = $request->get_from_post('yze_request_token');
     $session = YZE_Session_Context::get_instance();
     $saved_tokens = $session->get_request_token($request->the_uri());
     if (!$saved_tokens) {
         return;
     }
     if ($request->the_referer_uri(true) != $request->the_uri()) {
         return;
     }
     if (!$post_request_token) {
         throw new YZE_RuntimeException(__("MISSING_POST_REQUEST_TOKEN"));
     }
     if (!in_array($post_request_token, $saved_tokens)) {
         throw new YZE_RuntimeException(__("REQUEST_TOKEN_NOT_MATCH"));
     }
 }
Exemple #2
0
 public function output($return = false)
 {
     if (!$this->innerRedirect) {
         if (!$return) {
             header("Location: {$this->destinationURI}");
             return;
         }
         return $this->destinationURI;
     }
     if ($this->datas && $this->destinationController) {
         YZE_Session_Context::get_instance()->save_controller_datas($this->destinationURI, $this->datas);
     }
     $format = $this->sourceController->getRequest()->get_output_format();
     $target_uri = $this->destinationURI;
     if ($format != "tpl") {
         $ext = pathinfo($this->url_components['path'], PATHINFO_EXTENSION);
         $target_uri = @preg_replace('/\\.' . $ext . '$/', "", $this->url_components['path']) . ".{$format}?" . @$this->url_components['query'] . (@$this->url_components['fragment'] ? "#" . $this->url_components['fragment'] : "");
     }
     //内部重定向,不经过浏览器在请求一次
     return yze_go($target_uri, $this->sourceController->getRequest()->the_method(), true);
 }
Exemple #3
0
 /**
  * 返回 module指定的css bundle
  * @param unknown $module
  * @return array
  */
 public static function cssBundle($module)
 {
     $session = YZE_Session_Context::get_instance();
     return $session->get($module . "-css-bundle");
 }
Exemple #4
0
 public static function post_cache_has()
 {
     $uri = YZE_Request::get_instance()->the_uri();
     return YZE_Session_Context::get_instance()->get_post_datas($uri);
 }
Exemple #5
0
function set_i18n_cache($i18n)
{
    return YZE_Session_Context::get_instance()->set('i18n', $i18n);
}