<?php echo " <div class=\"navigation\">"; if($fid) echo "<a href=\"?\">forums</a>"; if($tid) echo ":: <a href=\"?fid=" . $fid . "\">threads</a>"; if($pid) echo ":: <a href=\"?fid=" . $fid . "&tid=" . $tid . "\">posts</a>"; echo "</div>\n"; if($fid && $tid) { // echo "<h1>Posts</h1>"; include_once("posts.php"); $posts = new Posts($FORUMS_DIR . "/" . $fid . "/" . $tid . ".xml"); $posts->show(); } else if($fid) { echo " <h1>Threads</h1>\n"; echo " <a href=\"?mode=editor&task=new&fid=".$fid. "&tid=".time()."&pid=-1\">New thread</a>\n"; include_once("threads.php"); $threads = new Threads($FORUMS_DIR . "/" . $fid); $threads->show(); } else { echo " <h1>Forums</h1>\n"; include_once("forums.php"); $forums = new Forums($FORUMS_DIR . "/forums.xml"); if($action == "addforum") { $newfid = 1; while($forums->getForum($newfid)) $newfid++; $forums->add(new Forum($newfid, $title)); $forums->write(); } $forums->show(); if($current_user->uid == 0) { ?> <form method="post" action="?mode=forum&action=addforum"> Add new forum: <input name="title" value=""><button type="submit">Add</button> </form> <?php } } ?>