Ejemplo n.º 1
0
 public function listAction()
 {
     $id_category = $this->getParam('category_id');
     var_dump($id_category);
     $fo = new Zend_Controller_Request_Http();
     $fo->isGet();
     // action body
 }
Ejemplo n.º 2
0
 /**
  * Ensures that the page that has been requested is valid based on the total
  * number of results. If it's not valid, the page is redirected to the last
  * valid page (via a response exception).
  *
  * @param integer $page
  * @param integer $perPage
  * @param integer $total
  * @param string $linkType
  * @param mixed $linkData
  */
 public function canonicalizePageNumber($page, $perPage, $total, $linkType, $linkData = null)
 {
     if ($this->getResponseType() != 'html' || !$this->_request->isGet()) {
         return;
     }
     if ($perPage < 1 || $total < 1) {
         return;
     }
     $page = max(1, $page);
     $maxPage = ceil($total / $perPage);
     if ($page <= $maxPage) {
         return;
         // within the range
     }
     $params = $_GET;
     if ($maxPage <= 1) {
         unset($params['page']);
     } else {
         $params['page'] = $maxPage;
     }
     $redirectUrl = $this->_buildLink($linkType, $linkData, $params);
     throw $this->responseException($this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, $redirectUrl));
 }
Ejemplo n.º 3
0
 public function testIsOptions()
 {
     $_SERVER['REQUEST_METHOD'] = 'OPTIONS';
     $this->assertTrue($this->_request->isOptions());
     $this->assertFalse($this->_request->isGet());
 }
Ejemplo n.º 4
0
 /**
  * _checkSession If $_GET['reset'] is set, reset the SESSION_NAMESPACE
  *
  * @param Zend_Controller_Request_Http $req
  * @return void
  */
 private function _checkSession($req)
 {
     if ($req->isGet() && null !== ($reset = $this->_getParam('reset'))) {
         $this->session->query = null;
         $this->session->searchFormState = null;
     }
 }
Ejemplo n.º 5
0
 /**
  * Check authorize request for validity and return token
  *
  * @return Mage_Oauth_Model_Token
  */
 public function checkAuthorizeRequest()
 {
     if (!$this->_request->isGet()) {
         Mage::throwException('Request is not GET');
     }
     $this->_requestType = self::REQUEST_AUTHORIZE;
     $this->_fetchProtocolParamsFromQuery();
     $this->_initToken();
     return $this->_token;
 }
Ejemplo n.º 6
0
 protected function _getStyleLanguageChangerParams(Zend_Controller_Request_Http $request)
 {
     $params = array();
     $canChangeStyleLanguage = $request->isGet() && empty($this->_viewStateChanges['styleId']);
     if ($request->isGet()) {
         if (!empty($this->_viewStateChanges['styleId'])) {
             $params['canChangeStyle'] = false;
         } else {
             $styles = XenForo_Application::isRegistered('styles') ? XenForo_Application::get('styles') : array();
             if (count($styles) <= 1) {
                 $params['canChangeStyle'] = false;
             } else {
                 if (XenForo_Visitor::hasInstance() && XenForo_Visitor::getInstance()->is_admin) {
                     $params['canChangeStyle'] = count($styles) > 1;
                 } else {
                     $changable = 0;
                     $params['canChangeStyle'] = false;
                     foreach ($styles as $style) {
                         if ($style['user_selectable']) {
                             $changable++;
                             if ($changable > 1) {
                                 $params['canChangeStyle'] = true;
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         $languages = XenForo_Application::isRegistered('languages') ? XenForo_Application::get('languages') : array();
         $params['canChangeLanguage'] = count($languages) > 1;
     } else {
         $params['canChangeStyle'] = false;
         $params['canChangeLanguage'] = false;
     }
     return $params;
 }
Ejemplo n.º 7
0
 protected function _getLanguageChangerParams(Zend_Controller_Request_Http $request)
 {
     $params = array();
     if ($request->isGet()) {
         $languages = XenForo_Application::isRegistered('languages') ? XenForo_Application::get('languages') : array();
         $params['canChangeLanguage'] = count($languages) > 1;
     } else {
         $params['canChangeLanguage'] = false;
     }
     return $params;
 }