last update: Mon, 05 Sep 2011 17:17:35 +0000
  1. <?
  2. require_once('enable_gzip.php');
  3. require_once('add_smarty.php');
  4. require_once("session.php");
  5. require_once('mysql_cfg.php');
  6. require_once('code_css.php');
  7. require_once("codehighlighter.php");
  8. //main template
  9. $smarty->assign('main_template', 'code.tpl');
  10. //title
  11. $smarty->assign('title', 'Code');
  12. //set default = nothing
  13. $smarty->assign('html_code', false);
  14. $smarty->assign('id', false);
  15. $additional_headers = array();
  16. $ausgabe = "";
  17. function strip_markup($s)
  18. {
  19. return str_replace('##', '', str_replace('', '', $s));
  20. }
  21. $allowed = array("graph.php","drawgraph.php","templates/drawgraph.tpl","format_jass.php","index.php","add_smarty.php","code_css.php","code.php","codehighlighter.php","comments.php","compare.php","comparer.php","create_thumbnail.php","download.php","enable_gzip.php","example.php","format_jass.php","gui.php","GuiParser.php","GuiParser2.php","html.php","index.php","pbar.php","session.php","source.php","text.php","upload.php","templates/code.tpl","templates/comments.tpl","templates/comparer.tpl","templates/gui.tpl","templates/html.tpl","templates/index.tpl","templates/login.tpl","templates/pbar.tpl","templates/site.tpl","templates/text.tpl","templates/upload.tpl");
  22. $f = null;
  23. if (isset($_GET['f']))
  24. $f = $_GET['f'];
  25. if (in_array($f,$allowed))
  26. {
  27. $additional_headers[] = '<script type="text/javascript" src="codehandling.js"></script>';
  28. $ausgabe.= "last update: ". date('r', filemtime($f)) . "\n";
  29. $language_id = 5;
  30. $style_id = 1;
  31. $format_output = (isset($_GET['f'])) ? intval($_GET['f']) : false;
  32. $code = file_get_contents($f);
  33. $default_lang = 5;
  34. $ech = new easycodehighlighter($code, $default_lang, $language_id, $style_id, $format_output);
  35. if ($ech->format_script == null)
  36. {
  37. $smarty->assign('format_script', 0);
  38. }
  39. else
  40. {
  41. $smarty->assign('format_script', (($format_output) ? 2 : 1));
  42. }
  43. $output = $ech->output;
  44. foreach ($allowed as $row)
  45. {
  46. $output = str_replace('"'.basename($row).'"','"<a href="source.php?f='.$row.'">'.basename($row).'</a>"', $output);
  47. $output = str_replace('\''.basename($row).'\'','\'<a href="source.php?f='.$row.'">'.basename($row).'</a>\'', $output);
  48. }
  49. $smarty->assign('output', $output);
  50. $smarty->assign('jass_code', strip_markup(htmlspecialchars($ech->code)));
  51. $additional_headers[] = $ech->code_css;
  52. }
  53. else
  54. {
  55. $ausgabe.= "Der Quellcode dieser Datei ist aus Sicherheitsgründen und/oder Faulheit von peq verboten, frag peq, ob er ihn freigibt.<br />\n";
  56. $f = null;
  57. }
  58. if ($f == null)
  59. {
  60. $ausgabe.= "Datei auswählen:<br />\n
  61. <ul>\n";
  62. foreach ($allowed as $row)
  63. {
  64. $ausgabe.= " <li><a href=\"source.php?f=$row\">$row</a></li>\n";
  65. }
  66. $ausgabe.= "</ul>\n";
  67. }
  68. $smarty->assign('ausgabe', $ausgabe);
  69. $smarty->assign('additional_headers', $additional_headers);
  70. $smarty->assign("compileTime",sprintf("%.4f",(microtime(true) - $sript_start_time))); $smarty->display('site.tpl');
  71. ?>

goto line:
Compare with:
text copy window edit this code post new code