Ignore:
Timestamp:
Dec 11, 2006, 7:04:53 AM (17 years ago)
Author:
rub
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r1637 r1649  
    601601
    602602/**
    603  * Redirects to the given URL
     603 * Redirects to the given URL (HTTP method)
     604 *
     605 * Note : once this function called, the execution doesn't go further
     606 * (presence of an exit() instruction.
     607 *
     608 * @param string $url
     609 * @return void
     610 */
     611function redirect_http( $url )
     612{
     613  if (ob_get_length () !== FALSE)
     614  {
     615    ob_clean();
     616  }
     617  header('Request-URI: '.$url);
     618  header('Content-Location: '.$url);
     619  header('Location: '.$url);
     620  exit();
     621}
     622
     623/**
     624 * Redirects to the given URL (HTML method)
    604625 *
    605626 * Note : once this function called, the execution doesn't go further
     
    611632 * @return void
    612633 */
    613 function redirect( $url , $msg = '', $refresh_time = 0)
     634function redirect_html( $url , $msg = '', $refresh_time = 0)
    614635{
    615636  global $user, $template, $lang_info, $conf, $lang, $t2, $page, $debug;
     
    651672
    652673  exit();
     674}
     675
     676/**
     677 * Redirects to the given URL (Switch to HTTP method or HTML method)
     678 *
     679 * Note : once this function called, the execution doesn't go further
     680 * (presence of an exit() instruction.
     681 *
     682 * @param string $url
     683 * @param string $title_msg
     684 * @param integer $refreh_time
     685 * @return void
     686 */
     687function redirect( $url , $msg = '', $refresh_time = 0)
     688{
     689  global $conf;
     690
     691  // with RefeshTime <> 0, only html must be used
     692  if (($conf['default_redirect_method'] == 'http') and ($refresh_time == 0))
     693  {
     694    redirect_http($url);
     695  }
     696  else
     697  {
     698    redirect_html($url, $msg, $refresh_time);
     699  }
    653700}
    654701
Note: See TracChangeset for help on using the changeset viewer.