<?php
if(!defined("BASE_DIR")) exit;
if(!perm('links'))
{
	no_perm();
} else {
	
	if(!@file_exists(BASE_DIR . 'class/Class.Links.php'))
	{
		module_not_installed('Links');
	} else {
	
		include_once(BASE_DIR . 'admin/class/class.links.php');
		$links = new Links;
		
		
		
		$_REQUEST['sub'] = (isset($_REQUEST['sub']) && !empty($_REQUEST['sub'])) ? $_REQUEST['sub'] : 'overview';
		switch($_REQUEST['sub'])
		{
			case 'delrating':
				if(!perm('del_rating'))
					no_perm();
				else
					$links->DelRating(@$_REQUEST['id']);
			break;
			
			case 'overview':
				$links->ListLinks();
			break;
			
			case 'edit':
				if(!perm('links_edit'))
					no_perm();
				else
					$links->EditLink(@$_REQUEST['id']);
			break;
			
			case 'new':
				if(!perm('links_edit'))
					no_perm();
				else
					$links->NewLink();
			break;
			
			case 'copy':
				if(!perm('links_edit'))
					no_perm();
				else
					$links->CopyLink(@$_REQUEST['id']);
			break;
			
			case 'settings':
				if(!perm('links_settings'))
					no_perm();
				else
					$links->Settings();
			break;
			
			case 'categs':
				if(!perm('links_categs'))
					no_perm();
				else
					$links->LinkCategs();
			break;
			
			case 'delcateg':
				if(!perm('links_categs'))
					no_perm();
				else
					$links->DelCateg(@$_REQUEST['id']);
			break;
			
			case 'editcateg':
				if(!perm('links_categs'))
					no_perm();
				else
					$links->EditCateg(@$_REQUEST['id']);
			break;
			
			case 'addcateg':
				if(!perm('links_categs'))
					no_perm();
				else
					$links->AddCateg();
			break;
			
			case 'iconupload':
				include_once(BASE_DIR . 'admin/class/class.fileupload.php');
				$upload = new Fileupload('/uploads/links/','hidden',@$_REQUEST['divid'],100);
			break;
		}
	}
}
?>