<?php
require '../../../zb_system/function/c_system_base.php';
require '../../../zb_system/function/c_system_admin.php';
$zbp->Load();
$action='root';
if (!$zbp->CheckRights($action)) {$zbp->ShowError(6);die();}
if (!$zbp->CheckPlugin('SEOTools')) {$zbp->ShowError(48);die();}

$blogtitle='SEO小工具';
$act = "";
if ($_GET['act']){
$act = $_GET['act'] == "" ? 'config' : $_GET['act'];
}
require $blogpath . 'zb_system/admin/admin_header.php';
require $blogpath . 'zb_system/admin/admin_top.php';
?>
<div id="divMain">
  <div class="divHeader"><?php echo $blogtitle;?></div>
  <div class="SubMenu">
  <?php SEOTools_SubMenu($act);?>
  <a href="https://me.alipay.com/zrcs" target="_blank"><span class="m-left" style="color:#F00">赞助</span></a>
  <a href="http://www.fengwensheng.com/" target="_blank"><span class="m-right">帮助</span></a>
  </div>
  <div id="divMain2">
<!--代码-->
<?php if ($act == 'config'){ ?>
    <?php
	if(isset($_POST['distitle_seo'])){
		$zbp->Config('SEOTools')->distitle_seo=$_POST['distitle_seo'];
		$zbp->Config('SEOTools')->sys_tag=$_POST['sys_tag'];
		$zbp->Config('SEOTools')->dissys_tag=$_POST['dissys_tag'];
		$zbp->Config('SEOTools')->discos_tag=$_POST['discos_tag'];
		$zbp->Config('SEOTools')->tags_nums=$_POST['tags_nums'];
		$zbp->Config('SEOTools')->links_nums=$_POST['links_nums'];
		$zbp->SaveConfig('SEOTools');
		$zbp->SetHint('good');
		Redirect('./main.php?act=config');
	}
	?>

	<form id="form1" name="form1" method="post">  
    <table width="100%" style='padding:0;margin:0;' cellspacing='0' cellpadding='0' class="tableBorder">
		<tr>
			<th width="15%"><p align="center">配置名称</p></th>
			<th width="50%"><p align="center">配置内容</p></th>
			<th width="35%"><p align="center">配置说明</p></th>
		</tr>
		<tr>
			<td><label for="distitle_seo"><p align="center">标题优化(总开关)</p></label></td>
			<td><p align="left"><input type="text" id="distitle_seo" name="distitle_seo" class="checkbox" value="<?php echo $zbp->Config('SEOTools')->distitle_seo;?>"/></p></td>
			<td><p align="left">☆是否打开标题优化（默认关闭）</p></td>
		</tr>
		<tr>
			<td><label for="dissys_tag"><p align="center">系统标签</p></label></td>
			<td><p align="left"><input type="text" id="dissys_tag" name="dissys_tag" class="checkbox" value="<?php echo $zbp->Config('SEOTools')->dissys_tag;?>"/></p></td>
			<td><p align="left">☆是否打开替换系统标签</p></td>
		</tr>
		<tr>
			<td><label for="discos_tag"><p align="center">自定义链接</p></label></td>
			<td><p align="left"><input type="text" id="discos_tag" name="discos_tag" class="checkbox" value="<?php echo $zbp->Config('SEOTools')->discos_tag;?>"/></p></td>
			<td><p align="left">☆是否打开替换自定义链接</p></td>
		</tr>
		<tr>
			<td><label for="sys_tag"><p align="center">系统标签范围</p></label></td>
			<td><p align="left"><textarea name="sys_tag" type="text" id="sys_tag" style="width:98%;height:25px;"><?php echo htmlspecialchars($zbp->Config('SEOTools')->sys_tag);?></textarea></p></td>
			<td><p align="left">☆随机选取系统标签参数量</p></td>
		</tr>
		<tr>
			<td><label for="tags_nums"><p align="center">关键词重复</p></label></td>
			<td><p align="left"><textarea name="tags_nums" type="text" id="tags_nums" style="width:98%;height:25px;"><?php echo htmlspecialchars($zbp->Config('SEOTools')->tags_nums);?></textarea></p></td>
			<td><p align="left">☆单篇文章重复关键词替换次数，默认一次</p></td>
		</tr>
		<tr>
			<td><label for="links_nums"><p align="center">锚文本数</p></label></td>
			<td><p align="left"><textarea name="links_nums" type="text" id="sys_tag" style="width:98%;height:25px;"><?php echo htmlspecialchars($zbp->Config('SEOTools')->links_nums);?></textarea></p></td>
			<td><p align="left">☆单篇文章内容允许最大链接数<br>(实际等于设置值乘以关键词重复次数)</p></td>
		</tr>
	</table>
	<br />
   <input name="" type="Submit" class="button" value="保存"/>
    </form>


    <?php
	}
	if ($act == 'title'){
	?>
    <?php
	if(isset($_POST['title_keywords'])){
		$zbp->Config('SEOTools')->title_keywords=$_POST['title_keywords'];
		$zbp->Config('SEOTools')->title_description=$_POST['title_description'];
		$zbp->Config('SEOTools')->title_ms=$_POST['title_ms'];
		$zbp->Config('SEOTools')->title_change=$_POST['title_change'];	
		$zbp->SaveConfig('SEOTools');
		$zbp->SetHint('good');
		Redirect('./main.php?act=title');
	}
	?>

	<form id="form1" name="form1" method="post">  
    <table width="100%" style='padding:0;margin:0;' cellspacing='0' cellpadding='0' class="tableBorder">
		<tr>
			<th width="15%"><p align="center">配置名称</p></th>
			<th width="50%"><p align="center">配置内容</p></th>
			<th width="35%"><p align="center">配置说明</p></th>
		</tr>
		<tr>
			<td><label for="title_change"><p align="center">标题互换</p></label></td>
			<td><p align="left"><input type="text" id="title_change" name="title_change" class="checkbox" value="<?php echo $zbp->Config('SEOTools')->title_change;?>"/></p></td>
			<td><p align="left">除首页外，其他页面标题互换</p></td>
		</tr>
		<tr>
			<td><label for="title_keywords"><p align="center">首页关键词</p></label></td>
			<td><p align="left"><textarea name="title_keywords" type="text" id="title_keywords" style="width:98%;"><?php echo $zbp->Config('SEOTools')->title_keywords;?></textarea></p></td>
			<td><p align="left">首页关键词</p></td>
		</tr>
		<tr>
			<td><label for="title_description"><p align="center">首页描述</p></label></td>
			<td><p align="left"><textarea name="title_description" type="text" id="title_description" style="width:98%;"><?php echo htmlspecialchars($zbp->Config('SEOTools')->title_description);?></textarea></p></td>
			<td><p align="left">首页描述</p></td>
		</tr>
		<tr>
			<td><label for="title_ms"><p align="center">文章页描述字数</p></label></td>
			<td><p align="left"><textarea name="title_ms" type="text" id="title_ms" style="width:98%;"><?php echo htmlspecialchars($zbp->Config('SEOTools')->title_ms);?></textarea></p></td>
			<td><p align="left">文章页描述获字数</p></td>
		</tr>
	</table>
	<br />
   <input name="" type="Submit" class="button" value="保存"/>
    </form>
<p>☆博客标题优化，文章页加描述关键词（根据“唐朝”标题SEO插件修改，版权归原作者所有）</p>


    <?php
	}
	if ($act == 'content'){
	?>
    <?php
	if(isset($_POST['article_top'])){
		$zbp->Config('SEOTools')->article_top=$_POST['article_top'];
		$zbp->Config('SEOTools')->article_foot=$_POST['article_foot'];
		$zbp->SaveConfig('SEOTools');
		$zbp->SetHint('good');
		Redirect('./main.php?act=content');
	}
	?>

	<form id="form1" name="form1" method="post">  
    <table width="100%" style='padding:0;margin:0;' cellspacing='0' cellpadding='0' class="tableBorder">
		<tr>
			<th width="15%"><p align="center">配置名称</p></th>
			<th width="50%"><p align="center">配置内容（不添加请留空）</p></th>
			<th width="35%"><p align="center">配置说明</p></th>
		</tr>
		<tr>
			<td><label for="article_top"><p align="center">文章首部添加</p></label></td>
			<td><p align="left"><textarea name="article_top" type="text" id="article_top" style="width:98%;"><?php echo htmlspecialchars($zbp->Config('SEOTools')->article_top);?></textarea></p></td>
			<td><p align="left">广告小方块左浮动：(不添加请留空。。)<br />&lt;div style=&quot float:left; padding-right: 5px;&quot &gt;您的代码 &lt;/div&gt;</p></td>
		</tr>
		<tr>
			<td><label for="article_foot"><p align="center">文章尾部添加</p></label></td>
			<td><p align="left"><textarea name="article_foot" type="text" id="article_foot" style="width:98%;"><?php echo htmlspecialchars($zbp->Config('SEOTools')->article_foot);?></textarea></p></td>
			<td><p align="left">广告小方块右浮动：(不添加请留空。。)<br />&lt;div style=&quot float:right; padding-left: 5px;&quot &gt;您的代码 &lt;/div&gt;</p></td>
		</tr>
	</table>
	<br />
   <input name="" type="Submit" class="button" value="保存"/>
    </form>
<p>☆在文章内放置Google、Baidu广告（头部、尾部、任意部位）<br>
☆为文章添加一键分享功能<br>
</p>

    <?php
	}
	if ($act == 'links'){
	?>

<!--  会存不会修
	<?php
	if(isset($_POST['title'])){
	$kw=new SEOTools;
	$kw->Title=$_POST["title"];
	$kw->Des=$_POST["des"];
	$kw->Url=$_POST["url"];
	$kw->IsUsed=$_POST["IsUsed"];
	$kw->Save();
	}
	?>
-->

<?php
		$str = '<form action="save.php?type=add" method="post">
				<table width="100%" border="1" class="tableBorder">
				<tr>
					<th scope="col" width="5%" height="32" nowrap="nowrap">序号</th>
					<th scope="col" width="25%">关键字</th>
					<th scope="col" width="25%">描述</th>
					<th scope="col" width="25%">链接</th>
					<th scope="col" width="10%">替换</th>
					<th scope="col" width="10%">操作</th>
				</tr>';
		$str .= '<tr>';
		$str .= '<td align="center">0</td>';
		$str .= '<td><input type="text" class="sedit" name="title" value=""></td>';
		$str .= '<td><input type="text" class="sedit" name="des" value=""></td>';
		$str .= '<td><input type="text" class="sedit" name="url" value=""></td>';
		$str .= '<td><input type="text" class="checkbox" name="IsUsed" value="1" /></td>';
		$str .= '<td><input type="hidden" name="editid" value="">
						<input name="add" type="submit" class="button" value="增加"/></td>';
		$str .= '</tr>';
		$str .= '</form>';
		$where = array(array('=','KeyWord_Type','0'));
		$order = array('KeyWord_IsUsed'=>'DESC','KeyWord_Order'=>'ASC');
		$sql= $zbp->db->sql->Select($zbp->table['SEOTools'],'*',$where,$order,null,null);
		$array=$zbp->GetListCustom($zbp->table['SEOTools'],$zbp->datainfo['SEOTools'],$sql);
		$i =1;
		foreach ($array as $key => $reg) {
			$str .= '<form action="save.php?type=add" method="post" name="keyword">';
			$str .= '<tr>';
			$str .= '<td align="center">'.$i.'</td>';
			$str .= '<td><input type="text" class="sedit" name="title" value="'.$reg->Title.'" ></td>';
			$str .= '<td><input type="text" class="sedit" name="des" value="'.$reg->Des.'" ></td>';
			$str .= '<td><input type="text" class="sedit" name="url" value="'.$reg->Url.'" ></td>';
			$str .= '<td><input type="text" class="checkbox" name="IsUsed" value="'.$reg->IsUsed.'" /></td>';
			$str .= '<td nowrap="nowrap">
						<input type="hidden" name="editid" value="'.$reg->ID.'">
						<input name="edit" type="submit" class="button" value="修改"/>
						<input name="del" type="button" class="button" value="删除" onclick="if(confirm(\'您确定要进行删除操作吗？\')){location.href=\'save.php?type=del&id='.$reg->ID.'\'}"/>
					</td>';
			$str .= '</tr>';
			$str .= '</form>';
			$i++;
		}
		$str .='</table>';
		echo $str;
?>

    <?php
	}
	?>

  </div>
</div>
<script type="text/javascript">AddHeaderIcon("<?php echo $bloghost . 'zb_users/plugin/SEOTools/logo.png';?>");</script>
<script type="text/javascript">
ActiveTopMenu("topmenu_SEOTools");
</script> 
<?php
require $blogpath . 'zb_system/admin/admin_footer.php';
RunTime();
?>
