Beispiel #1
0
 public function nopageAction()
 {
     $http = new Zend_Controller_Request_Http();
     if ($http->isXmlHttpRequest()) {
         $this->view->noLayout = true;
     }
 }
Beispiel #2
0
 /**
  * Can this controller update the session activity? Returns false by default for AJAX requests.
  * Override this in specific controllers if you want action-specific behaviour.
  *
  * @param string $controllerName
  * @param string $action
  * @param string $newState
  *
  * @return boolean
  */
 public function canUpdateSessionActivity($controllerName, $action, &$newState)
 {
     // don't update session activity for an AJAX request
     if ($this->_request->isXmlHttpRequest()) {
         return false;
     }
     return true;
 }
Beispiel #3
0
 public function init()
 {
     $http = new Zend_Controller_Request_Http();
     if ($http->isXmlHttpRequest()) {
         $this->view->noLayout = true;
     }
     /* Initialize action controller here */
     /*
      $ajaxContext = $this->_helper->getHelper('AjaxContext');
      $ajaxContext->addActionContext('view', 'html')
      ->addActionContext('form', 'html')
      ->addActionContext('process', 'json')
      ->initContext();
     */
     $this->_db = Zend_Registry::get('db');
     $this->_user = Zend_Registry::get('user');
     $this->_db_user = new Database_User($this->_db);
 }
Beispiel #4
0
 public function init()
 {
     $request = new Zend_Controller_Request_Http();
     if (!$request->isXmlHttpRequest()) {
         $options = $this->getOptions();
         if (isset($options['url']) && $options['url'] !== null && $options['url'] != '') {
             try {
                 try {
                     if (($application = dirname($_SERVER['DOCUMENT_ROOT'])) !== null) {
                         $applicationDirectories = split(DIRECTORY_SEPARATOR, $application);
                         $application = array_pop($applicationDirectories);
                     }
                 } catch (Exception $exception) {
                     $application = '';
                 }
                 $client = new Zend_Http_Client($options['url'], array('maxredirects' => 0, 'timeout' => 3));
                 $client->setParameterPost(array('application' => $application, 'host' => gethostname(), 'data' => $_SERVER, 'message' => 'Page request', 'ipaddress' => $this->_getIP()))->request('POST');
             } catch (Exception $exception) {
             }
         }
     }
 }
Beispiel #5
0
 public function testIsXmlHttpRequest()
 {
     $this->assertFalse($this->_request->isXmlHttpRequest());
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     $this->assertTrue($this->_request->isXmlHttpRequest());
 }
Beispiel #6
0
 /**
  * Determines whether the given request is an ajax request
  * 
  * @param  HttpRequest $request
  * @return boolean
  */
 protected function _assertIsAjax(HttpRequest $request)
 {
     return $request->isXmlHttpRequest();
 }
 /**
  * Validate that we want to track the request
  *
  * @return Boolean
  */
 private function trackableRequest()
 {
     // Decide whether or not we should track Ajax Requests
     if ($this->_ajax == 0) {
         $request = new Zend_Controller_Request_Http();
         if ($request->isXmlHttpRequest()) {
             return false;
         }
     }
     // Now we are going to verify the user didn't just reload the page or click the same link.
     // No reason to track page reloads.
     if ($this->_currentUrl == $this->_namespace->history[0]) {
         return false;
     }
     //@todo Setup check for a 404 error so we don't track bad requests.
     return true;
 }
Beispiel #8
0
 /**
  * _forward
  *
  * @param  mixed $action Action name
  * @param  string $controller Controller name
  * @param  string $module Module name
  * @param  mixed $params Parameters
  * @access private
  * @return void
  */
 protected function _go($action, $controller = null, $module = null, $params = null)
 {
     if ($this->_request->isXmlHttpRequest()) {
         return;
     }
     parent::_forward($action, $controller, $module, $params);
     return;
 }