Exemplo n.º 1
0
 private function _process_login($value)
 {
     // rest of URL used as redirect
     $redirect_to = $this->_get_remaining_url($value);
     if (midcom::get('auth')->is_valid_user()) {
         $response = new midcom_response_relocate($redirect_to);
         $response->send();
         // This will exit
     }
     midcom::get('auth')->show_login_page();
     // This will exit too
 }
Exemplo n.º 2
0
 /**
  * Relocate to another URL.
  *
  * Helper function to facilitate HTTP relocation (Location: ...) headers. The helper
  * actually can distinguish between site-local, absolute redirects and external
  * redirects. If you add an absolute URL starting with a "/", it will
  * automatically add an http[s]://$servername:$server_port in front of that URL;
  * note that the server_port is optional and only added if non-standard ports are
  * used. If the url does not start with http[s], it is taken as a URL relative to
  * the current anchor prefix, which gets prepended automatically (no other characters
  * as the anchor prefix get inserted).
  *
  * Fully qualified urls (starting with http[s]) are used as-is.
  *
  * Note, that this function automatically makes the page uncacheable, calls
  * midcom_finish and exit, so it will never return. If the headers have already
  * been sent, this will leave you with a partially completed page, so beware.
  *
  * @param string $url    The URL to redirect to, will be preprocessed as outlined above.
  * @param string $response_code HTTP response code to send with the relocation, from 3xx series
  */
 function relocate($url, $response_code = 302)
 {
     $response = new midcom_response_relocate($url, $response_code);
     $response->send();
 }