summaryrefslogtreecommitdiff
path: root/forum/htdocs/index.php
diff options
context:
space:
mode:
authordeva <deva>2011-11-01 09:32:21 +0000
committerdeva <deva>2011-11-01 09:32:21 +0000
commit42c62cb041a2b2b95c9cda0c20fcf70334fd244c (patch)
tree38371eb37ff7348585ee84438b326c25055e2cbe /forum/htdocs/index.php
parent208e3b642149a9ac701a43397d31990f9b27ca79 (diff)
Rewl og krat... needs cleaning up - after port to GIT.origin
Diffstat (limited to 'forum/htdocs/index.php')
-rw-r--r--forum/htdocs/index.php79
1 files changed, 57 insertions, 22 deletions
diff --git a/forum/htdocs/index.php b/forum/htdocs/index.php
index c4e0570..0608f93 100644
--- a/forum/htdocs/index.php
+++ b/forum/htdocs/index.php
@@ -8,6 +8,12 @@ include_once("config.php");
include_once($UTIL_DIR . "/login.php");
checklogin();
+if($yeah) {
+include_once($UTIL_DIR . "/cache.php");
+$cache = new Cache($DATA_DIR . "/cache.xml");
+$cache->rebuild();
+}
+
// Catch the modes that must not output any html.
if($current_user) {
switch($mode) {
@@ -40,16 +46,26 @@ include_once($UTIL_DIR . "/clientinfo.php");
<?php if($mode == "editor") {?> <script language="javascript" src="lib.js" type="text/javascript"></script><?php } ?>
</head>
<body>
- <div id="menu_top" class="menu">
- <a href="?mode=forum">Forum</a>
- <a href="?mode=filehandler">Filehandler</a>
- <a href="?mode=calendar">Calendar</a>
- <a href="?mode=addressbook">Addressbook</a>
- <a href="?mode=profile">Profile</a>
- <a href="?mode=tasks">Tasks</a>
-<?php if($current_user->uid == 0) {?> <a href="?mode=diagnostics">Diagnostics</a><?php } ?>
- </div>
<?php
+ function menu($pos, $unread)
+{
+ global $current_user;
+
+ if($unread) $newposts = "newposts";
+ else $newposts = "nonewposts";
+
+ $str .=" <div id=\"menu_".$pos."\" class=\"menu\">\n";
+ $str .=" <a href=\"?mode=forum\"><span class=\"".$newposts."\">&nbsp;</span>Forum</a>\n";
+ $str .=" <a href=\"?mode=filehandler\">Filehandler</a>\n";
+ $str .=" <a href=\"?mode=calendar\">Calendar</a>\n";
+ $str .=" <a href=\"?mode=addressbook\">Addressbook</a>\n";
+ $str .=" <a href=\"?mode=profile\">Profile</a>\n";
+ $str .=" <a href=\"?mode=tasks\">Tasks</a>\n";
+ if($current_user->uid == 0)
+ $str .=" <a href=\"?mode=diagnostics\">Diagnostics</a>\n";
+ $str .=" </div>\n";
+ return $str;
+}
// Globals:
// $fid
@@ -58,57 +74,76 @@ include_once($UTIL_DIR . "/clientinfo.php");
// $task
if($current_user) {
- echo " <p>Logged in as: " . $current_user->name . " - <a href=\"?action=logout\">Logout</a></p>\n";
+ $str = "";
+
+ $str .= " <p>Logged in as: " . $current_user->name . " - <a href=\"?action=logout\">Logout</a></p>\n";
switch($mode) {
case "profile":
include_once($UTIL_DIR. "/profile.php");
+ $str .= profile();
break;
case "tasks":
include_once($UTIL_DIR. "/tasks.php");
+ $str .= tasks();
break;
case "calendar":
include_once($UTIL_DIR. "/calendar.php");
+ $str .= calendar();
break;
case "addressbook":
include_once($UTIL_DIR. "/addressbook.php");
+ $str .= addressbook();
break;
case "editor":
include_once($UTIL_DIR. "/editor.php");
+ $str .= editor();
break;
case "edit":
include_once($UTIL_DIR. "/edit.php");
+ $str .= "";
break;
case "filehandler":
include_once($UTIL_DIR. "/filehandler.php");
+ $str .= filehandler();
break;
case "diagnostics":
include_once($UTIL_DIR. "/diagnostics.php");
+ $str .= "";
break;
- case "view":
default:
+ case "view":
include_once($UTIL_DIR. "/view.php");
-?>
- <div id="menu_bottom" class="menu">
- <a href="?mode=forum">Forum</a>
- <a href="?mode=filehandler">Filehandler</a>
- <a href="?mode=calendar">Calendar</a>
- <a href="?mode=addressbook">Addressbook</a>
- <a href="?mode=profile">Profile</a>
- <a href="?mode=tasks">Tasks</a>
-<?php if($current_user->uid == 0) {?> <a href="?mode=diagnostics">Diagnostics</a><?php } ?>
- </div>
-<?php
+ $str .= viewForum();
+ if(!isset($GLOBALS['fid'])) {
+ include_once($UTIL_DIR. "/calendar.php");
+ $str .= calendar();
+ }
break;
}
+ if($mode != "edit") {
+ include_once($UTIL_DIR . "/forums.php");
+
+ $forums = new Forums($FORUMS_DIR . "/forums.xml");
+
+ $unreadPosts = false;
+ foreach($forums->forums as $forum) {
+ $unreadPosts |= $forum->newStuff;
+ }
+
+ echo menu("top", $unreadPosts). $str. menu("bottom", $unreadPosts);
+ } else {
+ echo $str;
+ }
+
} else {
?>
<form action="?action=login" method="post">