1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Core Cleanup.

This commit is contained in:
Cameron
2020-05-02 15:35:30 -07:00
parent 43d8221340
commit 834ea354e4
17 changed files with 119 additions and 154 deletions

View File

@@ -370,8 +370,11 @@ e107_debug::init(); // defines E107_DEBUG_LEVEL
if(E107_DEBUG_LEVEL)
{
// $e107_debug = true; // BC
$db_debug = e107::getDebug();
$db_debug->Mark_Time('Init ErrHandler');
$dbg = e107::getDebug();
/** @deprecated $db_debug */
$db_debug = $dbg;
$dbg->logTime('Init ErrHandler');
}
//
@@ -397,14 +400,14 @@ e107::getSingleton('e107_traffic'); // We start traffic counting ASAP
$sql = e107::getDb(); //TODO - find & replace $sql, $e107->sql
$sql->db_SetErrorReporting(false);
$sql->db_Mark_Time('SQL Connect');
$dbg->logTime('SQL Connect');
$merror=$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
// create after the initial connection.
//DEPRECATED, BC, call the method only when needed
$sql2 = e107::getDb('sql2'); //TODO find & replace all $sql2 calls
$sql->db_Mark_Time('Prefs, misc tables');
$dbg->logTime('Prefs, misc tables');
//DEPRECATED, BC, call the method only when needed, $e107->admin_log caught by __get()
$admin_log = e107::getAdminLog(); //TODO - find & replace $admin_log, $e107->admin_log
@@ -437,21 +440,21 @@ $e107->set_urls_deferred();
// TODO - remove it from here, auto-loaded when required
$sql->db_Mark_Time('Load Cache Handler');
$dbg->logTime('Load Cache Handler');
e107_require_once(e_HANDLER.'cache_handler.php');
//DEPRECATED, BC, call the method only when needed, $e107->arrayStorage caught by __get()
$sql->db_Mark_Time('Load Array Storage Handler');
$dbg->logTime('Load Array Storage Handler');
e107_require_once(e_HANDLER.'arraystorage_class.php'); // ArrayData(); BC Fix only.
$eArrayStorage = e107::getArrayStorage(); //TODO - find & replace $eArrayStorage with e107::getArrayStorage();
//DEPRECATED, BC, call the method only when needed, $e107->e_event caught by __get()
$sql->db_Mark_Time('Load Event Handler');
$dbg->logTime('Load Event Handler');
$e_event = e107::getEvent(); //TODO - find & replace $e_event, $e107->e_event
// TODO - DEPRECATED - remove
$sql->db_Mark_Time('Load Core Prefs');
$dbg->logTime('Load Core Prefs');
e107_require_once(e_HANDLER."pref_class.php");
$sysprefs = new prefs;
@@ -510,7 +513,7 @@ $pref = e107::getPref();
// $e107->set_base_path(); moved to init().
//DEPRECATED, BC, call e107::getConfig('menu')->get('pref_name') only when needed
$sql->db_Mark_Time('Load Menu Prefs');
$dbg->logTime('Load Menu Prefs');
$menu_pref = e107::getConfig('menu')->getPref(); //extract menu prefs
// NEW - force ssl
@@ -527,9 +530,9 @@ if(e107::getPref('ssl_enabled') && !deftrue('e_SSL_DISABLE') && empty($_E107['cl
}
}
// $sql->db_Mark_Time('(Extracting Core Prefs Done)');
// $dbg->logTime('(Extracting Core Prefs Done)');
$sql->db_Mark_Time('Init Language and detect changes');
$dbg->logTime('Init Language and detect changes');
$lng = e107::getLanguage(); // required for v1.0 BC.
$lng->detect();
@@ -623,9 +626,9 @@ if(!empty($pref['redirectsiteurl']) && !empty($pref['siteurl'])) {
// - Language detection (because of session.cookie_domain)
// to avoid multi-language 'access-denied' issues.
//session_start(); see e107::getSession() above
$sql->db_Mark_Time('Load Session Handler');
$dbg->logTime('Load Session Handler');
e107::getSession(); //init core _SESSION - actually here for reference only, it's done by language handler set() method
$sql->db_Mark_Time('Set User Language Session');
$dbg->logTime('Set User Language Session');
e107::getLanguage()->set(); // set e_LANGUAGE, USERLAN, Language Session / Cookies etc. requires $pref;
if(varset($pref['multilanguage']) && (e_LANGUAGE != $pref['sitelanguage']))
@@ -638,7 +641,7 @@ if(varset($pref['multilanguage']) && (e_LANGUAGE != $pref['sitelanguage']))
// e107_include_once(e_LANGUAGEDIR.e_LANGUAGE.'/'.e_LANGUAGE.'.php');
// e107_include_once(e_LANGUAGEDIR.e_LANGUAGE.'/'.e_LANGUAGE.'_custom.php');
// v1 Custom language File Path.
$sql->db_Mark_Time('Include Global Core Language Files');
$dbg->logTime('Include Global Core Language Files');
if((e_ADMIN_AREA === true) && !empty($pref['adminlanguage']))
{
include(e_LANGUAGEDIR.$pref['adminlanguage'].'/'.$pref['adminlanguage'].'.php');
@@ -665,7 +668,7 @@ unset($customLan, $customLan2);
$lng->bcDefs(); // defined v1.x definitions for old templates.
$sql->db_Mark_Time('Include Global Plugin Language Files');
$dbg->logTime('Include Global Plugin Language Files');
if(isset($pref['lan_global_list']))
{
foreach($pref['lan_global_list'] as $path)
@@ -680,7 +683,7 @@ if(isset($pref['lan_global_list']))
$sql->db_Mark_Time('CHAP challenge');
$dbg->logTime('CHAP challenge');
$die = (e_AJAX_REQUEST == true) ? false : true;
e107::getSession()
@@ -691,7 +694,7 @@ unset($die);
//
// N: misc setups: online user tracking, cache
//
$sql->db_Mark_Time('Misc resources. Online user tracking, cache');
$dbg->logTime('Misc resources. Online user tracking, cache');
/**
@@ -705,9 +708,9 @@ $override = e107::getSingleton('override', true);
//DEPRECATED, BC, call the method only when needed, $e107->user_class caught by __get()
$e_userclass = e107::getUserClass(); //TODO - find & replace $e_userclass, $e107->user_class
$sql->db_Mark_Time('Init Event Handler');
$dbg->logTime('Init Event Handler');
e107::getEvent()->init();
$sql->db_Mark_Time('Register Core Events');
$dbg->logTime('Register Core Events');
e107::getNotify()->registerEvents();
//
@@ -800,7 +803,7 @@ if (isset($pref['modules']) && $pref['modules']) {
}
*/
$sql->db_Mark_Time('Load Plugin Modules');
$dbg->logTime('Load Plugin Modules');
$js_body_onload = array(); // Initialise this array in case a module wants to add to it
@@ -811,7 +814,7 @@ if(isset($pref['e_module_list']) && $pref['e_module_list'])
{
if (is_readable(e_PLUGIN."{$mod}/e_module.php"))
{
$sql->db_Mark_Time('[e_module in '.$mod.']');
$dbg->logTime('[e_module in '.$mod.']');
require_once(e_PLUGIN."{$mod}/e_module.php");
}
}
@@ -822,7 +825,7 @@ if(isset($pref['e_module_list']) && $pref['e_module_list'])
// P: THEME LOADING
//
$sql->db_Mark_Time('Load Theme');
$dbg->logTime('Load Theme');
if(!defined("USERTHEME" ))
{
@@ -871,7 +874,7 @@ if (!function_exists('checkvalidtheme'))
return;
}
$sql->db_Mark_Time("Theme Check");
e107::getDebug()->logTime("Theme Check");
if (@fopen(e_THEME.$theme_check.'/theme.php', 'r'))
// if (is_readable(e_THEME.$theme_check.'/theme.php'))
@@ -918,17 +921,19 @@ if (!function_exists('checkvalidtheme'))
}
}
$sql->db_Mark_Time("Theme Check End");
e107::getDebug()->logTime("Theme Check End");
$themes_dir = $e107->getFolder('themes');
$e107->http_theme_dir = "{$e107->server_path}{$themes_dir}{$e107->site_theme}/";
unset($sql);
}
}
//
// Q: ALL OTHER SETUP CODE
//
$sql->db_Mark_Time('Misc Setup');
$dbg->logTime('Misc Setup');
//------------------------------------------------------------------------------------------------------------------------------------//
if (!class_exists('e107table', false))
@@ -944,8 +949,8 @@ if (!class_exists('e107table', false))
public $eMenuTotal = array();
public $eSetStyle;
private $themeClass = 'theme'; // v2.3.0+
private $legacyThemeClass = '';
private $adminThemeClass = '';
private $legacyThemeClass;
private $adminThemeClass;
public $frontend = null;
private $uniqueId = null;
private $content = array();
@@ -999,6 +1004,7 @@ if (!class_exists('e107table', false))
$this->thm = new $this->legacyThemeClass();
}
return null;
}
@@ -1211,7 +1217,7 @@ if (!class_exists('e107table', false))
private function hasLegacyCode()
{
$legacy = ['VIEWPORT','THEME_DISCLAIMER', 'IMODE', 'BODYTAG', 'COMMENTLINK', 'OTHERNEWS_LIMIT',
'PRE_EXTENDEDSTRING', 'COMMENTOFFSTRING'];
'PRE_EXTENDEDSTRING', 'COMMENTOFFSTRING', 'CORE_CSS'];
foreach($legacy as $const)
{
@@ -1287,7 +1293,7 @@ $ns = e107::getRender(); //TODO - find & replace $ns, $e107->ns
// EONE-134 - bad e_module could destroy e107 instance
$e107 = e107::getInstance(); // Is this needed now?
$sql->db_Mark_Time('IP Handler and Ban Check');
$dbg->logTime('IP Handler and Ban Check');
e107::getIPHandler()->ban();
if(varset($pref['force_userupdate']) && USER && !isset($_E107['no_forceuserupdate']) && $_SERVER['QUERY_STRING'] !== 'logout')
@@ -1299,7 +1305,7 @@ if(varset($pref['force_userupdate']) && USER && !isset($_E107['no_forceuserupdat
}
}
$sql->db_Mark_Time('Signup/splash/admin');
$dbg->logTime('Signup/splash/admin');
if(($pref['membersonly_enabled'] && !isset($_E107['allow_guest'])) || ($pref['maintainance_flag'] && empty($_E107['cli']) && empty($_E107['no_maintenance'])))
@@ -1317,7 +1323,7 @@ if(!isset($_E107['no_prunetmp']))
}
$sql->db_Mark_Time('Login/logout/ban/tz');
$dbg->logTime('Login/logout/ban/tz');
if (isset($_POST['userlogin']) || isset($_POST['userlogin_x']))
@@ -1463,7 +1469,7 @@ define('TIMEOFFSET', $e_deltaTime);
// ----------------------------------------------------------------------------
$sql->db_Mark_Time('Find/Load Theme');
$dbg->logTime('Find/Load Theme');
if(e_ADMIN_AREA) // Load admin phrases ASAP
{
@@ -1499,7 +1505,7 @@ if(!defined('THEME'))
$theme_pref = varset($pref['sitetheme_pref']);
// --------------------------------------------------------------
$sql->db_Mark_Time('Find/Load Theme-Layout'); // needs to run after checkvalidtheme() (for theme previewing).
$dbg->logTime('Find/Load Theme-Layout'); // needs to run after checkvalidtheme() (for theme previewing).
if(deftrue('e_ADMIN_AREA'))
{
@@ -1541,14 +1547,14 @@ else
if(!isset($_E107['no_menus']))
{
$sql->db_Mark_Time('Init Menus');
$dbg->logTime('Init Menus');
e107::getMenu()->init();
}
// here we USE the theme
if(e_ADMIN_AREA)
{
$sql->db_Mark_Time('Loading Admin Theme');
$dbg->logTime('Loading Admin Theme');
if(file_exists(THEME.'admin_theme.php') && !deftrue('e_MENUMANAGER_ACTIVE')) // no admin theme when previewing.
{
require_once (THEME.'admin_theme.php');
@@ -1560,8 +1566,9 @@ if(e_ADMIN_AREA)
}
else
{
$sql->db_Mark_Time('Loading Site Theme');
$dbg->logTime('Loading Site Theme');
require_once (THEME.'theme.php');
if(isset($SC_WRAPPER))
{
e107::scStyle($SC_WRAPPER);
@@ -2206,13 +2213,13 @@ e107::getDebug()->log("Timezone: ".USERTIMEZONE); // remove later on.
}
$sql->db_Mark_Time('Go online');
$dbg->logTime('Go online');
if(!isset($_E107['no_online']) && varset($pref['track_online']))
{
e107::getOnline()->goOnline($pref['track_online'], $pref['flood_protect']);
}
$sql->db_Mark_Time('(After Go online)');
$dbg->logTime('(After Go online)');
/**
* Set Cookie
@@ -2986,4 +2993,4 @@ function plugInstalled($plugname)
return isset($pref['plug_installed'][$plugname]);*/
}
$sql->db_Mark_Time('(After class2)');
$dbg->logTime('(After class2)');

View File

@@ -76,10 +76,10 @@ new admin_start;
require_once(e_ADMIN.'auth.php');
e107::getDb()->db_Mark_Time('(Start Admin Checks)');
e107::getDebug()->logTime('(Start Admin Checks)');
e107::getDb()->db_Mark_Time('(After Admin Checks)');
e107::getDebug()->logTime('(After Admin Checks)');
$mes = e107::getMessage();
if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'infopanel'; // Shouldn't be needed - but just in case
@@ -140,34 +140,34 @@ class admin_start
unset($_SESSION['lancheck']);
e107::getDb()->db_Mark_Time('Check Paths');
e107::getDebug()->logTime('Check Paths');
$this->checkPaths();
e107::getDb()->db_Mark_Time('Check Timezone');
e107::getDebug()->logTime('Check Timezone');
$this->checkTimezone();
e107::getDb()->db_Mark_Time('Check Writable');
e107::getDebug()->logTime('Check Writable');
$this->checkWritable();
e107::getDb()->db_Mark_Time('Check Incompatible Plugins');
e107::getDebug()->logTime('Check Incompatible Plugins');
$this->checkIncompatiblePlugins();
e107::getDb()->db_Mark_Time('Check Filetypes');
e107::getDebug()->logTime('Check Filetypes');
$this->checkFileTypes();
e107::getDb()->db_Mark_Time('Check Suspect Files');
e107::getDebug()->logTime('Check Suspect Files');
$this->checkSuspiciousFiles();
e107::getDb()->db_Mark_Time('Check Deprecated');
e107::getDebug()->logTime('Check Deprecated');
$this->checkDeprecated();
e107::getDb()->db_Mark_Time('Check HTMLArea');
e107::getDebug()->logTime('Check HTMLArea');
$this->checkHtmlarea();
e107::getDb()->db_Mark_Time('Check Htaccess');
e107::getDebug()->logTime('Check Htaccess');
$this->checkHtaccess();
e107::getDb()->db_Mark_Time('Check Core Update');
e107::getDebug()->logTime('Check Core Update');
$this->checkCoreUpdate();
if($this->exit === true)
@@ -175,16 +175,16 @@ class admin_start
return null;
}
e107::getDb()->db_Mark_Time('Check New Install');
e107::getDebug()->logTime('Check New Install');
$this->checkNewInstall();
/* e107::getDb()->db_Mark_Time('Check Plugin Update');
/* e107::getDebug()->logTime('Check Plugin Update');
$this->checkPluginUpdate();
e107::getDb()->db_Mark_Time('Check Theme Update');
e107::getDebug()->logTime('Check Theme Update');
$this->checkThemeUpdate();
*/
e107::getDb()->db_Mark_Time('Check Password Encryption');
e107::getDebug()->logTime('Check Password Encryption');
$this->checkPasswordEncryption();

View File

@@ -20,7 +20,7 @@ if (!defined('e107_INIT'))
}
e107::getDb()->db_Mark_Time('(Start auth.php)');
e107::getDebug()->logTime('(Start auth.php)');
define('e_CAPTCHA_FONTCOLOR','#F9A533');

View File

@@ -15,7 +15,7 @@ if (!defined('e107_INIT'))
exit;
}
e107::getDb()->db_Mark_Time('(Start boot.php)');
e107::getDebug()->logTime('(Start boot.php)');
header('Content-type: text/html; charset=utf-8', TRUE);
define('ADMINFEED', 'https://e107.org/adminfeed');
@@ -216,7 +216,7 @@ e107::coreLan('footer', true);
continue;
}
e107::getDb()->db_Mark_Time('[boot.php: Loading LANS for '.$_p.']');
e107::getDebug()->logTime('[boot.php: Loading LANS for '.$_p.']');
e107::loadLanFiles($_p, 'admin');
}
}
@@ -224,7 +224,7 @@ e107::coreLan('footer', true);
// Get Icon constants, theme override (theme/templates/admin_icons_template.php) is allowed
e107::getDb()->db_Mark_Time('[boot.php: Loading admin_icons]');
e107::getDebug()->logTime('[boot.php: Loading admin_icons]');
include_once(e107::coreTemplatePath('admin_icons'));

View File

@@ -26,7 +26,7 @@ if(!defined('USER_AREA'))
define("USER_AREA", FALSE);
}
e107::getDb()->db_Mark_Time('(Header Top)');
e107::getDebug()->logTime('(Header Top)');
if(!deftrue('e_MENUMANAGER_ACTIVE'))
@@ -559,7 +559,7 @@ function getAlert()
// Header included notification, from this point header includes are not possible
define('HEADER_INIT', TRUE);
e107::getDb()->db_Mark_Time("End Head, Start Body");
e107::getDebug()->logTime("End Head, Start Body");
//
// K: (The rest is ignored for popups, which have no menus)
@@ -597,7 +597,7 @@ if ($e107_popup != 1)
// (legacy?) function admin_purge_related moved to boot.php
e107::getDb()->db_Mark_Time('Parse Admin Header');
e107::getDebug()->logTime('Parse Admin Header');
//NEW - Iframe mod
if (!deftrue('e_IFRAME'))
@@ -610,7 +610,7 @@ if ($e107_popup != 1)
e107::css("inline","body { padding:0px } "); // default padding for iFrame-only.
}
e107::getDb()->db_Mark_Time('(End: Parse Admin Header)');
e107::getDebug()->logTime('(End: Parse Admin Header)');
}
// XXX - we don't need this (use e107::getMessage()) - find out what's using it and remove it

View File

@@ -401,7 +401,7 @@ function update_check()
if(function_exists('update_' . $func))
{
$sql->db_Mark_Time('Check Core Update_' . $func . ' ');
e107::getDebug()->logTime('Check Core Update_' . $func . ' ');
if(!call_user_func('update_' . $func, false))
{
$dbUpdatesPref[$func] = 0;

View File

@@ -21,7 +21,7 @@ define('ADMIN_AREA',FALSE);
$e107 = e107::getInstance();
$sql = e107::getDb();
$sql->db_Mark_Time('(Header Top)');
e107::getDebug()->logTime('(Header Top)');
@@ -199,7 +199,7 @@ $e_pref = e107::getConfig('core');
// Other Meta tags.
// Register Core CSS first, TODO - convert $no_core_css to constant, awaiting for path changes
// Register Core CSS first
// NOTE: PREVIEWTHEME check commented - It shouldn't break anything as it's overridden by theme CSS now
if (/*!defined("PREVIEWTHEME") && */! (isset($no_core_css) && $no_core_css !==true) && defset('CORE_CSS') !== false)
{
@@ -310,8 +310,6 @@ else
}
}
// FIXME: TEXTDIRECTION compatibility CSS (marj?)
// TODO: probably better to externalise along with some other things above
// possibility to overwrite some CSS definition according to TEXTDIRECTION
// especially usefull for rtl.css
// see _blank theme for examples
@@ -385,9 +383,6 @@ echo "\n<!-- footer_inline_css -->\n";
//
// E: Send JS all in once
// Read here why - http://code.google.com/speed/page-speed/docs/rtt.html#PutStylesBeforeScripts
// TODO - more work (zones, eplug_js, headerjs etc order, external JS/CSS)
// TODO - mobile support
// [JSManager] Load JS Includes - Zone 1 - Before Library
e107::getJs()->renderJs('header', 1);
@@ -434,8 +429,7 @@ else
if (is_readable(e_FILE.'user.vbs') && filesize(e_FILE.'user.vbs')) { echo "<script type='text/vbscript' src='".e_FILE_ABS."user.vbs'></script>\n"; }
}
//FIXME - CHAP JS
// TODO - convert it to e107::getJs()->header/footerFile() call
// Old Deprecated CHAP Support.
if (!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHAP'],0))
{
if ($pref['password_CHAP'] == 2)
@@ -546,53 +540,8 @@ 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";
}
//
// FIXME H: Generate JS for image preloads (do we really need this?)
/* @DEPRECATED */
/*
if ($pref['image_preload'] && is_dir(THEME.'images'))
{
$ejs_listpics = '';
$handle=opendir(THEME.'images');
while ($file = readdir($handle))
{
if(preg_match("#(jpg|jpeg|gif|bmp|png)$#i", $file))
{
$ejs_listpics .= $file.",";
}
}
$ejs_listpics = substr($ejs_listpics, 0, -1);
closedir($handle);
if (!isset($script_text)) $script_text = '';
$script_text .= "ejs_preload('".THEME_ABS."images/','".$ejs_listpics."');\n";
}
if (isset($script_text) && $script_text)
{
echo "<script type='text/javascript'>\n";
echo "<!--\n";
echo $script_text;
echo "// -->\n";
echo "</script>\n";
}*/
//
// FIXME - I: Calculate JS onload() functions for the BODY tag
//
// Fader menu
// OLD CODE REMOVAL
//global $eMenuActive, $eMenuArea;
//if(in_array('fader_menu', $eMenuActive)) $js_body_onload[] = 'changecontent(); ';
// External links handling
//$js_body_onload = array();//'externalLinks();'; - already registered to e107:loaded Event by the new JS API
// Theme JS
// XXX DEPRECATED $body_onload and related functionality
/** const THEME_ONLOAD @deprecated */
if (defined('THEME_ONLOAD')) $js_body_onload[] = THEME_ONLOAD;
$body_onload='';
if (count($js_body_onload)) $body_onload = " onload=\"".implode(" ",$js_body_onload)."\"";
@@ -715,7 +664,7 @@ if($noBody === true) // New in v2.2.2 - remove need for BODYTAG.
{
echo "\n<!-- Start theme.html -->\n";
}
elseif(!deftrue('BODYTAG')) //TODO Discuss a better way?
elseif(!deftrue('BODYTAG')) // @deprecated.
{
$body_onload .= " id='layout-".e107::getForm()->name2id(THEME_LAYOUT)."' ";
echo "<body".$body_onload.">\n";
@@ -725,7 +674,7 @@ else
if ($body_onload)
{
// Kludge to get the CHAP code included
echo substr(trim(BODYTAG), 0, -1).' '.$body_onload.">\n"; // FIXME - must be a better way!
echo substr(trim(BODYTAG), 0, -1).' '.$body_onload.">\n";
}
else
{
@@ -772,12 +721,11 @@ if(deftrue('BOOTSTRAP'))
// Header included notification, from this point header includes are not possible
define('HEADER_INIT', TRUE);
$sql->db_Mark_Time("Main Page Body");
e107::getDebug()->logTime("Main Page Body");
//
// K: (The rest is ignored for popups, which have no menus)
//
//echo "XXX - ".$e107_popup;
// require $e107_popup =1; to use it as header for popup without menus
if(!isset($e107_popup))
{
@@ -792,7 +740,7 @@ if ($e107_popup != 1) {
//
// M: Send top of body for custom pages and for news
//
//XXX - remove all page detections
// BC Fix
if (defset('e_PAGE') == 'news.php' && isset($NEWSHEADER))
{
parseheader($NEWSHEADER);

View File

@@ -122,6 +122,11 @@
}
function Mark_Time($sMarker)
{
$this->logTime($sMarker);
}
public function logTime($sMarker)
{ // Should move to traffic_class?
$timeNow = microtime();
$nMarks = ++$this->nTimeMarks;

View File

@@ -5250,6 +5250,7 @@ return;
$sql = e107::getDb();
$tp = e107::getParser();
$dbg = e107::getDebug();
// $html = $this->getXss();
@@ -5260,20 +5261,20 @@ return;
echo "<h2>Standard v2 Parser</h2>";
echo "<h3>\$tp->dataFilter()</h3>";
// echo $tp->dataFilter($html); // Remove Comment for a real mess!
$sql->db_Mark_Time('------ Start Parser Test -------');
$dbg->logTime('------ Start Parser Test -------');
print_a($tp->dataFilter($html));
$sql->db_Mark_Time('tp->dataFilter');
$dbg->logTime('tp->dataFilter');
echo "<h3>\$tp->toHTML()</h3>";
// echo $tp->dataFilter($html); // Remove Comment for a real mess!
print_a($tp->toHTML($html));
$sql->db_Mark_Time('tp->toHtml');
$dbg->logTime('tp->toHtml');
echo "<h3>\$tp->toDB()</h3>";
// echo $tp->dataFilter($html); // Remove Comment for a real mess!
$todb = $tp->toDB($html);
print_a( $todb);
$sql->db_Mark_Time('tp->toDB');
$dbg->logTime('tp->toDB');
echo "<h3>\$tp->toForm() with toDB input.</h3>";
print_a( $tp->toForm($todb));
@@ -5282,8 +5283,8 @@ return;
echo "<h3>Processed</h3>";
$cleaned = $this->cleanHtml($html, true); // false = don't check html pref.
print_a($cleaned);
$sql->db_Mark_Time('new Parser');
// $sql->db_Mark_Time('------ End Parser Test -------');
$dbg->logTime('new Parser');
// $dbg->logTime('------ End Parser Test -------');
echo "<h3>Processed &amp; Rendered</h3>";
echo $cleaned;

View File

@@ -1262,7 +1262,7 @@ class e_jsmanager
if($label && E107_DEBUG_LEVEL > 0)
{
echo $external ? "<!-- [JSManager] ".$label." -->\n" : "/* [JSManager] ".$label." */\n\n";
e107::getDb()->db_Mark_Time("Load JS/CSS: ".$label);
e107::getDebug()->logTime("Load JS/CSS: ".$label);
}

View File

@@ -627,7 +627,7 @@ class e_menu
{
echo "\n<!-- Menu Start: ".$mname." -->\n";
}
e107::getDb()->db_Mark_Time($mname);
e107::getDebug()->logTime($mname);
if(is_numeric($mpath) || ($mname === false)) // Custom Page/Menu
{
@@ -696,7 +696,7 @@ class e_menu
deftrue('e_DEBUG') ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php');
}
e107::getDb()->db_Mark_Time("(After ".$mname.")");
e107::getDebug()->logTime("(After ".$mname.")");
if(e_DEBUG === true)
{

View File

@@ -310,6 +310,7 @@ class e_db_mysql implements e_db
/**
* @return void
* @param string $sMarker
* @deprecated Use e107::getDebug()->logTime();
* @desc Enter description here...
* @access private
*/

View File

@@ -95,6 +95,7 @@ class e_online
$sql = e107::getDb();
$user = e107::getUser();
$dbg = e107::getDebug();
$online_timeout = 300;
@@ -141,14 +142,14 @@ class e_online
// don't do anything if main admin logged in as another user
if ($user->isUser() && !$user->getParentId())
{
$sql->db_Mark_Time('Go online (isUser)');
$dbg->logTime('Go online (isUser)');
// Find record that matches IP or visitor, or matches user info
$sql->db_Mark_Time('Go online (db select)');
$dbg->logTime('Go online (db select)');
if ($sql->select('online', '*', "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}' LIMIT 1"))
{
$sql->db_Mark_Time('Go online (db fetch)');
$dbg->logTime('Go online (db fetch)');
$row = $sql->fetch();
$sql->db_Mark_Time('Go online (db end)');
$dbg->logTime('Go online (db end)');
if ($row['online_user_id'] == $udata)
{
@@ -234,19 +235,19 @@ class e_online
$query['online_location'] = $page;
}
$sql->db_Mark_Time('Go online (update) Line:'.__LINE__);
$dbg->logTime('Go online (update) Line:'.__LINE__);
$sql->update('online', $query);
$sql->db_Mark_Time('Go online (after update) Line:'.__LINE__);
$dbg->logTime('Go online (after update) Line:'.__LINE__);
}
else
{
$sql->db_Mark_Time('Go online (insert) Line: '.__LINE__);
$dbg->logTime('Go online (insert) Line: '.__LINE__);
$sql->insert('online',$insert_query);
$sql->db_Mark_Time('Go online (after insert) Line: '.__LINE__);
$dbg->logTime('Go online (after insert) Line: '.__LINE__);
}
$sql->db_Mark_Time('Go online (after isUser)');
$dbg->logTime('Go online (after isUser)');
}
// don't do anything if main admin logged in as another user
elseif(!$user->getParentId())
@@ -268,9 +269,9 @@ class e_online
// echo "here {$online_pagecount}";
$query="`online_pagecount` = {$row['online_pagecount']}{$update_page} WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'";
}
$sql->db_Mark_Time('Go online (update) Line:'.__LINE__);
$dbg->logTime('Go online (update) Line:'.__LINE__);
$sql->update('online', $query);
$sql->db_Mark_Time('Go online (after update) Line:'.__LINE__);
$dbg->logTime('Go online (after update) Line:'.__LINE__);
}
else
{ // New visitor
@@ -312,12 +313,12 @@ class e_online
// Speed up ajax requests
if(!deftrue('e_AJAX_REQUEST'))
{
$sql->db_Mark_Time('Go online (delete) Line:'.__LINE__);
$dbg->logTime('Go online (delete) Line:'.__LINE__);
$sql->delete('online', '`online_timestamp` < '.(time() - $online_timeout));
// FIXME - don't use constants below, save data in class vars, call e_online signleton - e107::getOnline()
// $total_online = $sql->db_Count('online'); // 1 less query! :-)
$sql->db_Mark_Time('Go online (total_online) Line:'.__LINE__);
$dbg->logTime('Go online (total_online) Line:'.__LINE__);
if ($total_online = $sql->gen('SELECT o.*,u.user_image FROM `#online` AS o LEFT JOIN `#user` AS u ON o.online_user_id = u.user_id WHERE o.online_pagecount > 0 ORDER BY o.online_timestamp DESC'))
// if ($total_online = $sql->gen('SELECT o FROM `#online` WHERE o.online_pagecount > 0 ORDER BY o.online_timestamp DESC'))
{
@@ -325,7 +326,7 @@ class e_online
$members_online = 0;
$listuserson = array();
$sql->db_Mark_Time('Go online (db fetch) Line:'.__LINE__);
$dbg->logTime('Go online (db fetch) Line:'.__LINE__);
while ($row = $sql->fetch())
{
@@ -373,7 +374,7 @@ class e_online
define('TOTAL_ONLINE', $total_online);
define('MEMBERS_ONLINE', $members_online);
define('GUESTS_ONLINE', $total_online - $members_online);
$sql->db_Mark_Time('Go online (db count) Line:'.__LINE__);
$dbg->logTime('Go online (db count) Line:'.__LINE__);
define('ON_PAGE', $sql->db_Count('online', '(*)', "WHERE `online_location` = '{$page}' "));
define('MEMBER_LIST', $member_list);

View File

@@ -1618,14 +1618,16 @@ class e107plugin
// echo "Found plugin: ".$row['plugin_path']." in DB<br />";
}
}
$sql->db_Mark_Time('Start Scanning Plugin Files');
e107::getDebug()->logTime('Start Scanning Plugin Files');
$plugList = $fl->get_files(e_PLUGIN, "^plugin\.(php|xml)$", "standard", 1);
foreach ($plugList as $num => $val) // Remove Duplicates caused by having both plugin.php AND plugin.xml.
{
$key = basename($val['path']);
$pluginList[$key] = $val;
}
$sql->db_Mark_Time('After Scanning Plugin Files');
e107::getDebug()->logTime('After Scanning Plugin Files');
$p_installed = e107::getPref('plug_installed', array()); // load preference;
$mes = e107::getMessage();

View File

@@ -1066,7 +1066,7 @@ class e_parse_shortcode
if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS)
{
$sql->db_Mark_Time("SC ".$code);
e107::getDebug()->logTime("SC ".$code);
}
if (E107_DBG_SC && ADMIN)

View File

@@ -86,7 +86,7 @@ if(false === $cached)
$xmonth_cnt = array();
$month_links = array();
$sql->db_Mark_Time('News months menu');
e107::getDebug()->logTime('News months menu');
if(!$sql->select("news", "news_id, news_datestamp", "news_class IN (".USERCLASS_LIST.") AND (FIND_IN_SET('0', news_render_type) OR FIND_IN_SET(1, news_render_type)) AND news_datestamp > ".intval($start)." AND news_datestamp < ".intval($end)." ORDER BY news_datestamp DESC"))
{
e107::getCache()->set($cString, '');

View File

@@ -59,7 +59,7 @@
// ----------------------------
$sql->db_Mark_Time("Start Simple URL-ReWrite Routine");
e107::getDebug()->logTime("Start Simple URL-ReWrite Routine");
$eUrl = e_url::instance();
$eUrl->run();
@@ -74,7 +74,7 @@
// -----------------------------------------
$sql->db_Mark_Time("Start regular eFront Class");
e107::getDebug()->logTime("Start regular eFront Class");
$front = eFront::instance();
$front->init()