Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. <?php
  2.  
  3. register_tick_function(function(){
  4. if (isset($GLOBALS["developer_debug"]) && $GLOBALS["developer_debug"] == 'active'){
  5. $backtrace = debug_backtrace();
  6. $line = $backtrace[0]['line'] - 1;
  7. $file = $backtrace[0]['file'];
  8.  
  9. if ($file == __FILE__) return;
  10.  
  11. static $fp, $cur, $buf;
  12. if (!isset($fp[$file])) {
  13. $fp[$file] = fopen($file, 'r');
  14. $cur[$file] = 0;
  15. }
  16.  
  17. if (isset($buf[$file][$line])) {
  18. $code = $buf[$file][$line];
  19. } else {
  20. do {
  21. $code = fgets($fp[$file]);
  22. $buf[$file][$cur[$file]] = $code;
  23. } while (++$cur[$file] <= $line);
  24. }
  25.  
  26. $line++;
  27. if (defined('ERR_LOG')){ $error_log = ERR_LOG; } else {
  28. $error_log = "../logs/error_log";
  29. }
  30. error_log("n==========================================================n", 3, $error_log);
  31. error_log("n $file : $line :: $code n", 3, $error_log);
  32. error_log("n Variables: n" . print_r(get_defined_vars(), true) . "n", 3, $error_log);
  33. $GLOBALS["_TROUBLESHOOTING"][] = "<code>n $file : $line ::: ". htmlentities($code, ENT_QUOTES) . " n</code>";
  34. }
  35. }, ["_SERVER" => $_SERVER, "_COOKIE"=>$_COOKIE, "_REQUEST"=>$_REQUEST, "_SESSION"=>$_SESSION, "_GLOBALS"=>$GLOBALS]);
  36. // To use...
  37. // declare(ticks=1);
  38. // include_once('debug.php');
  39.  
  40. $(document).ready(function() {
  41. var dev_top_button = document.createElement("Button");
  42. dev_top_button.innerHTML = "Top Dev Data";
  43. dev_top_button.style = "top:0;right:75%;position:absolute;z-index: 9999"
  44. document.body.appendChild(dev_top_button);
  45.  
  46. var dev_bottom_button = document.createElement("Button");
  47. dev_bottom_button.innerHTML = "Bottom Dev Data";
  48. dev_bottom_button.style = "top:0;right:50%;position:absolute;z-index: 9999"
  49. document.body.appendChild(dev_bottom_button);
  50.  
  51. $(dev_top_button).click(function(){
  52. $("#debug_top").toggle();
  53. });
  54.  
  55. $(dev_bottom_button).click(function(){
  56. $("#debug_bottom").toggle();
  57. });
  58. });
  59.  
  60. echo "<div class='debug_outer' id='debug_top'><h3>Developer Information</h3><div class='debug_inner'><pre>";
  61.  
  62. if (isset($GLOBALS['_TROUBLESHOOTING']) && is_array($GLOBALS['_TROUBLESHOOTING']) && ! empty($GLOBALS['_TROUBLESHOOTING'])) {
  63.  
  64. $troubleshooting_return_array = $GLOBALS['_TROUBLESHOOTING'];
  65.  
  66. } else {
  67.  
  68. $troubleshooting_return_array = ['Empty'];
  69. }
  70.  
  71. echo print_r(["_COOKIE" => $_COOKIE, "_REQUEST" => $_REQUEST, "_SESSION" => $_SESSION, "_TROUBLESHOOTING" => $troubleshooting_return_array, "_SERVER" => $_SERVER, "_GLOBALS" => $GLOBALS], true);
  72. echo '</pre></div></div>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement