<?php
if(!defined("BASE_DIR")) exit;
if(!perm('newsletter'))
{
	no_perm();
} else {
	include_once(BASE_DIR . 'admin/class/class.newsletter.php');
	include_once(BASE_DIR . 'admin/functions/func.newsletter.php');
	$newsletter = new Newsletter;
	
	$_REQUEST['sub'] = (isset($_REQUEST['sub']) && !empty($_REQUEST['sub'])) ? $_REQUEST['sub'] : 'new';
	switch($_REQUEST['sub'])
	{
		case 'showabos':
			if(!perm('newsletter'))
				no_perm();
			else
				$newsletter->ShowAbos();
		break;
		
		case 'new':
			if(!perm('newslettersend'))
				no_perm();
			else
				$newsletter->NewNewsletter($_REQUEST['to']);
		break;
		
		case 'deletecateg':
			if(!perm('newsletter'))
				no_perm();
			else
				$newsletter->DelCateg($_REQUEST['id']);
		break;
		
		case 'categs':
			if(!perm('newsletter'))
				no_perm();
			else
				$newsletter->GetCatgs();
		break;
		
		case 'archive':
			if(!perm('newsletter'))
				no_perm();
			else
				$newsletter->GetArchive();
		break;
		
		case 'view':
			if(!perm('newsletter'))
				no_perm();
			else
				$newsletter->ShowNewsletter($_REQUEST['id']);
		break;
		
		case 'getattachment':
			if(!perm('newsletter_attachdownload'))
				no_perm();
			else
				$newsletter->GetAttachment($_REQUEST['att']);
		break;
		
	}
}

?>
