1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-26 02:43:16 +02:00

Code cleanup.

This commit is contained in:
Cameron
2020-12-05 12:43:05 -08:00
parent 68e251d771
commit b16d7605b6
7 changed files with 142 additions and 207 deletions

View File

@ -26,20 +26,20 @@
class e107_db_debug
{
private $active = false; // true when debug is active.
var $aSQLdetails = array(); // DB query analysis (in pieces for further analysis)
var $aDBbyTable = array();
var $aOBMarks = array(0 => ''); // Track output buffer level at each time mark
var $aMarkNotes = array(); // Other notes can be added and output...
var $aTimeMarks = array(); // Overall time markers
var $curTimeMark = 'Start';
var $nTimeMarks = 0; // Provide an array index for time marks. Stablizes 'current' function
var $aGoodQueries = array();
var $aBadQueries = array();
var $scbbcodes = array();
var $scbcount;
var $deprecated_funcs = array();
var $aLog = array(); // Generalized debug log (only seen during debug)
var $aIncList = array(); // Included files
public $aSQLdetails = array(); // DB query analysis (in pieces for further analysis)
public $aDBbyTable = array();
public $aOBMarks = array(0 => ''); // Track output buffer level at each time mark
public $aMarkNotes = array(); // Other notes can be added and output...
public $aTimeMarks = array(); // Overall time markers
public $curTimeMark = 'Start';
public $nTimeMarks = 0; // Provide an array index for time marks. Stablizes 'current' function
// public $aGoodQueries = array();
// var $aBadQueries = array();
public $scbbcodes = array();
public $scbcount;
public $deprecated_funcs = array();
public $aLog = array(); // Generalized debug log (only seen during debug)
public $aIncList = array(); // Included files
function __construct()
{
@ -175,14 +175,15 @@
}
/**
* @param $query
* @param $rli
* @param $origQryRes
* @param $aTrace
* @param $mytime
* @param $curtable
*/
/**
* @param $query
* @param $rli
* @param $origQryRes
* @param $aTrace
* @param $mytime
* @param $curtable
* @return null
*/
function Mark_Query($query, $rli, $origQryRes, $aTrace, $mytime, $curtable)
{
if(!$this->active)
@ -210,7 +211,7 @@
if($sQryRes) // There's something to explain
{
//$nFields = mysql_num_fields($sQryRes);
$nFields = $sql->columnCount($sQryRes); // mysql_num_fields($sQryRes);
$nFields = $sql->columnCount(); // mysql_num_fields($sQryRes);
$bExplained = true;
}
}
@ -227,7 +228,7 @@
$t['marker'] = $this->curTimeMark;
$t['caller'] = "$sCallingFile($sCallingLine)";
$t['query'] = $query;
$t['ok'] = ($sQryRes !== false) ? true : false;
$t['ok'] = ($sQryRes !== false);
$t['error'] = $sQryRes ? '' : $sql->getLastErrorText(); // mysql_error();
$t['nFields'] = $nFields;
$t['time'] = $mytime;
@ -267,6 +268,8 @@
$this->aDBbyTable[$curtable]['DB Time'] = $mytime;
$this->aDBbyTable[$curtable]['DB Count'] = 1;
}
return null;
}
@ -402,6 +405,7 @@
function countLabel($amount)
{
$inc = '';
if($amount < 30)
{
@ -431,7 +435,7 @@
foreach($this->aTimeMarks as $item)
{
$item['What'] = str_pad($item['What'], 50, " ", STR_PAD_RIGHT);
$item['What'] = str_pad($item['What'], 50);
$text .= implode("\t\t\t", $item) . "\n";
}
@ -534,10 +538,10 @@
$tMem = ($tMarker['Memory']);
if($tMem < 0) // Quick Fix for negative numbers.
{
// if($tMem < 0) // Quick Fix for negative numbers.
// {
// $tMem = 0.0000000001;
}
// }
$tMarker['Memory'] = ($tMem ? number_format($tMem / 1024.0, 1) : '?'); // display if known
@ -578,9 +582,9 @@
$tMarker['Time'] = $this->highlight($tMarker['Time'], $thisDelta, .2);
$tMarker['%Time'] = $totTime ? number_format(100.0 * ($thisDelta / $totTime), 0) : 0;
$tMarker['%DB Count'] = number_format(100.0 * $tMarker['DB Count'] / $sql->db_QueryCount(), 0);
$tMarker['%DB Time'] = $db_time ? number_format(100.0 * $tMarker['DB Time'] / $db_time, 0) : 0;
$tMarker['%Time'] = $totTime ? number_format(100.0 * ($thisDelta / $totTime)) : 0;
$tMarker['%DB Count'] = number_format(100.0 * $tMarker['DB Count'] / $sql->db_QueryCount());
$tMarker['%DB Time'] = $db_time ? number_format(100.0 * $tMarker['DB Time'] / $db_time) : 0;
$tMarker['DB Time'] = number_format($tMarker['DB Time'] * 1000.0, 1);
$tMarker['OB Lev'] = $this->aOBMarks[$tKey];
@ -600,9 +604,9 @@
}
}
$aSum['%Time'] = $totTime ? number_format(100.0 * ($aSum['Time'] / $totTime), 0) : 0;
$aSum['%DB Time'] = $db_time ? number_format(100.0 * ($aSum['DB Time'] / $db_time), 0) : 0;
$aSum['%DB Count'] = ($sql->db_QueryCount()) ? number_format(100.0 * ($aSum['DB Count'] / ($sql->db_QueryCount())), 0) : 0;
$aSum['%Time'] = $totTime ? number_format(100.0 * ($aSum['Time'] / $totTime)) : 0;
$aSum['%DB Time'] = $db_time ? number_format(100.0 * ($aSum['DB Time'] / $db_time)) : 0;
$aSum['%DB Count'] = ($sql->db_QueryCount()) ? number_format(100.0 * ($aSum['DB Count'] / ($sql->db_QueryCount()))) : 0;
$aSum['Time'] = number_format($aSum['Time'] * 1000.0, 1);
$aSum['DB Time'] = number_format($aSum['DB Time'] * 1000.0, 1);
@ -675,16 +679,16 @@
$aSum['DB Time'] += $curTable['DB Time'];
$aSum['DB Count'] += $curTable['DB Count'];
$curTable['%DB Count'] = number_format(100.0 * $curTable['DB Count'] / $sql->db_QueryCount(), 0);
$curTable['%DB Time'] = number_format(100.0 * $curTable['DB Time'] / $db_time, 0);
$curTable['%DB Count'] = number_format(100.0 * $curTable['DB Count'] / $sql->db_QueryCount());
$curTable['%DB Time'] = number_format(100.0 * $curTable['DB Time'] / $db_time);
$timeLabel = number_format($curTable['DB Time'] * 1000.0, 1);
$curTable['DB Time'] = $this->highlight($timeLabel, ($curTable['DB Time'] * 1000), 500); // 500 msec
$text .= "<tr><td class='forumheader3'>" . implode("&nbsp;</td><td class='forumheader3' style='text-align:right'>", array_values($curTable)) . "&nbsp;</td></tr>\n";
}
$aSum['%DB Time'] = $db_time ? number_format(100.0 * ($aSum['DB Time'] / $db_time), 0) : 0;
$aSum['%DB Count'] = ($sql->db_QueryCount()) ? number_format(100.0 * ($aSum['DB Count'] / ($sql->db_QueryCount())), 0) : 0;
$aSum['%DB Time'] = $db_time ? number_format(100.0 * ($aSum['DB Time'] / $db_time)) : 0;
$aSum['%DB Count'] = ($sql->db_QueryCount()) ? number_format(100.0 * ($aSum['DB Count'] / ($sql->db_QueryCount()))) : 0;
$aSum['DB Time'] = number_format($aSum['DB Time'] * 1000.0, 1);
$text .= "<tr><td class='fcaption'><b>" . implode("&nbsp;</td><td class='fcaption' style='text-align:right'><b>", array_values($aSum)) . "&nbsp;</b></td></tr>\n";
$text .= "\n</table><br />\n";
@ -892,11 +896,12 @@
}
/**
* var_dump to debug log
*
* @param mixed $message
*/
/**
* var_dump to debug log
*
* @param mixed $message
* @param int $TraceLev
*/
function dump($message, $TraceLev = 1)
{

View File

@ -281,10 +281,11 @@ class e_parse extends e_parser
// CHARSET is utf-8
// if(strtolower(CHARSET) == 'utf-8')
// {
if(version_compare(PHP_VERSION, '6.0.0') < 1)
if(PHP_MAJOR_VERSION < 6)
{
// Need to do something here
if(extension_loaded('mbstring'))
if(extension_loaded('mbstring') && defined('MB_OVERLOAD_STRING'))
{
// Check for function overloading
$temp = ini_get('mbstring.func_overload');

View File

@ -156,7 +156,7 @@ class banner_ui extends e_admin_ui
// ------- Customize Create --------
public function beforeCreate($new_data)
public function beforeCreate($new_data, $old_data)
{
// e107::getMessage()->addDebug(print_a($new_data,true));
@ -604,6 +604,8 @@ class banner_form_ui extends e_admin_form_ui
return $this->campaigns;
break;
}
return null;
}

View File

@ -1,71 +1,93 @@
<!--
function tick(e107_datepref, e107_dateformat, e107_datesuff1, e107_datesuff2, e107_datesuff3, e107_datesuff4) {
function tick(e107_datepref,e107_dateformat,e107_datesuff1,e107_datesuff2,e107_datesuff3,e107_datesuff4) {
if(e107_datepref=='undefined'){e107_datepref = '';}
var hours, minutes, seconds, ap;
var intHours, intMinutes, intSeconds, today;
var intDay, intDate, intMonth, intYear, timeString;
today = new Date();
intDay = today.getDay();
intDate = today.getDate();
intMonth = today.getMonth();
intYear = today.getYear();
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
timeString = DayNam[intDay]+" "+e107_datepref+" "+intDate;
if (intDate == 1 || intDate == 21 || intDate == 31) {
timeString= timeString + e107_datesuff1 + " ";
} else if (intDate == 2 || intDate == 22) {
timeString= timeString + e107_datesuff2 + " ";
} else if (intDate == 3 || intDate == 23) {
timeString= timeString + e107_datesuff3 + " ";
} else {
timeString = timeString + e107_datesuff4 + " ";
}
if (intYear < 2000){
intYear += 1900;
}
timeString = timeString+" "+MnthNam[intMonth]+" "+intYear;
if(e107_dateformat == 1){
if (intHours == 0) {
hours = "12:";
ap = "am.";
} else if (intHours < 12) {
hours = intHours+":";
ap = "am.";
} else if (intHours == 12) {
hours = "12:";
ap = "pm.";
} else {
intHours = intHours - 12
hours = intHours + ":";
ap = "pm.";
if (e107_datepref === undefined) {
e107_datepref = '';
}
}else{
if (intHours < 10) {
hours = "0" + intHours + ":";
} else {
hours = intHours + ":";
if (e107_datesuff1 === undefined) {
e107_datesuff1 = '';
}
ap = '';
}
if (intMinutes < 10) {
minutes = "0"+intMinutes;
} else {
minutes = intMinutes;
}
if (intSeconds < 10) {
seconds = ":0"+intSeconds;
} else {
seconds = ":"+intSeconds;
}
timeString = (document.all)? timeString+", "+hours+minutes+seconds+" "+ap:timeString+" "+hours+minutes+" "+ap;
var clock = (document.all) ? document.all("Clock") : document.getElementById("Clock");
clock.innerHTML = timeString;
(document.all)?window.setTimeout("tick('"+e107_datepref+"','"+e107_dateformat+"','"+e107_datesuff1+"','"+e107_datesuff2+"','"+e107_datesuff3+"','"+e107_datesuff4+"');", 1000):window.setTimeout("tick('"+e107_datepref+"','"+e107_dateformat+"','"+e107_datesuff1+"','"+e107_datesuff2+"','"+e107_datesuff3+"','"+e107_datesuff4+"');", 6000);
if (e107_datesuff2 === undefined) {
e107_datesuff2 = '';
}
if (e107_datesuff3 === undefined) {
e107_datesuff3 = '';
}
if (e107_datesuff4 === undefined) {
e107_datesuff4 = '';
}
var hours, minutes, seconds, ap;
var intHours, intMinutes, intSeconds, today;
var intDay, intDate, intMonth, intYear, timeString;
today = new Date();
intDay = today.getDay();
intDate = today.getDate();
intMonth = today.getMonth();
intYear = today.getYear();
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
timeString = DayNam[intDay] + " " + e107_datepref + " " + intDate;
if (intDate == 1 || intDate == 21 || intDate == 31) {
timeString = timeString + e107_datesuff1 + " ";
} else if (intDate == 2 || intDate == 22) {
timeString = timeString + e107_datesuff2 + " ";
} else if (intDate == 3 || intDate == 23) {
timeString = timeString + e107_datesuff3 + " ";
} else {
timeString = timeString + e107_datesuff4 + " ";
}
if (intYear < 2000) {
intYear += 1900;
}
timeString = timeString + " " + MnthNam[intMonth] + " " + intYear;
if (e107_dateformat == 1) {
if (intHours == 0) {
hours = "12:";
ap = "am.";
} else if (intHours < 12) {
hours = intHours + ":";
ap = "am.";
} else if (intHours == 12) {
hours = "12:";
ap = "pm.";
} else {
intHours = intHours - 12
hours = intHours + ":";
ap = "pm.";
}
} else {
if (intHours < 10) {
hours = "0" + intHours + ":";
} else {
hours = intHours + ":";
}
ap = '';
}
if (intMinutes < 10) {
minutes = "0" + intMinutes;
} else {
minutes = intMinutes;
}
if (intSeconds < 10) {
seconds = ":0" + intSeconds;
} else {
seconds = ":" + intSeconds;
}
timeString = (document.all) ? timeString + ", " + hours + minutes + seconds + " " + ap : timeString + " " + hours + minutes + " " + ap;
var clock = (document.all) ? document.all("Clock") : document.getElementById("Clock");
clock.innerHTML = timeString;
(document.all) ? window.setTimeout("tick('" + e107_datepref + "','" + e107_dateformat + "','" + e107_datesuff1 + "','" + e107_datesuff2 + "','" + e107_datesuff3 + "','" + e107_datesuff4 + "');", 1000) : window.setTimeout("tick('" + e107_datepref + "','" + e107_dateformat + "','" + e107_datesuff1 + "','" + e107_datesuff2 + "','" + e107_datesuff3 + "','" + e107_datesuff4 + "');", 6000);
}
////tick();
tick();
//-->

View File

@ -1,47 +0,0 @@
<?php
/*
+ ----------------------------------------------------------------------------------------------+
| e107 website system : http://e107.org
| Steve Dunstan 2001-2002 : 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/index.html,v $
| $Revision: 1.2 $
| $Date: 2008-08-08 20:16:12 $
| $Author: e107steved $
+-----------------------------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// Parameters available: $line, $file, $message
echo "<?xml version='1.0' encoding='utf-8' ?>\n";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">\n";
echo "<head>
<title>".LAN_ERROR_43."</title>
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<meta http-equiv='content-style-type' content='text/css' />
<meta http-equiv='content-language' content='en' />
</head>\n
<body>\n
<div id='bodytext'>";
if (is_readable(e_IMAGE.'logo.png'))
{
echo "<img src='".e_IMAGE_ABS.'logo.png'."' alt='".LAN_ERROR_44."' />";
}
echo "<div style='text-align:center; font: 14px verdana, tahoma, arial, helvetica, sans-serif;'>";
echo LAN_ERROR_38.'<br />';
echo LAN_ERROR_39.'<br />';
echo LAN_ERROR_40.'<br /><br /><br /></div>';
echo "<div style='text-align:center; font: 12px verdana, tahoma, arial, helvetica, sans-serif;'>";
echo LAN_ERROR_41.'<br />';
echo "<b>CRITICAL_ERROR: </b><br />Line {$line} {$file}<br />
<br />".LAN_ERROR_42.$message."</div>\n";
echo "</div></body>\n</html>";
?>

View File

@ -1,47 +0,0 @@
<?php
/*
+ ----------------------------------------------------------------------------------------------+
| e107 website system : http://e107.org
| Steve Dunstan 2001-2002 : 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/index.html,v $
| $Revision: 1.2 $
| $Date: 2008-08-08 20:16:12 $
| $Author: e107steved $
+-----------------------------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// Parameters available: $line, $file, $message
echo "<?xml version='1.0' encoding='utf-8' ?>\n";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">\n";
echo "<head>
<title>".LAN_ERROR_43."</title>
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<meta http-equiv='content-style-type' content='text/css' />
<meta http-equiv='content-language' content='en' />
</head>\n
<body>\n
<div id='bodytext'>";
if (is_readable(e_IMAGE.'logo.png'))
{
echo "<img src='".e_IMAGE_ABS.'logo.png'."' alt='".LAN_ERROR_44."' />";
}
echo "<div style='text-align:center; font: 14px verdana, tahoma, arial, helvetica, sans-serif;'>";
echo LAN_ERROR_38.'<br />';
echo LAN_ERROR_39.'<br />';
echo LAN_ERROR_40.'<br /><br /><br /></div>';
echo "<div style='text-align:center; font: 12px verdana, tahoma, arial, helvetica, sans-serif;'>";
echo LAN_ERROR_41.'<br />';
echo "<b>CRITICAL_ERROR: </b><br />Line {$line} {$file}<br />
<br />".LAN_ERROR_42.$message."</div>\n";
echo "</div></body>\n</html>";
?>

View File

@ -1,4 +1,4 @@
<!--
/*
JS for logon.
*/
@ -407,4 +407,3 @@ function bit_rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}
//-->