summaryrefslogtreecommitdiff
path: root/forum/utils/view.php
diff options
context:
space:
mode:
authordeva <deva>2008-10-11 18:07:19 +0000
committerdeva <deva>2008-10-11 18:07:19 +0000
commitbd9e96a0c94d263b734720a9e3e35d4d1e872de3 (patch)
treefd92e40a05c6992e8faa93f04de3656816360101 /forum/utils/view.php
parent534c0058a2e04fc9e9588189a7c9b87756c3df61 (diff)
Added 'add forum' functionality when logged in as admin.
Diffstat (limited to 'forum/utils/view.php')
-rw-r--r--forum/utils/view.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/forum/utils/view.php b/forum/utils/view.php
index 0adb1a0..01e8b6a 100644
--- a/forum/utils/view.php
+++ b/forum/utils/view.php
@@ -23,6 +23,24 @@ echo "</div>\n";
echo "<h1>Forums</h1>";
include_once("forums.php");
$forums = new Forums($FORUMS_DIR . "/forums.xml");
+
+ if($action == "addforum") {
+ $newfid = 0;
+ 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&amp;action=addforum">
+Add new forum: <input name="title" value=""><button type="submit">Add</button>
+</form>
+<?php
+ }
+
}
?> \ No newline at end of file