/[cvs]/nfo/php/libs/org.netfrag.flib/Site/DebugBox.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.flib/Site/DebugBox.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Tue Dec 3 17:48:42 2002 UTC (21 years, 8 months ago) by joko
Branch: MAIN
Changes since 1.3: +5 -2 lines
+ bugfix - too fast making changes before  -  debug box stayed empty ;)

1 <?
2 // -------------------------------------------------------------------------
3 // $Id: DebugBox.php,v 1.3 2002/12/03 17:39:38 joko Exp $
4 // -------------------------------------------------------------------------
5 // $Log: DebugBox.php,v $
6 // Revision 1.3 2002/12/03 17:39:38 joko
7 // + don't have _any_ kind of php-errors in the (critical) startup-phase
8 //
9 // Revision 1.2 2002/11/17 07:23:13 jonen
10 // + small bugfix: really _no_ error should occour when javascript scope is not switched
11 //
12 // Revision 1.1 2002/11/12 05:42:31 joko
13 // + initial checkin
14 //
15 // -------------------------------------------------------------------------
16
17
18 class Site_DebugBox {
19
20 function activate() {
21
22 global $site, $debugbox_status;
23
24 //print dumpvar($site); exit;
25 if (!$site->config['mode']['DEBUGBOX']) { return; }
26
27 $debugbox_status['active'] = 1;
28
29 $width = 380;
30
31 $debugbox_status['injs'] = 1;
32 ?>
33
34 <div id="debugbox_control" align="right" style="position:absolute;top:0px;right:0px;border:1px solid black;padding:3px;font-family:Verdana,Helvetica,Arial;font-size:10px;z-index:99;">
35 <a style="color:black;font-size:10px;" href="javascript:toggleBoxVisibility(1);">[ show ]</a><br>
36 <a style="color:black;font-size:10px;" href="javascript:toggleBoxVisibility(0);">[ hide ]</a>
37 </div>
38 <div id="debugbox_control_2" align="right" style="visibility:hidden;position:absolute;top:35px;right:0px;border:1px solid black;font-family:Verdana,Helvetica,Arial;font-size:10px;padding:3px;z-index:99;">
39 next...<br>
40 <a id="usernotice" style="color:black;font-size:10px;" href="javascript:jumpToNext('usernotice');">[ dprint ]</a><br>
41 <a id="phperror" style="color:black;font-size:10px;" href="javascript:jumpToNext('phperror');">[ error ]</a><br>
42 <a id="phpnotice" style="color:black;font-size:10px;" href="javascript:jumpToNext('phpnotice');">[ notice ]</a><br>
43 </div>
44
45 <div id="debugbox" style="visibility:hidden;background:#dddddd;color:#000000;position:absolute;top:100px;width:<?= $width ?>px;right:0px;border:1px solid black;font-family:Verdana,Helvetica,Arial;font-size:10px;">
46 </div>
47
48 <script language="javascript">
49 var debugbox_width = '<?= ($width - 10) . "px" ?>';
50 var debugbox_level_E_USER_NOTICE = <?= E_USER_NOTICE ?>;
51 </script>
52
53 <script language="javascript" src="<?= $site->config['url']['base'] . 'inc/debugbox.js' ?>"></script>
54
55 <?
56 $debugbox_status['injs'] = 0;
57 }
58
59 function append($message, $level) {
60 global $site, $debugbox_status;
61
62 //print "msg: $message<br>";
63
64 // TODO: queue messages here for later view when output started
65 //if (!$debugbox_status) { return; }
66
67 // don't do any output when not in html
68 if (!$debugbox_status['inhtml']) { return; }
69
70 if (!$site->config['mode']['DEBUGBOX']) { return; }
71 if ($level > $site->config['mode']['DEBUGBOX_LEVEL'] && $level != E_USER_NOTICE) { return; }
72
73 if (!isset($debugbox_status['active'])) { $debugbox_status['active'] = 0; }
74 if (!isset($debugbox_status['injs'])) { $debugbox_status['injs'] = 0; }
75
76 // don't do any output when inside javascript
77 if ($debugbox_status['injs']) { return; }
78
79 //$message = str_replace("\n", "", $message);
80 //$message = str_replace("'", '', $message);
81 //$message = str_replace('"', '', $message);
82 //$message = quotemeta($message);
83 //$message = addslashes($message);
84 $message = urlencode($message);
85
86 if ($debugbox_status['active'] == 1) {
87 $store_method = 'dprint';
88 } else {
89 $store_method = 'debug_buffer.push';
90 if ($debugbox_status['buffer_ok'] != 1) {
91 $debugbox_status['buffer_ok'] = 1;
92 $store_method = "debug_buffer = new Array(\"hello\"); " . $store_method;
93 }
94 }
95
96 print "
97 <script language=\"javascript\">
98 $store_method(\"$message\", \"$level\");
99 </script>\n";
100
101 }
102
103 }
104
105 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed