source.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /* $Id: source.php,v 1.6 2006/03/27 13:08:09 sfox Exp $ */
  3. require_once('include/prepend.php');
  4. commonHeader('Show Source');
  5. $url = $_GET['url'];
  6. if (strpos($url, "manual1/") !== FALSE) {
  7. $lang = substr($url, 8, 2);
  8. }
  9. switch($lang) {
  10. case "pt":
  11. $lang = "pt_BR";
  12. case in_array($lang, $man_languages):
  13. $lang = $lang;
  14. break;
  15. default:
  16. echo "Language not recognised.";
  17. commonFooter();
  18. exit;
  19. }
  20. print('This feature is currently disabled.<br /><br /><br /><br /><br />');
  21. /*
  22. ?>
  23. Source of: <?php echo $url; ?><br />
  24. <?php
  25. hdelim();
  26. $legal_dirs = array(
  27. "/manual1/$lang" => 1,
  28. "/include" => 1,
  29. "/stats" => 1);
  30. $dir = dirname($url);
  31. if ($dir && $legal_dirs[$dir]) {
  32. $page_name = realpath($url);
  33. } else {
  34. $page_name = basename($url);
  35. }
  36. if (file_exists($page_name) && !is_dir($page_name)) {
  37. show_source($page_name);
  38. } elseif (is_dir($page_name)) {
  39. echo "<p>No file specified. Can't show source for a directory.</p>\n";
  40. }
  41. echo hdelim();
  42. ?>
  43. <p>If you're interested in what's behind the <strong>commonHeader()</strong>
  44. and <strong>commonFooter()</strong> functions, you can always take a look
  45. at the source of the <?php print_link('/source.php?url=/include/layout.php', 'layout.php'); ?>
  46. files. And, of course, if you want to see the source of this page, have a
  47. look <?php print_link("/source.php?url=/source.php", "here"); ?>.</p>
  48. <?
  49. */
  50. commonFooter();
  51. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  52. ?>