1
0
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:
secretr
2009-10-01 15:05:41 +00:00
parent 0a96f4ca7b
commit 38431a75f8
6 changed files with 835 additions and 696 deletions

View File

@ -9,8 +9,8 @@
* General purpose file
*
* $Source: /cvs_backup/e107_0.8/class2.php,v $
* $Revision: 1.148 $
* $Date: 2009-09-29 17:45:06 $
* $Revision: 1.149 $
* $Date: 2009-10-01 15:05:41 $
* $Author: secretr $
*
*/
@ -1068,12 +1068,12 @@ if (
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_admin.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'))
{
//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
// && (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE)

View File

@ -1,25 +1,25 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| 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.14 $
| $Date: 2009-09-13 10:29:56 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Admin Footer
*
* $Source: /cvs_backup/e107_0.8/e107_admin/footer.php,v $
* $Revision: 1.15 $
* $Date: 2009-10-01 15:05:40 $
* $Author: secretr $
*/
if (!defined('e107_INIT'))
{
exit;
}
$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
@ -45,39 +45,37 @@ global $error_handler, $db_time, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQ
// A Ensure sql and traffic objects exist
//
/*
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);
}
*/
$e107 = e107::getInstance();
$sql = e107::getDb();
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
//
if (ADMIN == TRUE) {
if ($pref['cachestatus']) {
if (ADMIN === TRUE)
{
if ($pref['cachestatus'])
{
if (!$sql->db_Select('generic', '*', "gen_type='empty_cache'"))
{
$sql->db_Insert('generic', "0,'empty_cache','".time()."','0','','0',''");
} else {
$row = $sql->db_Fetch();
if (($row['gen_datestamp']+604800) < time()) // If cache not cleared in last 7 days, clear it.
}
else
{
require_once(e_HANDLER."cache_handler.php");
$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
@ -90,33 +88,38 @@ if (ADMIN == TRUE) {
$eTimingStop = microtime();
global $eTimingStart;
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta( $eTimingStart, $eTimingStop );
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
$dbPercent = 100.0 * $db_time / $clockTime;
// Format for display or logging
$rendertime = number_format($clockTime, 2); // Clock time during page render
$db_time = number_format($db_time,2); // Clock time in DB render
$dbPercent = number_format($dbPercent,0); // DB as percent of clock
$db_time = number_format($db_time, 2); // Clock time in DB render
$dbPercent = number_format($dbPercent, 0); // DB as percent of clock
$memuse = $e107->get_memory_usage(); // Memory at end, in B/KB/MB/GB ;)
$rinfo = '';
if ( function_exists( 'getrusage' ) )
if (function_exists('getrusage'))
{
$ru = getrusage();
$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);
$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);
$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));
$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));
$cpuStart = $cpuUStart + $cpuSStart;
$cpuTot = $cpuUTime + $cpuSTime;
$cpuTime = $cpuTot - $cpuStart;
$cpuPct = 100.0 * $cpuTime / $rendertime; /* CPU load during known clock time */
// Format for display or logging (Uncomment as needed for logging)
//$cpuUTime = number_format($cpuUTime, 3); // User cpu
//$cpuSTime = number_format($cpuSTime, 3); // System cpu
//$cpuTot = number_format($cpuTot, 3); // Total (User+System)
// User cpu
//$cpuUTime = number_format($cpuUTime, 3);
// System cpu
//$cpuSTime = number_format($cpuSTime, 3);
// Total (User+System)
//$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)
$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
@ -125,51 +128,63 @@ if (ADMIN == TRUE) {
// $logname = "/home/mysite/public_html/queryspeed.log";
// $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp);
if($pref['displayrendertime'])
if ($pref['displayrendertime'])
{
$rinfo .= CORE_LAN11;
if (isset($cpuTime))
{
// $rinfo .= "{$cpuTime} cpu sec ({$cpuPct}% load, {$cpuStart} startup). Clock: ";
$rinfo .= sprintf(CORE_LAN14,$cpuTime,$cpuPct,$cpuStart);
// $rinfo .= "{$cpuTime} cpu sec ({$cpuPct}% load, {$cpuStart} startup). Clock: ";
$rinfo .= sprintf(CORE_LAN14, $cpuTime, $cpuPct, $cpuStart);
}
$rinfo .= $rendertime.CORE_LAN12.$dbPercent.CORE_LAN13;
}
if($pref['displaysql']){ $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 ($pref['displaysql'])
{
$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'))
{
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)
//
// 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'>";
echo "\n<!-- DEBUG -->\n<div class='e-debug debug-info'>";
$db_debug->Show_All();
echo "</div>\n";
}
}
/*
/*
changes by jalist 24/01/2005:
show sql queries
usage: add ?showsql to query string, must be admin
*/
if(ADMIN && isset($queryinfo) && is_array($queryinfo))
{
$c=1;
// XXX - Too old? Something using this?
if (ADMIN && isset($queryinfo) && is_array($queryinfo))
{
$c = 1;
$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>
<td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
foreach ($queryinfo as $infovalue)
@ -178,30 +193,33 @@ if (ADMIN == TRUE) {
$c++;
}
echo "</table></div>";
}
}
//
// 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
// Works any time we get this far. Not calibrated, but it is quick and simple to use.
// To use: eQTimeOn(); eQTimeOff();
//
$tmp = eQTimeElapsed();
if (strlen($tmp)) {
global $ns;
$ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
}
//
// 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.
// To use: eQTimeOn(); eQTimeOff();
//
$tmp = eQTimeElapsed();
if (strlen($tmp))
{
e107::getRender()->tablerender('Quick Admin Timer', "Results: {$tmp} microseconds");
}
if ($pref['developer']) {
if ($pref['developer'])
{
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();
$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>";
while (ob_get_level() > $oblev_at_start) {
$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)
{
ob_end_flush();
}
echo $obdbg;
@ -210,20 +228,26 @@ if ($pref['developer']) {
// Until they work that out, we'll disable this message.
// Devs can re-enable for testing as needed.
//
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>";
if (0 && $oblev_before_start != 0)
{
$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;
}
}
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)
{
$tmp = $error_handler->return_errors();
if($tmp)
{
echo "
<div class='e107_debug php_err block-text'>
<div class='e-debug php-errors block-text'>
<h3>PHP Errors:</h3><br />
".$error_handler->return_errors()."
".$tmp."
</div>
";
}
unset($tmp);
}
//
@ -236,27 +260,35 @@ if (function_exists('theme_foot'))
//
// F any included JS footer scripts
// DEPRECATED - use e107::getJs()->footerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
//
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);
foreach($footer_js as $fname)
foreach ($footer_js as $fname)
{
echo "<script type='text/javascript' src='{$fname}'></script>\n";
$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.
// 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();
$_serverTime = time();
$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.
* Benefit: account for user time corrections and changes in internet delays
* Drawback: each update may cause all server times to display a bit different
@ -281,23 +313,28 @@ header("Cache-Control: must-revalidate");
header("ETag: {$etag}");
$pref['compression_level'] = 6;
if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip")) {
if (strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"], ""), "gzip"))
{
$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;
}
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']);
$page = gzencode($page, $level);
header("Content-Encoding: gzip", true);
header("Content-Length: ".strlen($page), true);
echo $page;
} else {
}
else
{
header("Content-Length: ".strlen($page), true);
echo $page;
}
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!
?>

View File

@ -1,34 +1,30 @@
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| /e107_admin/header.php
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/header.php,v $
| $Revision: 1.46 $
| $Date: 2009-09-29 17:40:56 $
| $Author: secretr $
+---------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Admin Header
*
* $Source: /cvs_backup/e107_0.8/e107_admin/header.php,v $
* $Revision: 1.47 $
* $Date: 2009-10-01 15:05:41 $
* $Author: secretr $
*/
if (!defined('e107_INIT')) { exit; }
if(!defined('ADMIN_AREA'))
if (!defined('e107_INIT'))
{
exit;
}
if (!defined('ADMIN_AREA'))
{
//avoid PHP warning
define("ADMIN_AREA", TRUE);
}
define("USER_AREA", FALSE);
// Header included notification
define('HEADER_INIT', TRUE);
$sql->db_Mark_Time('(Header Top)');
//
@ -65,10 +61,10 @@ $sql->db_Mark_Time('(Header Top)');
//
// A: Admin Defines and Links
//
require_once(e_ADMIN.'ad_links.php');
require_once (e_ADMIN.'ad_links.php');
if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2)
{
$threshold=(time() - ($pref['del_unv'] * 60));
$threshold = (time() - ($pref['del_unv'] * 60));
$sql->db_Delete("user", "user_ban = 2 AND user_join < '{$threshold}' ");
}
@ -79,8 +75,7 @@ if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2)
// send the charset to the browser - overrides spurious server settings with the lan pack settings.
header('Content-type: text/html; charset=utf-8', TRUE);
echo (defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='utf-8' "."?".">\n")."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
echo(defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='utf-8' "."?".">\n")."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
//
// B.2: Include admin LAN defines
@ -89,11 +84,8 @@ echo (defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='utf-8' "."
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_header.php");
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_footer.php');
if (!defined('ADMIN_WIDTH')) {
if (!defined('ADMIN_WIDTH'))
{
define('ADMIN_WIDTH', "width: 95%");
}
@ -187,9 +179,6 @@ if (!defined('ADMIN_UPGRADEPLUGIN_ICON'))
define("ADMIN_UPGRADEPLUGIN_ICON_PATH", e_IMAGE."admin_images/up_16.png");
}
//
// C: Send start of HTML
//
@ -199,7 +188,7 @@ echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? "
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<meta http-equiv='content-style-type' content='text/css' />
";
echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
echo(defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
echo "<title>".SITENAME." : ".LAN_head_4.(defined("e_PAGETITLE") ? ": ".e_PAGETITLE : (defined("PAGE_NAME") ? ": ".PAGE_NAME : ""))."</title>\n";
//
@ -209,13 +198,13 @@ echo "<!-- *JS* -->\n";
// Wysiwyg JS support on or off.
// your code should run off e_WYSIWYG
if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']))
if (varset($pref['wysiwyg'], FALSE) && check_class($pref['post_html']))
{
define("e_WYSIWYG",TRUE);
define("e_WYSIWYG", TRUE);
}
else
{
define("e_WYSIWYG",FALSE);
define("e_WYSIWYG", FALSE);
}
// [JSManager] Load JS Includes - Zone 1 - Before Library
@ -227,25 +216,31 @@ e107::getJs()->renderJs('header_inline', 1);
$hash = md5(serialize(varset($pref['e_jslib'])).THEME.e_LANGUAGE.ADMIN).'_admin'; //FIXME - hash is wrong, move this to e_jsmanager?
echo "<script type='text/javascript' src='".e_FILE_ABS."e_jslib.php?{$hash}'></script>\n";
// [JSManager] Load JS Includes - Zone 2 - After Library, before CSS
e107::getJs()->renderJs('header', 2);
e107::getJs()->renderJs('header_inline', 2);
//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 "<script type='text/javascript' src='{$eplug_js}'></script>\n";
}
//FIXME - theme.js/user.js should be registered/rendered through e_jsmanager
if (file_exists(THEME.'theme.js')) { echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n"; }
if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js')) { echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n"; }
if (file_exists(THEME.'theme.js'))
{
echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n";
}
if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js'))
{
echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n";
}
// XXX - This shouldn't be here as well
if ((strpos(e_SELF, 'fileinspector.php') === FALSE) && getperms("0"))
{
echo "<script type='text/javascript'>
echo "<script type='text/javascript'>
<!--
function savepreset(ps,pid){
if(confirm('".$tp->toJS(LAN_PRESET_CONFIRMSAVE)."'))
@ -259,7 +254,8 @@ function savepreset(ps,pid){
}
//iepngfix - 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))
{
/*
* The only problem is that the browser is REALLY,
* REALLY slow when it has to render more elements
@ -280,9 +276,8 @@ if((isset($pref['enable_png_image_fix']) && $pref['enable_png_image_fix'] == tru
//
echo "<!-- *CSS* -->\n";
require_once(e_FILE."/e_css.php");
if (isset($eplug_css) && $eplug_css) {
if (isset($eplug_css) && $eplug_css)
{
echo "\n<!-- eplug_css -->\n";
echo "<link rel='stylesheet' href='{$eplug_css}' type='text/css' />\n";
}
@ -310,15 +305,10 @@ else
echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
}
// [JSManager] Load JS Includes - Zone 3 - After Theme CSS, before e_meta and headerjs()
e107::getJs()->renderJs('header', 3);
e107::getJs()->renderJs('header_inline', 3);
//XXX - do we still need it?
if (function_exists('headerjs')){echo headerjs(); }
//
// F: Send Meta Tags and Icon links
//
@ -327,25 +317,33 @@ echo "<!-- *META* -->\n";
// --- Load plugin Meta files and eplug_ before others --------
if (vartrue($pref['e_meta_list']))
{
foreach($pref['e_meta_list'] as $val)
foreach ($pref['e_meta_list'] as $val)
{
if(is_readable(e_PLUGIN.$val."/e_meta.php"))
if (is_readable(e_PLUGIN.$val."/e_meta.php"))
{
echo "<!-- $val meta -->\n";
require_once(e_PLUGIN.$val."/e_meta.php");
require_once (e_PLUGIN.$val."/e_meta.php");
}
}
}
// [JSManager] Load JS Includes - Zone 4 - After e_meta
//XXX - do we still need it?
if (function_exists('headerjs'))
{
echo headerjs();
}
// [JSManager] Load JS Includes - Zone 4 - After e_meta, headerjs
e107::getJs()->renderJs('header', 4);
e107::getJs()->renderJs('header_inline', 4);
// ---------- Favicon ---------
if (file_exists(THEME."favicon.ico")) {
if (file_exists(THEME."favicon.ico"))
{
echo "<link rel='icon' href='".THEME_ABS."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".THEME_ABS."favicon.ico' type='image/xicon' />\n";
}elseif (file_exists(e_BASE."favicon.ico")) {
}
elseif (file_exists(e_BASE."favicon.ico"))
{
echo "<link rel='icon' href='".SITEURL."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".SITEURL."favicon.ico' type='image/xicon' />\n";
}
@ -353,12 +351,17 @@ if (file_exists(THEME."favicon.ico")) {
// G: Send Theme Headers
//
if(function_exists('theme_head')){
if (function_exists('theme_head'))
{
echo "\n<!-- *THEME HEAD* -->\n";
echo theme_head();
}
//
// Unobtrusive JS, prevent 3rd party code overload
// FIXME: TEXTDIRECTION compatibility CSS (marj?)
//
require_once(e_FILE."/e_css.php");
//
// H: Generate JS for image preloads [user mode only]
@ -370,17 +373,15 @@ echo "\n<!-- *PRELOAD* -->\n";
//
$body_onload = "";
//
// J: Send end of <head> and start of <body>
//
/*
* Admin LAN
* TODO - remove it from here
*/
require_once(e_HANDLER.'js_helper.php');
require_once (e_HANDLER.'js_helper.php');
echo "
<script type='text/javascript'>
(".e_jshelper::toString(LAN_JSCONFIRM).").addModLan('core', 'delete_confirm');
@ -388,7 +389,6 @@ echo "
</script>
";
// [JSManager] Load JS Includes - Zone 5 - After theme_head, before e107:loaded trigger
e107::getJs()->renderJs('header', 5);
e107::getJs()->renderJs('header_inline', 5);
@ -406,9 +406,12 @@ echo "});\n";
echo "// -->\n";
echo "</script>\n";
echo "</head>
<body".$body_onload.">\n";
// Header included notification, from this point header includes are not possible
define('HEADER_INIT', TRUE);
$sql->db_Mark_Time("End Head, Start Body");
//
@ -416,29 +419,29 @@ $sql->db_Mark_Time("End Head, Start Body");
//
// require $e107_popup =1; to use it as header for popup without menus
if(!isset($e107_popup))
if (!isset($e107_popup))
{
$e107_popup = 0;
}
if ($e107_popup != 1) {
if ($e107_popup != 1)
{
//
// L: (optional) Body JS to disable right clicks [reserved; user mode]
//
//
// L: (optional) Body JS to disable right clicks [reserved; user mode]
//
//
// M: Send top of body for custom pages and for news [user mode only]
//
//
// M: Send top of body for custom pages and for news [user mode only]
//
//
// N: Send other top-of-body HTML
//
//
// N: Send other top-of-body HTML
//
$ns = new e107table;
$e107_var = array();
$ns = new e107table;
$e107_var = array();
/**
/**
* Build admin menus - addmin menus are now supporting unlimitted number of submenus
* TODO - add this to a handler for use on front-end as well (tree, sitelinks.sc replacement)
*
@ -461,17 +464,18 @@ $e107_var = array();
* @param bool $sortlist
* @return string parsed admin menu (or empty string if title is empty)
*/
function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_link = false, $sortlist = false)
{
global $E_ADMIN_MENU, $e107;
if(!$tmpl) $tmpl = $E_ADMIN_MENU;
function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_link = false, $sortlist = false)
{
global $E_ADMIN_MENU,$e107;
if (!$tmpl)
$tmpl = $E_ADMIN_MENU;
/*
* Search for id
*/
$temp = explode('--id--', $title, 2);
$title = $temp[0];
$id = str_replace(array(' ', '_'), '-',varset($temp[1]));
$id = str_replace(array(' ', '_'), '-', varset($temp[1]));
unset($temp);
@ -505,13 +509,12 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
$kpost = '';
$text = '';
if($sub_link)
if ($sub_link)
{
$kpost = '_sub';
}
else $text = $tmpl['start'];
//FIXME - e_parse::array2sc()
$search = array();
$search[0] = '/\{LINK_TEXT\}(.*?)/si';
@ -526,7 +529,7 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
$search[9] = '/\{LINK_IMAGE\}(.*?)/si';
foreach (array_keys($e107_vars) as $act)
{
if(vartrue($e107_vars[$act]['perm']) && !getperms($e107_vars[$act]['perm'])) // check perms first.
if (vartrue($e107_vars[$act]['perm']) && !getperms($e107_vars[$act]['perm'])) // check perms first.
{
continue;
}
@ -561,7 +564,7 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
$replace[8] = '';
$replace[9] = varset($e107_vars[$act]['image']);
if(varsettrue($e107_vars[$act]['sub']))
if (varsettrue($e107_vars[$act]['sub']))
{
$replace[6] = $id ? " id='eplug-nav-{$rid}-sub'" : '';
$replace[7] = ' '.varset($e107_vars[$act]['link_class'], 'e-expandit');
@ -575,64 +578,79 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
}
$text .= !$sub_link ? $tmpl['end'] : '';
if($sub_link || empty($title)) return $text;
if ($sub_link || empty($title))
return $text;
$e107->ns->tablerender($title, $text, array('id' => $id, 'style' => 'button_menu'));
$e107->ns->tablerender($title, $text, array('id'=>$id, 'style'=>'button_menu'));
return '';
}
}
/*
/*
* DEPRECATED - use e_admin_menu()
*/
if (!function_exists('show_admin_menu')) {
function show_admin_menu($title, $active_page, $e107_vars, $js = FALSE, $sub_link = FALSE, $sortlist = FALSE) {
if (!function_exists('show_admin_menu'))
{
function show_admin_menu($title, $active_page, $e107_vars, $js = FALSE, $sub_link = FALSE, $sortlist = FALSE)
{
//return e_admin_menu($title, $active_page, $e107_vars, false, false, $sortlist);
global $ns, $BUTTON, $BUTTON_OVER, $BUTTONS_START, $BUTTONS_END, $SUB_BUTTON, $SUB_BUTTON_OVER, $SUB_BUTTONS_START, $SUB_BUTTONS_END;
global $ns,$BUTTON,$BUTTON_OVER,$BUTTONS_START,$BUTTONS_END,$SUB_BUTTON,$SUB_BUTTON_OVER,$SUB_BUTTONS_START,$SUB_BUTTONS_END;
$id_title = "yop_".str_replace(" ", "", $title);
if (!isset($BUTTONS_START)) {
if (!isset($BUTTONS_START))
{
$BUTTONS_START = "<div style='text-align:center; width:100%'><table class='fborder' style='width:98%;'>\n";
}
if (!isset($BUTTON)) {
if (!isset($BUTTON))
{
$BUTTON = "<tr><td class='button'><div style='width:100%; text-align:center'><a style='cursor:pointer; text-decoration:none;' {ONCLICK} >{LINK_TEXT}</a></div></td></tr>\n";
}
if (!isset($BUTTON_OVER)) {
if (!isset($BUTTON_OVER))
{
$BUTTON_OVER = "<tr><td class='button'><div style='width:100%; text-align:center'><a style='cursor:pointer; text-decoration:none;' {ONCLICK} ><b>&laquo;&nbsp;{LINK_TEXT}&nbsp;&raquo;</b></a></div></td></tr>\n";
}
if (!isset($BUTTONS_END)) {
if (!isset($BUTTONS_END))
{
$BUTTONS_END = "</table></div>\n";
}
if (!isset($SUB_BUTTON)) {
if (!isset($SUB_BUTTON))
{
$SUB_BUTTON = "<a style='text-decoration:none;' href='{LINK_URL}'>{LINK_TEXT}</a><br />";
}
if (!isset($SUB_BUTTON_OVER)) {
if (!isset($SUB_BUTTON_OVER))
{
$SUB_BUTTON_OVER = "<b> &laquo; <a style='text-decoration:none;' href='{LINK_URL}'>{LINK_TEXT}</a> &raquo; </b><br />";
}
if (!isset($SUB_BUTTONS_START)) {
if (!isset($SUB_BUTTONS_START))
{
$SUB_BUTTONS_START = "<div style='text-align:center; width:100%'><table class='fborder' style='width:98%;'>
<tr><td class='button'><a style='text-align:center; cursor:pointer; text-decoration:none;'
onclick=\"expandit('{SUB_HEAD_ID}');\" >{SUB_HEAD}</a></td></tr>
<tr id='{SUB_HEAD_ID}' style='display: none' ><td class='forumheader3' style='text-align:left;'>";
}
if (!isset($SUB_BUTTONS_END)) {
if (!isset($SUB_BUTTONS_END))
{
$SUB_BUTTONS_END = "</td></tr></table></div>";
}
if ($sortlist == TRUE) {
if ($sortlist == TRUE)
{
$temp = $e107_vars;
unset($e107_vars);
foreach (array_keys($temp) as $key) {
foreach (array_keys($temp) as $key)
{
$func_list[] = $temp[$key]['text'];
}
usort($func_list, 'strcoll');
foreach ($func_list as $func_text) {
foreach (array_keys($temp) as $key) {
if ($temp[$key]['text'] == $func_text) {
foreach ($func_list as $func_text)
{
foreach (array_keys($temp) as $key)
{
if ($temp[$key]['text'] == $func_text)
{
$e107_vars[] = $temp[$key];
}
}
@ -645,29 +663,40 @@ if (!function_exists('show_admin_menu')) {
$search[3] = "/\{SUB_HEAD\}(.*?)/si";
$search[4] = "/\{SUB_HEAD_ID\}(.*?)/si";
if ($sub_link) {
if ($sub_link)
{
$replace[0] = '';
$replace[1] = '#';
$replace[2] = '';
$replace[3] = $title;
$replace[4] = $id_title;
$text = preg_replace($search, $replace, $SUB_BUTTONS_START);
} else {
}
else
{
$text = $BUTTONS_START.'';
}
foreach (array_keys($e107_vars) as $act) {
if (!isset($e107_vars[$act]['perm']) || !$e107_vars[$act]['perm'] || getperms($e107_vars[$act]['perm'])) {
if ($active_page == $act || (str_replace("?", "", e_PAGE.e_QUERY) == str_replace("?", "", $act))) {
foreach (array_keys($e107_vars) as $act)
{
if (!isset($e107_vars[$act]['perm']) || !$e107_vars[$act]['perm'] || getperms($e107_vars[$act]['perm']))
{
if ($active_page == $act || (str_replace("?", "", e_PAGE.e_QUERY) == str_replace("?", "", $act)))
{
$BUTTON_TEMPLATE = $sub_link ? $SUB_BUTTON_OVER : $BUTTON_OVER;
} else {
}
else
{
$BUTTON_TEMPLATE = $sub_link ? $SUB_BUTTON : $BUTTON;
}
$replace[0] = str_replace(" ", "&nbsp;", $e107_vars[$act]['text']);
$replace[1] = varset($e107_vars[$act]['link'], "#{$act}");
if (!empty($e107_vars[$act]['include'])) {
if (! empty($e107_vars[$act]['include']))
{
$replace[2] = $e107_vars[$act]['include'];
} else {
}
else
{
$replace[2] = $js ? " onclick=\"showhideit('".$act."');\"" : " onclick=\"document.location='".$e107_vars[$act]['link']."'; disabled=true;\"";
}
$replace[3] = $title;
@ -677,35 +706,47 @@ if (!function_exists('show_admin_menu')) {
}
$text .= $sub_link ? $SUB_BUTTONS_END : ''.$BUTTONS_END;
if ($title == "" || $sub_link) {
if ($title == "" || $sub_link)
{
return $text;
} else {
$ns -> tablerender($title, $text, array('id' => $id_title, 'style' => 'button_menu'));
}
else
{
$ns->tablerender($title, $text, array('id'=>$id_title, 'style'=>'button_menu'));
}
}
}
}
if (file_exists(THEME.'admin_template.php')) {
require_once(THEME.'admin_template.php');
} else {
require_once(e_BASE.$THEMES_DIRECTORY.'templates/admin_template.php');
}
if (file_exists(THEME.'admin_template.php'))
{
require_once (THEME.'admin_template.php');
}
else
{
require_once (e_BASE.$THEMES_DIRECTORY.'templates/admin_template.php');
}
if (!function_exists("parse_admin")) {
function parse_admin($ADMINLAYOUT) {
if (!function_exists("parse_admin"))
{
function parse_admin($ADMINLAYOUT)
{
global $tp;
$adtmp = explode("\n", $ADMINLAYOUT);
for ($a = 0; $a < count($adtmp); $a++) {
if (preg_match("/{.+?}/", $adtmp[$a])) {
for ($a = 0; $a < count($adtmp); $a++)
{
if (preg_match("/{.+?}/", $adtmp[$a]))
{
echo $tp->parseTemplate($adtmp[$a]);
} else {
}
else
{
echo $adtmp[$a];
}
}
}
}
}
/**
/**
* Automate DB system messages
* NOTE: default value of $output parameter will be changed to false (no output by default) in the future
*
@ -716,11 +757,13 @@ if (!function_exists("parse_admin")) {
* @param bool $output false suppress any function output
* @return integer|bool db::db_Query result
*/
function admin_update($update, $type = 'update', $success = false, $failed = false, $output = true) {
require_once(e_HANDLER."message_handler.php");
function admin_update($update, $type = 'update', $success = false, $failed = false, $output = true)
{
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
if (($type == 'update' && $update) || ($type == 'insert' && $update !== false)) {
if (($type == 'update' && $update) || ($type == 'insert' && $update !== false))
{
$emessage->add(($success ? $success : ($type == 'update' ? LAN_UPDATED : LAN_CREATED)), E_MESSAGE_SUCCESS);
}
elseif ($type == 'delete' && $update)
@ -740,7 +783,8 @@ function admin_update($update, $type = 'update', $success = false, $failed = fal
}
else
{
switch ($type) {
switch ($type)
{
case 'insert':
$msg = LAN_CREATED_FAILED;
break;
@ -756,57 +800,56 @@ function admin_update($update, $type = 'update', $success = false, $failed = fal
$emessage->add($text, E_MESSAGE_ERROR);
}
if($output) echo $emessage->render();
if ($output) echo $emessage->render();
return $update;
}
}
function admin_purge_related($table, $id)
{
global $ns, $tp;
function admin_purge_related($table, $id)
{
global $ns,$tp;
$msg = "";
$tp->parseTemplate("");
// Delete any related comments
require_once(e_HANDLER."comment_class.php");
require_once (e_HANDLER."comment_class.php");
$_com = new comment;
$num = $_com->delete_comments($table, $id);
if($num)
if ($num)
{
$msg .= $num." ".ADLAN_114." ".LAN_DELETED."<br />";
}
// Delete any related ratings
require_once(e_HANDLER."rate_class.php");
require_once (e_HANDLER."rate_class.php");
$_rate = new rater;
$num = $_rate->delete_ratings($table, $id);
if($num)
if ($num)
{
$msg .= LAN_RATING." ".LAN_DELETED."<br />";
}
if($msg)
if ($msg)
{
$ns->tablerender(LAN_DELETE, $msg);
}
}
}
$sql->db_Mark_Time('Parse Admin Header');
$sql->db_Mark_Time('Parse Admin Header');
//NEW - Iframe mod
if (!defsettrue('e_IFRAME'))
{
//NEW - Iframe mod
if (!defsettrue('e_IFRAME'))
{
//removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE
parse_admin($ADMIN_HEADER);
}
$sql->db_Mark_Time('(End: Parse Admin Header)');
}
$sql->db_Mark_Time('(End: Parse Admin Header)');
}
if(!varset($emessage) && !is_object($emessage))
// XXX - we don't need this (use e107::getMessage()) - find out what's using it and remove it
if (!varset($emessage) && !is_object($emessage))
{
require_once(e_HANDLER."message_handler.php");
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
}
?>

View File

@ -7,8 +7,8 @@
* GNU General Public License (http://gnu.org).
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/js_manager.php,v $
* $Revision: 1.2 $
* $Date: 2009-09-29 17:40:55 $
* $Revision: 1.3 $
* $Date: 2009-10-01 15:05:41 $
* $Author: secretr $
*
*/
@ -681,7 +681,8 @@ class e_jsmanager
*/
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')));
}
/**

View File

@ -1,25 +1,28 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/footer_default.php,v $
| $Revision: 1.17 $
| $Date: 2009-09-13 10:29:56 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/footer_default.php,v $
| $Revision: 1.18 $
| $Date: 2009-10-01 15:05:40 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT'))
{
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
@ -41,9 +44,11 @@ global $error_handler, $db_time, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQ
// H Final HTML (/body, /html)
// I collect and send buffered page, along with needed headers
//
$e107 = e107::getInstance();
$sql = e107::getDb();
$pref = e107::getPref();
if(varset($e107_popup)!=1)
if (varset($e107_popup) != 1)
{
//
// B.1 Clear cache (admin-only)
@ -56,22 +61,22 @@ if(varset($e107_popup)!=1)
$eTimingStop = microtime();
global $eTimingStart;
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta( $eTimingStart, $eTimingStop );
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
$dbPercent = 100.0 * $db_time / $clockTime;
// Format for display or logging
$rendertime = number_format($clockTime, 2); // Clock time during page render
$db_time = number_format($db_time,2); // Clock time in DB render
$dbPercent = number_format($dbPercent,0); // DB as percent of clock
$db_time = number_format($db_time, 2); // Clock time in DB render
$dbPercent = number_format($dbPercent, 0); // DB as percent of clock
$memuse = $e107->get_memory_usage(); // Memory at end, in B/KB/MB/GB ;)
$queryCount = $sql -> db_QueryCount();
$queryCount = $sql->db_QueryCount();
$rinfo = '';
$logLine = '';
if ($pref['log_page_accesses'])
{ // 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();
$cpuUTime = $ru['ru_utime.tv_sec'] + ($ru['ru_utime.tv_usec'] * 1e-6);
@ -88,7 +93,7 @@ if(varset($e107_popup)!=1)
//$cpuTot = number_format($cpuTot, 3); // Total (User+System)
$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)
$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
@ -97,19 +102,28 @@ if(varset($e107_popup)!=1)
// $logname = "/home/mysite/public_html/queryspeed.log";
// $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp);
if($pref['displayrendertime'])
if ($pref['displayrendertime'])
{
$rinfo .= CORE_LAN11;
if (isset($cpuTime))
{
// $rinfo .= "{$cpuTime} cpu sec ({$cpuPct}% load, {$cpuStart} startup). Clock: ";
$rinfo .= sprintf(CORE_LAN14,$cpuTime,$cpuPct,$cpuStart);
// $rinfo .= "{$cpuTime} cpu sec ({$cpuPct}% load, {$cpuStart} startup). Clock: ";
$rinfo .= sprintf(CORE_LAN14, $cpuTime, $cpuPct, $cpuStart);
}
$rinfo .= $rendertime.CORE_LAN12.$dbPercent.CORE_LAN13.'&nbsp;';
}
if($pref['displaysql']){ $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['displaysql'])
{
$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'])
{ // Need to log the page info to a text file as CSV data
@ -122,34 +136,36 @@ if(varset($e107_popup)!=1)
if (function_exists('theme_renderinfo'))
{
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)
//
// 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'>";
echo "\n<!-- DEBUG -->\n<div class='e-debug debug-info'>";
$db_debug->Show_All();
echo "</div>\n";
}
}
/*
/*
changes by jalist 24/01/2005:
show sql queries
usage: add ?showsql to query string, must be admin
*/
if(ADMIN && isset($queryinfo) && is_array($queryinfo))
{
$c=1;
if (ADMIN && isset($queryinfo) && is_array($queryinfo))
{
$c = 1;
$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>
<td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
foreach ($queryinfo as $infovalue)
@ -158,30 +174,34 @@ if(varset($e107_popup)!=1)
$c++;
}
echo "</table></div>";
}
}
//
// 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
// Works any time we get this far. Not calibrated, but it is quick and simple to use.
// To use: eQTimeOn(); eQTimeOff();
//
$tmp = eQTimeElapsed();
if (strlen($tmp)) {
//
// 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.
// To use: eQTimeOn(); eQTimeOff();
//
$tmp = eQTimeElapsed();
if (strlen($tmp))
{
global $ns;
$ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
}
$ns->tablerender('Quick Admin Timer', "Results: {$tmp} microseconds");
}
if ($pref['developer']) {
if ($pref['developer'])
{
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();
$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>";
while (ob_get_level() > $oblev_at_start) {
$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)
{
ob_end_flush();
}
echo $obdbg;
@ -190,20 +210,26 @@ if ($pref['developer']) {
// Until they work that out, we'll disable this message.
// Devs can re-enable for testing as needed.
//
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>";
if (0 && $oblev_before_start != 0)
{
$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;
}
}
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)
{
$tmp = $error_handler->return_errors();
if($tmp)
{
echo "
<div class='e107_debug php_err block-text'>
<div class='e-debug php-errors block-text'>
<h3>PHP Errors:</h3><br />
".$error_handler->return_errors()."
".$tmp."
</div>
";
}
unset($tmp);
}
//
@ -216,27 +242,35 @@ if (function_exists('theme_foot'))
//
// F any included JS footer scripts
// DEPRECATED - use e107::getJs()->footerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
//
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);
foreach($footer_js as $fname)
foreach ($footer_js as $fname)
{
echo "<script type='text/javascript' src='{$fname}'></script>\n";
$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.
// 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();
$_serverTime = time();
$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.
* Benefit: account for user time corrections and changes in internet delays
* Drawback: each update may cause all server times to display a bit different
@ -261,23 +295,28 @@ header("Cache-Control: must-revalidate");
header("ETag: {$etag}");
$pref['compression_level'] = 6;
if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip")) {
if (strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"], ""), "gzip"))
{
$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;
}
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']);
$page = gzencode($page, $level);
header("Content-Encoding: gzip", true);
header("Content-Length: ".strlen($page), true);
echo $page;
} else {
}
else
{
header("Content-Length: ".strlen($page), true);
echo $page;
}
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!
?>

View File

@ -9,8 +9,8 @@
* Default Header
*
* $Source: /cvs_backup/e107_0.8/e107_themes/templates/header_default.php,v $
* $Revision: 1.41 $
* $Date: 2009-09-29 17:42:22 $
* $Revision: 1.42 $
* $Date: 2009-10-01 15:05:40 $
* $Author: secretr $
*/
@ -22,9 +22,6 @@ if(!defined('USER_AREA'))
}
define('ADMIN_AREA',FALSE);
// Header included notification
define('HEADER_INIT', TRUE);
$e107 = e107::getInstance();
$e107->sql->db_Mark_Time('(Header Top)');
@ -113,6 +110,10 @@ else
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
//
@ -201,14 +202,13 @@ if (varset($pref['e_header_list']) && is_array($pref['e_header_list']))
// Send Javascript Libraries ALWAYS (for now)
$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";
/*
if (!isset($no_core_js) || !$no_core_js)
{
echo "<script type='text/javascript' src='".e_FILE_ABS."e_js.php'></script>\n";
}
*/
// [JSManager] Load JS Includes - Zone 2 - After Library
e107::getJs()->renderJs('header', 2);
e107::getJs()->renderJs('header_inline', 2);
// Send Plugin JS Files
//DEPRECATED - use e107::getJs()->headerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
if (isset($eplug_js) && $eplug_js)
{
echo "\n<!-- eplug_js -->\n";
@ -227,6 +227,7 @@ if (isset($eplug_js) && $eplug_js)
}
// Send Theme JS Files
//DEPRECATE this as well?
if (isset($theme_js_php) && $theme_js_php)
{
echo "<script type='text/javascript' src='".THEME_ABS."theme-js.php'></script>\n";
@ -240,6 +241,7 @@ else
}
//XXX - CHAP JS
// TODO - convert it to e107::getJs()->header/footerFile() call
if (!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHAP'],0))
{
if ($pref['password_CHAP'] == 2)
@ -251,11 +253,12 @@ if (!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHA
$js_body_onload[] = "getChallenge();";
}
/*
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";
}
*/
//IEpngfix - visible by IE6 only
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
//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()
@ -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
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]." " : "";
$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>
//
// [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
* FIXME - disable core JS
@ -422,12 +437,16 @@ echo "</script>\n";
echo "</head>
<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");
//
// 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
if(!isset($e107_popup))
{