diff options
author | deva <deva> | 2011-11-01 09:32:21 +0000 |
---|---|---|
committer | deva <deva> | 2011-11-01 09:32:21 +0000 |
commit | 42c62cb041a2b2b95c9cda0c20fcf70334fd244c (patch) | |
tree | 38371eb37ff7348585ee84438b326c25055e2cbe /forum/utils/view.php | |
parent | 208e3b642149a9ac701a43397d31990f9b27ca79 (diff) |
Rewl og krat... needs cleaning up - after port to GIT.origin
Diffstat (limited to 'forum/utils/view.php')
-rw-r--r-- | forum/utils/view.php | 105 |
1 files changed, 57 insertions, 48 deletions
diff --git a/forum/utils/view.php b/forum/utils/view.php index 2673394..1e9812a 100644 --- a/forum/utils/view.php +++ b/forum/utils/view.php @@ -1,56 +1,65 @@ <?php -echo " <div class=\"navigation\">"; -if($fid) { - echo "Legend: <a href=\"?\">Forums</a>"; - if($tid) { - include_once("forums.php"); - $forums = new Forums($FORUMS_DIR . "/forums.xml"); - $forum = $forums->getForum($fid); - echo " :: <a href=\"?fid=" . $fid . "\">".$forum->name."</a>"; - - include_once("posts.php"); - $posts = new Posts($FORUMS_DIR . "/" . $fid . "/" . $tid . ".xml"); - echo " :: ".$posts->thread->name; - - $posts->show(); - - } else { - include_once("forums.php"); - $forums = new Forums($FORUMS_DIR . "/forums.xml"); - $forum = $forums->getForum($fid); - echo " :: ".$forum->name; - - echo " <h1>Threads in '".$forum->name."'</h1>\n"; - echo " <a href=\"?mode=editor&task=new&fid=".$fid. - "&tid=".time()."&pid=-1\">New thread</a>\n"; + +function viewForum() +{ + global $fid, $tid, $action, $current_user, $UTIL_DIR, + $FORUMS_DIR, $smileys; + + $legend = " <div class=\"navigation\">"; + $f_str = ""; + if($fid) { + $legend .= "Legend: <a href=\"?\">Forums</a>"; + if($tid) { + include_once($UTIL_DIR . "/forums.php"); + $forums = new Forums($FORUMS_DIR . "/forums.xml"); + $forum = $forums->getForum($fid); + $legend .= " :: <a href=\"?fid=" . $fid . "\">".$forum->name."</a>"; + + include_once($UTIL_DIR . "/posts.php"); + $posts = new Posts($FORUMS_DIR . "/" . $fid . "/" . $tid . ".xml"); + $legend .= " :: ".$posts->thread->name; + + $f_str .= $posts->show(); + + } else { + include_once($UTIL_DIR . "/forums.php"); + $forums = new Forums($FORUMS_DIR . "/forums.xml"); + $forum = $forums->getForum($fid); + $legend .= " :: ".$forum->name; + + $f_str .= " <h1>Threads in '".$forum->name."'</h1>\n"; + $f_str .= " <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 "Legend: Forums"; - echo " <h1>Forums</h1>\n"; - include_once("forums.php"); - $forums = new Forums($FORUMS_DIR . "/forums.xml"); + include_once($UTIL_DIR . "/threads.php"); + $threads = new Threads($FORUMS_DIR . "/" . $fid); + $f_str .= $threads->show(); + } + } else { + $legend .= "Legend: Forums"; + $f_str .= " <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++; + if($action == "addforum") { + $newfid = 1; + while($forums->getForum($newfid)) $newfid++; - $forums->add(new Forum($newfid, $title)); - $forums->write(); - } + $forums->add(new Forum($newfid, $title)); + $forums->write(); + } - $forums->show(); + $f_str .= $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 - } + if($current_user->uid == 0) { + $f_str .= "<form method=\"post\" action=\"?mode=forum&action=addforum\">\n"; + $f_str .= "Add new forum: <input name=\"title\" value=\"\"><button type=\"submit\">Add</button>\n"; + $f_str .= "</form>\n"; + } + } + + $legend .= "</div>\n"; + + return $legend . $f_str; } -echo "</div>\n"; ?>
\ No newline at end of file |