phpDocumentor PHP_Debug
[ class tree: PHP_Debug ] [ index: PHP_Debug ] [ all elements ]

Source for file source.php

Documentation is available at source.php

  1. <?
  2. /**
  3. * Source.php : Show source of a php script
  4. *
  5. * You can use your own source.php file, param is for file to view is $_REQUEST['script']
  6. * /!\ Be carreful you must secure this page !!!! /!\
  7. *
  8. * Don't forget to secure this script !
  9. * With something like that or whatever you want ! :)
  10. *
  11. * if (!Rights::is_Admin())
  12. * {
  13. * redirect_login();
  14. * exit;
  15. * }
  16. *
  17. * Now uses external view source script :
  18. * --> http://aidan.dotgeek.org/lib/?file=PHP_Highlight.php
  19. *
  20. * @filesource
  21. * @package PHP_Debug
  22. * @see Debug
  23. * @since 10 Dec 2003
  24. */
  25. require_once('../includes/setup.php');
  26. /**
  27. * Lang Var
  28. */
  29. $txtScriptNameNeeded = "Script Name needed";
  30. $txtError = "ERROR";
  31. $txtViewSource = "View Source of";
  32. $txtWrongExt = "Only PHP or include script are allowed";
  33. /**
  34. * Other Var
  35. */
  36.  
  37. // Start HTML
  38. print('
  39. <html>
  40. <head>
  41. <style type="text/css" id="viewsourceStyleSheet">
  42. li { color:#7B68EE; font-family:courier new,arial; }
  43. .lineNumber { color:#7B68EE; font-family:courier new,arial; }
  44. .sourcecode {
  45. margin-top: 10px;
  46. background-color: #F5F5F5;
  47. border: 1px solid #BBB;
  48. padding: 6px;
  49. width: 100%
  50. }
  51. </style>
  52. </head>
  53. <body bgcolor="#FFFFFF">');
  54.  
  55. /**
  56. * Output Source
  57. */
  58. if (!$_REQUEST['script'])
  59. {
  60. echo "<br /><b>== $txtError : $txtScriptNameNeeded</b><br />";
  61. }
  62. else
  63. {
  64. $script = $_REQUEST['script'];
  65. print("<h3>== $txtViewSource : ". $_REQUEST['script'] ."</h3>");
  66.  
  67. if (ereg("(\.php|\.inc|\.tpl|\.txt)$", $script))
  68. {
  69. print("<div class=\"sourcecode\">");
  70.  
  71. $h = new PHP_Highlight;
  72. $h->loadFile($script);
  73. $h->toHtml(false, true, null, true);
  74.  
  75. print('</div>');
  76. }
  77. else
  78. print("<b>== $txtError : $txtWrongExt</b>");
  79. }
  80.  
  81. // Close HTML
  82. print('</body></html>');
  83. ?>

Documentation generated on Sun, 12 Jun 2005 14:52:26 +0200 by phpDocumentor 1.3.0RC3