template.inc.php 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. <link rel="stylesheet" type="text/css" href="hljs/styles/arduino-light.css">
  14. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  15. <link rel="shortcut icon" href="/git/bot/favicon.ico">
  16. </head><body>
  17. <h1>#git bot interface</h1>
  18. EOT;
  19. if ($user = logged_in()) {
  20. print <<<EOT
  21. <div id="login_menu">Hi <strong>$user</strong>. <a href="logout.php">Log
  22. out</a> or go do fun stuff.</div>
  23. EOT;
  24. }
  25. if (isset($_GET['ok'])) {
  26. print "<div id=\"msg\">Operation successful. Yay!</div>";
  27. }
  28. }
  29. function tpl_footer()
  30. {
  31. print <<<EOT
  32. </body></html>
  33. EOT;
  34. }
  35. function format_plain_linked($t)
  36. {
  37. return preg_replace('/\\b(https?:\/\/\\S+)(?<![.,!?;>])/', '<a href="$1">$1</a>', htmlspecialchars($t));
  38. }