5
You want a full copy of the functions.php file, or do you just want to check the redirect function (about halfway down the functions.php file)
I'll attach my redirect function from a xooops 2.2.2 site:
/*
* Function to redirect a user to certain pages
*/
function redirect_header($url, $time = 3, $message = '', $addredirect = true)
{
global $xoopsConfig, $xoopsLogger, $xTheme, $xoopsOption, $xoopsModule, $xoopsUser, $xoopsTpl;
if (preg_match('/b(java)?script:/si', $url) ) {
if (!preg_match('/^b(java)?script:([s]*)history.go(-[0-9]*)([s]*[;]*[s]*)$/si', $url) ) {
$url = XOOPS_URL;
}
}
//$xTheme->tplEngine->assign('xoops_showrblock', 1);
$xTheme->tplEngine->assign('time', intval($time));
if ($addredirect && strstr($url, 'user.php')) {
if (!strstr($url, '?')) {
$url .= '?xoops_redirect='.urlencode($_SERVER['REQUEST_URI']);
} else {
$url .= '&xoops_redirect='.urlencode($_SERVER['REQUEST_URI']);
}
}
if (defined('SID') && (! isset($_COOKIE[session_name()]) || ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']])))) {
if (!strstr($url, '?')) {
$url .= '?' . SID;
} else {
$url .= '&'.SID;
}
}
$url = preg_replace("/&/i", '&', htmlspecialchars($url, ENT_QUOTES));
$xTheme->tplEngine->assign('url', $url);
$message = trim($message) != '' ? $message : _TAKINGBACK;
$xTheme->tplEngine->assign('message', $message);
$xTheme->tplEngine->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
$xTheme->tplEngine->assign('xoops_module_header', '<meta http-equiv="Refresh" content="2; url='.$url.'" />');
$xoopsOption['template_main'] = 'system_redirect.html';
include XOOPS_ROOT_PATH."/footer.php";
exit();
}
think thats all you need.
Dave
PS: This extract comes from the yourdomain.com/include/functions.php file.