/[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.2 - (hide annotations)
Sun Nov 17 07:23:13 2002 UTC (21 years, 8 months ago) by jonen
Branch: MAIN
Changes since 1.1: +8 -4 lines
+ small bugfix: really _no_ error should occour when javascript scope is not switched

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

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