template.inc.php 883 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. function tpl_redirect($path)
  3. {
  4. header("Location: http://jk.gs/git/bot/$path");
  5. exit;
  6. }
  7. function tpl_header()
  8. {
  9. print <<<EOT
  10. <!DOCTYPE HTML>
  11. <html><head><title>#git bot interface</title>
  12. <link rel="stylesheet" type="text/css" href="../style.css">
  13. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  14. <link rel="shortcut icon" href="/git/bot/favicon.ico">
  15. </head><body>
  16. <h1>#git bot interface</h1>
  17. EOT;
  18. if ($user = logged_in()) {
  19. print <<<EOT
  20. <div id="login_menu">Hi <strong>$user</strong>. <a href="logout.php">Log
  21. out</a> or go do fun stuff.</div>
  22. EOT;
  23. }
  24. if (isset($_GET['ok'])) {
  25. print "<div id=\"msg\">Operation successful. Yay!</div>";
  26. }
  27. }
  28. function tpl_footer()
  29. {
  30. print <<<EOT
  31. </body></html>
  32. EOT;
  33. }
  34. function format_plain_linked($t)
  35. {
  36. return preg_replace('/\\b(https?:\/\/\\S+)(?<![.,!?;>])/', '<a href="$1">$1</a>', htmlspecialchars($t));
  37. }