public function referer($local = false)
    {
        $ref = $this->getEnv('HTTP_REFERER');

        $base = Configure::read('App.fullBaseUrl') . $this->webroot;
        if (!empty($ref) && !empty($base)) {
            if ($local && strpos($ref, $base) === 0) {
                $ref = substr($ref, strlen($base));
                if (!strlen($ref) || strpos($ref, '//') === 0) {
                    $ref = '/';
                }
                if ($ref[0] !== '/') {
                    $ref = '/' . $ref;
                }

                return $ref;
            }
            if (!$local) {
                return $ref;
            }
        }

        return '/';
    }
public function referer($local = false)
    {
        $ref = $this->getEnv('HTTP_REFERER');

        $base = Configure::read('App.fullBaseUrl') . $this->webroot;
        if (!empty($ref) && !empty($base)) {
            if ($local && strpos($ref, $base) === 0) {
                $ref = substr($ref, strlen($base));
                if (!strlen($ref) || strpos($ref, '//') === 0) {
                    $ref = '/';
                }
                if ($ref[0] !== '/') {
                    $ref = '/' . $ref;
                }

                return $ref;
            }
            if (!$local) {
                return $ref;
            }
        }

        return '/';
    }
public function referer ( $ local = false ) { $ ref = $ this -> getEnv ( 'HTTP_REFERER' ) ; $ base = Configure :: read ( 'App.fullBaseUrl' ) . $ this -> webroot ; if ( ! empty ( $ ref ) && ! empty ( $ base ) ) { if ( $ local && strpos ( $ ref , $ base ) === 0 ) { $ ref = substr ( $ ref , strlen ( $ base ) ) ; if ( ! strlen ( $ ref ) || strpos ( $ ref , '//' ) === 0 ) { $ ref = '/' ; } if ( $ ref [ 0 ] !== '/' ) { $ ref = '/' . $ ref ; } return $ ref ; } if ( ! $ local ) { return $ ref ; } } return '/' ; }
Returns the referer that referred this request.

@param bool $local Attempt to return a local address.
Local addresses do not contain hostnames.
@return string The referring address for this request.
Returns the referer that referred this request .