error.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. global $context;
  3. if(!function_exists('get_class_name')){
  4. function get_class_name($obj){
  5. $name = @get_class($obj);
  6. if(!$name){
  7. if(is_string($obj)){
  8. $name = 'String';
  9. }elseif(is_numeric($obj)){
  10. $name = 'Number';
  11. }elseif(is_array($obj)){
  12. $name = 'Array';
  13. }elseif(is_null($obj)){
  14. $name = 'Null';
  15. }else{
  16. $name = 'Object';
  17. }
  18. }
  19. return $name;
  20. }
  21. }
  22. ?>
  23. <!doctype html>
  24. <head>
  25. <meta charset="utf8"/>
  26. <title>Error</title>
  27. <script src="<?=Router::$base?>/js/juju/core.js"></script>
  28. <script src="<?=Router::$base?>/js/juju/page.js"></script>
  29. <script src="<?=Router::$base?>/js/juju/dom.js"></script>
  30. <script src="<?=Router::$base?>/js/juju/keyboard.js"></script>
  31. <script src="<?=Router::$base?>/js/juju/mouse.js"></script>
  32. <script src="<?=Router::$base?>/js/error.js"></script>
  33. <link rel="stylesheet" href="<?=Router::$base?>/css/main.css"></link>
  34. <link rel="stylesheet" href="<?=Router::$base?>/css/error.css"></link>
  35. </head>
  36. <body>
  37. <h2>
  38. <?=$context->error['message']?>
  39. </h2>
  40. <br/>
  41. <?php
  42. if(defined('DEBUG') && DEBUG){
  43. ?>
  44. <div class="error">
  45. <span class="collapse-arrow collapsed">
  46. &#10097;
  47. </span>
  48. <span>
  49. Call Stack
  50. </span>
  51. <div class="collapsable collapsed">
  52. <?php
  53. foreach($context->backtrace as $k => $trace){
  54. echo "<div><span class=\"collapse-arrow collapsed\">&#10097;</span>&nbsp;";
  55. if(isset($trace['class'])){
  56. echo "<span>{$trace['class']}{$trace['type']}{$trace['function']}</span>";
  57. }elseif(isset($trace['function'])){
  58. echo "<span>{$trace['function']}</span>";
  59. }
  60. if(isset($trace['file'])){
  61. echo "<span class=\"right\">{$trace['file']}:{$trace['line']}</span>";
  62. }
  63. echo "<div class=\"collapsable collapsed\">";
  64. if(isset($trace['args'])){
  65. echo "<div>Arguments:<ul>";
  66. foreach($trace['args'] as $arg){
  67. echo "<li><pre title=\"".get_class_name($arg)."\">".json_encode($arg,JSON_PRETTY_PRINT)."</pre></li>";
  68. }
  69. echo "</ul></div>";
  70. }
  71. if(isset($trace['object'])){
  72. echo "<div>Object:<pre title=\"".get_class_name($arg)."\">".json_encode($trace['object'],JSON_PRETTY_PRINT)."</pre></div>";
  73. }
  74. echo "</div><div class=\"clear\"></div></div>";
  75. }
  76. ?>
  77. </div>
  78. </div>
  79. <div class="error">
  80. <span class="collapse-arrow collapsed">
  81. &#10097;
  82. </span>
  83. <span>
  84. Included Files
  85. </span>
  86. <div class="collapsable collapsed">
  87. <?php
  88. foreach($context->included as $file){
  89. echo "<div>{$file}</div>";
  90. }
  91. ?>
  92. </div>
  93. </div>
  94. <?php
  95. }
  96. ?>
  97. </body>
  98. </html>