/[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.3 - (hide annotations)
Tue Dec 3 17:39:38 2002 UTC (21 years, 7 months ago) by joko
Branch: MAIN
Changes since 1.2: +13 -4 lines
+ don't have _any_ kind of php-errors in the (critical) startup-phase

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

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