<?php
if(!defined("BASE_DIR")) exit;
	
if(!file_exists(BASE_DIR . 'class/Class.Gaming.php'))
{
	module_not_installed('Gaming');
} else {

	include_once(BASE_DIR . 'admin/class/class.gaming.php');
	$gaming = new Gaming;
	
	$_REQUEST['sub'] = (isset($_REQUEST['sub']) && !empty($_REQUEST['sub'])) ? $_REQUEST['sub'] : 'plattforms';
	switch($_REQUEST['sub'])
	{
		case 'copyarticle':
			if(!perm('articles_new')) no_perm();
			else $gaming->copyArticle($_REQUEST['id']);
		break;
		
		case 'editarticle':
			$gaming->editArticle($_REQUEST['id']);
		break;
		
		case 'articles':
			if(!perm('articles')) no_perm();
			else $gaming->showArticles();
		break;
		
		case 'deletearticle':
			$gaming->deleteArticle($_REQUEST['id']);
		break;
		
		case 'openclose_article':
			$gaming->ArticleOpenclose($_REQUEST['openclose'],$_REQUEST['id']);
		break;
		
		case 'newarticle':
			if(!perm('articles_new')) no_perm();
			else $gaming->addArticle();
		break;
		
		case 'article_categories':
			if(!perm('articles_category')) no_perm();
			else $gaming->ArticleCategs();
		break;
		
		case 'edit_articlecateg':
			if(!perm('articles_category')) no_perm();
			else $gaming->EditArticleCateg($_REQUEST['id']);
		break;
		
		case 'add_articlecateg':
			if(!perm('articles_category')) no_perm();
			else $gaming->AddArticleCateg();
		break;
		
		case 'del_articlecateg':
			if(!perm('articles_category')) 
			{
				no_perm();
			} else {
				$gaming->DelArticleCateg($_REQUEST['id']);
				header('Location:index.php?do=gaming&sub=article_categories');
				exit;
			}
		break;
		
		case 'plattforms':
			if(!perm('plattforms')) no_perm();
			else $gaming->showPlattforms();
		break;
		
		case 'cheats':
			if(!perm('cheats')) no_perm();
			else $gaming->showCheats();
		break;
		
		case 'cheatssetings':
			if(!perm('cheats')) no_perm();
			else $gaming->CheatsSettings();
		break;
		
		case 'editcheat':
			if(!perm('cheats')) no_perm();
			else $gaming->editCheat($_REQUEST['id']);
		break;
		
		case 'newcheat':
			if(!perm('cheats')) no_perm();
			else $gaming->newCheat();
		break;
		
		case 'copycheat':
			if(!perm('cheats')) no_perm();
			else $gaming->copyCheat($_REQUEST['id']);
		break;
		
		case 'delrating_article':
			if(!perm('del_rating'))
				no_perm();
			else
				$gaming->DelRatingArticles(@$_REQUEST['id']);
		break;
		
		case 'gamingiconupload':
			if(perm('articles'))
			{
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload('/uploads/articles/','hidden',@$_REQUEST['divid'],@$_REQUEST['resize']);
			}
		break;
		
		
		case 'cheaticonupload':
			if(perm('cheats'))
			{
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload('/uploads/cheats/','hidden',@$_REQUEST['divid'],@$_REQUEST['resize']);
			}
		break;
		
		case 'cheatfileupload':
			if(perm('cheats'))
			{
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload('/uploads/cheats_files/','hidden',@$_REQUEST['divid'],0,'',1);
			}
		break;
	}
}
?>