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 $
+----------------------------------------------------------------------------+
* 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; }
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,28 +45,26 @@ 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 {
}
else
{
$row = $sql->db_Fetch();
if (($row['gen_datestamp'] + 604800) < time()) // If cache not cleared in last 7 days, clear it.
{
@ -102,18 +100,23 @@ if (ADMIN == TRUE) {
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)
@ -135,26 +138,37 @@ if (ADMIN == TRUE) {
}
$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";
}
@ -165,11 +179,12 @@ if (ADMIN == TRUE) {
usage: add ?showsql to query string, must be admin
*/
// 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)
@ -191,17 +206,20 @@ if (ADMIN == TRUE) {
// To use: eQTimeOn(); eQTimeOff();
//
$tmp = eQTimeElapsed();
if (strlen($tmp)) {
global $ns;
$ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
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,21 +228,27 @@ 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)
{
$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);
}
//
// E Last themed footer code, usually JS
@ -236,6 +260,7 @@ 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))
@ -248,6 +273,12 @@ if(isset($footer_js) && is_array($footer_js))
}
}
// [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.
@ -256,7 +287,8 @@ if(isset($footer_js) && is_array($footer_js))
// This must be done as late as possible in page processing.
$_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,19 +313,24 @@ 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;
}

View File

@ -1,24 +1,23 @@
<?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('e107_INIT'))
{
exit;
}
if (!defined('ADMIN_AREA'))
{
//avoid PHP warning
@ -26,9 +25,6 @@ if(!defined('ADMIN_AREA'))
}
define("USER_AREA", FALSE);
// Header included notification
define('HEADER_INIT', TRUE);
$sql->db_Mark_Time('(Header Top)');
//
@ -79,7 +75,6 @@ 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";
//
@ -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
//
@ -227,22 +216,28 @@ 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'>
@ -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
//
@ -337,15 +327,23 @@ if (vartrue($pref['e_meta_list']))
}
}
// [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,12 +373,10 @@ echo "\n<!-- *PRELOAD* -->\n";
//
$body_onload = "";
//
// J: Send end of <head> and start of <body>
//
/*
* Admin LAN
* TODO - remove it from here
@ -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");
//
@ -420,8 +423,8 @@ 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]
@ -464,7 +467,8 @@ $e107_var = array();
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;
if (!$tmpl)
$tmpl = $E_ADMIN_MENU;
/*
* Search for id
@ -511,7 +515,6 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
}
else $text = $tmpl['start'];
//FIXME - e_parse::array2sc()
$search = array();
$search[0] = '/\{LINK_TEXT\}(.*?)/si';
@ -575,8 +578,8 @@ 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'));
return '';
@ -585,54 +588,69 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
/*
* 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;
$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,28 +706,40 @@ 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 {
}
else
{
$ns->tablerender($title, $text, array('id'=>$id_title, 'style'=>'button_menu'));
}
}
}
if (file_exists(THEME.'admin_template.php')) {
if (file_exists(THEME.'admin_template.php'))
{
require_once (THEME.'admin_template.php');
} else {
}
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];
}
}
@ -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) {
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;
@ -790,8 +834,6 @@ function admin_purge_related($table, $id)
}
}
$sql->db_Mark_Time('Parse Admin Header');
//NEW - Iframe mod
@ -804,6 +846,7 @@ if (!defsettrue('e_IFRAME'))
$sql->db_Mark_Time('(End: Parse Admin Header)');
}
// 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");

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

@ -11,15 +11,18 @@
| 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 $
| $Revision: 1.18 $
| $Date: 2009-10-01 15:05:40 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
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,7 +44,9 @@ 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)
{
@ -107,9 +112,18 @@ if(varset($e107_popup)!=1)
}
$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,19 +136,21 @@ 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";
}
@ -149,7 +165,7 @@ if(varset($e107_popup)!=1)
{
$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)
@ -171,17 +187,21 @@ if(varset($e107_popup)!=1)
// To use: eQTimeOn(); eQTimeOff();
//
$tmp = eQTimeElapsed();
if (strlen($tmp)) {
if (strlen($tmp))
{
global $ns;
$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,21 +210,27 @@ 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)
{
$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);
}
//
// E Last themed footer code, usually JS
@ -216,6 +242,7 @@ 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))
@ -228,6 +255,12 @@ if(isset($footer_js) && is_array($footer_js))
}
}
// [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.
@ -236,7 +269,8 @@ if(isset($footer_js) && is_array($footer_js))
// This must be done as late as possible in page processing.
$_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,19 +295,24 @@ 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;
}

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))
{