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

if(!perm('news'))
{
	no_perm();
} else {
	include_once(BASE_DIR . 'admin/class/class.news.php');
	$news = new News;
	
	$_REQUEST['sub'] = (isset($_REQUEST['sub']) && !empty($_REQUEST['sub'])) ? $_REQUEST['sub'] : 'overview';
	
	switch($_REQUEST['sub'])
	{
		case '':
		case 'overview':
			$news->showNews();
		break;
		
		case 'addnews':
			$news->addNews();
		break;
		
		case 'editcateg':
			$news->editCateg($_REQUEST['id']);
		break;
		
		case 'addcateg':
			$news->newCateg();
		break;
		
		case 'categories':
			$news->displayCategs();
		break;
		
		case 'delcateg':
			$news->delCateg($_REQUEST['id']);
		break;
		
		case 'openclose':
			$news->Openclose($_REQUEST['openclose'],$_REQUEST['id']);
		break;
	
		case 'editnews':
			$news->editNews($_REQUEST['id']);
		break;
		
		case 'delete':
			$news->deleteNews($_REQUEST['id']);
		break;
		
		case 'delrating':
			if(!perm('del_rating'))
				no_perm();
			else
				$news->DelRating(@$_REQUEST['id']);
		break;
		
		case 'iconupload':
			if(perm('news_edit') || perm('news_new'))
			{
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload('/uploads/news/','hidden',@$_REQUEST['divid'],@$_REQUEST['resize']);
			}
		break;
	}
}
?>