mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
header/footer code cleanup
This commit is contained in:
@@ -1004,6 +1004,8 @@ if (!class_exists('e107table', false))
|
|||||||
$ret[$sc] = isset($val[$var]) ? (string) $val[$var] : null;
|
$ret[$sc] = isset($val[$var]) ? (string) $val[$var] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$bread = e107::breadcrumb();
|
||||||
|
$ret['{---BREADCRUMB---}'] = e107::getForm()->breadcrumb($bread);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2019 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
@@ -74,19 +74,19 @@ if (varset($e107_popup) != 1)
|
|||||||
{
|
{
|
||||||
if ($pref['cachestatus'])
|
if ($pref['cachestatus'])
|
||||||
{
|
{
|
||||||
if (!$sql->db_Select('generic', '*', "gen_type='empty_cache'"))
|
if (!$sql->select('generic', '*', "gen_type='empty_cache'"))
|
||||||
{
|
{
|
||||||
$sql->db_Insert('generic', "0,'empty_cache','".time()."','0','','0',''");
|
$sql->insert('generic', "0,'empty_cache','".time()."','0','','0',''");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$row = $sql->db_Fetch();
|
$row = $sql->fetch();
|
||||||
if (($row['gen_datestamp'] + 604800) < time()) // If cache not cleared in last 7 days, clear it.
|
if (($row['gen_datestamp'] + 604800) < time()) // If cache not cleared in last 7 days, clear it.
|
||||||
{
|
{
|
||||||
require_once (e_HANDLER."cache_handler.php");
|
require_once (e_HANDLER."cache_handler.php");
|
||||||
$ec = new ecache;
|
$ec = new ecache;
|
||||||
$ec->clear();
|
$ec->clear();
|
||||||
$sql->db_Update('generic', "gen_datestamp='".time()."' WHERE gen_type='empty_cache'");
|
$sql->update('generic', "gen_datestamp='".time()."' WHERE gen_type='empty_cache'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ if (varset($e107_popup) != 1)
|
|||||||
$memuse = eHelper::getMemoryUsage(); // Memory at end, in B/KB/MB/GB ;)
|
$memuse = eHelper::getMemoryUsage(); // Memory at end, in B/KB/MB/GB ;)
|
||||||
$rinfo = '';
|
$rinfo = '';
|
||||||
|
|
||||||
if (function_exists('getrusage'))
|
if (function_exists('getrusage') && !empty($eTimingStartCPU))
|
||||||
{
|
{
|
||||||
$ru = getrusage();
|
$ru = getrusage();
|
||||||
$cpuUTime = $ru['ru_utime.tv_sec'] + ($ru['ru_utime.tv_usec'] * (1e-6));
|
$cpuUTime = $ru['ru_utime.tv_sec'] + ($ru['ru_utime.tv_usec'] * (1e-6));
|
||||||
@@ -157,11 +157,11 @@ if (varset($e107_popup) != 1)
|
|||||||
{
|
{
|
||||||
$rinfo .= CORE_LAN15.$sql->db_QueryCount().". ";
|
$rinfo .= CORE_LAN15.$sql->db_QueryCount().". ";
|
||||||
}
|
}
|
||||||
if (isset($pref['display_memory_usage']) && $pref['display_memory_usage'])
|
if (!empty($pref['display_memory_usage']))
|
||||||
{
|
{
|
||||||
$rinfo .= CORE_LAN16.$memuse;
|
$rinfo .= CORE_LAN16.$memuse;
|
||||||
}
|
}
|
||||||
if (isset($pref['displaycacheinfo']) && $pref['displaycacheinfo'])
|
if (!empty($pref['displaycacheinfo']) && !empty($cachestring))
|
||||||
{
|
{
|
||||||
$rinfo .= $cachestring.".";
|
$rinfo .= $cachestring.".";
|
||||||
}
|
}
|
||||||
@@ -186,9 +186,9 @@ if (varset($e107_popup) != 1)
|
|||||||
//
|
//
|
||||||
if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL)
|
if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL)
|
||||||
{
|
{
|
||||||
global $db_debug;
|
// global $db_debug;
|
||||||
echo "\n<!-- DEBUG -->\n<div class='e-debug debug-info'>";
|
echo "\n<!-- DEBUG -->\n<div class='e-debug debug-info'>";
|
||||||
$db_debug->Show_All();
|
e107::getDebug()->Show_All();
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ if (is_array($pref['e_footer_list']))
|
|||||||
if(is_readable($fname))
|
if(is_readable($fname))
|
||||||
{
|
{
|
||||||
|
|
||||||
$ret = ($e107_debug || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
$ret = (!empty($e107_debug) || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,9 +316,6 @@ if (is_array($pref['e_footer_list']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// [JSManager] Load JS Footer Includes by priority
|
// [JSManager] Load JS Footer Includes by priority
|
||||||
e107::getJs()->renderJs('footer', true);
|
e107::getJs()->renderJs('footer', true);
|
||||||
|
|
||||||
@@ -329,30 +326,9 @@ e107::getJs()->renderJs('footer', true);
|
|||||||
// G final JS script keeps user and server time in sync.
|
// G final JS script keeps user and server time in sync.
|
||||||
// It must be the last thing created before sending the page to the user.
|
// It must be the last thing created before sending the page to the user.
|
||||||
//
|
//
|
||||||
// see e107.js and class2.php
|
|
||||||
// This must be done as late as possible in page processing.
|
|
||||||
$_serverTime = time();
|
|
||||||
$lastSet = isset($_COOKIE['e107_tdSetTime']) ? $_COOKIE['e107_tdSetTime'] : 0;
|
|
||||||
$_serverPath = e_HTTP;
|
|
||||||
$_serverDomain = deftrue('MULTILANG_SUBDOMAIN') ? '.'.e_DOMAIN : '';
|
|
||||||
if (abs($_serverTime - $lastSet) > 120)
|
|
||||||
{
|
|
||||||
/* update time delay every couple of minutes.
|
|
||||||
* Benefit: account for user time corrections and changes in internet delays
|
|
||||||
* Drawback: each update may cause all server times to display a bit different
|
|
||||||
*/
|
|
||||||
// echo "<script type='text/javascript'>\n";
|
|
||||||
|
|
||||||
// e107::js('footer-inline',"SyncWithServerTime('{$_serverTime}', '{$_serverPath}', '{$_serverDomain}');",'prototype');
|
// All JavaScript settings are placed in the footer of the page with the library weight so that inline scripts appear afterwards.
|
||||||
|
|
||||||
//echo "SyncWithServerTime('{$_serverTime}', '{$_serverPath}', '{$_serverDomain}');
|
|
||||||
// </script>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// All JavaScript settings are placed in the footer of the page with the library weight so that inline scripts appear
|
|
||||||
// afterwards.
|
|
||||||
e107::getJs()->renderJs('settings');
|
e107::getJs()->renderJs('settings');
|
||||||
|
|
||||||
e107::getJs()->renderJs('footer_inline', true);
|
e107::getJs()->renderJs('footer_inline', true);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -363,9 +339,13 @@ echo "</body></html>";
|
|||||||
//
|
//
|
||||||
// I Send the buffered page data, along with appropriate headers
|
// I Send the buffered page data, along with appropriate headers
|
||||||
//
|
//
|
||||||
|
|
||||||
// SecretR - EXPERIMENT! SEND CSS data to header. Performance tests in progress.
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
|
|
||||||
|
$magicSC = e107::getRender()->getMagicShortcodes(); // support for {---TITLE---} etc.
|
||||||
|
|
||||||
|
$tmp['search'] = array_keys($magicSC);
|
||||||
|
$tmp['replace'] = array_values($magicSC);
|
||||||
|
|
||||||
$e_js = e107::getJs();
|
$e_js = e107::getJs();
|
||||||
|
|
||||||
$tmp0 = $e_js->renderJs('library_css', false, 'css', true);
|
$tmp0 = $e_js->renderJs('library_css', false, 'css', true);
|
||||||
@@ -419,22 +399,6 @@ if($tmp1)
|
|||||||
|
|
||||||
// Shutdown
|
// Shutdown
|
||||||
$e107->destruct();
|
$e107->destruct();
|
||||||
/*
|
|
||||||
if($tmp)
|
|
||||||
{
|
|
||||||
$page = str_replace($tmp['search'], $tmp['replace'], ob_get_clean());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{*/
|
|
||||||
|
|
||||||
//$length = ob_get_length();
|
|
||||||
// $page = ob_get_clean();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// $page = ob_get_clean();
|
|
||||||
|
|
||||||
// New - see class2.php
|
// New - see class2.php
|
||||||
$ehd = new e_http_header;
|
$ehd = new e_http_header;
|
||||||
@@ -457,4 +421,5 @@ echo $page;
|
|||||||
|
|
||||||
unset($In_e107_Footer);
|
unset($In_e107_Footer);
|
||||||
$e107_Clean_Exit = TRUE; // For registered shutdown function -- let it know all is well!
|
$e107_Clean_Exit = TRUE; // For registered shutdown function -- let it know all is well!
|
||||||
?>
|
|
||||||
|
|
||||||
|
@@ -20,13 +20,10 @@ $In_e107_Footer = TRUE; // For registered shutdown function
|
|||||||
|
|
||||||
$magicSC = e107::getRender()->getMagicShortcodes(); // support for {---TITLE---} etc.
|
$magicSC = e107::getRender()->getMagicShortcodes(); // support for {---TITLE---} etc.
|
||||||
|
|
||||||
|
|
||||||
global $error_handler,$db_time,$FOOTER;
|
global $error_handler,$db_time,$FOOTER;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// System browser CACHE control - defaults to no cache; override in e107_config or on the fly
|
// System browser CACHE control - defaults to no cache; override in e107_config or on the fly
|
||||||
// This is temporary solution, we'll implement more flexible way for cache control override
|
// This is temporary solution, we'll implement more flexible way for cache control override
|
||||||
// per page, more investigation needed about cache related headers, browser quirks etc
|
// per page, more investigation needed about cache related headers, browser quirks etc
|
||||||
@@ -71,7 +68,7 @@ if (varset($e107_popup) != 1)
|
|||||||
//
|
//
|
||||||
if(!deftrue('e_IFRAME'))
|
if(!deftrue('e_IFRAME'))
|
||||||
{
|
{
|
||||||
parseheader((varset($ph) ? $cust_footer : $FOOTER));
|
parseheader($FOOTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
$eTimingStop = microtime();
|
$eTimingStop = microtime();
|
||||||
@@ -91,7 +88,7 @@ if (varset($e107_popup) != 1)
|
|||||||
$logLine .= "'".($now = time())."','".gmstrftime('%y-%m-%d %H:%M:%S', $now)."','".e107::getIPHandler()->getIP(FALSE)."','".e_PAGE.'?'.e_QUERY."','".$rendertime."','".$db_time."','".$queryCount."','".$memuse."','".$_SERVER['HTTP_USER_AGENT']."','{$_SERVER["REQUEST_METHOD"]}'";
|
$logLine .= "'".($now = time())."','".gmstrftime('%y-%m-%d %H:%M:%S', $now)."','".e107::getIPHandler()->getIP(FALSE)."','".e_PAGE.'?'.e_QUERY."','".$rendertime."','".$db_time."','".$queryCount."','".$memuse."','".$_SERVER['HTTP_USER_AGENT']."','{$_SERVER["REQUEST_METHOD"]}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('getrusage'))
|
if (function_exists('getrusage') && !empty($eTimingStartCPU))
|
||||||
{
|
{
|
||||||
$ru = getrusage();
|
$ru = getrusage();
|
||||||
$cpuUTime = $ru['ru_utime.tv_sec'] + ($ru['ru_utime.tv_usec'] * 1e-6);
|
$cpuUTime = $ru['ru_utime.tv_sec'] + ($ru['ru_utime.tv_usec'] * 1e-6);
|
||||||
@@ -135,11 +132,11 @@ if (varset($e107_popup) != 1)
|
|||||||
{
|
{
|
||||||
$rinfo .= CORE_LAN16.$memuse;
|
$rinfo .= CORE_LAN16.$memuse;
|
||||||
}
|
}
|
||||||
if (isset($pref['displaycacheinfo']) && $pref['displaycacheinfo'])
|
/* if (isset($pref['displaycacheinfo']) && $pref['displaycacheinfo'])
|
||||||
{
|
{
|
||||||
// $rinfo .= $cachestring.".";
|
$rinfo .= $cachestring.".";
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if ($pref['log_page_accesses'])
|
if ($pref['log_page_accesses'])
|
||||||
{
|
{
|
||||||
// Need to log the page info to a text file as CSV data
|
// Need to log the page info to a text file as CSV data
|
||||||
@@ -314,7 +311,7 @@ if(deftrue('e_DEVELOPER'))
|
|||||||
{
|
{
|
||||||
echo "\n\n<!-- ======= [JSManager] FOOTER: Remaining CSS ======= -->";
|
echo "\n\n<!-- ======= [JSManager] FOOTER: Remaining CSS ======= -->";
|
||||||
}
|
}
|
||||||
$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('library','other','core','plugin','theme'); // INLINE CSS in Body not supported by HTML5. .
|
$CSSORDER = defined('CSSORDER') && deftrue('CSSORDER') ? explode(",",CSSORDER) : array('library','other','core','plugin','theme'); // INLINE CSS in Body not supported by HTML5. .
|
||||||
|
|
||||||
foreach($CSSORDER as $val)
|
foreach($CSSORDER as $val)
|
||||||
{
|
{
|
||||||
@@ -394,7 +391,7 @@ if (!empty($pref['e_output_list']) && is_array($pref['e_output_list']))
|
|||||||
if(is_readable($fname))
|
if(is_readable($fname))
|
||||||
{
|
{
|
||||||
|
|
||||||
$ret = ($e107_debug || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
$ret = (!empty($e107_debug) || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($ret);
|
unset($ret);
|
||||||
@@ -409,9 +406,6 @@ if (!empty($pref['e_output_list']) && is_array($pref['e_output_list']))
|
|||||||
|
|
||||||
$search = array_keys($magicSC);
|
$search = array_keys($magicSC);
|
||||||
$replace = array_values($magicSC);
|
$replace = array_values($magicSC);
|
||||||
$bread = e107::breadcrumb();
|
|
||||||
$search[] = '{---BREADCRUMB---}';
|
|
||||||
$replace[] = e107::getForm()->breadcrumb($bread);
|
|
||||||
|
|
||||||
// New - see class2.php
|
// New - see class2.php
|
||||||
$ehd = new e_http_header;
|
$ehd = new e_http_header;
|
||||||
@@ -435,4 +429,5 @@ e107::getSession()->shutdown(); // moved from the top of footer_default.php to f
|
|||||||
// Shutdown
|
// Shutdown
|
||||||
$e107->destruct();
|
$e107->destruct();
|
||||||
$e107_Clean_Exit=true; // For registered shutdown function -- let it know all is well!
|
$e107_Clean_Exit=true; // For registered shutdown function -- let it know all is well!
|
||||||
?>
|
|
||||||
|
|
||||||
|
@@ -2863,7 +2863,7 @@ class themeHandler
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPreview()
|
static function showPreview()
|
||||||
{
|
{
|
||||||
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_theme.php");
|
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_theme.php");
|
||||||
$text = "<br /><div class='indent'>".TPVLAN_1.".</div><br />";
|
$text = "<br /><div class='indent'>".TPVLAN_1.".</div><br />";
|
||||||
|
Reference in New Issue
Block a user