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