<?php
require '../../Run.php';
if($admin !=1 && $admin != 2)
{
	ehtml("您的操作权限不足，无法进入本页面!");
	exit();
}
$tpl_name = 'login';
$tpl_title = '登录模板';
if($_GET['action'] != NULL)
{
		$tpl_name = $_GET['action'];
		if($tpl_name == 'bbs')
		{
			$tpl_title = '论坛模板修改';
		}elseif($tpl_name == 'index'){
			$tpl_title = '电脑首页模板';
		}elseif($tpl_name == 'article'){
			$tpl_title = '文章模板修改';
		}elseif($tpl_name == 'loginok'){
			$tpl_title = '登录成功模板';
		}elseif($tpl_name == 'zone'){
			$tpl_title = '空间模板';
		}
}
$css = '<style>body,html{height:100%;}
textarea{height:80%;}</style>';
echo head($tpl_title,$css);
echo topNav($tpl_title,'<a href="../wap_admin.php?">后台</a>','<a href="../../index.php?">首页</a>');
if($_POST['add'] != NULL){
	$mysql = new D('dd_tpl');
	$back = $mysql->where(array('tplsiteid'=>WAPID,'tplsm'=>$tpl_name))->update(array('tplcontent'=>$_POST['content']));
	if($back == TRUE){
		echo '<div class="tip">';
		echo '修改模板成功!';
		echo '</div>';
	}else{
		echo '<div class="tip">';
		echo '修改模板失败!';
		echo '</div>';
	}
	echo '<div class="mylink">';
	echo '<a href="?action='.$tpl_name.'">返回上一页</a>';
	echo '</div>';
}else{
	echo '<div class="title">';
	echo '<a href="?action=login">登录页面模板</a>|';
	echo '<a href="?action=bbs">论坛阅读模板</a>|';
	echo '<a href="?action=index">电脑首页模板</a><br>';
	echo '<a href="?action=article">文章模板</a>|';
	echo '<a href="?action=loginok">登录成功</a>|';
	echo '<a href="?action=zone">空间模板</a>';
	echo '</div>';
	echo '<div style="height:90%;margin-left:10px;margin-right:10px;">';
	echo '<form method="post" action="?action='.$tpl_name.'" style="height:100%">';
	echo '<table width="100%" border="0" cellpadding="0" cellspacing="0" style="height:100%"><tr><td>';
	echo '<textarea name="content" style="width:100%;height:100%;font-family:\'微软雅黑\';">'.ddtpl($tpl_name).'</textarea>';
	echo '</td></tr><tr><td height="40">';
	echo '<input type="submit" style="height:40px;width:100%;" value="保存修改">';
	echo '<input name="add" value="login" type="hidden">';
	echo '</td></tr></table>';
	echo '</form>';
	echo '</div>';
}
echo '<div class="tip">';
echo '您可在本页面对系统界面进行微调，当您需要进行大规模修改时请谨慎操作!必要时您可以资讯专业的技术人员!切记!不可随意修改!';
echo '</div>';
echo footer(1);
?>