src/Neuron/Forum/Forum.php
public function getHTML ($input) {
		global $fdb;
		global $scopeBuster;
		$scopeBuster->input = $input;
		$page = new Neuron_Core_Template ();
//q($input);
 		if
 		(
 			count
 			(
 				$fdb->x
 				("
 					SELECT
 						*
 					FROM
 						`forum_bans`
 					WHERE
 						`ID`=$this->userID AND `forumID`='{$this->compID}'
 				")
 			) == 1
 		)
 		{
			$page->set ('content', 'You have been banned from this forum');
			$page->set ('mode', 'banned');
			return $page->parse ('forum.tpl');
			die ('There is no future. Forum:'.__LINE__);
		}

		$nowt = false;
		$done = false;

		//if not changed to true, triggers a default forum view later; that happens if no action set, invalid action, or invalid data

		if (!$input || !isset ($input['action'])) {
			$input['action'] = 'default';
		}

		switch ($input['action']) {

		case 'newTopic';

			if($this->board->isBoard($input['board']) && $this->board->guestable($input['board']) && ($input['title'] != '') && ($input['post'] != '')) {
				//if true board is valid & visable to user, and they've said something...

				$topic = $this->topic->makeNew($input['board'], $input['title'], $input['post']);

				$input = array('board' => $input['board']);

				$done = true;
			} else {
				break;
			}

		case 'viewBoard':

			if($this->board->isBoard($input['board'])) {
				//also checks board access validity :)
				$topics = $this->topic->getList($input['board']);

				$info['board'] = $input['board'];
				$info['boardTitle'] = $this->board->getTitle($input['board']);

				$info['empty'] = (count($topics) == 0) ? 'true' : 'false';

				//$debug[] = $topics;
				//$page->set('debug', $debug);

				$page->set('mode', 'board');
				$page->set('topics', $topics);
				$page->set ('info', $info);
				$done = true;
			}

		break;/******************************************/

		case 'reply':

			if ($this->topic->isTopic($input['topic'])) {
				$board = $this->topic->getParentBoard($input['topic']);

				if ($this->board->isVisible($board) && $this->board->guestable($board) && $input['post'] != '') {
					$post = $this->post->makeNew($board, $input['topic'], $input['post']);

					$posts = $this->post->getList($input['topic']);

					$input = array('topic' => $input['topic'], 'pageNumber' => ceil(count($posts) / 15));
					$done = true;
				}
			} else {
				break;
			}


		case 'viewTopic':

			if($this->topic->isTopic($input['topic'])) {
				if($this->board->isVisible($this->topic->getParentBoard($input['topic']))) {
					$posts = $this->post->getList($input['topic']);

					$info['board'] = $this->topic->getParentBoard($input['topic']);
					$info['boardTitle'] = $this->board->getTitle($info['board']);
					$info['topicTitle'] = $this->topic->getTitle($input['topic']);
					$info['topic'] = $input['topic'];

					$page->set('mode', 'topic');
					$page->set('posts', $posts);
					$page->set ('info', $info);
					$done = true;
				}
			}

			break;

		case 'editPost':

			//not used oop overly much here as other information is needed too, and tbh I doubt much else'd need this functionality
			if ($this->post->isPost(intval($input['postID'])) && $this->post->canEdit($input['postID'])) {
				$myPostID = $input['postID'];
				safen($myPostID);

				$postQuery = $fdb->x
				("
					SELECT
						`board_id`,
						`poster_id`,
						`topic_id`,
						`post_content`
					FROM
						`forum_posts`
					WHERE
						`ID`='$myPostID'
					LIMIT 1
				");

				$resultToo = $fdb->x
				("
					SELECT
						`ID`
					FROM
						`forum_posts`
					WHERE
						`topic_id`='".$postQuery[0]['topic_id']."'
					ORDER BY
						`created` ASC
					LIMIT 1
				");

				$info['firstReply'] = ($resultToo[0]['ID'] == $input['postID']);
				$info['topic'] = $postQuery[0]['topic_id'];
				$info['postID'] = $input['postID'];

				$info['board'] = $postQuery[0]['board_id'];
				$info['boardTitle'] = $this->board->getTitle($info['board']);
				$info['topicTitle'] = $this->topic->getTitle($info['topic']);

				textBits::toBB($postQuery[0]['post_content']);//altered by reference
				//textBits::dbUnpack($postQuery[0]['post_content']);

				$info['post'] = $postQuery[0]['post_content'];
				$page->set('mode', 'editPost');
				$page->set('info', $info);

				$done = true;
			}

			break;

		case 'deletePost':

			//q($input, 'input(EP)');
			if (($this->isMod) && (isset($input['postID']))) {
				if($this->post->isPost($input['postID'])) {
					$this->modlog("Deleted post ID {$input['postID']}");
					$topic = $this->post->getTopic($input['postID']);

					$this->post->deletePost($input['postID']);
					$forumToo = new Neuron_Forum_Forum($this->forumType, $this->forumID, $this->objUser, $this->isOmni, $this->isMod);
					$input = array('action' => 'viewTopic', 'topic' => $this->post->getTopic($input['postID']));
					$forumToo->getHTML($input);
					return $forumToo->getHTML($input);
					$nowt = true;
				}
				
			}

		break;

		case 'editedPost':

			//var_dump($input);
			//print 'asd'.$this->topic->isTopic(intval($input['topic'])).'asd';

			if ($this->post->canEdit($input['postID'])) {
				$postQuery = $fdb->x
				("
					SELECT
						`board_id`,
						`poster_id`,
						`topic_id`,
						`post_content`
					FROM
						`forum_posts`
					WHERE
						`ID`='".intval($input['postID'])."'
					LIMIT 1
				");

				if ($postQuery[0]['poster_id'] != $this->userID) {
					$this->modlog("Edited post ID {$input['postID']}");
				}

				if((isset($input['topic'])) && ($this->topic->isTopic(intval($input['topic'])))) {
					$this->post->update($input['postID'], $input['post'], $input['topic']);
				}
				else
				{
					$this->post->update($input['postID'], $input['post']);
				}

				$forumToo = new Neuron_Forum_Forum($this->forumType, $this->forumID, $this->objUser, $this->isOmni, $this->isMod);
				$input = array('action' => 'viewTopic', 'topic' => intval($input['topic']));

				return $forumToo->getHTML($input);

				$nowt = true;
			}

		break;

		case 'topicAdmin':

			if($this->isMod) {

				$page->set('mode', 'topicAdmin');
				$page->set('board', $input['board']);

				$topics = $this->topic->getList($input['board']);

				$page->set('topics', $topics);
				$done = true;
			}
		break;

		case 'topicAdminSave':
//q($input);
$max = array();
foreach($input as $k => $in) {
		if (substr($k, 0, 9) == 'topicType') {
			$max[] = substr($k, 10);
		}
}
sort($max);
$top = array_pop($max);

			if($this->isMod) {
			
				$curCount = 0;
				while ($curCount <= $top) {
					if (isset($input['topicType_'.$curCount])) {
					
						$topicType = intval($input['topicType_'.$curCount]);
						if (($topicType != 'unchanged') && (($topicType == '1') || ($topicType == '2') || ($topicType == '3'))) {

							if ($this->topic->isTopic(intval($curCount))) {
								$this->modlog ("Changed topic ID $curCount to type $topicType (1 = A, 2 = S, 3 = N)");
								$fdb->q
								("
									UPDATE
										`forum_topics`
									SET
										`type`='$topicType'
									WHERE
										`ID`='$curCount'
								");
							}
						}

						if (array_key_exists("delete_$curCount", $input)) {
							if ($this->topic->isTopic(intval($curCount))) {
								$title = $this->topic->getTitle($curCount);
								$this->modlog("Deleted topic ID $curCount ({$title})");
								$this->topic->deleteTopic($curCount);
							}
						}
					}
					$curCount++;
				}
			}
			$this->board->reStat(intval($input['board']));
			
				$forumToo = new Neuron_Forum_Forum($this->forumType, $this->forumID, $this->objUser, $this->isOmni, $this->isMod);
				$input = array('action' => 'viewBoard', 'board' => intval($input['board']));
				return $forumToo->getHTML($input);
				$nowt = true;
		break;

		case 'boardAdmin':
			if($this->isMod) {
				$boards = $this->board->getList();

				$page->set('mode', 'boardAdmin');
				$page->set('boards', $boards);

				$done = true;
			}

		break;

		case 'boardAdminSave':
//print 'adsadsadd';///
//q($input);

			if($this->isMod) {
				//load existing stuff.

				$highest = array(0);
				foreach ($input as $ik => $in) {
					if (substr($ik, 0, 6) == 'DelNum') {
						$highest[] = substr($ik, 6);
					}
				}
				
				sort($highest);
				
				$highest = array_pop($highest);
				if ($highest < $input['totalRows']) {
					$highest = $input['totalRows'];
				}

				$X = 0;
				//I know this is really ugly, but without var[] there's not much else I can do, without a large re-write & replan.  You should have said sooner that [] was broken :(
				while ($X <= $highest && $X < 9000) {
					if (isset($input["DelNum$X"]) && !isset($input["Made$X"])) {
							//q($input["Priv$X"]);
							//print 'asdsd';
						//q($input);
						if (
							$this->board->isBoard($X) &&
							!isset($input["Made$X"]) &&
							($input['DelNum'.$X] == 'Preserve') &&
							($input['DelNum'.$X] !== 0)
						) {
							//if board exists then update the name, desc and position.  if not, then insert a new row with the relevant data
							//$dbg[] = "board exists ($X) - trying to update info";
							safen($input["TitleNum$X"]);
							safen($input["DescNum$X"]);
							safen($input["Position$X"]);
							$priv = 0;
							$guest = 0;
							if (isset($input["Priv$X"])) { $priv = $input["Priv$X"] == 'on' ? 1 : 0; }
							if (isset($input["guest_$X"])) { $guest = $input["guest_$X"] == 'on' ? 1 : 0; }
							
							$fdb->q
							("
								UPDATE
									`forum_boards`
								SET
									`title`='".$input['TitleNum'.$X]."',
									`desc`='".$input['DescNum'.$X]."',
									`order`='".$input['Position'.$X]."',
									`private`='$priv',
									`guestable`='$guest'
								WHERE
									`ID`='$X'
							");
						}
						elseif (
							$input["DelNum$X"] != 'Preserve' && $X != 0
						) {
							//prevents chit-chat from being removed
							//$dbg[] = 'killing '.$X.' !';
							$this->modlog ("Deleted Board! ID ( $X, title was ".$this->board->getTitle($X)." )");

							$fdb->q ("DELETE FROM `forum_boards` WHERE `ID`=$X");
							$fdb->q ("DELETE FROM `forum_topics` WHERE `forum_id`='".$this->compID."' AND `board_id`=$X");
							$fdb->q ("DELETE FROM `forum_posts` WHERE `forum_id`='".$this->compID."' AND `board_id`=$X");
						}

					}
					else
					{

						if (isset($input['DelNum'.$X])) {
							if(isset($input["Made$X"])) {
								$fdb->q
								("
									INSERT INTO
										`forum_boards`
									(
										`forum_id`,
										`title`,
										`desc`,
										`order`
									)
									VALUES
									(
										'".$this->compID."',
										'".$input['TitleNum'.$X]."',
										'".$input['DescNum'.$X]."',
										'".$input['Position'.$X]."'
									)
								");
							}
						}
					}
					$X++;
				}
			}

		break;

		case 'banAdmin':

			if($this->isMod) {

				$bans = $fdb->x("SELECT * FROM `forum_bans`");
				//var_dump($bans);

				$page->set('mode', 'banAdmin');
				$page->set('bans', $bans);
				//$page->set('debug', $bans);
				$done = true;

			}

		break;

		case 'banAdminSave':

			if($this->isMod) {

				$highest = array(0);
				foreach ($input as $ik => $in) {
					if (substr($ik, 0, 6) == 'DelNum') {
						$highest[] = substr($ik, 6);
					}
				}

				sort($highest);
				$highest = array_pop($highest);

				if ($highest < $input['totalRows']) { $highest = $input['totalRows']; }

				$X = 0;
				while ($X <= $highest && $X < 9000) {

					if (isset($input["DelNum$X"]) && !isset($input["Made$X"])) {
						if ($input["DelNum$X"] == 'Pickle') {
							$fdb->q("DELETE FROM `forum_bans` WHERE `ID`=$X");
							$this->modlog("Deleted ban - ID $X");
						}

					}
					else
					{

						if(
							isset($input["Made$X"]) &&
							($input['IDNum'.$X] != '') &&
							($input['IDNum'.$X] != 0)
						) {
							safen($input['ReasonNum'.$X]);
							$input['IDNum'.$X] = intval($input['IDNum'.$X]);
							$fdb->q
							("
								INSERT INTO
									`forum_bans`
								(
									`user`,
									`forumID`,
									`time`,
									`reason`,
									`by`
								)
								VALUES
								(
									'".$input['IDNum'.$X]."',
									'{$this->compID}',
									'".time()."',
									'".$input['ReasonNum'.$X]."',
									'{$this->userID}'
								)
							");
						}
					}
					$X++;
				}

				$bans = $fdb->x ("SELECT * FROM `forum_bans`");
				$page->set('mode', 'banAdmin');
				$page->set('bans', $bans);

				$done = true;
			}

		break;

		}

		if (!$done) {
			$boards = $this->board->getList();
			$page->set('mode', 'index');
			$page->set('boards', $boards);
		}

		if (!$nowt) {
			return $page->parse ('forum.tpl');
		}
	
	}
public function getHTML ($input) {
		global $fdb;
		global $scopeBuster;
		$scopeBuster->input = $input;
		$page = new Neuron_Core_Template ();
//q($input);
 		if
 		(
 			count
 			(
 				$fdb->x
 				("
 					SELECT
 						*
 					FROM
 						`forum_bans`
 					WHERE
 						`ID`=$this->userID AND `forumID`='{$this->compID}'
 				")
 			) == 1
 		)
 		{
			$page->set ('content', 'You have been banned from this forum');
			$page->set ('mode', 'banned');
			return $page->parse ('forum.tpl');
			die ('There is no future. Forum:'.__LINE__);
		}

		$nowt = false;
		$done = false;

		//if not changed to true, triggers a default forum view later; that happens if no action set, invalid action, or invalid data

		if (!$input || !isset ($input['action'])) {
			$input['action'] = 'default';
		}

		switch ($input['action']) {

		case 'newTopic';

			if($this->board->isBoard($input['board']) && $this->board->guestable($input['board']) && ($input['title'] != '') && ($input['post'] != '')) {
				//if true board is valid & visable to user, and they've said something...

				$topic = $this->topic->makeNew($input['board'], $input['title'], $input['post']);

				$input = array('board' => $input['board']);

				$done = true;
			} else {
				break;
			}

		case 'viewBoard':

			if($this->board->isBoard($input['board'])) {
				//also checks board access validity :)
				$topics = $this->topic->getList($input['board']);

				$info['board'] = $input['board'];
				$info['boardTitle'] = $this->board->getTitle($input['board']);

				$info['empty'] = (count($topics) == 0) ? 'true' : 'false';

				//$debug[] = $topics;
				//$page->set('debug', $debug);

				$page->set('mode', 'board');
				$page->set('topics', $topics);
				$page->set ('info', $info);
				$done = true;
			}

		break;/******************************************/

		case 'reply':

			if ($this->topic->isTopic($input['topic'])) {
				$board = $this->topic->getParentBoard($input['topic']);

				if ($this->board->isVisible($board) && $this->board->guestable($board) && $input['post'] != '') {
					$post = $this->post->makeNew($board, $input['topic'], $input['post']);

					$posts = $this->post->getList($input['topic']);

					$input = array('topic' => $input['topic'], 'pageNumber' => ceil(count($posts) / 15));
					$done = true;
				}
			} else {
				break;
			}


		case 'viewTopic':

			if($this->topic->isTopic($input['topic'])) {
				if($this->board->isVisible($this->topic->getParentBoard($input['topic']))) {
					$posts = $this->post->getList($input['topic']);

					$info['board'] = $this->topic->getParentBoard($input['topic']);
					$info['boardTitle'] = $this->board->getTitle($info['board']);
					$info['topicTitle'] = $this->topic->getTitle($input['topic']);
					$info['topic'] = $input['topic'];

					$page->set('mode', 'topic');
					$page->set('posts', $posts);
					$page->set ('info', $info);
					$done = true;
				}
			}

			break;

		case 'editPost':

			//not used oop overly much here as other information is needed too, and tbh I doubt much else'd need this functionality
			if ($this->post->isPost(intval($input['postID'])) && $this->post->canEdit($input['postID'])) {
				$myPostID = $input['postID'];
				safen($myPostID);

				$postQuery = $fdb->x
				("
					SELECT
						`board_id`,
						`poster_id`,
						`topic_id`,
						`post_content`
					FROM
						`forum_posts`
					WHERE
						`ID`='$myPostID'
					LIMIT 1
				");

				$resultToo = $fdb->x
				("
					SELECT
						`ID`
					FROM
						`forum_posts`
					WHERE
						`topic_id`='".$postQuery[0]['topic_id']."'
					ORDER BY
						`created` ASC
					LIMIT 1
				");

				$info['firstReply'] = ($resultToo[0]['ID'] == $input['postID']);
				$info['topic'] = $postQuery[0]['topic_id'];
				$info['postID'] = $input['postID'];

				$info['board'] = $postQuery[0]['board_id'];
				$info['boardTitle'] = $this->board->getTitle($info['board']);
				$info['topicTitle'] = $this->topic->getTitle($info['topic']);

				textBits::toBB($postQuery[0]['post_content']);//altered by reference
				//textBits::dbUnpack($postQuery[0]['post_content']);

				$info['post'] = $postQuery[0]['post_content'];
				$page->set('mode', 'editPost');
				$page->set('info', $info);

				$done = true;
			}

			break;

		case 'deletePost':

			//q($input, 'input(EP)');
			if (($this->isMod) && (isset($input['postID']))) {
				if($this->post->isPost($input['postID'])) {
					$this->modlog("Deleted post ID {$input['postID']}");
					$topic = $this->post->getTopic($input['postID']);

					$this->post->deletePost($input['postID']);
					$forumToo = new Neuron_Forum_Forum($this->forumType, $this->forumID, $this->objUser, $this->isOmni, $this->isMod);
					$input = array('action' => 'viewTopic', 'topic' => $this->post->getTopic($input['postID']));
					$forumToo->getHTML($input);
					return $forumToo->getHTML($input);
					$nowt = true;
				}
				
			}

		break;

		case 'editedPost':

			//var_dump($input);
			//print 'asd'.$this->topic->isTopic(intval($input['topic'])).'asd';

			if ($this->post->canEdit($input['postID'])) {
				$postQuery = $fdb->x
				("
					SELECT
						`board_id`,
						`poster_id`,
						`topic_id`,
						`post_content`
					FROM
						`forum_posts`
					WHERE
						`ID`='".intval($input['postID'])."'
					LIMIT 1
				");

				if ($postQuery[0]['poster_id'] != $this->userID) {
					$this->modlog("Edited post ID {$input['postID']}");
				}

				if((isset($input['topic'])) && ($this->topic->isTopic(intval($input['topic'])))) {
					$this->post->update($input['postID'], $input['post'], $input['topic']);
				}
				else
				{
					$this->post->update($input['postID'], $input['post']);
				}

				$forumToo = new Neuron_Forum_Forum($this->forumType, $this->forumID, $this->objUser, $this->isOmni, $this->isMod);
				$input = array('action' => 'viewTopic', 'topic' => intval($input['topic']));

				return $forumToo->getHTML($input);

				$nowt = true;
			}

		break;

		case 'topicAdmin':

			if($this->isMod) {

				$page->set('mode', 'topicAdmin');
				$page->set('board', $input['board']);

				$topics = $this->topic->getList($input['board']);

				$page->set('topics', $topics);
				$done = true;
			}
		break;

		case 'topicAdminSave':
//q($input);
$max = array();
foreach($input as $k => $in) {
		if (substr($k, 0, 9) == 'topicType') {
			$max[] = substr($k, 10);
		}
}
sort($max);
$top = array_pop($max);

			if($this->isMod) {
			
				$curCount = 0;
				while ($curCount <= $top) {
					if (isset($input['topicType_'.$curCount])) {
					
						$topicType = intval($input['topicType_'.$curCount]);
						if (($topicType != 'unchanged') && (($topicType == '1') || ($topicType == '2') || ($topicType == '3'))) {

							if ($this->topic->isTopic(intval($curCount))) {
								$this->modlog ("Changed topic ID $curCount to type $topicType (1 = A, 2 = S, 3 = N)");
								$fdb->q
								("
									UPDATE
										`forum_topics`
									SET
										`type`='$topicType'
									WHERE
										`ID`='$curCount'
								");
							}
						}

						if (array_key_exists("delete_$curCount", $input)) {
							if ($this->topic->isTopic(intval($curCount))) {
								$title = $this->topic->getTitle($curCount);
								$this->modlog("Deleted topic ID $curCount ({$title})");
								$this->topic->deleteTopic($curCount);
							}
						}
					}
					$curCount++;
				}
			}
			$this->board->reStat(intval($input['board']));
			
				$forumToo = new Neuron_Forum_Forum($this->forumType, $this->forumID, $this->objUser, $this->isOmni, $this->isMod);
				$input = array('action' => 'viewBoard', 'board' => intval($input['board']));
				return $forumToo->getHTML($input);
				$nowt = true;
		break;

		case 'boardAdmin':
			if($this->isMod) {
				$boards = $this->board->getList();

				$page->set('mode', 'boardAdmin');
				$page->set('boards', $boards);

				$done = true;
			}

		break;

		case 'boardAdminSave':
//print 'adsadsadd';///
//q($input);

			if($this->isMod) {
				//load existing stuff.

				$highest = array(0);
				foreach ($input as $ik => $in) {
					if (substr($ik, 0, 6) == 'DelNum') {
						$highest[] = substr($ik, 6);
					}
				}
				
				sort($highest);
				
				$highest = array_pop($highest);
				if ($highest < $input['totalRows']) {
					$highest = $input['totalRows'];
				}

				$X = 0;
				//I know this is really ugly, but without var[] there's not much else I can do, without a large re-write & replan.  You should have said sooner that [] was broken :(
				while ($X <= $highest && $X < 9000) {
					if (isset($input["DelNum$X"]) && !isset($input["Made$X"])) {
							//q($input["Priv$X"]);
							//print 'asdsd';
						//q($input);
						if (
							$this->board->isBoard($X) &&
							!isset($input["Made$X"]) &&
							($input['DelNum'.$X] == 'Preserve') &&
							($input['DelNum'.$X] !== 0)
						) {
							//if board exists then update the name, desc and position.  if not, then insert a new row with the relevant data
							//$dbg[] = "board exists ($X) - trying to update info";
							safen($input["TitleNum$X"]);
							safen($input["DescNum$X"]);
							safen($input["Position$X"]);
							$priv = 0;
							$guest = 0;
							if (isset($input["Priv$X"])) { $priv = $input["Priv$X"] == 'on' ? 1 : 0; }
							if (isset($input["guest_$X"])) { $guest = $input["guest_$X"] == 'on' ? 1 : 0; }
							
							$fdb->q
							("
								UPDATE
									`forum_boards`
								SET
									`title`='".$input['TitleNum'.$X]."',
									`desc`='".$input['DescNum'.$X]."',
									`order`='".$input['Position'.$X]."',
									`private`='$priv',
									`guestable`='$guest'
								WHERE
									`ID`='$X'
							");
						}
						elseif (
							$input["DelNum$X"] != 'Preserve' && $X != 0
						) {
							//prevents chit-chat from being removed
							//$dbg[] = 'killing '.$X.' !';
							$this->modlog ("Deleted Board! ID ( $X, title was ".$this->board->getTitle($X)." )");

							$fdb->q ("DELETE FROM `forum_boards` WHERE `ID`=$X");
							$fdb->q ("DELETE FROM `forum_topics` WHERE `forum_id`='".$this->compID."' AND `board_id`=$X");
							$fdb->q ("DELETE FROM `forum_posts` WHERE `forum_id`='".$this->compID."' AND `board_id`=$X");
						}

					}
					else
					{

						if (isset($input['DelNum'.$X])) {
							if(isset($input["Made$X"])) {
								$fdb->q
								("
									INSERT INTO
										`forum_boards`
									(
										`forum_id`,
										`title`,
										`desc`,
										`order`
									)
									VALUES
									(
										'".$this->compID."',
										'".$input['TitleNum'.$X]."',
										'".$input['DescNum'.$X]."',
										'".$input['Position'.$X]."'
									)
								");
							}
						}
					}
					$X++;
				}
			}

		break;

		case 'banAdmin':

			if($this->isMod) {

				$bans = $fdb->x("SELECT * FROM `forum_bans`");
				//var_dump($bans);

				$page->set('mode', 'banAdmin');
				$page->set('bans', $bans);
				//$page->set('debug', $bans);
				$done = true;

			}

		break;

		case 'banAdminSave':

			if($this->isMod) {

				$highest = array(0);
				foreach ($input as $ik => $in) {
					if (substr($ik, 0, 6) == 'DelNum') {
						$highest[] = substr($ik, 6);
					}
				}

				sort($highest);
				$highest = array_pop($highest);

				if ($highest < $input['totalRows']) { $highest = $input['totalRows']; }

				$X = 0;
				while ($X <= $highest && $X < 9000) {

					if (isset($input["DelNum$X"]) && !isset($input["Made$X"])) {
						if ($input["DelNum$X"] == 'Pickle') {
							$fdb->q("DELETE FROM `forum_bans` WHERE `ID`=$X");
							$this->modlog("Deleted ban - ID $X");
						}

					}
					else
					{

						if(
							isset($input["Made$X"]) &&
							($input['IDNum'.$X] != '') &&
							($input['IDNum'.$X] != 0)
						) {
							safen($input['ReasonNum'.$X]);
							$input['IDNum'.$X] = intval($input['IDNum'.$X]);
							$fdb->q
							("
								INSERT INTO
									`forum_bans`
								(
									`user`,
									`forumID`,
									`time`,
									`reason`,
									`by`
								)
								VALUES
								(
									'".$input['IDNum'.$X]."',
									'{$this->compID}',
									'".time()."',
									'".$input['ReasonNum'.$X]."',
									'{$this->userID}'
								)
							");
						}
					}
					$X++;
				}

				$bans = $fdb->x ("SELECT * FROM `forum_bans`");
				$page->set('mode', 'banAdmin');
				$page->set('bans', $bans);

				$done = true;
			}

		break;

		}

		if (!$done) {
			$boards = $this->board->getList();
			$page->set('mode', 'index');
			$page->set('boards', $boards);
		}

		if (!$nowt) {
			return $page->parse ('forum.tpl');
		}
	
	}
/*
Every page load is parsed by this.
Input contains all input that was send in the form (or the request in general).
Mind that there is no difference between post and get data here.