23 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
26 if ($mode == 'popup') {
27 $dump = $this->dump(
'');
29 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
31 <meta http-equiv="content-language" content="' .
_LANGCODE .
'" />
32 <meta http-equiv="content-type" content="text/html; charset=' .
_CHARSET .
'" />
34 <meta name="generator" content="XOOPS" />
38 <div style="text-align:center;">
39 <input class="formButton" value="' .
_CLOSE .
'" type="button" onclick="javascript:window.close();" />
43 <script type="text/javascript">
44 debug_window = openWithSelfMain("about:blank", "popup", 680, 450, true);
45 debug_window.document.clear();
47 $lines = preg_split(
"/(\r\n|\r|\n)( *)/",
$content);
48 foreach ($lines as $line) {
49 $ret .=
"\n" .
'debug_window.document.writeln("' . str_replace(array(
'"' ,
'</'), array(
'\"' ,
'<\/'), $line) .
'");';
53 debug_window.document.close();
61 if (function_exists(
'memory_get_usage')) {
62 $memory = memory_get_usage() .
' bytes';
64 if (strtoupper(substr(PHP_OS, 0, 3)) ===
'WIN') {
66 exec(
'tasklist /FI "PID eq ' . getmypid() .
'" /FO LIST', $out);
77 $views = array(
'errors' ,
'deprecated',
'queries' ,
'blocks' ,
'extra');
78 $ret .=
"\n<div id=\"xo-logger-output\">\n<div id='xo-logger-tabs'>\n";
79 $ret .=
"<a href='javascript:xoSetLoggerView(\"none\")'>" .
_LOGGER_NONE .
"</a>\n";
80 $ret .=
"<a href='javascript:xoSetLoggerView(\"\")'>" .
_LOGGER_ALL .
"</a>\n";
81 foreach ($views as $view) {
82 $count = count($this->$view);
83 $ret .=
"<a href='javascript:xoSetLoggerView(\"$view\")'>" . constant(
'_LOGGER_' . strtoupper($view)) .
" ($count)</a>\n";
85 $count = count($this->logstart);
86 $ret .=
"<a href='javascript:xoSetLoggerView(\"timers\")'>" .
_LOGGER_TIMERS .
"($count)</a>\n";
90 if (empty($mode) || $mode ==
'errors') {
100 $ret .=
'<table id="xo-logger-errors" class="outer"><tr><th>' .
_LOGGER_ERRORS .
'</th></tr>';
101 foreach ($this->errors as
$error) {
102 $ret .=
"\n<tr><td class='$class'>";
105 $ret .= sprintf(
_LOGGER_FILELINE, $this->sanitizePath($error[
'errstr']), $this->sanitizePath($error[
'errfile']), $error[
'errline']);
106 $ret .=
"<br />\n</td></tr>";
107 $class = ($class ==
'odd') ?
'even' :
'odd';
109 $ret .=
"\n</table>\n";
112 if (empty($mode) || $mode ==
'deprecated') {
115 foreach ($this->deprecated as $message) {
116 $ret .=
"\n<tr><td class='$class'>";
118 $ret .=
"<br />\n</td></tr>";
119 $class = ($class ==
'odd') ?
'even' :
'odd';
121 $ret .=
"\n</table>\n";
124 if (empty($mode) || $mode ==
'queries') {
126 $ret .=
'<table id="xo-logger-queries" class="outer"><tr><th>' .
_LOGGER_QUERIES .
'</th></tr>';
128 $pattern =
'/\b' . preg_quote(
$xoopsDB->prefix()) .
'\_/i';
130 foreach ($this->queries as $q) {
131 $sql = preg_replace($pattern,
'', $q[
'sql']);
132 $query_time = isset($q[
'query_time']) ? sprintf (
'%0.6f - ', $q[
'query_time']) :
'';
134 if (isset($q[
'error'])) {
135 $ret .=
'<tr class="' . $class .
'"><td><span style="color:#ff0000;">' . $query_time . htmlentities(
$sql) .
'<br /><strong>Error number:</strong> ' . $q[
'errno'] .
'<br /><strong>Error message:</strong> ' . $q[
'error'] .
'</span></td></tr>';
137 $ret .=
'<tr class="' . $class .
'"><td>' . $query_time. htmlentities(
$sql) .
'</td></tr>';
140 $class = ($class ==
'odd') ?
'even' :
'odd';
142 $ret .=
'<tr class="foot"><td>' .
_LOGGER_TOTAL .
': <span style="color:#ff0000;">' . count($this->queries) .
'</span></td></tr></table>';
144 if (empty($mode) || $mode ==
'blocks') {
146 $ret .=
'<table id="xo-logger-blocks" class="outer"><tr><th colspan="2">' .
_LOGGER_BLOCKS .
'</th></tr>';
147 foreach ($this->blocks as $b) {
149 $ret .=
'<tr><td class="' . $class .
'"><strong>' . $b[
'name'] .
':</strong> ' . sprintf(
_LOGGER_CACHED, intval($b[
'cachetime'])) .
'</td></tr>';
151 $ret .=
'<tr><td class="' . $class .
'"><strong>' . $b[
'name'] .
':</strong> ' .
_LOGGER_NOT_CACHED .
'</td></tr>';
153 $class = ($class ==
'odd') ?
'even' :
'odd';
155 $ret .=
'<tr class="foot"><td>' .
_LOGGER_TOTAL .
': <span style="color:#ff0000;">' . count($this->blocks) .
'</span></td></tr></table>';
157 if (empty($mode) || $mode ==
'extra') {
159 $ret .=
'<table id="xo-logger-extra" class="outer"><tr><th colspan="2">' .
_LOGGER_EXTRA .
'</th></tr>';
160 foreach ($this->extra as $ex) {
161 $ret .=
'<tr><td class="' . $class .
'"><strong>';
162 $ret .= htmlspecialchars($ex[
'name']) .
':</strong> ' . htmlspecialchars($ex[
'msg']);
163 $ret .=
'</td></tr>';
164 $class = ($class ==
'odd') ?
'even' :
'odd';
168 if (empty($mode) || $mode ==
'timers') {
170 $ret .=
'<table id="xo-logger-timers" class="outer"><tr><th colspan="2">' .
_LOGGER_TIMERS .
'</th></tr>';
171 foreach ($this->logstart as $k => $v) {
172 $ret .=
'<tr><td class="' . $class .
'"><strong>';
173 $ret .= sprintf(
_LOGGER_TIMETOLOAD, htmlspecialchars($k) .
'</strong>',
'<span style="color:#ff0000;">' . sprintf(
"%.03f", $this->dumpTime($k)) .
'</span>');
174 $ret .=
'</td></tr>';
175 $class = ($class ==
'odd') ?
'even' :
'odd';
183 <script type=
"text/javascript">
184 function xoLogCreateCookie(name,value,days) {
186 var date =
new Date();
187 date.setTime(date.getTime()+(days*24*60*60*1000));
188 var expires =
"; expires="+date.toGMTString();
190 else var expires =
"";
191 document.cookie = name+
"="+value+expires+
"; path=/";
193 function xoLogReadCookie(name) {
194 var nameEQ = name +
"=";
195 var ca = document.cookie.split(
';');
196 for(var i=0;i < ca.length;i++) {
198 while (c.charAt(0)==
' ') c = c.substring(1,c.length);
199 if (c.indexOf(nameEQ) == 0)
return c.substring(nameEQ.length,c.length);
203 function xoLogEraseCookie(name) {
204 createCookie(name,
"",-1);
206 function xoSetLoggerView( name ) {
207 var log = document.getElementById(
"xo-logger-output" );
210 for ( i=0; i!=log.childNodes.length; i++ ) {
211 elt = log.childNodes[i];
212 if ( elt.tagName && elt.tagName.toLowerCase() !=
'script' && elt.id !=
"xo-logger-tabs" ) {
213 elt.style.display = ( !name || elt.id ==
"xo-logger-" + name ) ?
"block" :
"none";
216 xoLogCreateCookie(
'XOLOGGERVIEW', name, 1 );
218 xoSetLoggerView( xoLogReadCookie(
'XOLOGGERVIEW' ) );