<?php

/*
	[Discuz!] (C)2001-2006 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$RCSfile: menu.inc.php,v $
	$Revision: 1.65 $
	$Date: 2006/09/01 04:35:06 $
*/

if(!defined('IN_DISCUZ') || !isset($PHP_SELF) || !preg_match("/[\/\\\\]admincp\.php$/", $PHP_SELF)) {
        exit('Access Denied');
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Discuz! Administrator's Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<link rel="stylesheet" type="text/css" id="css" href="./images/admincp/admincp.css">
<script>
var is_ie = document.all ? true : false;
var is_ff = window.addEventListener ? true : false;
function refreshmainframe(e) {
	e = e ? e : window.event;
	actualCode = e.keyCode ? e.keyCode : e.charCode;
	if(actualCode == 116 && parent.main) {
		parent.main.location.reload();
		if(is_ie) {
			e.keyCode = 0;
			e.returnValue = false;
		} else {
			e.preventDefault();
		}
	}
}
function get_cookie(name) {
	cookiename = name + '=';
	cookiepos = document.cookie.indexOf(cookiename);
	if(cookiepos != -1) {
		cookiestart =cookiepos+cookiename.length;
		cookieend = document.cookie.indexOf(';', cookiestart);
		if(cookieend == -1) {
			cookieend = document.cookie.length;
		}
		return unescape(document.cookie.substring(cookiestart, cookieend));
	}
	return '';
}
function set_cookie(name, value) {
	expires = new Date();
	expires.setTime(expires.getTime() + 2592000);
	document.cookie = name + "=" + value + "; path=<?=$cookiepath?>; expires=" + expires.toGMTString();
}
function $(id) {
	return document.getElementById(id);
}
var collapsed=get_cookie('<?=$tablepre?>collapse');
function collapse_change(menucount) {
	if($('menu_' + menucount).style.display == 'none') {
		$('menu_' + menucount).style.display = '';collapsed = collapsed.replace('[' + menucount + ']' , '');
		$('menuimg_' + menucount).src = './images/admincp/menu_reduce.gif';
	} else {
		$('menu_' + menucount).style.display = 'none';collapsed += '[' + menucount + ']';
		$('menuimg_' + menucount).src = './images/admincp/menu_add.gif';
	}
	set_cookie('<?=$tablepre?>collapse', collapsed);
}
</script>
</head>

<body onkeydown="refreshmainframe(event)" style="margin:5px!important;margin:3px;">

<?
		$menu = $menu ? $menu : 'home';
		$collapse = $_DCOOKIE['collapse'];
		$menucount = 0;
		if($adminid == 1) {
			echo '<table width="146" border="0" cellspacing="0" align="center" cellpadding="0" class="leftmenulist" style="margin-bottom: 5px;">'.
				'<tr class="leftmenutext"><td><div align="center"><a href="'.$indexname.'" target="_blank">'.$lang['header_home'].'</a>&nbsp;&nbsp;<a href="#"  onClick="parent.menu.location=\'admincp.php?action=menu\'; parent.main.location=\'admincp.php?action=home\';return false;">'.$lang['header_admin'].'</a></div></td></tr>'.
				'</table>';
			echo '<div id="home">';
			showmenu($lang['menu_general'],	array(array('name' => $lang['menu_forums_edit'], 'url' => 'admincp.php?action=forumsedit'),
							array('name' => $lang['menu_members_edit'], 'url' => 'admincp.php?action=members'),
							array('name' => $lang['menu_members_edit_ban_user'], 'url' => 'admincp.php?action=banmember'),
							array('name' => $lang['menu_members_newsletter'], 'url' => 'admincp.php?action=members&submitname=newslettersubmit'),
							array('name' => $lang['menu_maint_threads'], 'url' => 'admincp.php?action=threads'),
							array('name' => $lang['menu_maint_prune'], 'url' => 'admincp.php?action=prune'),
							array('name' => $lang['menu_moderate_modthreads'], 'url' => 'admincp.php?action=modthreads'),
							array('name' => $lang['menu_moderate_modreplies'], 'url' => 'admincp.php?action=modreplies'),
							array('name' => $lang['menu_runwizard'], 'url' => 'admincp.php?action=runwizard')));
			showmenu($lang['menu_logs'],	array(array('name' => $lang['menu_logs_login'], 'url' => 'admincp.php?action=illegallog'),
							array('name' => $lang['menu_logs_rating'], 'url' => 'admincp.php?action=ratelog'),
							array('name' => $lang['menu_logs_credit'], 'url' => 'admincp.php?action=creditslog'),
							array('name' => $lang['menu_logs_mod'], 'url' => 'admincp.php?action=modslog'),
							array('name' => $lang['menu_logs_medal'], 'url' => 'admincp.php?action=medalslog'),
							array('name' => $lang['menu_logs_ban'], 'url' => 'admincp.php?action=banlog'),
							array('name' => $lang['menu_logs_admincp'], 'url' => 'admincp.php?action=cplog'),
							array('name' => $lang['menu_logs_error'], 'url' => 'admincp.php?action=errorlog')));
			echo '</div><div id="basic" style="display: none">';
			showmenu($lang['menu_settings'],array(array('name' => $lang['settings_general'], 'url' => 'admincp.php?action=settings&do=basic'),
							array('name' => $lang['settings_access'], 'url' => 'admincp.php?action=settings&do=access'),
							array('name' => $lang['settings_styles'], 'url' => 'admincp.php?action=settings&do=styles'),
							array('name' => $lang['settings_seo'], 'url' => 'admincp.php?action=settings&do=seo'),
							array('name' => $lang['settings_functions'], 'url' => 'admincp.php?action=settings&do=functions'),
							array('name' => $lang['settings_credits'], 'url' => 'admincp.php?action=settings&do=credits'),
							array('name' => $lang['settings_security'], 'url' => 'admincp.php?action=settings&do=security'),
							array('name' => $lang['settings_periods'], 'url' => 'admincp.php?action=settings&do=periods'),
							array('name' => $lang['settings_permissions'], 'url' => 'admincp.php?action=settings&do=permissions'),
							array('name' => $lang['settings_attachments'], 'url' => 'admincp.php?action=settings&do=attachments'),
							array('name' => $lang['settings_javascript'], 'url' => 'admincp.php?action=settings&do=javascript'),
							array('name' => $lang['settings_wap'], 'url' => 'admincp.php?action=settings&do=wap'),
							array('name' => $lang['settings_misc'], 'url' => 'admincp.php?action=settings&do=misc')));
			echo '</div><div id="forums" style="display: none">';
			showmenu($lang['menu_forums'],	array(array('name' => $lang['menu_forums_add'], 'url' => 'admincp.php?action=forumadd'),
							array('name' => $lang['menu_forums_edit'], 'url' => 'admincp.php?action=forumsedit'),
							array('name' => $lang['menu_forums_merge'], 'url' => 'admincp.php?action=forumsmerge'),
							array('name' => $lang['menu_forums_threadtypes'], 'url' => 'admincp.php?action=threadtypes')));
			if(isfounder()) {
				showmenu($lang['menu_styles'],	array(array('name' => $lang['menu_styles'], 'url' => 'admincp.php?action=styles'),
								array('name' => $lang['menu_styles_templates'], 'url' => 'admincp.php?action=templates')));
			} else {
				showmenu($lang['menu_styles'],	array(array('name' => $lang['menu_styles'], 'url' => 'admincp.php?action=styles')));
			}
			echo '</div><div id="users" style="display: none">';
			showmenu($lang['menu_members'], array(array('name' => $lang['menu_members_add'], 'url' => 'admincp.php?action=memberadd'),
							array('name' => $lang['menu_members_edit'], 'url' => 'admincp.php?action=members'),
							array('name' => $lang['menu_members_edit_ban_user'], 'url' => 'admincp.php?action=banmember'),
							array('name' => $lang['menu_members_merge'], 'url' => 'admincp.php?action=membersmerge'),
							array('name' => $lang['menu_members_ipban'], 'url' => 'admincp.php?action=ipban'),
							array('name' => $lang['menu_members_credits'], 'url' => 'admincp.php?action=members&submitname=creditsubmit'),
							array('name' => $lang['menu_moderate_modmembers'], 'url' => 'admincp.php?action=modmembers'),
							array('name' => $lang['menu_members_profile_fields'], 'url' => 'admincp.php?action=profilefields')));
			showmenu($lang['menu_groups'],	array(array('name' => $lang['menu_admingroups'], 'url' => 'admincp.php?action=admingroups'),
							array('name' => $lang['menu_usergroups'], 'url' => 'admincp.php?action=usergroups'),
							array('name' => $lang['menu_ranks'], 'url' => 'admincp.php?action=ranks')));
			echo '</div><div id="posts" style="display: none">';
			showmenu($lang['menu_moderate'],array(array('name' => $lang['menu_moderate_modthreads'], 'url' => 'admincp.php?action=modthreads'),
							array('name' => $lang['menu_moderate_modreplies'], 'url' => 'admincp.php?action=modreplies')));
			showmenu($lang['menu_maint'],	array(array('name' => $lang['menu_maint_threads'], 'url' => 'admincp.php?action=threads'),
							array('name' => $lang['menu_maint_prune'], 'url' => 'admincp.php?action=prune'),
							array('name' => $lang['menu_maint_attaches'], 'url' => 'admincp.php?action=attachments')));
			showmenu($lang['menu_posting'],	array(array('name' => $lang['menu_posting_discuzcodes'], 'url' => 'admincp.php?action=discuzcodes'),
							array('name' => $lang['menu_posting_censors'], 'url' => 'admincp.php?action=censor'),
							array('name' => $lang['menu_posting_smilies'], 'url' => 'admincp.php?action=smilies'),
							array('name' => $lang['menu_posting_attachtypes'], 'url' => 'admincp.php?action=attachtypes'),
							array('name' => $lang['menu_moderate_recyclebin'], 'url' => 'admincp.php?action=recyclebin')));
			echo '</div><div id="api" style="display: none">';
			showmenu($lang['menu_supesite'],array(array('name' => $lang['supe_settings'], 'url' => 'admincp.php?action=xspace')));
			showmenu($lang['menu_passport'],array(array('name' => $lang['menu_passport_settings'], 'url' => 'admincp.php?action=passport'),
							array('name' => $lang['menu_passport_pushthreads'], 'url' => 'admincp.php?action=pushthreads'),
							array('name' => $lang['menu_passport_siteengine'], 'url' => 'admincp.php?action=siteengine'),
							array('name' => $lang['menu_passport_shopex'], 'url' => 'admincp.php?action=shopex')));
			showmenu($lang['menu_qihoo'], array(array('name' => $lang['menu_qihoo_config'], 'url' => 'admincp.php?action=qihoo_config'),
							array('name' => $lang['menu_qihoo_topics'], 'url' => 'admincp.php?action=qihoo_topics')));
			showmenu($lang['menu_ecommerce'], array(array('name' => $lang['menu_ecommerce_alipay'], 'url' => 'admincp.php?action=alipay'),
							array('name' => $lang['menu_ecommerce_credit_orders'], 'url' => 'admincp.php?action=orders'),
							array('name' => $lang['menu_ecommerce_trade_orders'], 'url' => 'admincp.php?action=tradelog')));
			showmenu($lang['menu_plugins'],	array(array('name' => $lang['menu_plugins_edit'], 'url' => 'admincp.php?action=plugins'),
							array('name' => $lang['menu_plugins_config'], 'url' => 'admincp.php?action=pluginsconfig')));
			echo '</div><div id="others" style="display: none">';
			showmenu($lang['menu_misc'], 	array(array('name' => $lang['menu_misc_announces'], 'url' => 'admincp.php?action=announcements'),
							array('name' => $lang['menu_misc_medals'], 'url' => 'admincp.php?action=medals'),
							array('name' => $lang['menu_misc_advertisements'], 'url' => 'admincp.php?action=adv'),
							array('name' => $lang['menu_misc_links'], 'url' => 'admincp.php?action=forumlinks'),
							array('name' => $lang['menu_misc_crons'], 'url' => 'admincp.php?action=crons'),
							array('name' => $lang['menu_misc_onlinelist'], 'url' => 'admincp.php?action=onlinelist')));
			echo '</div><div id="tools" style="display: none">';
			if(isfounder()) {
				showmenu($lang['menu_database'],array(array('name' => $lang['menu_database_export'], 'url' => 'admincp.php?action=export'),
								array('name' => $lang['menu_database_import'], 'url' => 'admincp.php?action=import'),
								array('name' => $lang['menu_database_query'], 'url' => 'admincp.php?action=runquery'),
								array('name' => $lang['menu_database_optimize'], 'url' => 'admincp.php?action=optimize')));
			}
			showmenu($lang['menu_tools'],	array(array('name' => $lang['menu_members_newsletter'], 'url' => 'admincp.php?action=members&submitname=newslettersubmit'),
							array('name' => $lang['menu_tools_updatecaches'], 'url' => 'admincp.php?action=updatecache'),
							array('name' => $lang['menu_tools_updatecounters'], 'url' => 'admincp.php?action=counter'),
							array('name' => $lang['menu_tools_javascript'], 'url' => 'admincp.php?action=jswizard'),
							array('name' => $lang['menu_tools_fileperms'], 'url' => 'admincp.php?action=fileperms'),
							array('name' => $lang['menu_maint_pmprune'], 'url' => 'admincp.php?action=pmprune')));
			showmenu($lang['menu_logs'],	array(array('name' => $lang['menu_logs_login'], 'url' => 'admincp.php?action=illegallog'),
							array('name' => $lang['menu_logs_rating'], 'url' => 'admincp.php?action=ratelog'),
							array('name' => $lang['menu_logs_credit'], 'url' => 'admincp.php?action=creditslog'),
							array('name' => $lang['menu_logs_mod'], 'url' => 'admincp.php?action=modslog'),
							array('name' => $lang['menu_logs_medal'], 'url' => 'admincp.php?action=medalslog'),
							array('name' => $lang['menu_logs_ban'], 'url' => 'admincp.php?action=banlog'),
							array('name' => $lang['menu_logs_admincp'], 'url' => 'admincp.php?action=cplog'),
							array('name' => $lang['menu_logs_error'], 'url' => 'admincp.php?action=errorlog')));
			echo '</div>';
			echo '<table width="146" border="0" cellspacing="0" align="center" cellpadding="0" class="leftmenulist">'.
				'<tr class="leftmenutext"><td><div style="margin-left:48px;"><a href="admincp.php?action=logout" target="_top">'.$lang['menu_logout'].'</a></td></tr>'.
				'</table>';
		} else {
			//showmenu($lang['menu_home'],	'admincp.php?action=home');
			$menuarray = array();
			$menuarray[] = array('name' => $lang['menu_forums_rules'], 'url' => 'admincp.php?action=forumrules');
			if($allowedituser || $allowbanuser || $allowbanip || $allowpostannounce || $allowcensorword || $allowmassprune) {
				if($allowedituser) {
					$menuarray[] = array('name' => $lang['menu_members_edit'], 'url' => 'admincp.php?action=editmember');
				}
				if($allowbanuser) {
					$menuarray[] = array('name' => $lang['menu_members_edit_ban_user'], 'url' => 'admincp.php?action=banmember');
				}
				if($allowbanip) {
					$menuarray[] = array('name' => $lang['menu_members_ipban'], 'url' => 'admincp.php?action=ipban');
				}
				if($allowpostannounce) {
					$menuarray[] = array('name' => $lang['menu_misc_announces'], 'url' => 'admincp.php?action=announcements');
				}
				if($allowcensorword) {
					$menuarray[] = array('name' => $lang['menu_posting_censors'], 'url' => 'admincp.php?action=censor');
				}
				if($allowmassprune) {
					$menuarray[] = array('name' => $lang['menu_maint_prune'], 'url' => 'admincp.php?action=prune');
				}
			}
			showmenu($lang['menu_moderation'], $menuarray);
			unset($menuarray);

			if($allowmoduser || $allowmodpost) {
				$menuarray = array();
				if($allowmoduser) {
					$menuarray[] = array('name' => $lang['menu_moderate_modmembers'], 'url' => 'admincp.php?action=modmembers');
				}
				if($allowmodpost) {
					$menuarray[] = array('name' => $lang['menu_moderate_modthreads'], 'url' => 'admincp.php?action=modthreads');
					$menuarray[] = array('name' => $lang['menu_moderate_modreplies'], 'url' => 'admincp.php?action=modreplies');
				}
				showmenu($lang['menu_moderate'], $menuarray);
				unset($menuarray);
			}

			showmenu($lang['menu_plugins'],	array(array('name' => $lang['menu_plugins'], 'url' => 'admincp.php?action=plugins')));

			if($allowviewlog) {
				showmenu($lang['menu_logs'],	array(array('name' => $lang['menu_logs_rating'], 'url' => 'admincp.php?action=ratelog'),
								array('name' => $lang['menu_logs_mod'], 'url' => 'admincp.php?action=modslog'),
								array('name' => $lang['menu_logs_ban'], 'url' => 'admincp.php?action=banlog')));
			}

		}

?>

</body>
</html>