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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Sun Dec 22 13:27:32 2002 UTC (21 years, 6 months ago) by jonen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +5 -2 lines
+ modified path to 'debugbox.js' according to new file structure under 'inc'

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

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