PageRenderTime 45ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/include_header.php

http://thinktankforums.googlecode.com/
PHP | 126 lines | 83 code | 36 blank | 7 comment | 9 complexity | 6865391d1b78828344bc56ac192486bb MD5 | raw file
Possible License(s): 0BSD
  1. <?php
  2. /* think tank forums
  3. *
  4. * include_header.php
  5. */
  6. // get and clear any cookie message
  7. if (!empty($_COOKIE[$ttf_cfg["cookie_name"].'-msg'])) {
  8. $message = $_COOKIE[$ttf_cfg["cookie_name"].'-msg'];
  9. $message_color = $_COOKIE[$ttf_cfg["cookie_name"].'-msg-clr'];
  10. setcookie($ttf_cfg["cookie_name"].'-msg', FALSE, 1, $ttf_cfg["cookie_path"], $ttf_cfg["cookie_domain"], $ttf_cfg["cookie_secure"]);
  11. setcookie($ttf_cfg["cookie_name"].'-msg-clr', FALSE, 1, $ttf_cfg["cookie_path"], $ttf_cfg["cookie_domain"], $ttf_cfg["cookie_secure"]);
  12. };
  13. header('Content-Type: text/html; charset=utf-8');
  14. if (empty($ttf_title)) {
  15. $ttf_htmltitle = $ttf_cfg["forum_name"];
  16. } else {
  17. $ttf_htmltitle = $ttf_cfg["forum_name"]." &raquo; ".$ttf_title;
  18. };
  19. echo <<<EOF
  20. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  21. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  22. <head>
  23. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  24. <title>{$ttf_htmltitle}</title>
  25. <link rel="stylesheet" type="text/css" href="style.css" />
  26. </head>
  27. <body>
  28. <h1><a href="./">{$ttf_cfg["forum_name"]}</a></h1>
  29. <h2>{$ttf_label}</h2>
  30. <div id="enclosure">
  31. <div class="menu_title">
  32. EOF;
  33. if (isset($ttf["uid"])) {
  34. // print user box
  35. if (isset($ttf["avatar_type"])) {
  36. echo ' <img src="avatars/'.$ttf["uid"].'.'.$ttf["avatar_type"].'" alt="your avatar" width="30" height="30" class="avatar" />'."\n";
  37. };
  38. echo <<<EOF
  39. hi, {$ttf["username"]}!
  40. </div>
  41. <div class="menu_body">
  42. &middot; <a href="search.php">search</a><br />
  43. &middot; <a href="editprofile.php">edit your profile</a><br />
  44. &middot; <a href="logout.php">log out</a>
  45. EOF;
  46. } else {
  47. // print login box
  48. $force_https = $ttf_cfg["cookie_secure"] ? 'https://'.$ttf_cfg["address"].'/' : '';
  49. echo <<<EOF
  50. log in to {$ttf_cfg["forum_shortname"]}
  51. </div>
  52. <div class="menu_body">
  53. <form action="{$force_https}login.php" method="post">
  54. <div>
  55. <input type="text" name="username" maxlength="16" size="16" /><br />
  56. <input type="password" name="password" maxlength="32" size="16" /><br />
  57. <input type="submit" value="let's go!" />
  58. </div>
  59. </form>
  60. </div>
  61. <div class="menu_title">
  62. can't log in?
  63. </div>
  64. <div class="menu_body">
  65. &middot; <a href="register.php">register an account</a><br />
  66. &middot; <a href="recover.php">recover your account</a><br />
  67. &middot; <a href="search.php">search the forums</a>
  68. EOF;
  69. };
  70. echo <<<EOF
  71. </div>
  72. EOF;
  73. if ($ttf["perm"] == 'admin') {
  74. echo <<<EOF
  75. <div class="menu_title">
  76. you can admin!
  77. </div>
  78. <div class="menu_body">
  79. &middot; <a href="admin_forum.php">forums</a><br />
  80. &middot; <a href="admin_recovery.php">recovery</a><br />
  81. &middot; <a href="admin_search_ip.php">search by ip</a><br />
  82. &middot; <a href="admin_userlist.php">user list</a><br />
  83. </div>
  84. EOF;
  85. };
  86. if (!empty($message)) {
  87. echo <<<EOF
  88. <div class="contentbox-green" style="border-color: {$message_color};">{$message}</div>
  89. EOF;
  90. };