diff options
author | rub <rub@piwigo.org> | 2006-12-11 06:04:53 +0000 |
---|---|---|
committer | rub <rub@piwigo.org> | 2006-12-11 06:04:53 +0000 |
commit | d54d1a52349c30f81529095ce21befda4079180e (patch) | |
tree | b60c3579e01e1de2af37433d0d8063c0d96651b3 /include/functions.inc.php | |
parent | 222afe2caa357d6d31efdef87e2444d3e042880d (diff) |
Feature Issue ID 0000602: Redirect must be done by html or http
Redirect it's only done by the html method but must be done too with http method.
Creation of two functions redirect_http and redirect_html.
Function redirect calls one or other functions follow $conf or parameters.
$conf value are true on BSF, in order to check modifications.
Must be set to false on RC.
git-svn-id: http://piwigo.org/svn/trunk@1649 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions.inc.php | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index bfa7ad28f..e62960ad2 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -600,7 +600,28 @@ function pwg_debug( $string ) } /** - * Redirects to the given URL + * Redirects to the given URL (HTTP method) + * + * Note : once this function called, the execution doesn't go further + * (presence of an exit() instruction. + * + * @param string $url + * @return void + */ +function redirect_http( $url ) +{ + if (ob_get_length () !== FALSE) + { + ob_clean(); + } + header('Request-URI: '.$url); + header('Content-Location: '.$url); + header('Location: '.$url); + exit(); +} + +/** + * Redirects to the given URL (HTML method) * * Note : once this function called, the execution doesn't go further * (presence of an exit() instruction. @@ -610,7 +631,7 @@ function pwg_debug( $string ) * @param integer $refreh_time * @return void */ -function redirect( $url , $msg = '', $refresh_time = 0) +function redirect_html( $url , $msg = '', $refresh_time = 0) { global $user, $template, $lang_info, $conf, $lang, $t2, $page, $debug; @@ -653,6 +674,32 @@ function redirect( $url , $msg = '', $refresh_time = 0) } /** + * Redirects to the given URL (Switch to HTTP method or HTML method) + * + * Note : once this function called, the execution doesn't go further + * (presence of an exit() instruction. + * + * @param string $url + * @param string $title_msg + * @param integer $refreh_time + * @return void + */ +function redirect( $url , $msg = '', $refresh_time = 0) +{ + global $conf; + + // with RefeshTime <> 0, only html must be used + if (($conf['default_redirect_method'] == 'http') and ($refresh_time == 0)) + { + redirect_http($url); + } + else + { + redirect_html($url, $msg, $refresh_time); + } +} + +/** * returns $_SERVER['QUERY_STRING'] whitout keys given in parameters * * @param array $rejects |