<?php

/*

'**************************************************************************************************

' 软件名称: 黑色幻想舞曲管理系统CMS2.0

' 版本编号: hshxsdj 2.0

' 官方网站: http://www..hshxs.com

' 官方论坛：http://bbs.hshxs.com

' 版权所有: 黑色幻想开发团队    噬己翼(QQ:532917920)

' 郑重声明:

'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；

'    2、黑色幻想网络事业部保留此软件的法律追究权利

'**************************************************************************************************

*/

include "../include/conn.php";

include "../include/function.php";

include "admin_version.php";

include "admin_loginstate.php";

?>

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>文章专题管理</title>

<script type="text/javascript" language="javascript">var tentpath='<?php echo S_SitePath?>';</script>

<script src="js/jquery.js" language="javascript"></script>

<script src="js/Function.JS" language="javascript"></script>

<script language="javascript" src="js/topic.js"></script>

<script language="javascript" src="js/alerts.js"></script>

<link type="text/css" href="images/alerts.css" rel="stylesheet" media="screen">

<script language="javascript">

<!--

$(document).ready(function(){

	$("#button").click(function(){

		var TopicName=$("#TopicName").val();

		var Template=$("#Template").val();

		var Cname=$("#Cname").val();

		var re = /^[a-z0-9]*$/gi

	$("#TopicName").css("border-color","#666 #ccc #ccc #666");

	$("#Template").css("border-color","#666 #ccc #ccc #666");

	$("#Cname").css("border-color","#666 #ccc #ccc #666");

	$("#topname").text("");

	$("#stemplate").text("");

	$("#scname").text("");

		if(TopicName==""){

		$("#TopicName").css("border","1px solid red");

		$("#topname").text("请填写专题名称！").css("color","red");

		$("#TopicName").focus();

		jAlert("请填写专题名称！","操作提示");

		return false;

		}

		else if(Template==""){

		$("#Template").css("border","1px solid red");

		$("#stemplate").text("请指定专题模板文件！").css("color","red");

		$("#Template").focus();

		jAlert("请指定专题模板文件！","操作提示");

		return false;

		}

		else if(Cname==""){

		$("#Cname").css("border","1px solid red");

		$("#scname").text("请填写专题别名！").css("color","red");

		$("#Cname").focus();

		jAlert("请填写专题别名！","操作提示");

		return false;}	

		else if(re.test(Cname)==false){

		$("#Cname").css("border","1px solid red");

		jAlert("英文别名必须是数字或字母组成！","操作提示");

		return false;}

	})

$("#btn_spanall").click(function(){

		jConfirm('您确定要生成选中的专题吗！', '操作提示', function(r) {

				if(r==true){

					form1.action='?action=span';

					form1.submit();

					}

				});

	 })

	

$("#btn_delall").click(function(){

		jConfirm('您确定删除选中的视频专题吗?', '操作提示', function(r) {

				if(r==true){

					form1.action='?action=delall';

					form1.submit();

					}

				});

	 })	

	

	

})



function del(id){

	jConfirm('您确定删除该视频专题吗?', '操作提示', function(r) {

		if(r==true){

			window.location='?action=del&S_ID='+id;

			}

				});

		

		}



function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}

//-->

</script>

<link  href="images/style.css" rel="stylesheet" type="text/css" />

</head>



<body>

<?php

SystemPer(4);

	class ui_topic{

		public function editdata($Arr,$url){

			global $editor;

			$editor->BasePath='edit';

			$editor->Height=465;

			$editor->Width=650;

			$editor->AutoSave=false;

						$name=$Arr[0];

						$color=$Arr[1];

						$aname=$Arr[2];

						$temp=$Arr[3];

						$pic=$Arr[4];

						$reco=$Arr[5];

						$hits=$Arr[6];

						$hide=$Arr[7];

						$key=$Arr[8];

						$remark=$Arr[9];

						$content=$Arr[10];

			$editor->Value=	$content;		

			//图片保存路径session

			$_SESSION['imgtypes']="topic";

			if(IsNul($name)){

				$actionname="编辑";

				}

			else{

				$actionname="添加";

				}	

?>

<div class="r_main">

	<div class="r_content">

		<div class="r_content_1">

					<form id="form1" name="form1" method="post" action="<?php echo $url?>">

                <table width="100%" border="0" cellpadding="0" cellspacing="0"  class="tb_style">

                    <tr>

                      <td class="td_title" colspan="2" >&nbsp;<?php echo $actionname?>视频专题</td>

                    </tr>

                	<tr>

<td width="85"   height="30" class="td_border">&nbsp;专题名称：</td>

                    <td width="666" class="td_border"><input type="text" name="TopicName" id="TopicName" value="<?php echo $name?>" size="35" />

                      <font color="#FF0000">＊</font>&nbsp; <label id="topname"></label>                                   颜色：<select name="Color" >

	<?php if(!IsNul($color)){?>

		<option  value=""></option>

        <?php }

	   else{

		?>

		<option style="background-color:<?php echo $color?>;color: <?php echo $color?>" value="<?php echo $color?>"></option>

		<?php }?>

		<option style="background-color:#00FF00;color: #00FF00" value="#00FF00">绿色</option>

		<option style="background-color:#0000CC;color: #0000CC" value="#0000CC">深蓝</option>

		<option style="background-color:#FFFF00;color: #FFFF00" value="#FFFF00">黄色</option>

		<option style="background-color:#FF33CC;color: #FF33CC" value="#FF33CC">粉红</option>

		<option style="background-color:#FF0000;color: #FF0000" value="#FF0000">红色</option>

		<option style="background-color:#660099;color: #660099" value="#660099">紫色</option>

		<option style="background-color:#FFFFFF;color: #FFFFFF" value="">无色</option>

									

					  </select></td></tr>

                    <tr>

                      <td width="85" height="30" class="td_border">&nbsp;英文别名：</td>

                      <td class="td_border" >

<input type="text" name="Cname" id="Cname" value="<?php echo $aname?>" size="35" />

<font color="#FF0000">＊</font>&nbsp;&nbsp;&nbsp;<label id="scname"></label></td></tr>

                    <tr>

                      <td width="85" height="30" class="td_border">&nbsp;专题模板：</td>

                      <td class="td_border" >

                      <input type="text" name="Template" id="Template" <?php if(!IsNul($temp)){?> value="vodtopic.html"<?php }else{?>value="<?php echo $temp?>"<?php }?> size="35" />

                      <font color="#FF0000">＊</font><label id="stemplate"></label>

                      <input type="checkbox" name="edittime" class="checkbox" id="edittime"   value="1" checked="checked"/>

更新时间</td></tr>

                      <tr>

                        <td width="85" height="30" class="td_border">&nbsp;专题图片：</td>

                        <td class="td_border" ><input name="S_Pic" type="text" id="S_Pic" value="<?php echo $pic?>" size="35" />

                          <input type="button" name="doClear" id="doClear"class="rb1" value="清  除" onclick="javascript:document.form1.TheImg.value='';"/><iframe src="js/upload.php?action=topic" scrolling="no" topmargin="0" width="300" height="30" marginwidth="0" marginheight="0" frameborder="0" align="center"></iframe></td>

                    </tr>



                    <tr>

                      <td width="85" height="30" class="td_border">&nbsp;推荐星级：</td>

                      <td class="td_border" ><select name="Reco" id="Reco" style=" color:#FF0000; " >

                          <option value="0" <?php if($reco==0){echo "selected";}?>>取消</option>

                          <option value="1" <?php if($reco==1){echo "selected";}?>>一星</option>

                          <option value="2" <?php if($reco==2){echo "selected";}?>>二星</option>

                          <option value="3" <?php if($reco==3){echo "selected";}?>>三星</option>

                          <option value="4" <?php if($reco==4){echo "selected";}?>>四星</option>

                          <option value="5" <?php if($reco==5){echo "selected";}?>>五星</option>

                        </select>

                     &nbsp; 人气:

                      <input type="text" name="Hits" id="Hits" value="<?php if(!IsNum($hits)){$hits=0;}?><?php echo $hits?>"  size="5" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>                      

                      &nbsp;&nbsp;是否隐藏：

                    <input type="radio" name="IsHide" id="IsHide"  checked value="0" class="radio" />显 示&nbsp;&nbsp;<input type="radio" name="IsHide" id="IsHide" <?php if($hide==1){echo "checked";}?> value="1"  class="radio"/>

                    隐 藏  <label id="shits"></label>                  </td></tr>

                    <tr>

                      <td width="85" height="30" class="td_border">&nbsp;专题作者：</td>

                      <td class="td_border" ><input type="text" name="keyword2" id="keyword2" value="<?php echo $key?>" size="50" />

                        <font color="#FF0000">&nbsp;＊请使用站内注册会员名</font></td>

                    </tr>

                    <tr>

                      <td height="30" class="td_border">&nbsp;专题概述：</td>

                      <td class="td_border" ><font color="#FF0000">

                        <textarea name="S_Remark"  id="S_Remark"cols="83" rows="3"><?php echo $remark?></textarea>

                      <br />

                      ＊不填写则自动截取专题介绍的前100个字符</font></td>

                    </tr>

                    <tr>

                      <td width="85" height="30" class="td_border">&nbsp;专题介绍：</td>

                      <td class="td_border" ><?php

                      $editor->Create();

					  ?></td></tr>

                    <tr><td height="50" colspan="2" align="center" class="td_border" ><input type="submit" name="button" id="button" value="确定提交" class="rb1"/>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;

<input type="reset" name="button2" id="button2" value="清除重设" class="rb1"/></td>

                    </tr>

                </table>

</form>

		</div>

	</div>

</div>

<?php			

			}

		

		public function main($sql,$size){

			global $db;

			$Arr=getpagerow($sql,$size);//sql,每页显示条数

			$result=$db->query($Arr[2]);

			$action=SafeRequest("action","get");

			$articletopicnum=$db->num_rows($result);

?>

<div class="r_main">

	<div class="r_content">

		<div class="r_content_1">

                <form id="form1" action="" method="post" name="form1">

                    <table width="100%" border="0" cellpadding="0" cellspacing="0"  class="tb_style">

                     <tr>

                       <td colspan="8" class="td_title">&nbsp;视频专题列表</td>

                     </tr>

                     <tr>

                       <td height="40" colspan="8" class="td_border">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 关键字：

                         <input name="keyword" type="text" id="keyword" value="" size="25" >

                         <input type="hidden" id="types" name="types" value="1">

                         <input type="button" id="search" value="搜索" class="rb1" >

&nbsp;&nbsp;&nbsp;&nbsp;

<select name="select"  onchange="MM_jumpMenu('self',this,0)">

  <option value="admin_video.asp">查看选项</option>

  <option value="?action=listbyreco">推荐星级</option>

  <option value="?action=listhide">隐藏专题</option>

  <option value="?action=listunhide">显示专题</option>

  <option value="?action=listtimeup">时间升序</option>

  <option value="?action=listtimedown">时间降序</option>

  <option value="?action=listidup">序号升序</option>

  <option value="?action=listiddown">序号降序</option>

  <option value="?action=listbyhits">人气升序</option>

  <option value="?action=listbyhitsa">人气降序</option>

</select></td>

                      </tr>

                      <tr>

                        <td width="10%" height="30" bgcolor="#FFFFFF"  class="td_btop3">&nbsp;&nbsp;编号

                     	<?php if($action=="listidup"){?>

                       			 <a href="?action=listiddown"><img src="images/down.gif" border="0" alt="点击按ID升序排列"></a>

                        <?php	}

							else{

						?>

								<a href="?action=listidup"><img src="images/up.gif" border="0" alt="点击按ID升序排列"></a>

						<?php		}?>                       

                        </td>

                        <td width="25%" height="30" bgcolor="#FFFFFF"  class="td_btop3">&nbsp;专题名称</td>

                        <td width="8%" align="center" bgcolor="#FFFFFF"  class="td_btop3">人气

                     	<?php if($action=="listbyhits"){?>

                        <a href="?action=listbyhitsa"><img src="images/up.gif" border="0" alt="点击按人气排序"></a>

                        <?php }else{?>

                         <a href="?action=listbyhits"><img src="images/down.gif" border="0" alt="点击按人气排序"></a>

                        <?php }?>                       

                        </td>

                        <td width="14%" align="center" bgcolor="#FFFFFF" class="td_btop3">英文别名</td>

                        <td width="13%"    align="center" bgcolor="#FFFFFF" class="td_btop3">推荐星级

                     <?php if($action=="listbyreco"){?>

                    	<a href="?action=listbyrecoa"><img src="images/up.gif" border="0" alt="点击按星级排序"></a>

                    <?php }else{?>

                    	<a href="?action=listbyreco"><img src="images/down.gif" border="0" alt="点击按星级排序"></a>

                    <?php }?>                       

                        </td>

                        <td width="13%"    align="center" bgcolor="#FFFFFF" class="td_btop3">更新时间

                     <?php if($action=="listbytime"){?>

                    	<a href="?action=listbytimea"><img src="images/up.gif" border="0" alt="点击按星级排序"></a>

                    <?php }else{?>

                    	<a href="?action=listbytime"><img src="images/down.gif" border="0" alt="点击按星级排序"></a>

                    <?php }?>                       

                        </td>

                        <td width="5%"   align="center" bgcolor="#FFFFFF" class="td_btop3">显示</td>

                        <td width="12%"   align="center" bgcolor="#FFFFFF" class="td_btop3">操作</td>

                      </tr>

                       <?php

					   if($articletopicnum==0) echo "

							<tr>

                            	<td colspan=\"8\" class=\"td_border\" height=\"30\" align=center><b>Sorry！暂无文章专题,请添加！</b></td>

                            </tr>";						   

                       if($result){

						   while ($row = $db ->fetch_array($result)){



					   ?> 

                       <tr>

                        <td width="8%" height="30" bgcolor="#FFFFFF" class="td_border">&nbsp;<input type="checkbox" id="S_ID" name="S_ID[]" value="<?php echo $row['S_ID']?>" class="checkbox">

                         <?php echo $row['S_ID']?>、</td>

                        <td width="25%" height="30" bgcolor="#FFFFFF" class="td_border">&nbsp;<font color="<?php echo $row['S_Color']?>"><?php echo $row['S_Name']?></font>&nbsp;<font color="#ff0000">(共<?php

           		$sqlstr="select * from s_video where S_Topic=".$row['S_ID']."";

        		$res=$db -> query($sqlstr);

 				$nums= $db -> num_rows($res);

				echo $nums;

						?>条)</font></a></td>

                        <td width="8%" height="30" align="center" bgcolor="#FFFFFF" class="td_border"><?php echo $row['S_Hits']?></td>

                        <td width="14%" height="30" align="center" bgcolor="#FFFFFF" class="td_border"><?php echo $row['S_AliasName']?></td>

                        <td width="13%" height="30" align="center" bgcolor="#FFFFFF" class="td_border"id="S_Reco<?php echo $row['S_ID']?>">&nbsp;

                         <script language="javascript">ShowStar(<?php echo $row['S_Reco']?>,<?php echo $row['S_ID']?>)</script></td>

                        

                        <td width="15%" height="30" align="center" bgcolor="#FFFFFF" class="td_border">

						<?php 

								if(date("Y-m-d",strtotime($row['S_AddTime']))==date('Y-m-d')){

									echo "<font color=red>".date("Y-m-d",strtotime($row['S_AddTime']))."</font>";

									}

								else{

									echo date("Y-m-d",strtotime($row['S_AddTime']));

									}	

								?>

                                </td>

                        <td width="5%" height="30" align="center" bgcolor="#FFFFFF" class="td_border"><a href="?action=ishide&amp;S_ID=<?php echo $row['S_ID']?>&amp;S_IsHide=<?php echo $row['S_IsHide']?>">

                          <?php if($row['S_IsHide']==0){echo "<img src='../images/common/yes.gif'/>";}else{echo "<img src='../images/common/no.gif'/>";}?>

                        </a><a href="?action=ishide&S_ID=<?php echo $row['S_ID']?>&S_IsHide=<?php echo $row['S_IsHide']?>"></a></td>

                        <td width="12%" height="30" align="center" bgcolor="#FFFFFF" class="td_border">&nbsp;<a href="?action=editdata&S_ID=<?php echo $row['S_ID']?>">编辑</a> &nbsp;<a style="cursor:pointer;" onclick="del(<?php echo $row['S_ID']?>)">删除</a></td>

                      </tr>

                         <?php

							   }

					   }

					?> 

		

                  

                    <tr>

                        <td height="30" colspan="8" align="left" class="td_border" bgcolor="#FFFFFF">&nbsp;<input type="checkbox" value="" class="checkbox" id="ChkAll" name="ChkAll" />

                        全选&nbsp;&nbsp;&nbsp;&nbsp; <input type="button" value="删除删除专题" class="rb1" id="btn_delall"  >

                       &nbsp; &nbsp;<input type="button" name="button" value="批量生成" class="rb1"  id="btn_spanall" disabled="disabled"/>&nbsp; &nbsp;

                        <input type="button" value="增加新主题" onClick="location.href='?action=add'" class="rb1" /></td>

                      </tr>

                   <tr>

				    <td height="30" colspan="8" align="right" class="td_border"><?php echo $Arr[0];?></td>

			      </tr> 

                  </table> 

     </form>

		</div>

	</div>

</div>

<?php			

			}

		

		}

?>        



<?php

$ui=new ui_topic;

include_once('../images/edit/sinaEditor.class.php');

$editor=new sinaEditor('gently_editor');

$action=SafeRequest("action","get");

switch($action){

	case 'main':

		$ui->main("select * from s_topic where S_SystemID=2",20);

		break;

	case 'add':

		add();

		break;

	case 'saveadd':

		saveadd();

		break;

	case 'editdata':

		editdata();

		break;

	case 'saveedit':

		saveedit();

		break;

	case 'del':

		del();

		break;

	case 'delall':

		delall();

		break;

	case 'listbysc':

		search();

		break;

	case 'listidup':

		listidup();

		break;

	case 'listbyhits':

		listbyhits();

		break;

	case 'listbyreco':

		listbyreco();

		break;

	case 'listbyrecoa':

		listbyrecoa();

		break;

	case 'listbytime':

		listbytime();

		break;

	case 'listbytimea':

		listbytimea();

		break;

	case 'ishide':

		ishide();

		break;		

	default:

		$ui->main("select * from s_topic where S_SystemID=2 order by S_ID desc",20);

	}

	function ishide(){

		global $db;

		$ishide=SafeRequest("S_IsHide","get");

		$id=SafeRequest("S_ID","get");

		if(!IsNum($ishide)) $ishide=0;

		if(!IsNum($id)) die("<script>jAlert('id传输错误?','操作提示',function(R){history.back();})</script>");

		if($ishide==1){

			$ishide=0;

			}

		else{

			$ishide=1;

			}	

		$sql="update s_topic set S_IsHide=$ishide where S_ID=$id";

		if($db->query($sql)){

			die("<script>window.location='admin_articletopic.php';</script>");

			}

		else{

			die("<script>jAlert('未知错误!','操作提示',function(R){history.back();})</script>");

			}		

		}

	//时间

	function listbytime(){

		global $ui;

		$ui->main("select * from s_topic  where  S_SystemID=2 order by S_AddTime desc",30);				

		}

	function listbytimea(){

		global $ui;

		$ui->main("select * from s_topic  where S_SystemID=2 order by S_AddTime asc",30);				

		}	

	

	//星级

	function listbyreco(){

		global $ui;

		$ui->main("select * from s_topic  where  S_SystemID=2 order by S_Reco desc",30);		

		}

	function listbyrecoa(){

		global $ui;

		$ui->main("select * from s_topic  where S_SystemID=2 order by S_Reco asc",30);		

		}	

	//人气

	function listbyhits(){

		global $ui;

		$ui->main("select * from s_topic  where S_SystemID=2 order by S_Hits desc",30);

		}

	function listbyhitsa(){

		global $ui;

		$ui->main("select * from s_topic where  S_SystemID=2 order by S_Hits asc",30);		

		}	

	//id升序

	function listidup(){

		global $ui;

		$ui->main("select * from s_topic   where S_SystemID=2 order by S_ID asc",30);

		}



	function search(){

		global $ui;

		$key=SafeRequest("keyword","get");

		$sql="select * from s_topic where S_SystemID=2 and S_Name like '%".$key."%'";

		$ui->main($sql,20);

		}

	

	function delall(){

		global $db;

		$S_ID=RequestBox("S_ID");

		$sql="delete from s_topic where S_ID in ($S_ID)";

		//die($S_ID);

		if($S_ID=="0"){

			die("<script>jAlert('请选择要删除的专题?','操作提示',function(R){history.back();})</script>");

			}

		else{

			if($db->query($sql)){

				die("<script>jAlert('恭喜你！操作成功了！','成功提示',function(R){window.location='admin_articletopic.php';})</script>");

				}

			else{

				die("<script>jAlert('专题删除失败','操作提示',function(R){window.location='admin_articletopic.php';})</script>");

				}	

			}

		}

	

	function del(){

		global $db;

		$S_ID=SafeRequest("S_ID","get");

		$sql="delete from s_topic where S_ID='".$S_ID."'";

		//die($sql);

		if($db->query($sql)){

			echo "<script>window.location='admin_articletopic.php';</script>";

			}

		else{

			die("<script>jAlert('专题删除失败','操作提示',function(R){window.location='admin_articletopic.php';})</script>");

			}	

		}

	

	function saveedit(){

		global $db;

		$S_ID=SafeRequest("S_ID","get");

		$TopicName = SafeRequest("TopicName","post");

		$Template = SafeRequest("Template","post");

		$Cname = SafeRequest("Cname","post");

		$S_Pic = SafeRequest("S_Pic","post");

		$S_Content = SafeRequest("gently_editor","post");

		$S_Content1 = SafeRequest("S_Content","post");

		$IsHide = SafeRequest("IsHide","post");

		$Color=SafeRequest("Color","post");

		$Keyword=SafeRequest("keyword2","post");

		$Hits = SafeRequest("Hits","post");

		if(!IsNum($Hits)){$Hits==0;}

		$Reco= SafeRequest("Reco","post");

		$S_Remark = SafeRequest("S_Remark","post");

		$S_AddTime =date("Y-m-d");

		if(!IsNul($S_Remark)) $S_Remark=substr(strip_tags($S_Content),0,100);

		$sql="update s_topic set S_Name='".$TopicName."',S_Keywords='".$Keyword."',S_Color='".$Color."',S_AliasName='".$Cname."',S_Pic='".$S_Pic."',S_Template='".$Template."',S_Remark='".$S_Remark."',S_Content='".$S_Content."',S_Reco=".$Reco.",S_IsHide=".$IsHide.",S_Hits=".$Hits.",S_AddTime='".$S_AddTime."' where S_ID=".$S_ID."";

		//die($sql);

		if($db->query($sql)){

			echo "<script>window.location='admin_articletopic.php';</script>";

			}

		else{

			die("<script>jAlert('专题编辑失败','操作提示',function(R){window.location='admin_articletopic.php';})</script>");

			}	

		}

	

	function editdata(){

		global $ui;

		global $db;

		$S_ID=SafeRequest("S_ID","get");

		$sql="Select * from s_topic where S_ID=".$S_ID."";

		if($row=$db->Getrow($sql)){

			$Arr=array($row['S_Name'],$row['S_Color'],$row['S_AliasName'],$row['S_Template'],$row['S_Pic'],$row['S_Reco'],$row['S_Hits'],$row['S_IsHide'],$row['S_Keywords'],$row['S_Remark'],$row['S_Content']);

			}

		$ui->editdata($Arr,"?action=saveedit&S_ID=".$S_ID."");



		}

	

	function add(){

		global $ui;

		$Arr=array("","","","","","","",0,"","","","");

		$ui->editdata($Arr,"?action=saveadd");

		}

	function saveadd(){

		global $db;

		//$gently_editor=SafeRequest("gently_editor","post");

		$TopicName = SafeRequest("TopicName","post");

		$Template = SafeRequest("Template","post");

		$Cname = SafeRequest("Cname","post");

		$S_Pic = SafeRequest("S_Pic","post");

		$S_Content = SafeRequest("gently_editor","post");

		$S_Content1 = SafeRequest("S_Content","post");

		$IsHide = SafeRequest("IsHide","post");

		$Color=SafeRequest("Color","post");

		$Keyword=SafeRequest("keyword2","post");

		$Hits = SafeRequest("Hits","post");

		if(!IsNum($Hits)){$Hits==0;}

		$Reco= SafeRequest("Reco","post");

		$S_Remark = SafeRequest("S_Remark","post");

		$S_AddTime =date("Y-m-d");

		if(!IsNul($S_Remark)) $S_Remark=substr(strip_tags($S_Content),0,100);

		$sql="Insert s_topic  (S_Name,S_Keywords,S_Color,S_AliasName,S_Pic,S_Template,S_Remark,S_Content,S_Reco,S_IsHide,S_SystemID,S_Hits,S_AddTime) values ('".$TopicName."','".$Keyword."','".$Color."','".$Cname."','".$S_Pic."','".$Template."','".$S_Remark."','".$S_Content."',".$Reco.",".$IsHide.",2,".$Hits.",'".$S_AddTime."')";

		//die($sql);



		if($db->query($sql)){

			echo "<script>window.location='admin_articletopic.php';</script>";

			}

		else{

			die("<script>jAlert('专题添加失败','操作提示',function(R){window.location='admin_articletopic.php';})</script>");

			}	

		}	

?>

<?php include "admin_bottom.php"; ?>

</body>

</html>