<?php
require_once "../includes/common.inc.php";
require_once MODEPATH.'./'.$adminpath.'/global.func.php';
require_once MODEPATH.'./includes/cache.func.php';
if(!$mm_mid){	
	clearcookies();
	header("Location:loggin.php?action=loggin");
	mexit();
}
if(!$adminid){	
	cpmsg('admin_login_failure','loggin.php?action=loggin');
	mexit();
}
$gd=0;
$gdinfo=gd_info();
if(count($gdinfo)){
	$gd=1;
}
if(empty($action)){
	include theme('index', 'themes/admin','admin');
}
	$actions=array();
	switch($adminid){
		case 1:
			$actions = array('settings','pic','pic_post','pic_sort','importpic','makehtml','members','usergroups','guestbook', 'admingroups',  'settings', 'news', 'ad', 'uploads', 'onlines','link','db','left','top','main','footer');
			
		break;	
		case 2:
			$actions = array('pic','pic_post','importpic','makehtml', 'uploads', 'onlines','link','left','top','main','footer');
		break;
		default:
			$actions = array();
		break;
	}
if($action=='top'){
	@include lang('themes', 'themes/admin');
	$topmenus = array(
		'pic' => $lang['pic'].$lang['manage'],
		'makehtml' => $lang['makehtml'],
		'ad' => $lang['ad'].$lang['manage'],
		'guestbook' => $lang['guestbook'].$lang['manage'],
		'members' => $lang['user'].$lang['manage'],
		'settings' => $lang['system'].$lang['set'],
	
	);
	include theme('top', 'themes/admin','admin');
}elseif($action=='main'){
	require_once MODEPATH.'./'.$adminpath.'/main.inc.php';
}elseif($action=='msg'){
	@include lang('msg','themes/admin');
	if(isset($lang[$msg])) {
		eval("\$messages = \"".$lang[$msg]."\";");	
	}
	include theme('tips', 'themes/admin','admin');
	mexit();
}elseif($action=='left'){
	include theme('left', 'themes/admin','admin');
}elseif($action=='footer'){
	include theme('buttom', 'themes/admin','admin');
}else{

	if($action && in_array($action, $actions)){
		require_once MODEPATH.'./'.$adminpath.'/'.$action.'.inc.php';
	}else{
		cpmsg('error');
	}
}
?>