예제 #1
0
 /**
  * Redirect to another URL.
  *
  * If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently"
  * or "303 See Other" code in the header pointing to the new location. If the headers have already been
  * sent this will be accomplished using a JavaScript statement.
  *
  * @param   string   $url    The URL to redirect to. Can only be http/https URL
  * @param   boolean  $moved  True if the page is 301 Permanently Moved, otherwise 303 See Other is assumed.
  *
  * @return  void
  *
  * @since   3.2
  */
 public function redirect($url, $moved = false)
 {
     // Handle B/C by checking if a message was passed to the method, will be removed at 4.0
     if (func_num_args() > 1) {
         $args = func_get_args();
         /*
          * Do some checks on the $args array, values below correspond to legacy redirect() method
          *
          * $args[0] = $url
          * $args[1] = Message to enqueue
          * $args[2] = Message type
          * $args[3] = $moved
          */
         if (isset($args[1]) && !empty($args[1]) && !is_bool($args[1])) {
             // Log that passing the message to the function is deprecated
             JLog::add('Passing a message and message type to JFactory::getApplication()->redirect() is deprecated. ' . 'Please set your message via JFactory::getApplication()->enqueueMessage() prior to calling redirect().', JLog::WARNING, 'deprecated');
             $message = $args[1];
             // Set the message type if present
             if (isset($args[2]) && !empty($args[2])) {
                 $type = $args[2];
             } else {
                 $type = 'message';
             }
             // Enqueue the message
             $this->enqueueMessage($message, $type);
             // Reset the $moved variable
             $moved = isset($args[3]) ? (bool) $args[3] : false;
         }
     }
     // Persist messages if they exist.
     if (count($this->_messageQueue)) {
         $session = JFactory::getSession();
         $session->set('application.queue', $this->_messageQueue);
     }
     // Hand over processing to the parent now
     parent::redirect($url, $moved);
 }
예제 #2
0
파일: cms.php 프로젝트: Rai-Ka/joomla-cms
 /**
  * Redirect to another URL.
  *
  * If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently"
  * or "303 See Other" code in the header pointing to the new location. If the headers have already been
  * sent this will be accomplished using a JavaScript statement.
  *
  * @param   string   $url     The URL to redirect to. Can only be http/https URL
  * @param   integer  $status  The HTTP 1.1 status code to be provided. 303 is assumed by default.
  *
  * @return  void
  *
  * @since   3.2
  */
 public function redirect($url, $status = 303)
 {
     // Handle B/C by checking if a message was passed to the method, will be removed at 4.0
     if (func_num_args() > 1) {
         $args = func_get_args();
         /*
          * Do some checks on the $args array, values below correspond to legacy redirect() method
          *
          * $args[0] = $url
          * $args[1] = Message to enqueue
          * $args[2] = Message type
          * $args[3] = $status (previously moved)
          */
         if (isset($args[1]) && !empty($args[1]) && (!is_bool($args[1]) && !is_int($args[1]))) {
             // Log that passing the message to the function is deprecated
             $this->getLogger()->warning('Passing a message and message type to ' . __METHOD__ . '() is deprecated. ' . 'Please set your message via ' . __CLASS__ . '::enqueueMessage() prior to calling ' . __CLASS__ . '::redirect().', array('category' => 'deprecated'));
             $message = $args[1];
             // Set the message type if present
             if (isset($args[2]) && !empty($args[2])) {
                 $type = $args[2];
             } else {
                 $type = 'message';
             }
             // Enqueue the message
             $this->enqueueMessage($message, $type);
             // Reset the $moved variable
             $status = isset($args[3]) ? (bool) $args[3] : false;
         }
     }
     // Persist messages if they exist.
     if (count($this->messageQueue)) {
         $this->getSession()->set('application.queue', $this->messageQueue);
     }
     // Hand over processing to the parent now
     parent::redirect($url, $status);
 }