Changeset 10018

Show
Ignore:
Timestamp:
11/28/08 12:31:27 (1 month ago)
Author:
afz
Message:

Add new method to Jaws_Header: redirect to referrer

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.8/jaws/html/include/Jaws/Header.php

    r7922 r10018  
    66 * @package    Core 
    77 * @author     Pablo Fischer <pablo@pablo.com.mx> 
     8 * @author     Ali Fazelzadeh <afz@php.net> 
    89 * @copyright  2005-2008 Jaws Development Group 
    910 * @license    http://www.gnu.org/copyleft/lesser.html 
     
    1718     * Edits the location of the browser, once its set it will exit 
    1819     * 
    19      * @param   string  $url URL to move the location 
     20     * @param   string  $url URL to move the location if empty redirect to refer page 
    2021     * @access  public 
    2122     */ 
    22     function Location($url
     23    function Location($url = ''
    2324    { 
    2425        $GLOBALS['app']->Session->Synchronize(); 
     26        if (empty($url)) { 
     27            $url = $GLOBALS['app']->getSiteURL() . '/'; 
     28        } 
     29 
     30        header('Location: '.$url); 
     31        exit; 
     32    } 
     33 
     34    /** 
     35     * Redirect to referrer page 
     36     * 
     37     * @access  public 
     38     */ 
     39    function Referrer() 
     40    { 
     41        $GLOBALS['app']->Session->Synchronize(); 
     42        if (isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) { 
     43            $url = $_SERVER['HTTP_REFERER']; 
     44        } else { 
     45            $url = $GLOBALS['app']->getSiteURL() . '/'; 
     46        } 
     47 
    2548        header('Location: '.$url); 
    2649        exit; 
     
    92115    } 
    93116} 
    94 ?>