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

if(@file_exists(BASE_DIR . 'admin/class/class.gallery.php'))
{
	if(!perm('gallery_overview'))
	{
		no_perm();
	} else {
		
		include_once(BASE_DIR . 'admin/class/class.gallery.php');
		$gallery = new Gallery;
		
		$_REQUEST['sub'] = (isset($_REQUEST['sub']) && !empty($_REQUEST['sub'])) ? $_REQUEST['sub'] : 'overview';
		
		$GLOBALS['tmpl']->assign('gs', $gallery->GetSettings());
		
		switch($_REQUEST['sub'])
		{
			case 'overview':
				$gallery->ListCategs();
			break;
			
			case 'showincluded':
				$gallery->ListIncluded($_REQUEST['id']);
			break;
			
			case 'editgallery':
				$gallery->EditGallery($_REQUEST['id']);
			break;
			
			case 'editimages':
				$gallery->EditImages($_REQUEST['id']);
			break;
			
			case 'addimages':
				$gallery->AddImages($_REQUEST['id']);
			break;
			
			case 'gallerydel':
				$gallery->GalDel($_REQUEST['id']);
			break;
			
			case 'addgallery':
				$gallery->newGallery($_REQUEST['id']);
			break;
			
			case 'editcateg':
				$gallery->editCateg($_REQUEST['id']);
			break;
			
			case 'delcategory':
				$gallery->delCateg($_REQUEST['id']);
			break;
			
			case 'addcategory':
				$gallery->addCateg();
			break;
			
			case 'editimage':
				$gallery->editImage($_REQUEST['id']);
			break;
			
			case 'gallerysettings':
				$gallery->GalSettings();
			break;
			
			case 'categicon':
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload('/uploads/galerie_icons/','hidden',@$_REQUEST['divid'],@$_REQUEST['resize']);
			break;
			
			case 'gallimgupload':
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload('/uploads/galerie/','hidden',@$_REQUEST['divid'],@$_REQUEST['resize']);
			break;
			
			
		}
	}
} else {
	notFound();
}
?>