summaryrefslogtreecommitdiff
path: root/forum/utils/forums.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/forums.php
parent534c0058a2e04fc9e9588189a7c9b87756c3df61 (diff)
Added 'add forum' functionality when logged in as admin.
Diffstat (limited to 'forum/utils/forums.php')
-rw-r--r--forum/utils/forums.php49
1 files changed, 11 insertions, 38 deletions
diff --git a/forum/utils/forums.php b/forum/utils/forums.php
index 9305623..85e977b 100644
--- a/forum/utils/forums.php
+++ b/forum/utils/forums.php
@@ -6,8 +6,6 @@ include_once($UTIL_DIR . "/threads.php");
class Forum {
public $fid;
- public $readlist;
- public $writelist;
public $name;
private $newStuff;
@@ -25,11 +23,9 @@ class Forum {
echo "</div>";
}
- public function Forum($fid, $readlist, $writelist, $name)
+ public function Forum($fid, $name)
{
$this->fid = $fid;
- $this->readlist = $readlist;
- $this->writelist = $writelist;
$this->name = $name;
}
}
@@ -40,13 +36,16 @@ class Forums {
public $forums = array();
public function add($forum) {
+ global $FORUMS_DIR;
+ if(!file_exists($FORUMS_DIR . "/". $forum->fid)) {
+ mkdir($FORUMS_DIR . "/". $forum->fid);
+ }
$key = $forum->fid;
$this->forums[$key] = $forum;
}
public function write()
{
- /*
$fp = fopen($this->file, "w");
$block = TRUE;
@@ -54,39 +53,15 @@ class Forums {
fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- fwrite($fp, "<members>\n");
- foreach($this->members as $member) {
- fwrite($fp, " <member id=\"" .
- htmlspecialchars($member->id, ENT_QUOTES, "UTF-8") . "\"\n");
- fwrite($fp, " name=\"" .
- htmlspecialchars($member->name, ENT_QUOTES, "UTF-8") . "\"\n");
- fwrite($fp, " description=\"" .
- htmlspecialchars($member->description, ENT_QUOTES, "UTF-8") . "\"\n");
- fwrite($fp, " image=\"" .
- htmlspecialchars($member->image, ENT_QUOTES, "UTF-8") . "\">\n");
-
-
- fwrite($fp, " </member>\n");
+ fwrite($fp, "<forums>\n");
+ foreach($this->forums as $forum) {
+ fwrite($fp, " <forum fid=\"" . $forum->fid . "\"\n");
+ fwrite($fp, " name=\"" . htmlspecialchars($forum->name, ENT_QUOTES, "UTF-8") . "\"/>\n");
}
- fwrite($fp, "</members>\n");
+ fwrite($fp, "</forums>\n");
fclose($fp);
- */
- }
-
- /*
- public function deleteForumUser($id)
- {
- if($this->members[$id]) {
- unset($this->members[$id]);
- // $this->write();
- } else {
- echo "<p>ERROR: User! <em>".$id."</em> does not exist!</p>\n";
- return false;
- }
- return true;
}
- */
public function getForum($fid)
{
@@ -112,8 +87,6 @@ class Forums {
foreach($forums as $f) {
$forum = new Forum($f->getAttribute('fid'),
- $f->getAttribute('readlist'),
- $f->getAttribute('writelist'),
$f->getAttribute('name'));
$this->add($forum);
@@ -126,7 +99,7 @@ class Forums {
public function Forums($file)
{
$this->file = $file;
- $this->read();
+ if(file_exists($file)) $this->read();
}
}