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

if(@file_exists(BASE_DIR . 'admin/class/class.shop.php'))
{

	if(!perm('shop'))
	{
		no_perm();
	} else {
		
		include_once(BASE_DIR . 'admin/class/class.shop.php');
		$shop = new Shop;
		
		$_REQUEST['sub'] = (isset($_REQUEST['sub']) && !empty($_REQUEST['sub'])) ? $_REQUEST['sub'] : 'home';
		switch($_REQUEST['sub'])
		{
			case 'prodvotes':
				$shop->getProdVotes($_REQUEST['id']);
			break;
			
			case 'showmoney':
				$shop->showMoney();
			break;
			
			case 'categvariants':
				$shop->CategVariants($_REQUEST['id']);
			break;
			
			case 'new':
				$shop->addArticle();
			break;
			
			case 'home':
				$shop->getHome();
			break;
			
			case 'settings':
				$shop->shopSettings();
			break;
			
			case 'shopinfos':
				$shop->shopInfos();
			break;
			
			case 'orders':
				$shop->listOrders();
			break;
			
			case 'edit_order':
				$shop->editOrder($_REQUEST['id']);
			break;
			
			case 'getHtmlOrder':
				$shop->getHtmlOrder($_REQUEST['id']);
			break;
			
			case 'cancel_order':
				$shop->cancelOrder($_REQUEST['id']);
			break;
			
			case 'edit_article':
				$shop->editArticle($_REQUEST['id']);
			break;
			
			case 'delete_article':
				$shop->deleteArticle($_REQUEST['id']);
			break;
			
			case 'copy_article':
				$shop->copyArticle($_REQUEST['id']);
			break;
			
			case 'user_downloads':
				$shop->userDownloads($_REQUEST['user']);
			break;
			
			case 'esd_downloads':
				$shop->esdDownloads($_REQUEST['id']);
			break;
			
			case 'articles':
				$shop->listArticles();
			break;
			
			case 'get_prods_categs':
				$shop->get_prods_categs();
			break;
			
			case 'get_prods_parts':
				$shop->get_prods_parts();
			break;
			
			case 'get_prods_tuning':
				$shop->get_prods_tuning();
			break;
			
			case 'article_variants':
				$shop->getVariants($_REQUEST['id'],$_REQUEST['cat']);
			break;
			
			case 'article_stprices':
				$shop->getStprices($_REQUEST['id']);
			break;
			
			case 'categories':
				$shop->displayCategories();
			break;
			
			case 'name_text':
				$shop->editCategNameText($_REQUEST['langcode'],$_REQUEST['id']);
			break;
			
			case 'edit_categ':
				$shop->editCateg($_REQUEST['id']);
			break;
			
			
			case 'new_categ':
				$shop->newCateg(@$_REQUEST['id']);
			break;
			
			case 'del_categ':
				$shop->delCateg(@$_REQUEST['id']);
			break;
			
			case 'categ_icon_upload':
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload($_REQUEST['updir'],'hidden',@$_REQUEST['divid'],$_REQUEST['resize'],@$_REQUEST['ending']);
			break;
			
			case 'categ_icon': 
				$up = (isset($_REQUEST['updir']) && $_REQUEST['updir']!='') ? $_REQUEST['updir'] : '/uploads/shop/icons/';
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload(@$_REQUEST['updir'],'hidden',@$_REQUEST['divid'],480,@$_REQUEST['ending']);
			break;
			
			case 'esd_upload':
				include_once(BASE_DIR . 'admin/class/class.fileupload_shopdownloads.php');
				$upload = new ESDFileupload(@$_REQUEST['updir'],'hidden',@$_REQUEST['divid'],'','','/uploads/shop/files/');
			break;
			
			case 'categories_addons':
				$shop->categAddons();
			break;
			
			case 'paymentmethods':
				$shop->PaymentMethods();
			break;
			
			case 'editpaymentmethod':
				$shop->EditPaymentMethod($_REQUEST['Id'], $_REQUEST['lc']);
			break;
			
			
			
			
			case 'editshipper':
				$shop->EditShipper($_REQUEST['Id'], $_REQUEST['lc']);
			break;
			
			
			case 'editshippingvolumes':
				$shop->EditShippingVolumes($_REQUEST['Id']);
			break;
			
			case 'shipper':
				$shop->ShippingMethods();
			break;
			
			case 'taxes':
				$shop->Taxes();
			break;
			
			case 'shippingready':
				$shop->ShippingReady();
			break;
			
			case 'availabilities':
				$shop->Availabilities();
			break;
			
			case 'couponcodes':
				$shop->CouponCodes();
			break;
			
			case 'units':
				$shop->Units();
			break;
			
			case 'manufacturer':
				$shop->Manufacturer();
			break;
			
			case 'specifications':
				$shop->Specifications($_REQUEST['id']);
			break;
			
			case 'openclose':
				$shop->openclose($_REQUEST['status'],$_REQUEST['id']);
			break;
			
			case 'groupsettings':
				$shop->groupSettings();
			break;
		}
		
	}
} else {
	notFound();
}
?>