Speed up your XOOPS site:-) updated
Date 2005-11-14 18:00:24 | Category: XOOPS
|
redirect_header() makes your site slow.
You can make your site fast only by hack just 2 or 3 point.
This site demonstrates it to you. The message is displayed as a left block in the redirected page.
The inserting point for hacked codes is different each other by XOOPS core versions.
COMMON in theme.html Insert this 8 lines into the top of your theme.html
<{php}>
if( ! empty( $_SESSION['redirect_message'] ) ) {
if( empty( $this->_tpl_vars['xoops_lblocks'] ) ) $this->_tpl_vars['xoops_lblocks'] = array() ;
array_unshift( $this->_tpl_vars['xoops_lblocks'] , array( 'title' => 'Message' , 'content' => $_SESSION['redirect_message'] , 'weight' => 0 ) ) ;
$this->_tpl_vars['xoops_showlblock'] = 1 ;
unset( $_SESSION['redirect_message'] ) ;
}
<{/php}>
If you use XOOPS 2.2.x, also insert them into themeadmin.html
XOOPS 2.0.13a-JP line 423 in include/functions.php
$xoopsTpl->assign('url', $url);
$message = trim($message) != '' ? $message : _TAKINGBACK;
$xoopsTpl->assign('message', $message);
$xoopsTpl->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
$GLOBALS['xoopsModuleUpdate'] = 1;
// GIJ start
if( ! headers_sent() ) {
$_SESSION['redirect_message'] = $message ;
header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
exit ;
}
// GIJ end
$xoopsTpl->display('db:system_redirect.html');
exit();
} else {
$url = preg_replace("/& amp;/i", '&', htmlspecialchars($url, ENT_QUOTES));
// GIJ start
if( ! headers_sent() ) {
$_SESSION['redirect_message'] = $message ;
header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
exit ;
}
// GIJ end
echo '
<html>
<head>
line 128 in include/cp_functions.php If you use "admin in theme" of altsys, don't hack this file.
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td width='2%' valign='top' class='bg5' background='".XOOPS_URL."/modules/system/images/bg_menu.gif' align='center'></td>
<td width='15%' valign='top' class='bg5' align='center'><img src='".XOOPS_URL."/modules/system/images/menu.gif' /><br />
<table border='0' cellpadding='4' cellspacing='0' width='100%'>";
// GIJ start
if( ! empty( $_SESSION['redirect_message'] ) ) {
echo "<tr><td>".htmlspecialchars($_SESSION['redirect_message'],ENT_QUOTES)."</td></tr>\n" ;
unset( $_SESSION['redirect_message'] ) ;
}
// GIJ end
foreach ( $admin_mids as $adm ) {
if ( !empty($xoops_admin_menu_ft[$adm]) ) {
echo "<tr><td align='center'>".$xoops_admin_menu_ft[$adm]."</td></tr>";
}
}
XOOPS 2.0.13.2 line 404 in include/functions.php
$xoopsTpl->assign('url', $url);
$message = trim($message) != '' ? $message : _TAKINGBACK;
$xoopsTpl->assign('message', $message);
$xoopsTpl->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
// GIJ start
if( ! headers_sent() ) {
$_SESSION['redirect_message'] = $message ;
header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
exit ;
}
// GIJ end
$xoopsTpl->display('db:system_redirect.html');
exit();
}
line 141 in include/cp_functions.php If you use "admin in theme" of altsys, don't hack this file.
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td width='2%' valign='top' class='bg5' background='".XOOPS_URL."/m
odules/system/images/bg_menu.gif' align='center'></td>
<td width='15%' valign='top' class='bg5' align='center'><img src='".
XOOPS_URL."/modules/system/images/menu.gif' /><br />
<table border='0' cellpadding='4' cellspacing='0' width='100%'>";
// GIJ start
if( ! empty( $_SESSION['redirect_message'] ) ) {
echo "<tr><td>".htmlspecialchars($_SESSION['redirect_message'],ENT_QUOTES)."</td></tr>\n" ;
unset( $_SESSION['redirect_message'] ) ;
}
// GIJ end
foreach ( array_keys($xoops_admin_menu_ft) as $adm ) {
if ( in_array($adm, $admin_mids) ) {
echo "<tr><td align='center'>".$xoops_admin_menu_ft[$adm]."</td>
</tr>";
}
}
XOOPS 2.2.3 final line 424 in include/functions.php
$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';
// GIJ start
if( ! headers_sent() ) {
$_SESSION['redirect_message'] = $message ;
header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
exit ;
}
// GIJ end
include XOOPS_ROOT_PATH."/footer.php";
exit();
}
---- 2005/8/15 fixed
from: - header( "Location: $url" ) ; to: - header( "Location: ".preg_replace("/& amp;/i",'&',$url) ) ;
---- 2005/11/14 modified (for the security reason)
from: - header( "Location: ".preg_replace("/& amp;/i",'&',$url) ) ; to: - header( "Location: ".strtr(preg_replace("/& amp;/i",'&',$url),"\r\n\0"," ") ) ;
---- 2005/11/17 modified (it is not necessary to convert & ) and added 2.2.3final
from: - header( "Location: ".strtr(preg_replace("/& amp;/i",'&',$url),"\r\n\0"," ") ) ; to: - header( "Location: ".strtr($url,array("\r"=>'',"\n"=>'') ) ) ;
---- 2006/4/11 reverted (it is necessary to convert & )
from: - header( "Location: ".strtr($url,array("\r"=>'',"\n"=>'') ) ) ; to: - header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
|
|