WeakWiki


modules\forum\forum.include.php



/********************************************************************************
WeakWiki (WeakWiki Forum module include file: forum.include.php)
Copyright (C) 2010 Alexander Lang

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this
program; if not, see .

Project Home: http://weakwiki.robnet.wmweb.at/
Contact:      robbiblubber@robnet.wmweb.at
********************************************************************************/



require_once('./modules/forum/forum.support.include.php');


$op = 'topic';
if(isset($_GET['op'])) { $op = $_GET['op']; }

$file = _FORUM_START;
if(isset($_GET['f'])) { $file = $_GET['f']; }


switch($op)
{
	case 'topic':
		$f = new FoTopic($file);
		
		$pm = new PageMenu();
		
		if($f->request(OP_ADMIN))
		{
			$pm->add("getFileName() . "\" class=\"fncl\">new topic");
			$pm->add("getFileName() . "\" class=\"fncl\">edit");
			$pm->add("getFileName() . "\" class=\"fncl\">delete");
		}
		
		if($f->request(OP_WRITE))
		{
			$pm->add("getFileName() . "\" class=\"fncl\">new thread");
		}
		
		$pm->add("top");
		$pm->add("home");
		$pm->write();
			
		$i = $f;
		$m = "";
		while(true)
		{
			$m = "getFileName() . "\" class=\"fncl\">" . $i->getTitle() . "" . $m;
			
			$i = $i->getParent();
			if($i == null) break;
			
			$m = "" . $m; 
		}
		echo($m);
		
		echo("
\n"); echo("" . $f->getTitle() . "\n"); echo("
\n"); if($f->getText() != '') { echo("

" . wikiParse($f->getText()) . "
"); } $empty = true; if(count($f->getTopics()) > 0) { echo("

topics:
"); echo("
\n"); foreach($f->getTopics() as $i) { echo("getFileName() . "\" class=\"fncl\">" . $i->getTitle() . "
\n"); } echo("
\n"); $empty = false; } if(count($f->getThreads()) > 0) { echo("

threads:
"); echo("
\n"); foreach($f->getThreads() as $i) { echo("getFileName() . "\" class=\"fncl\">" . $i->getTitle() . ""); } echo("
\n"); $empty = false; } if($empty) { echo("



No threads.
"); } break; case 'newtopic': case 'edittopic': $pm = new PageMenu(); $pm->add("top"); $pm->write(); $f = new FoTopic($file); $hl = "New Topic"; $tit = ""; $txt = ""; $i = $f; if($_GET['op'] == 'edittopic') { $hl = "Edit Topic"; $tit = $f->getTitle(); $txt = $f->getText(); $i = $f->getParent(); } echo("


\n" . $hl . "
\n"); $m = ""; while(true) { $m = $i->getTitle() . $m; $i = $i->getParent(); if($i == null) break; $m = " → " . $m; } echo("in " . $m . ".

\n"); echo("
\n
\n"); echo("\n"); echo("\n"); echo("\n"); echo("\n"); echo("\n"); echo("
    Title:
    Permissions:getPrivileges() . "\"/>
    Text:

getFileName() . "\" class=\"fncl\">cancel  \n"); echo("accept
\n"); break; case 'cnewtopic': $tit = $_POST['title']; if(trim($tit) == '') { $tit = "(untitled)"; } $p = new FoTopic($_GET['f']); $f = new FoTopic(); $f->setTitle($tit); $f->setText($_POST['text']); $f->setPrivileges($_POST['privileges']); $f->setParent($p); $f->save(); $p->addTopic($f); $p->save(); echo("\n"); } ?>

WeakWiki