Exemple #1
0
/**
 * Redirects to the given URL (automatically choose HTTP or HTML method).
 * once this function called, the execution doesn't go further
 * (presence of an exit() instruction.
 *
 * @param string $url
 * @param string $msg
 * @param integer $refresh_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 and !headers_sent()) {
        redirect_http($url);
    } else {
        redirect_html($url, $msg, $refresh_time);
    }
}
/**
 * Exits the current script with 404 code.
 * @todo nice display if $template loaded
 *
 * @param string $msg
 * @param string|null $alternate_url redirect to this url
 */
function page_not_found($msg, $alternate_url = null)
{
    set_status_header(404);
    if ($alternate_url == null) {
        $alternate_url = make_index_url();
    }
    redirect_html($alternate_url, '<div style="text-align:left; margin-left:5em;margin-bottom:5em;">
<h1 style="text-align:left; font-size:36px;">' . l10n('Page not found') . '</h1><br>' . $msg . '</div>', 5);
}