<?php
if(!defined("BASE_DIR")) exit;

if(@file_exists(BASE_DIR . 'admin/class/class.forums.php'))
{
	
	if(!perm('forum'))
	{
		no_perm();
	} else {
		
		include_once(BASE_DIR . 'admin/class/class.forums.php');
		$forum = new Forums;
		
		$_REQUEST['sub'] = (isset($_REQUEST['sub']) && !empty($_REQUEST['sub'])) ? $_REQUEST['sub'] : 'overview';
		switch($_REQUEST['sub'])
		{
			case 'overview':
				$forum->Overview();
			break;
			
			case 'editcategory':
				$forum->CategoryEdit($_GET['id']);
			break;
			
			case 'deleteforum':
				$forum->DeleteForum($_GET['id']);
			break;
			
			case 'deletecategory':
				$forum->DeleteCategory($_GET['id']);
			break;
			
			case 'addforum':
				$forum->AddForum($_GET['id']);
			break;
			
			case 'newcategory':
				$forum->AddCategory($_GET['id']);
			break;
			
			case 'editforum':
				$forum->EditForum($_GET['id']);
			break;
			
			case 'userpermissions':
				$forum->UserPermissions($_GET['g_id'],$_GET['f_id']);
			break;
			
			case 'closeforum':
				$forum->AdminSwitchForumStatus($_GET['id'],1,1);
				header("Location:index.php?do=forums" . (isset($_GET['fid']) ? '&id=' . $_GET['fid'] : '') );
			break;
			
			case 'openforum':
				$forum->AdminSwitchForumStatus($_GET['id'],0,1);
				header("Location:index.php?do=forums" . (isset($_GET['fid']) ? '&id=' . $_GET['fid'] : '') );
			break;
			
			case 'editmods':
				$forum->Mods($_GET['id']);
			break;
			
			case 'searchmod':
				$_REQUEST['noout'] =1;
				$forum->ModSearch($_REQUEST['q']);
			break;
			
			case 'deltopics':
				$forum->DelTopics();
			break;
			
			case 'attachmentsettings':
				$forum->AttachmentSettings();
			break;
			
			case 'showattachments':
				$forum->ShowAttachments();
			break;
			
			case 'searchattachments':
				$_REQUEST['noout'] =1;
				$forum->AttachmentSearch($_REQUEST['q']);
			break;
			
			case 'delattachmenttype':
				$forum->DelAttachmentType($_GET['id']);
			break;
			
			case 'userrankings':
				$forum->UserRankings();
			break;
			
			case 'emoticons':
				$forum->Emoticons();
			break;
			
			case 'posticons':
				$forum->Posticons();
			break;
			
			case 'forumshelp':
				$forum->HelpPages();
			break;
			
			case 'forumshelpedit':
				$forum->HelpPageEdit($_REQUEST['id']);
			break;
			
			case 'forumshelpnew':
				$forum->HelpPageNew($_REQUEST['categ']);
			break;
			
			case 'delhelppage':
				$forum->DelHelpPage($_REQUEST['id']);
			break;
			
			case 'forumshelppageedit':
				$forum->ForumsHelpPageEdit($_REQUEST['id']);
			break;
			
			case 'delhelpcateg':
				$forum->DelHelpCateg($_REQUEST['categ']);
			break;
			
			case 'forumshelpnewcateg':
				$forum->ForumsHelpNewCateg();
			break;
			
		}
	}
} else {
	notFound();
}
?>