<?
define('ADMIN', 1);
include_once '../comm/dd.config.php';
dd_session_start();
if ($_GET['act'] == "menu") {
	$menu = new menu($_SESSION['ddadmin'], $duoduo);
	$res = $menu->get_menu();
	$menudata['homeInfo']['title'] = "后台管理";
	$menudata['homeInfo']['href'] = u($res['index']['mod'], $res['index']['act']);
	$menudata['logoInfo']['title'] = "后台管理";
	$menudata['logoInfo']['image'] = '/' . $webset['pc_logo'];
	$menudata['menuInfo'] = $res['data'];
	echo json_encode($menudata, JSON_UNESCAPED_UNICODE);
	exit();
}
if ($_GET['act'] == "upload") {

	if (isset($_FILES["file"])) {
		$file_name = upload("file", $saved_upload_name);
		$name = $_FILES["file"]['name'];
		$name = str_replace(strrchr($name, "."), "", $name);
		$data['title'] = $name;
		$data['src'] = "/" . $file_name;
		json(0, "", $data);
	}
}
if ($_GET['act'] == "deleteimg") {
	if ($_POST['url']) {
		unlink(DDROOT . $_POST['url']);
		json(0);
	}
}
if ($_GET['qz']) {
	$menu = new menu($_SESSION['ddadmin'], $duoduo);
	$menu->qzmenu();
}

if ($_GET['act'] == "changefield") {
	$res = db()->changefield($_REQUEST);
}
