mirror of
https://github.com/e107inc/e107.git
synced 2025-07-12 18:46:20 +02:00
js manager header/footer render
This commit is contained in:
10
class2.php
10
class2.php
@ -9,8 +9,8 @@
|
|||||||
* General purpose file
|
* General purpose file
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||||
* $Revision: 1.148 $
|
* $Revision: 1.149 $
|
||||||
* $Date: 2009-09-29 17:45:06 $
|
* $Date: 2009-10-01 15:05:41 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -1068,12 +1068,12 @@ if (
|
|||||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_admin.php');
|
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_admin.php');
|
||||||
}
|
}
|
||||||
// This should avoid further checks - NOTE: used in js_manager.php
|
// This should avoid further checks - NOTE: used in js_manager.php
|
||||||
define('e_ADMIN_AREA', $inAdminDir);
|
define('e_ADMIN_AREA', ($inAdminDir && !defsettrue('USER_AREA'))); //Force USER_AREA added
|
||||||
|
|
||||||
if(!defined('THEME'))
|
if(!defined('THEME'))
|
||||||
{
|
{
|
||||||
//Force USER_AREA added
|
|
||||||
if (e_ADMIN_AREA && varsettrue($pref['admintheme']) && !defsettrue('USER_AREA'))
|
if (e_ADMIN_AREA && varsettrue($pref['admintheme']))
|
||||||
{
|
{
|
||||||
//We have now e_IFRAME mod and USER_AREA force
|
//We have now e_IFRAME mod and USER_AREA force
|
||||||
// && (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE)
|
// && (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE)
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
+ ----------------------------------------------------------------------------+
|
* e107 website system
|
||||||
| e107 website system
|
*
|
||||||
|
|
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
||||||
| Steve Dunstan 2001-2002
|
* Released under the terms and conditions of the
|
||||||
| http://e107.org
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
| jalist@e107.org
|
*
|
||||||
|
|
* Admin Footer
|
||||||
| Released under the terms and conditions of the
|
*
|
||||||
| GNU General Public License (http://gnu.org).
|
* $Source: /cvs_backup/e107_0.8/e107_admin/footer.php,v $
|
||||||
|
|
* $Revision: 1.15 $
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/footer.php,v $
|
* $Date: 2009-10-01 15:05:40 $
|
||||||
| $Revision: 1.14 $
|
* $Author: secretr $
|
||||||
| $Date: 2009-09-13 10:29:56 $
|
*/
|
||||||
| $Author: secretr $
|
if (!defined('e107_INIT'))
|
||||||
+----------------------------------------------------------------------------+
|
{
|
||||||
*/
|
exit;
|
||||||
if (!defined('e107_INIT')) { exit; }
|
}
|
||||||
$In_e107_Footer = TRUE; // For registered shutdown function
|
$In_e107_Footer = TRUE; // For registered shutdown function
|
||||||
|
|
||||||
global $error_handler, $db_time, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $ADMIN_FOOTER, $e107, $pref;
|
global $error_handler,$db_time,$ADMIN_FOOTER;
|
||||||
|
|
||||||
//
|
//
|
||||||
// SHUTDOWN SEQUENCE
|
// SHUTDOWN SEQUENCE
|
||||||
@ -45,163 +45,181 @@ global $error_handler, $db_time, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQ
|
|||||||
// A Ensure sql and traffic objects exist
|
// A Ensure sql and traffic objects exist
|
||||||
//
|
//
|
||||||
|
|
||||||
/*
|
$e107 = e107::getInstance();
|
||||||
if(!is_object($sql)){
|
|
||||||
// reinstigate db connection if another connection from third-party script closed it ...
|
|
||||||
$sql = new db;
|
|
||||||
$sql -> db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
e107::getSingleton('e107_traffic')->Bump('Lost Traffic Counters');
|
e107::getSingleton('e107_traffic')->Bump('Lost Traffic Counters');
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
|
if (varset($e107_popup) != 1)
|
||||||
if(varset($e107_popup)!=1){
|
{
|
||||||
//
|
//
|
||||||
// B.1 Clear cache if over a week old
|
// B.1 Clear cache if over a week old
|
||||||
//
|
//
|
||||||
if (ADMIN == TRUE) {
|
if (ADMIN === TRUE)
|
||||||
if ($pref['cachestatus']) {
|
{
|
||||||
if (!$sql->db_Select('generic', '*', "gen_type='empty_cache'"))
|
if ($pref['cachestatus'])
|
||||||
{
|
{
|
||||||
$sql->db_Insert('generic', "0,'empty_cache','".time()."','0','','0',''");
|
if (!$sql->db_Select('generic', '*', "gen_type='empty_cache'"))
|
||||||
} else {
|
|
||||||
$row = $sql->db_Fetch();
|
|
||||||
if (($row['gen_datestamp']+604800) < time()) // If cache not cleared in last 7 days, clear it.
|
|
||||||
{
|
{
|
||||||
require_once(e_HANDLER."cache_handler.php");
|
$sql->db_Insert('generic', "0,'empty_cache','".time()."','0','','0',''");
|
||||||
$ec = new ecache;
|
}
|
||||||
$ec->clear();
|
else
|
||||||
$sql->db_Update('generic', "gen_datestamp='".time()."' WHERE gen_type='empty_cache'");
|
{
|
||||||
|
$row = $sql->db_Fetch();
|
||||||
|
if (($row['gen_datestamp'] + 604800) < time()) // If cache not cleared in last 7 days, clear it.
|
||||||
|
{
|
||||||
|
require_once (e_HANDLER."cache_handler.php");
|
||||||
|
$ec = new ecache;
|
||||||
|
$ec->clear();
|
||||||
|
$sql->db_Update('generic', "gen_datestamp='".time()."' WHERE gen_type='empty_cache'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// B.2 Send footer template, stop timing, send simple page stats
|
// B.2 Send footer template, stop timing, send simple page stats
|
||||||
//
|
//
|
||||||
//NEW - Iframe mod
|
//NEW - Iframe mod
|
||||||
if (!defsettrue('e_IFRAME'))
|
if (!defsettrue('e_IFRAME'))
|
||||||
{
|
{
|
||||||
parse_admin($ADMIN_FOOTER);
|
parse_admin($ADMIN_FOOTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
$eTimingStop = microtime();
|
$eTimingStop = microtime();
|
||||||
global $eTimingStart;
|
global $eTimingStart;
|
||||||
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta( $eTimingStart, $eTimingStop );
|
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
|
||||||
$dbPercent = 100.0 * $db_time / $clockTime;
|
$dbPercent = 100.0 * $db_time / $clockTime;
|
||||||
// Format for display or logging
|
// Format for display or logging
|
||||||
$rendertime = number_format($clockTime, 2); // Clock time during page render
|
$rendertime = number_format($clockTime, 2); // Clock time during page render
|
||||||
$db_time = number_format($db_time,2); // Clock time in DB render
|
$db_time = number_format($db_time, 2); // Clock time in DB render
|
||||||
$dbPercent = number_format($dbPercent,0); // DB as percent of clock
|
$dbPercent = number_format($dbPercent, 0); // DB as percent of clock
|
||||||
$memuse = $e107->get_memory_usage(); // Memory at end, in B/KB/MB/GB ;)
|
$memuse = $e107->get_memory_usage(); // Memory at end, in B/KB/MB/GB ;)
|
||||||
$rinfo = '';
|
$rinfo = '';
|
||||||
|
|
||||||
if ( function_exists( 'getrusage' ) )
|
if (function_exists('getrusage'))
|
||||||
{
|
{
|
||||||
$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));
|
||||||
$cpuSTime = $ru['ru_stime.tv_sec'] + ($ru['ru_stime.tv_usec'] * 1e-6);
|
$cpuSTime = $ru['ru_stime.tv_sec'] + ($ru['ru_stime.tv_usec'] * (1e-6));
|
||||||
$cpuUStart = $eTimingStartCPU['ru_utime.tv_sec'] + ($eTimingStartCPU['ru_utime.tv_usec'] * 1e-6);
|
$cpuUStart = $eTimingStartCPU['ru_utime.tv_sec'] + ($eTimingStartCPU['ru_utime.tv_usec'] * (1e-6));
|
||||||
$cpuSStart = $eTimingStartCPU['ru_stime.tv_sec'] + ($eTimingStartCPU['ru_stime.tv_usec'] * 1e-6);
|
$cpuSStart = $eTimingStartCPU['ru_stime.tv_sec'] + ($eTimingStartCPU['ru_stime.tv_usec'] * (1e-6));
|
||||||
$cpuStart = $cpuUStart + $cpuSStart;
|
$cpuStart = $cpuUStart + $cpuSStart;
|
||||||
$cpuTot = $cpuUTime + $cpuSTime;
|
$cpuTot = $cpuUTime + $cpuSTime;
|
||||||
$cpuTime = $cpuTot - $cpuStart;
|
$cpuTime = $cpuTot - $cpuStart;
|
||||||
$cpuPct = 100.0 * $cpuTime / $rendertime; /* CPU load during known clock time */
|
$cpuPct = 100.0 * $cpuTime / $rendertime; /* CPU load during known clock time */
|
||||||
|
|
||||||
// Format for display or logging (Uncomment as needed for logging)
|
// Format for display or logging (Uncomment as needed for logging)
|
||||||
//$cpuUTime = number_format($cpuUTime, 3); // User cpu
|
// User cpu
|
||||||
//$cpuSTime = number_format($cpuSTime, 3); // System cpu
|
//$cpuUTime = number_format($cpuUTime, 3);
|
||||||
//$cpuTot = number_format($cpuTot, 3); // Total (User+System)
|
// System cpu
|
||||||
$cpuStart = number_format($cpuStart, 3); // Startup time (i.e. CPU used before class2.php)
|
//$cpuSTime = number_format($cpuSTime, 3);
|
||||||
$cpuTime = number_format($cpuTime, 3); // CPU while we were measuring the clock (cpuTot-cpuStart)
|
// Total (User+System)
|
||||||
$cpuPct = number_format($cpuPct,0); // CPU Load (CPU/Clock)
|
//$cpuTot = number_format($cpuTot, 3);
|
||||||
|
|
||||||
|
$cpuStart = number_format($cpuStart, 3); // Startup time (i.e. CPU used before class2.php)
|
||||||
|
$cpuTime = number_format($cpuTime, 3); // CPU while we were measuring the clock (cpuTot-cpuStart)
|
||||||
|
$cpuPct = number_format($cpuPct, 0); // CPU Load (CPU/Clock)
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Here's a good place to log CPU usage in case you want graphs and/or your host cares about that
|
// Here's a good place to log CPU usage in case you want graphs and/or your host cares about that
|
||||||
// e.g. (on a typical vhosted linux host)
|
// e.g. (on a typical vhosted linux host)
|
||||||
//
|
//
|
||||||
// $logname = "/home/mysite/public_html/queryspeed.log";
|
// $logname = "/home/mysite/public_html/queryspeed.log";
|
||||||
// $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp);
|
// $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp);
|
||||||
|
|
||||||
if($pref['displayrendertime'])
|
if ($pref['displayrendertime'])
|
||||||
{
|
{
|
||||||
$rinfo .= CORE_LAN11;
|
$rinfo .= CORE_LAN11;
|
||||||
if (isset($cpuTime))
|
if (isset($cpuTime))
|
||||||
{
|
{
|
||||||
// $rinfo .= "{$cpuTime} cpu sec ({$cpuPct}% load, {$cpuStart} startup). Clock: ";
|
// $rinfo .= "{$cpuTime} cpu sec ({$cpuPct}% load, {$cpuStart} startup). Clock: ";
|
||||||
$rinfo .= sprintf(CORE_LAN14,$cpuTime,$cpuPct,$cpuStart);
|
$rinfo .= sprintf(CORE_LAN14, $cpuTime, $cpuPct, $cpuStart);
|
||||||
}
|
}
|
||||||
$rinfo .= $rendertime.CORE_LAN12.$dbPercent.CORE_LAN13;
|
$rinfo .= $rendertime.CORE_LAN12.$dbPercent.CORE_LAN13;
|
||||||
}
|
}
|
||||||
if($pref['displaysql']){ $rinfo .= CORE_LAN15.$sql -> db_QueryCount().". "; }
|
if ($pref['displaysql'])
|
||||||
if(isset($pref['display_memory_usage']) && $pref['display_memory_usage']){ $rinfo .= CORE_LAN16.$memuse; }
|
{
|
||||||
if(isset($pref['displaycacheinfo']) && $pref['displaycacheinfo']){ $rinfo .= $cachestring."."; }
|
$rinfo .= CORE_LAN15.$sql->db_QueryCount().". ";
|
||||||
|
}
|
||||||
|
if (isset($pref['display_memory_usage']) && $pref['display_memory_usage'])
|
||||||
|
{
|
||||||
|
$rinfo .= CORE_LAN16.$memuse;
|
||||||
|
}
|
||||||
|
if (isset($pref['displaycacheinfo']) && $pref['displaycacheinfo'])
|
||||||
|
{
|
||||||
|
$rinfo .= $cachestring.".";
|
||||||
|
}
|
||||||
|
|
||||||
if (function_exists('theme_renderinfo'))
|
if (function_exists('theme_renderinfo'))
|
||||||
{
|
{
|
||||||
theme_renderinfo($rinfo);
|
theme_renderinfo($rinfo);
|
||||||
} else {
|
|
||||||
echo ($rinfo ? "\n<div style='text-align:center' class='e107_foot smalltext'>{$rinfo}</div>\n" : "");
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo($rinfo ? "\n<div class='e-footer-info smalltext'>{$rinfo}</div>\n" : "");
|
||||||
|
}
|
||||||
|
|
||||||
} // End of regular-page footer (the above NOT done for popups)
|
} // End of regular-page footer (the above NOT done for popups)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// C Dump all debug and traffic information
|
// C Dump all debug and traffic information
|
||||||
//
|
//
|
||||||
if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL) {
|
if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL)
|
||||||
global $db_debug;
|
{
|
||||||
echo "\n<!-- DEBUG -->\n<div class='e107_debug dbg_info'>";
|
global $db_debug;
|
||||||
$db_debug->Show_All();
|
echo "\n<!-- DEBUG -->\n<div class='e-debug debug-info'>";
|
||||||
echo "</div>\n";
|
$db_debug->Show_All();
|
||||||
}
|
echo "</div>\n";
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
changes by jalist 24/01/2005:
|
changes by jalist 24/01/2005:
|
||||||
show sql queries
|
show sql queries
|
||||||
usage: add ?showsql to query string, must be admin
|
usage: add ?showsql to query string, must be admin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(ADMIN && isset($queryinfo) && is_array($queryinfo))
|
// XXX - Too old? Something using this?
|
||||||
{
|
if (ADMIN && isset($queryinfo) && is_array($queryinfo))
|
||||||
$c=1;
|
{
|
||||||
$mySQLInfo = $sql->mySQLinfo;
|
$c = 1;
|
||||||
echo "<div class='e107_debug qry_notice'><table class='fborder' style='width: 100%;'>
|
$mySQLInfo = $sql->mySQLinfo;
|
||||||
|
echo "<div class='e-debug query-notice'><table class='fborder' style='width: 100%;'>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
|
<td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
|
||||||
foreach ($queryinfo as $infovalue)
|
foreach ($queryinfo as $infovalue)
|
||||||
{
|
{
|
||||||
echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n";
|
echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n";
|
||||||
$c++;
|
$c++;
|
||||||
}
|
|
||||||
echo "</table></div>";
|
|
||||||
}
|
}
|
||||||
|
echo "</table></div>";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// D Close DB connection. We're done talking to underlying MySQL
|
// D Close DB connection. We're done talking to underlying MySQL
|
||||||
//
|
//
|
||||||
$sql -> db_Close(); // Only one is needed; the db is only connected once even with several $sql objects
|
$sql->db_Close(); // Only one is needed; the db is only connected once even with several $sql objects
|
||||||
|
|
||||||
//
|
//
|
||||||
// Just before we quit: dump quick timer if there is any
|
// Just before we quit: dump quick timer if there is any
|
||||||
// Works any time we get this far. Not calibrated, but it is quick and simple to use.
|
// Works any time we get this far. Not calibrated, but it is quick and simple to use.
|
||||||
// To use: eQTimeOn(); eQTimeOff();
|
// To use: eQTimeOn(); eQTimeOff();
|
||||||
//
|
//
|
||||||
$tmp = eQTimeElapsed();
|
$tmp = eQTimeElapsed();
|
||||||
if (strlen($tmp)) {
|
if (strlen($tmp))
|
||||||
global $ns;
|
{
|
||||||
$ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
|
e107::getRender()->tablerender('Quick Admin Timer', "Results: {$tmp} microseconds");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pref['developer']) {
|
if ($pref['developer'])
|
||||||
|
{
|
||||||
global $oblev_at_start,$oblev_before_start;
|
global $oblev_at_start,$oblev_before_start;
|
||||||
if (ob_get_level() != $oblev_at_start) {
|
if (ob_get_level() != $oblev_at_start)
|
||||||
|
{
|
||||||
$oblev = ob_get_level();
|
$oblev = ob_get_level();
|
||||||
$obdbg = "<div class='e107_debug ob_err' style='text-align:center' class='e107_foot smalltext'>Software defect detected; ob_*() level {$oblev} at end instead of ($oblev_at_start). POPPING EXTRA BUFFERS!</div>";
|
$obdbg = "<div class='e-debug ob-error'>Software defect detected; ob_*() level {$oblev} at end instead of ($oblev_at_start). POPPING EXTRA BUFFERS!</div>";
|
||||||
while (ob_get_level() > $oblev_at_start) {
|
while (ob_get_level() > $oblev_at_start)
|
||||||
|
{
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
}
|
}
|
||||||
echo $obdbg;
|
echo $obdbg;
|
||||||
@ -210,20 +228,26 @@ if ($pref['developer']) {
|
|||||||
// Until they work that out, we'll disable this message.
|
// Until they work that out, we'll disable this message.
|
||||||
// Devs can re-enable for testing as needed.
|
// Devs can re-enable for testing as needed.
|
||||||
//
|
//
|
||||||
if (0 && $oblev_before_start != 0) {
|
if (0 && $oblev_before_start != 0)
|
||||||
$obdbg = "<div class='e107_debug ob_err' style='text-align:center' class='e107_foot smalltext'>Software warning; ob_*() level {$oblev_before_start} at start; this page not properly integrated into its wrapper.</div>";
|
{
|
||||||
|
$obdbg = "<div class='e-debug ob-error'>Software warning; ob_*() level {$oblev_before_start} at start; this page not properly integrated into its wrapper.</div>";
|
||||||
echo $obdbg;
|
echo $obdbg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((ADMIN == true || $pref['developer']) && count($error_handler->errors) && $error_handler->debug == true)
|
if ((ADMIN == true || $pref['developer']) && count($error_handler->errors) && $error_handler->debug == true)
|
||||||
{
|
{
|
||||||
echo "
|
$tmp = $error_handler->return_errors();
|
||||||
<div class='e107_debug php_err block-text'>
|
if($tmp)
|
||||||
<h3>PHP Errors:</h3><br />
|
{
|
||||||
".$error_handler->return_errors()."
|
echo "
|
||||||
</div>
|
<div class='e-debug php-errors block-text'>
|
||||||
";
|
<h3>PHP Errors:</h3><br />
|
||||||
|
".$tmp."
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
unset($tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -236,31 +260,39 @@ if (function_exists('theme_foot'))
|
|||||||
|
|
||||||
//
|
//
|
||||||
// F any included JS footer scripts
|
// F any included JS footer scripts
|
||||||
|
// DEPRECATED - use e107::getJs()->footerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
|
||||||
//
|
//
|
||||||
global $footer_js;
|
global $footer_js;
|
||||||
if(isset($footer_js) && is_array($footer_js))
|
if (isset($footer_js) && is_array($footer_js))
|
||||||
{
|
{
|
||||||
$footer_js = array_unique($footer_js);
|
$footer_js = array_unique($footer_js);
|
||||||
foreach($footer_js as $fname)
|
foreach ($footer_js as $fname)
|
||||||
{
|
{
|
||||||
echo "<script type='text/javascript' src='{$fname}'></script>\n";
|
echo "<script type='text/javascript' src='{$fname}'></script>\n";
|
||||||
$js_included[] = $fname;
|
$js_included[] = $fname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [JSManager] Load JS Footer Includes by priority
|
||||||
|
e107::getJs()->renderJs('footer', true);
|
||||||
|
|
||||||
|
// [JSManager] Load JS Footer inline code by priority
|
||||||
|
e107::getJs()->renderJs('footer_inline', 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
|
// see e107.js and class2.php
|
||||||
// This must be done as late as possible in page processing.
|
// This must be done as late as possible in page processing.
|
||||||
$_serverTime=time();
|
$_serverTime = time();
|
||||||
$lastSet = isset($_COOKIE['e107_tdSetTime']) ? $_COOKIE['e107_tdSetTime'] : 0;
|
$lastSet = isset($_COOKIE['e107_tdSetTime']) ? $_COOKIE['e107_tdSetTime'] : 0;
|
||||||
if (abs($_serverTime - $lastSet) > 120) {
|
if (abs($_serverTime - $lastSet) > 120)
|
||||||
|
{
|
||||||
/* update time delay every couple of minutes.
|
/* update time delay every couple of minutes.
|
||||||
* Benefit: account for user time corrections and changes in internet delays
|
* Benefit: account for user time corrections and changes in internet delays
|
||||||
* Drawback: each update may cause all server times to display a bit different
|
* Drawback: each update may cause all server times to display a bit different
|
||||||
*/
|
*/
|
||||||
echo "<script type='text/javascript'>\n";
|
echo "<script type='text/javascript'>\n";
|
||||||
echo "SyncWithServerTime('{$_serverTime}');
|
echo "SyncWithServerTime('{$_serverTime}');
|
||||||
</script>\n";
|
</script>\n";
|
||||||
@ -281,23 +313,28 @@ header("Cache-Control: must-revalidate");
|
|||||||
header("ETag: {$etag}");
|
header("ETag: {$etag}");
|
||||||
|
|
||||||
$pref['compression_level'] = 6;
|
$pref['compression_level'] = 6;
|
||||||
if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip")) {
|
if (strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"], ""), "gzip"))
|
||||||
|
{
|
||||||
$browser_support = true;
|
$browser_support = true;
|
||||||
}
|
}
|
||||||
if(ini_get("zlib.output_compression") == false && function_exists("gzencode")) {
|
if (ini_get("zlib.output_compression") == false && function_exists("gzencode"))
|
||||||
|
{
|
||||||
$server_support = true;
|
$server_support = true;
|
||||||
}
|
}
|
||||||
if(varset($pref['compress_output'],false) && $server_support == true && $browser_support == true) {
|
if (varset($pref['compress_output'], false) && $server_support == true && $browser_support == true)
|
||||||
|
{
|
||||||
$level = intval($pref['compression_level']);
|
$level = intval($pref['compression_level']);
|
||||||
$page = gzencode($page, $level);
|
$page = gzencode($page, $level);
|
||||||
header("Content-Encoding: gzip", true);
|
header("Content-Encoding: gzip", true);
|
||||||
header("Content-Length: ".strlen($page), true);
|
header("Content-Length: ".strlen($page), true);
|
||||||
echo $page;
|
echo $page;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
header("Content-Length: ".strlen($page), true);
|
header("Content-Length: ".strlen($page), true);
|
||||||
echo $page;
|
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!
|
||||||
?>
|
?>
|
File diff suppressed because it is too large
Load Diff
@ -7,8 +7,8 @@
|
|||||||
* GNU General Public License (http://gnu.org).
|
* GNU General Public License (http://gnu.org).
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/js_manager.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/js_manager.php,v $
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
* $Date: 2009-09-29 17:40:55 $
|
* $Date: 2009-10-01 15:05:41 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -681,7 +681,8 @@ class e_jsmanager
|
|||||||
*/
|
*/
|
||||||
public function getCurrentTheme()
|
public function getCurrentTheme()
|
||||||
{
|
{
|
||||||
return ($this->isInAdmin() ? e107::getPref('admintheme') : e107::getPref('sitetheme'));
|
// XXX - USERTHEME is defined only on user session init
|
||||||
|
return ($this->isInAdmin() ? e107::getPref('admintheme') : defsettrue('USERTHEME', e107::getPref('sitetheme')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,25 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
+ ----------------------------------------------------------------------------+
|
+ ----------------------------------------------------------------------------+
|
||||||
| e107 website system
|
| e107 website system
|
||||||
|
|
|
|
||||||
| Steve Dunstan 2001-2002
|
| Steve Dunstan 2001-2002
|
||||||
| http://e107.org
|
| http://e107.org
|
||||||
| jalist@e107.org
|
| jalist@e107.org
|
||||||
|
|
|
|
||||||
| Released under the terms and conditions of the
|
| Released under the terms and conditions of the
|
||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/footer_default.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/footer_default.php,v $
|
||||||
| $Revision: 1.17 $
|
| $Revision: 1.18 $
|
||||||
| $Date: 2009-09-13 10:29:56 $
|
| $Date: 2009-10-01 15:05:40 $
|
||||||
| $Author: secretr $
|
| $Author: secretr $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT'))
|
||||||
$In_e107_Footer = TRUE; // For registered shutdown function
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$In_e107_Footer = TRUE; // For registered shutdown function
|
||||||
|
|
||||||
global $error_handler, $db_time, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $FOOTER, $e107;
|
global $error_handler,$db_time,$FOOTER;
|
||||||
|
|
||||||
//
|
//
|
||||||
// SHUTDOWN SEQUENCE
|
// SHUTDOWN SEQUENCE
|
||||||
@ -41,37 +44,39 @@ global $error_handler, $db_time, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQ
|
|||||||
// H Final HTML (/body, /html)
|
// H Final HTML (/body, /html)
|
||||||
// I collect and send buffered page, along with needed headers
|
// I collect and send buffered page, along with needed headers
|
||||||
//
|
//
|
||||||
|
$e107 = e107::getInstance();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
$pref = e107::getPref();
|
||||||
|
|
||||||
if(varset($e107_popup)!=1)
|
if (varset($e107_popup) != 1)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// B.1 Clear cache (admin-only)
|
// B.1 Clear cache (admin-only)
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// B.2 Send footer template, stop timing, send simple page stats
|
// B.2 Send footer template, stop timing, send simple page stats
|
||||||
//
|
//
|
||||||
parseheader((varset($ph) ? $cust_footer : $FOOTER));
|
parseheader((varset($ph) ? $cust_footer : $FOOTER));
|
||||||
|
|
||||||
$eTimingStop = microtime();
|
$eTimingStop = microtime();
|
||||||
global $eTimingStart;
|
global $eTimingStart;
|
||||||
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta( $eTimingStart, $eTimingStop );
|
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
|
||||||
$dbPercent = 100.0 * $db_time / $clockTime;
|
$dbPercent = 100.0 * $db_time / $clockTime;
|
||||||
// Format for display or logging
|
// Format for display or logging
|
||||||
$rendertime = number_format($clockTime, 2); // Clock time during page render
|
$rendertime = number_format($clockTime, 2); // Clock time during page render
|
||||||
$db_time = number_format($db_time,2); // Clock time in DB render
|
$db_time = number_format($db_time, 2); // Clock time in DB render
|
||||||
$dbPercent = number_format($dbPercent,0); // DB as percent of clock
|
$dbPercent = number_format($dbPercent, 0); // DB as percent of clock
|
||||||
$memuse = $e107->get_memory_usage(); // Memory at end, in B/KB/MB/GB ;)
|
$memuse = $e107->get_memory_usage(); // Memory at end, in B/KB/MB/GB ;)
|
||||||
$queryCount = $sql -> db_QueryCount();
|
$queryCount = $sql->db_QueryCount();
|
||||||
$rinfo = '';
|
$rinfo = '';
|
||||||
$logLine = '';
|
$logLine = '';
|
||||||
if ($pref['log_page_accesses'])
|
if ($pref['log_page_accesses'])
|
||||||
{ // Collect the first batch of data to log
|
{ // Collect the first batch of data to log
|
||||||
$logLine.= "'".($now = time())."','".gmstrftime('%y-%m-%d %H:%M:%S',$now)."','".$e107->getIP()."','".e_PAGE.'?'.e_QUERY."','".$rendertime."','".$db_time."','".$queryCount."','".$memuse."'";
|
$logLine .= "'".($now = time())."','".gmstrftime('%y-%m-%d %H:%M:%S', $now)."','".$e107->getIP()."','".e_PAGE.'?'.e_QUERY."','".$rendertime."','".$db_time."','".$queryCount."','".$memuse."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( function_exists( 'getrusage' ) )
|
if (function_exists('getrusage'))
|
||||||
{
|
{
|
||||||
$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);
|
||||||
@ -79,109 +84,124 @@ if(varset($e107_popup)!=1)
|
|||||||
$cpuUStart = $eTimingStartCPU['ru_utime.tv_sec'] + ($eTimingStartCPU['ru_utime.tv_usec'] * 1e-6);
|
$cpuUStart = $eTimingStartCPU['ru_utime.tv_sec'] + ($eTimingStartCPU['ru_utime.tv_usec'] * 1e-6);
|
||||||
$cpuSStart = $eTimingStartCPU['ru_stime.tv_sec'] + ($eTimingStartCPU['ru_stime.tv_usec'] * 1e-6);
|
$cpuSStart = $eTimingStartCPU['ru_stime.tv_sec'] + ($eTimingStartCPU['ru_stime.tv_usec'] * 1e-6);
|
||||||
$cpuStart = $cpuUStart + $cpuSStart;
|
$cpuStart = $cpuUStart + $cpuSStart;
|
||||||
$cpuTot = $cpuUTime + $cpuSTime;
|
$cpuTot = $cpuUTime + $cpuSTime;
|
||||||
$cpuTime = $cpuTot - $cpuStart;
|
$cpuTime = $cpuTot - $cpuStart;
|
||||||
$cpuPct = 100.0 * $cpuTime / $rendertime; /* CPU load during known clock time */
|
$cpuPct = 100.0 * $cpuTime / $rendertime; /* CPU load during known clock time */
|
||||||
// Format for display or logging (Uncomment as needed for logging)
|
// Format for display or logging (Uncomment as needed for logging)
|
||||||
//$cpuUTime = number_format($cpuUTime, 3); // User cpu
|
//$cpuUTime = number_format($cpuUTime, 3); // User cpu
|
||||||
//$cpuSTime = number_format($cpuSTime, 3); // System cpu
|
//$cpuSTime = number_format($cpuSTime, 3); // System cpu
|
||||||
//$cpuTot = number_format($cpuTot, 3); // Total (User+System)
|
//$cpuTot = number_format($cpuTot, 3); // Total (User+System)
|
||||||
$cpuStart = number_format($cpuStart, 3); // Startup time (i.e. CPU used before class2.php)
|
$cpuStart = number_format($cpuStart, 3); // Startup time (i.e. CPU used before class2.php)
|
||||||
$cpuTime = number_format($cpuTime, 3); // CPU while we were measuring the clock (cpuTot-cpuStart)
|
$cpuTime = number_format($cpuTime, 3); // CPU while we were measuring the clock (cpuTot-cpuStart)
|
||||||
$cpuPct = number_format($cpuPct,0); // CPU Load (CPU/Clock)
|
$cpuPct = number_format($cpuPct, 0); // CPU Load (CPU/Clock)
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Here's a good place to log CPU usage in case you want graphs and/or your host cares about that
|
// Here's a good place to log CPU usage in case you want graphs and/or your host cares about that
|
||||||
// e.g. (on a typical vhosted linux host)
|
// e.g. (on a typical vhosted linux host)
|
||||||
//
|
//
|
||||||
// $logname = "/home/mysite/public_html/queryspeed.log";
|
// $logname = "/home/mysite/public_html/queryspeed.log";
|
||||||
// $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp);
|
// $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp);
|
||||||
|
|
||||||
if($pref['displayrendertime'])
|
if ($pref['displayrendertime'])
|
||||||
{
|
{
|
||||||
$rinfo .= CORE_LAN11;
|
$rinfo .= CORE_LAN11;
|
||||||
if (isset($cpuTime))
|
if (isset($cpuTime))
|
||||||
{
|
{
|
||||||
// $rinfo .= "{$cpuTime} cpu sec ({$cpuPct}% load, {$cpuStart} startup). Clock: ";
|
// $rinfo .= "{$cpuTime} cpu sec ({$cpuPct}% load, {$cpuStart} startup). Clock: ";
|
||||||
$rinfo .= sprintf(CORE_LAN14,$cpuTime,$cpuPct,$cpuStart);
|
$rinfo .= sprintf(CORE_LAN14, $cpuTime, $cpuPct, $cpuStart);
|
||||||
}
|
}
|
||||||
$rinfo .= $rendertime.CORE_LAN12.$dbPercent.CORE_LAN13.' ';
|
$rinfo .= $rendertime.CORE_LAN12.$dbPercent.CORE_LAN13.' ';
|
||||||
}
|
}
|
||||||
if($pref['displaysql']){ $rinfo .= CORE_LAN15.$queryCount.". "; }
|
if ($pref['displaysql'])
|
||||||
if(isset($pref['display_memory_usage']) && $pref['display_memory_usage']){ $rinfo .= CORE_LAN16.$memuse; }
|
{
|
||||||
if(isset($pref['displaycacheinfo']) && $pref['displaycacheinfo']){ $rinfo .= $cachestring."."; }
|
$rinfo .= CORE_LAN15.$queryCount.". ";
|
||||||
|
}
|
||||||
|
if (isset($pref['display_memory_usage']) && $pref['display_memory_usage'])
|
||||||
|
{
|
||||||
|
$rinfo .= CORE_LAN16.$memuse;
|
||||||
|
}
|
||||||
|
if (isset($pref['displaycacheinfo']) && $pref['displaycacheinfo'])
|
||||||
|
{
|
||||||
|
$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
|
||||||
$logname = e_FILE."logs/logd_".date("z.Y", time()).".csv";
|
$logname = e_FILE."logs/logd_".date("z.Y", time()).".csv";
|
||||||
$logfp = fopen($logname, 'a+');
|
$logfp = fopen($logname, 'a+');
|
||||||
fwrite($logfp, $logLine."\n");
|
fwrite($logfp, $logLine."\n");
|
||||||
fclose($logfp);
|
fclose($logfp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('theme_renderinfo'))
|
if (function_exists('theme_renderinfo'))
|
||||||
{
|
{
|
||||||
theme_renderinfo($rinfo);
|
theme_renderinfo($rinfo);
|
||||||
} else {
|
|
||||||
echo ($rinfo ? "\n<div style='text-align:center' class='e107_foot smalltext'>{$rinfo}</div>\n" : "");
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo($rinfo ? "\n<div class='e-footer-info smalltext'>{$rinfo}</div>\n" : "");
|
||||||
|
}
|
||||||
|
|
||||||
} // End of regular-page footer (the above NOT done for popups)
|
} // End of regular-page footer (the above NOT done for popups)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// C Dump all debug and traffic information
|
// C Dump all debug and traffic information
|
||||||
//
|
//
|
||||||
if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL) {
|
if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL)
|
||||||
global $db_debug;
|
{
|
||||||
echo "\n<!-- DEBUG -->\n<div class='e107_debug dbg_info'>";
|
global $db_debug;
|
||||||
$db_debug->Show_All();
|
echo "\n<!-- DEBUG -->\n<div class='e-debug debug-info'>";
|
||||||
echo "</div>\n";
|
$db_debug->Show_All();
|
||||||
}
|
echo "</div>\n";
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
changes by jalist 24/01/2005:
|
changes by jalist 24/01/2005:
|
||||||
show sql queries
|
show sql queries
|
||||||
usage: add ?showsql to query string, must be admin
|
usage: add ?showsql to query string, must be admin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(ADMIN && isset($queryinfo) && is_array($queryinfo))
|
if (ADMIN && isset($queryinfo) && is_array($queryinfo))
|
||||||
{
|
{
|
||||||
$c=1;
|
$c = 1;
|
||||||
$mySQLInfo = $sql->mySQLinfo;
|
$mySQLInfo = $sql->mySQLinfo;
|
||||||
echo "<div class='e107_debug qry_notice'><table class='fborder' style='width: 100%;'>
|
echo "<div class='e-debug query-notice'><table class='fborder' style='width: 100%;'>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
|
<td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
|
||||||
foreach ($queryinfo as $infovalue)
|
foreach ($queryinfo as $infovalue)
|
||||||
{
|
{
|
||||||
echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n";
|
echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n";
|
||||||
$c++;
|
$c++;
|
||||||
}
|
|
||||||
echo "</table></div>";
|
|
||||||
}
|
}
|
||||||
|
echo "</table></div>";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// D Close DB connection. We're done talking to underlying MySQL
|
// D Close DB connection. We're done talking to underlying MySQL
|
||||||
//
|
//
|
||||||
$sql -> db_Close(); // Only one is needed; the db is only connected once even with several $sql objects
|
$sql->db_Close(); // Only one is needed; the db is only connected once even with several $sql objects
|
||||||
|
|
||||||
//
|
//
|
||||||
// Just before we quit: dump quick timer if there is any
|
// Just before we quit: dump quick timer if there is any
|
||||||
// Works any time we get this far. Not calibrated, but it is quick and simple to use.
|
// Works any time we get this far. Not calibrated, but it is quick and simple to use.
|
||||||
// To use: eQTimeOn(); eQTimeOff();
|
// To use: eQTimeOn(); eQTimeOff();
|
||||||
//
|
//
|
||||||
$tmp = eQTimeElapsed();
|
$tmp = eQTimeElapsed();
|
||||||
if (strlen($tmp)) {
|
if (strlen($tmp))
|
||||||
global $ns;
|
{
|
||||||
$ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
|
global $ns;
|
||||||
}
|
$ns->tablerender('Quick Admin Timer', "Results: {$tmp} microseconds");
|
||||||
|
}
|
||||||
|
|
||||||
if ($pref['developer']) {
|
if ($pref['developer'])
|
||||||
|
{
|
||||||
global $oblev_at_start,$oblev_before_start;
|
global $oblev_at_start,$oblev_before_start;
|
||||||
if (ob_get_level() != $oblev_at_start) {
|
if (ob_get_level() != $oblev_at_start)
|
||||||
|
{
|
||||||
$oblev = ob_get_level();
|
$oblev = ob_get_level();
|
||||||
$obdbg = "<div class='e107_debug ob_err' style='text-align:center' class='e107_foot smalltext'>Software defect detected; ob_*() level {$oblev} at end instead of ($oblev_at_start). POPPING EXTRA BUFFERS!</div>";
|
$obdbg = "<div class='e-debug ob-error'>Software defect detected; ob_*() level {$oblev} at end instead of ($oblev_at_start). POPPING EXTRA BUFFERS!</div>";
|
||||||
while (ob_get_level() > $oblev_at_start) {
|
while (ob_get_level() > $oblev_at_start)
|
||||||
|
{
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
}
|
}
|
||||||
echo $obdbg;
|
echo $obdbg;
|
||||||
@ -190,20 +210,26 @@ if ($pref['developer']) {
|
|||||||
// Until they work that out, we'll disable this message.
|
// Until they work that out, we'll disable this message.
|
||||||
// Devs can re-enable for testing as needed.
|
// Devs can re-enable for testing as needed.
|
||||||
//
|
//
|
||||||
if (0 && $oblev_before_start != 0) {
|
if (0 && $oblev_before_start != 0)
|
||||||
$obdbg = "<div class='e107_debug ob_err' style='text-align:center' class='e107_foot smalltext'>Software warning; ob_*() level {$oblev_before_start} at start; this page not properly integrated into its wrapper.</div>";
|
{
|
||||||
|
$obdbg = "<div class='e-debug ob-error'>Software warning; ob_*() level {$oblev_before_start} at start; this page not properly integrated into its wrapper.</div>";
|
||||||
echo $obdbg;
|
echo $obdbg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((ADMIN == true || $pref['developer']) && count($error_handler->errors) && $error_handler->debug == true)
|
if ((ADMIN == true || $pref['developer']) && count($error_handler->errors) && $error_handler->debug == true)
|
||||||
{
|
{
|
||||||
echo "
|
$tmp = $error_handler->return_errors();
|
||||||
<div class='e107_debug php_err block-text'>
|
if($tmp)
|
||||||
<h3>PHP Errors:</h3><br />
|
{
|
||||||
".$error_handler->return_errors()."
|
echo "
|
||||||
</div>
|
<div class='e-debug php-errors block-text'>
|
||||||
";
|
<h3>PHP Errors:</h3><br />
|
||||||
|
".$tmp."
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
unset($tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -216,31 +242,39 @@ if (function_exists('theme_foot'))
|
|||||||
|
|
||||||
//
|
//
|
||||||
// F any included JS footer scripts
|
// F any included JS footer scripts
|
||||||
|
// DEPRECATED - use e107::getJs()->footerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
|
||||||
//
|
//
|
||||||
global $footer_js;
|
global $footer_js;
|
||||||
if(isset($footer_js) && is_array($footer_js))
|
if (isset($footer_js) && is_array($footer_js))
|
||||||
{
|
{
|
||||||
$footer_js = array_unique($footer_js);
|
$footer_js = array_unique($footer_js);
|
||||||
foreach($footer_js as $fname)
|
foreach ($footer_js as $fname)
|
||||||
{
|
{
|
||||||
echo "<script type='text/javascript' src='{$fname}'></script>\n";
|
echo "<script type='text/javascript' src='{$fname}'></script>\n";
|
||||||
$js_included[] = $fname;
|
$js_included[] = $fname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [JSManager] Load JS Footer Includes by priority
|
||||||
|
e107::getJs()->renderJs('footer', true);
|
||||||
|
|
||||||
|
// [JSManager] Load JS Footer inline code by priority
|
||||||
|
e107::getJs()->renderJs('footer_inline', 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
|
// see e107.js and class2.php
|
||||||
// This must be done as late as possible in page processing.
|
// This must be done as late as possible in page processing.
|
||||||
$_serverTime=time();
|
$_serverTime = time();
|
||||||
$lastSet = isset($_COOKIE['e107_tdSetTime']) ? $_COOKIE['e107_tdSetTime'] : 0;
|
$lastSet = isset($_COOKIE['e107_tdSetTime']) ? $_COOKIE['e107_tdSetTime'] : 0;
|
||||||
if (abs($_serverTime - $lastSet) > 120) {
|
if (abs($_serverTime - $lastSet) > 120)
|
||||||
|
{
|
||||||
/* update time delay every couple of minutes.
|
/* update time delay every couple of minutes.
|
||||||
* Benefit: account for user time corrections and changes in internet delays
|
* Benefit: account for user time corrections and changes in internet delays
|
||||||
* Drawback: each update may cause all server times to display a bit different
|
* Drawback: each update may cause all server times to display a bit different
|
||||||
*/
|
*/
|
||||||
echo "<script type='text/javascript'>\n";
|
echo "<script type='text/javascript'>\n";
|
||||||
echo "SyncWithServerTime('{$_serverTime}');
|
echo "SyncWithServerTime('{$_serverTime}');
|
||||||
</script>\n";
|
</script>\n";
|
||||||
@ -261,23 +295,28 @@ header("Cache-Control: must-revalidate");
|
|||||||
header("ETag: {$etag}");
|
header("ETag: {$etag}");
|
||||||
|
|
||||||
$pref['compression_level'] = 6;
|
$pref['compression_level'] = 6;
|
||||||
if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip")) {
|
if (strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"], ""), "gzip"))
|
||||||
|
{
|
||||||
$browser_support = true;
|
$browser_support = true;
|
||||||
}
|
}
|
||||||
if(ini_get("zlib.output_compression") == false && function_exists("gzencode")) {
|
if (ini_get("zlib.output_compression") == false && function_exists("gzencode"))
|
||||||
|
{
|
||||||
$server_support = true;
|
$server_support = true;
|
||||||
}
|
}
|
||||||
if(varset($pref['compress_output'],false) && $server_support == true && $browser_support == true) {
|
if (varset($pref['compress_output'], false) && $server_support == true && $browser_support == true)
|
||||||
|
{
|
||||||
$level = intval($pref['compression_level']);
|
$level = intval($pref['compression_level']);
|
||||||
$page = gzencode($page, $level);
|
$page = gzencode($page, $level);
|
||||||
header("Content-Encoding: gzip", true);
|
header("Content-Encoding: gzip", true);
|
||||||
header("Content-Length: ".strlen($page), true);
|
header("Content-Length: ".strlen($page), true);
|
||||||
echo $page;
|
echo $page;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
header("Content-Length: ".strlen($page), true);
|
header("Content-Length: ".strlen($page), true);
|
||||||
echo $page;
|
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!
|
||||||
?>
|
?>
|
@ -9,8 +9,8 @@
|
|||||||
* Default Header
|
* Default Header
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_themes/templates/header_default.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_themes/templates/header_default.php,v $
|
||||||
* $Revision: 1.41 $
|
* $Revision: 1.42 $
|
||||||
* $Date: 2009-09-29 17:42:22 $
|
* $Date: 2009-10-01 15:05:40 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -22,9 +22,6 @@ if(!defined('USER_AREA'))
|
|||||||
}
|
}
|
||||||
define('ADMIN_AREA',FALSE);
|
define('ADMIN_AREA',FALSE);
|
||||||
|
|
||||||
// Header included notification
|
|
||||||
define('HEADER_INIT', TRUE);
|
|
||||||
|
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
$e107->sql->db_Mark_Time('(Header Top)');
|
$e107->sql->db_Mark_Time('(Header Top)');
|
||||||
|
|
||||||
@ -113,6 +110,10 @@ else
|
|||||||
define("e_WYSIWYG",FALSE);
|
define("e_WYSIWYG",FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [JSManager] Load JS Includes - Zone 1 - Before Library, e_header and style
|
||||||
|
e107::getJs()->renderJs('header', 1);
|
||||||
|
e107::getJs()->renderJs('header_inline', 1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// D: send CSS comes first
|
// D: send CSS comes first
|
||||||
//
|
//
|
||||||
@ -201,14 +202,13 @@ if (varset($pref['e_header_list']) && is_array($pref['e_header_list']))
|
|||||||
// Send Javascript Libraries ALWAYS (for now)
|
// Send Javascript Libraries ALWAYS (for now)
|
||||||
$hash = md5(serialize(varset($pref['e_jslib'])).serialize(varset($THEME_JSLIB)).THEME.e_LANGUAGE.ADMIN).'_front';
|
$hash = md5(serialize(varset($pref['e_jslib'])).serialize(varset($THEME_JSLIB)).THEME.e_LANGUAGE.ADMIN).'_front';
|
||||||
echo "<script type='text/javascript' src='".e_FILE_ABS."e_jslib.php?{$hash}'></script>\n";
|
echo "<script type='text/javascript' src='".e_FILE_ABS."e_jslib.php?{$hash}'></script>\n";
|
||||||
/*
|
|
||||||
if (!isset($no_core_js) || !$no_core_js)
|
// [JSManager] Load JS Includes - Zone 2 - After Library
|
||||||
{
|
e107::getJs()->renderJs('header', 2);
|
||||||
echo "<script type='text/javascript' src='".e_FILE_ABS."e_js.php'></script>\n";
|
e107::getJs()->renderJs('header_inline', 2);
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Send Plugin JS Files
|
// Send Plugin JS Files
|
||||||
|
//DEPRECATED - use e107::getJs()->headerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
|
||||||
if (isset($eplug_js) && $eplug_js)
|
if (isset($eplug_js) && $eplug_js)
|
||||||
{
|
{
|
||||||
echo "\n<!-- eplug_js -->\n";
|
echo "\n<!-- eplug_js -->\n";
|
||||||
@ -227,6 +227,7 @@ if (isset($eplug_js) && $eplug_js)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send Theme JS Files
|
// Send Theme JS Files
|
||||||
|
//DEPRECATE this as well?
|
||||||
if (isset($theme_js_php) && $theme_js_php)
|
if (isset($theme_js_php) && $theme_js_php)
|
||||||
{
|
{
|
||||||
echo "<script type='text/javascript' src='".THEME_ABS."theme-js.php'></script>\n";
|
echo "<script type='text/javascript' src='".THEME_ABS."theme-js.php'></script>\n";
|
||||||
@ -240,6 +241,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
//XXX - CHAP JS
|
//XXX - CHAP JS
|
||||||
|
// TODO - convert it to e107::getJs()->header/footerFile() call
|
||||||
if (!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHAP'],0))
|
if (!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHAP'],0))
|
||||||
{
|
{
|
||||||
if ($pref['password_CHAP'] == 2)
|
if ($pref['password_CHAP'] == 2)
|
||||||
@ -251,11 +253,12 @@ if (!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHA
|
|||||||
$js_body_onload[] = "getChallenge();";
|
$js_body_onload[] = "getChallenge();";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if((isset($pref['enable_png_image_fix']) && $pref['enable_png_image_fix'] == true) || (isset($sleight) && $sleight == true))
|
if((isset($pref['enable_png_image_fix']) && $pref['enable_png_image_fix'] == true) || (isset($sleight) && $sleight == true))
|
||||||
{
|
{
|
||||||
echo "<script type='text/javascript' src='".e_FILE_ABS."sleight_js.php'></script>\n\n";
|
echo "<script type='text/javascript' src='".e_FILE_ABS."sleight_js.php'></script>\n\n";
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//IEpngfix - visible by IE6 only
|
//IEpngfix - visible by IE6 only
|
||||||
if((isset($pref['enable_png_image_fix']) && $pref['enable_png_image_fix'] == true) || (isset($sleight) && $sleight == true)) {
|
if((isset($pref['enable_png_image_fix']) && $pref['enable_png_image_fix'] == true) || (isset($sleight) && $sleight == true)) {
|
||||||
@ -279,6 +282,10 @@ if((isset($pref['enable_png_image_fix']) && $pref['enable_png_image_fix'] == tru
|
|||||||
// Deprecated function finally removed
|
// Deprecated function finally removed
|
||||||
//if(function_exists('core_head')){ echo core_head(); }
|
//if(function_exists('core_head')){ echo core_head(); }
|
||||||
|
|
||||||
|
// [JSManager] Load JS Includes - Zone 3 - After e_plug/theme.js, before e_meta and headerjs()
|
||||||
|
e107::getJs()->renderJs('header', 3);
|
||||||
|
e107::getJs()->renderJs('header_inline', 3);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// F: Send Meta Tags, Icon links, headerjs()
|
// F: Send Meta Tags, Icon links, headerjs()
|
||||||
@ -299,6 +306,10 @@ if (is_array($pref['e_meta_list']))
|
|||||||
//headerjs moved here - it should be able to read any JS/code sent by e_meta
|
//headerjs moved here - it should be able to read any JS/code sent by e_meta
|
||||||
if (function_exists('headerjs')) {echo headerjs(); }
|
if (function_exists('headerjs')) {echo headerjs(); }
|
||||||
|
|
||||||
|
// [JSManager] Load JS Includes - Zone 4 - Just after e_meta, headerjs
|
||||||
|
e107::getJs()->renderJs('header', 4);
|
||||||
|
e107::getJs()->renderJs('header_inline', 4);
|
||||||
|
|
||||||
$diz_merge = (defined("META_MERGE") && META_MERGE != FALSE && $pref['meta_description'][e_LANGUAGE]) ? $pref['meta_description'][e_LANGUAGE]." " : "";
|
$diz_merge = (defined("META_MERGE") && META_MERGE != FALSE && $pref['meta_description'][e_LANGUAGE]) ? $pref['meta_description'][e_LANGUAGE]." " : "";
|
||||||
$key_merge = (defined("META_MERGE") && META_MERGE != FALSE && $pref['meta_keywords'][e_LANGUAGE]) ? $pref['meta_keywords'][e_LANGUAGE]."," : "";
|
$key_merge = (defined("META_MERGE") && META_MERGE != FALSE && $pref['meta_keywords'][e_LANGUAGE]) ? $pref['meta_keywords'][e_LANGUAGE]."," : "";
|
||||||
|
|
||||||
@ -408,6 +419,10 @@ if (count($js_body_onload)) $body_onload = " onload=\"".implode(" ",$js_body_onl
|
|||||||
// J: Send end of <head> and start of <body>
|
// J: Send end of <head> and start of <body>
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// [JSManager] Load JS Includes - Zone 5 - After theme_head, just before e107:loaded trigger
|
||||||
|
e107::getJs()->renderJs('header', 5);
|
||||||
|
e107::getJs()->renderJs('header_inline', 5);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fire Event e107:loaded
|
* Fire Event e107:loaded
|
||||||
* FIXME - disable core JS
|
* FIXME - disable core JS
|
||||||
@ -422,12 +437,16 @@ echo "</script>\n";
|
|||||||
|
|
||||||
echo "</head>
|
echo "</head>
|
||||||
<body".$body_onload.">\n";
|
<body".$body_onload.">\n";
|
||||||
|
|
||||||
|
// Header included notification, from this point header includes are not possible
|
||||||
|
define('HEADER_INIT', TRUE);
|
||||||
|
|
||||||
$e107->sql->db_Mark_Time("Main Page Body");
|
$e107->sql->db_Mark_Time("Main Page Body");
|
||||||
|
|
||||||
//
|
//
|
||||||
// K: (The rest is ignored for popups, which have no menus)
|
// K: (The rest is ignored for popups, which have no menus)
|
||||||
//
|
//
|
||||||
//echo "XX - ".$e107_popup;
|
//echo "XXX - ".$e107_popup;
|
||||||
// require $e107_popup =1; to use it as header for popup without menus
|
// require $e107_popup =1; to use it as header for popup without menus
|
||||||
if(!isset($e107_popup))
|
if(!isset($e107_popup))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user