<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<!--#include file="../include/config.inc"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_book.asp
'* 最后更新 2012-06-03 by 56770.kingdge
'*****************************************
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_book.inc"
CurrentId = 4
CurrentUrl = "admin_book.asp"
LB_Head()
LB_Menu()
action = request("action")
state = request("state")
%>
<div class="tabmenu mainwidth">
	  <ul>
		<li <%If action = "" And state = "" Then Response.Write("class=""current""") End If%>><a href="admin_book.asp"><span><%=Lang_Menu(57)%></span></a></li>
		<li <%If state = "0" Then Response.Write("class=""current""") End If%>><a href="?state=0"><span><%=Lang_Book(8)%></span></a></li>
		<li <%If state = "1" Then Response.Write("class=""current""") End If%>><a href="?state=1"><span><%=Lang_Book(9)%></span></a></li>
		<li <%If action = "notice" Then Response.Write("class=""current""") End If%>><a href="?action=notice"><span><%=Lang_Menu(118)%></span></a></li>
	  </ul>
</div>
<%
Response.Write("<div class=""tab-mainbody"">")
Response.Write("<div class=""tab-mainbody2"">")
If OutSubmit = 1 Then CheckOutSubmit()
Select Case Request("action")
		Case "savereply" : savereply()
		Case "savenotice" : savenotice()
		Case "reply" : reply()
		Case "notice" : booknotice()
			Case "del" : del()
		Case Else
			list()
End Select
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

sub del
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",7.6,"
		if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
				adminflag()
		End If
        del_id= Replace(safereplace(Trim(request("id"))),"，",",")
		If Right(del_id,1) = "," Then del_id = Left(del_id,Len(del_id)-1)
        if del_id="" then
                response.write"<SCRIPT language=JavaScript>alert('"& Lang_sys(41) &"');javascript:history.go(-1)</SCRIPT>"
                response.end
        end if
		conn.execute "delete from [guestbook] where id in ("&del_id&") "
		ManageLog Lang_book(1) & del_id
		m_t=Lang_sys(43)
		m_s="·"& Lang_sys(42)
		m_u="?page="& request("page") &"&pagenum="& request("pagenum") &"&keyword="& request("keyword")
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
end sub

sub savereply
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",7.5,"
		if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
				adminflag()
		End If
		conn.execute "update [guestbook] set reply='"&Replace(request("reply"),"'","&#180;")&"',show=1 where id="&CheckNum(request("id"),0)
		ManageLog Lang_book(2) &"["& Left(Replace(request("reply"),"'","&#180;"),50) &"]"
		m_t=Lang_Menu(57)
		m_s="·"& Lang_book(3)
		m_u="Admin_book.asp"
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
end sub

sub savenotice
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",7.7,"
		if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
				adminflag()
		End If
		set rs=server.CreateObject("adodb.recordset")
		sql="select * from [notice]"
		rs.open sql, conn, 1, 3
		For LangT = 1 To TotalLang
				rs("notice" & LanguageTxt(LangT))=replace(request("notice" & LanguageTxt(LangT)),"'","&#180;")
		Next
		rs.update
		ManageLog Lang_book(4)
		m_t=Lang_Menu(57)
		m_s="·"& Lang_book(5)
		m_u="Admin_book.asp?action=notice"
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
end sub

sub list
		admin_flag=",7.5,"
		if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
				adminflag()
		End If
		page = checknum(request("page"),1)
		pagenum = CheckNum(request("pagenum"),15)
		state = safereplace(Trim(request("state")))
		keyword = safereplace(Trim(request("keyword")))
		Dim ors
		Set ors=new Cls_vbsPage
		Set ors.Conn=conn
		With ors
		.PageSize=pagenum
		.PageName="Page"
		If IsSqlDataBase = 0 Then
				.DbType="AC"
		Else
				.DbType="MSSQL"
		End If
		.RecType=-1
		.Pkey="id"
		.Field="id,face,title,name,qq,email,ip,time,show"
		.Table="[guestbook]"
		sql = "1=1"
		If state <> "" Then sql = sql &" and show = "& CLng(state)
		If keyword <> "" Then sql = sql &" and (title like '%"& keyword &"%')"
		.Condition=sql
		.OrderBy="id desc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<form method="get" action="?">
<td height="30" align="left" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<select name="state">
<option value="" selected>┌ <%=Lang_book(6)%></option>
<option value="">├ <%=Lang_book(7)%></option>
<option value="0" <%=judge2("0",state)%>>├ <%=Lang_book(8)%></option>
<option value="1" <%=judge2("1",state)%>>├ <%=Lang_book(9)%></option>
</select></td>
<td style="padding-left:5px;"><input name="keyword" type="text" class="form_query" size="15"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><input type="hidden" name="pagenum" value="<%= pagenum %>">
</td>
</tr>
</table>
</td>
</form>
<td class="classhead" align="right">
<%=QuickMenu("admin_msg.asp|"& Lang_Menu(117) &"","Admin_book.asp?action=notice|"& Lang_Menu(118) &"")%>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable2">
<tbody>
<tr>
<form name="form" action="?" method="post">
<td height="30" class="classhead" align="left" colspan="2">
<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_delete.gif" title=" <%=Lang_sys(15)%> " align="absmiddle">
<input type="hidden" name="page" value="<%=page%>">
<input type="hidden" name="keyword" value="<%=keyword%>">
<input type="hidden" name="pagenum" value="<%= pagenum %>">
<input type="hidden" name="action" value="del">
</td>
<td height="30" class="classhead" align="right" colspan="6"><%=ors.ShowPageHead(page)%></td>
  </tr>
<tr>
  <td height="30" class="classtop" width="5%" title="<%=Lang_sys(4)%>" style="cursor:pointer;" onclick="location.href='javascript:selectall();';return false;"><%=Lang_sys(50)%></td>
  <td class="classtop" width="10%"><%=Lang_book(10)%></td>
  <td class="classtop" width="35%"><%=Lang_book(11)%></td>
  <td class="classtop" width="10%"><%=Lang_book(12)%></td>
  <td class="classtop" width="12%"><%=Lang_book(13)%></td>
  <td class="classtop" width="15%"><%=Lang_book(14)%></td>
  <td class="classtop" width="5%"><%=Lang_book(15)%></td>
  <td class="classtop" width="10%"><%=Lang_book(6)%></td>
 </tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
%>
<tr class="classrow">
  <td height="30" class="classrow"><input name="id" type="checkbox" value="<%=DataList(0,i)%>"></td>
  <td height="30" class="classrow" title="<%=DataList(7,i)%>"><%=FormatDateTime(DataList(7,i),2)%></td>
  <td height="30" class="classrow"><a href="?action=reply&id=<%=DataList(0,i)%>"><img src="../images/icons/<%=DataList(1,i)%>.gif" align="absmiddle" width="17" border="0"><%=DataList(2,i)%></a></td>
  <td height="30" class="classrow"><%=DataList(3,i)%></td>
  <td height="30" class="classrow"><%If DataList(4,i) <>"" Then%><a href="tencent://message/?uin=<%=checknum(DataList(4,i),0)%>&amp;Site=56770 eshop&menu=yes" target="blank"><img src="http://wpa.qq.com/pa?p=1:<%=checknum(DataList(4,i),0)%>:4" width="16" height="16" align="absmiddle" border="0" /></a><%End If%><%=DataList(4,i)%>&nbsp;</td>
  <td height="30" class="classrow"><a href="mailto:<%=DataList(5,i)%>" title="Email：<%=DataList(5,i)%>" target="_blank"><%=DataList(5,i)%></a></td>
  <td height="30" class="classrow"><img src="images/ip.gif" width="13" height="15" title="IP：<%=DataList(6,i)%>"></td>
  <td height="30" class="classrow"><%if DataList(8,i)=1 then response.write"<font color=red>"& Lang_book(9) &"</font>" else response.write Lang_book(8) end if%></td>
</tr>
<%
        Next
End If
%>
</form>
<tr>
	<td height="30" class="classfooter" colspan="2"><%=GetPageNum(15,pagenum)%></td>
	<td height="30" class="classfooter" align="right" colspan="6"><%=ors.ShowPageFoot(page)%></td>
</tr>
<tr>
<td colspan="8" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
  <%=Lang_book(16)%>
  </div>
</td>
</tr>
</tbody>
</table>
<script>tdshow("classtable");</script>
<%
end sub

sub reply
		admin_flag=",7.5,"
		if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
				adminflag()
		End If
		set rs=server.createobject("adodb.recordset")
		sql="select * from guestbook where id="&CheckNum(request("id"),0)
		rs.open sql,conn,1,3
%>
<SCRIPT language=JavaScript>
function CheckInput(){

	if(form.reply.value==''){
		alert("<%=Lang_book(17)%>");
		form.reply.focus();
		return false;
	}
	if(form.reply.value.length>255){
		alert("<%=Lang_book(18)%>");
		form.reply.focus();
		return false;
	}

	return true;
}
</SCRIPT>
<script language="javascript" type="text/javascript" src="ckeditor/ckeditor.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable">
<form name="form2" method="post" action="?" onSubmit="return CheckInput;">
<tr>
	<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="action" value="savereply"><input type="hidden" name="id" value="<%=request("id")%>"></td>
	<td class="classhead" colspan="5" height="30" align="right">
	<%=QuickMenu("","")%>
	</td>
 </tr>
<tr>
   <td class="classtop" height="30" colspan="2"><%=Lang_book(19)%></td>
</tr>
    <tr class="classrow">
      <td width="15%" height="30" class="classrow"><%=Lang_book(20)%></td>
      <td width="85%" class="classrow">
	  <%=rs("name")%>
      </td>
    </tr>
    <tr class="classrow">
      <td valign="top" class="classrow"><%=Lang_book(21)%></td>
      <td class="classrow">
		<textarea name="reply" id="reply" rows="10" cols="76" class="text"><%
		If Not IsNull(rs("reply")) Then 
			Response.write server.htmlencode(rs("reply")) 
		End If 
		%></textarea>
		<span id="btn_showFCK"><br /><input type="button" value="<%=Lang_sys(65)%>" onclick="showFCK()" class="button"></span>
		<script type="text/javascript">
		function showFCK(){
			document.getElementById("btn_showFCK").style.display = 'none' ;
			CKEDITOR.replace('reply',{height:150});
		}
		</script>
      </td>
    </tr>
    <tr>
      <td height="30" colspan="2" align="left" class="classfooter">
      <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
      </td>
    </tr>
  </form>
<tr>
   <td class="classtop" height="30" colspan="2"><%=rs("title")%></td>
</tr>
    <tr class="classrow">
      <td valign="top" class="classrow"><%=Lang_book(22)%></td>
      <td class="classrow"><%if rs("isadmin")=1 then response.write"[<font color=red>"& Lang_book(23) &"</font>]" end if%><%=rs("content")%>
      </td>
    </tr>
  </table>
  <script>tdshow("classtable");</script>
<%
rs.close
set rs=nothing
end sub

sub booknotice
		admin_flag=",7.7,"
		if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
				adminflag()
		End If
		set rs=conn.execute("select * from notice")
%>
<script language=JavaScript>
function CheckInput(){

	if(form.notice.value==''){
		alert("<%=Lang_book(17)%>");
		form.notice.focus();
		return false;
	}
	if(form.notice.value.length>255){
		alert("<%=Lang_book(18)%>");
		form.notice.focus();
		return false;
	}

	return true;
}
</script>
<script language="javascript" type="text/javascript" src="ckeditor/ckeditor.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable">
<form name="form2" method="post" action="?" onSubmit="return CheckInput;">
	<tr>
		<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="action" value="savenotice"></td>
		<td class="classhead" align="right">
		<%=QuickMenu("Admin_book.asp|"& Lang_Menu(57) &"","Admin_Dvote.asp|"& Lang_Menu(119) &"")%>
		</td>
	 </tr>
	<tr>
	   <td class="classtop" height="30" colspan="2"><%=Lang_Menu(118)%></td>
	</tr>
	<tr>
	<td class="classbg" colspan="2">
	<ul id="tablist">
	   <%For LangT = 1 To TotalLang%>
	   <li<%If LangT = 1 Then response.write(" class=""selected""") End If%>><a rel="tcontent<%= LangT %>" style="CURSOR:hand;"><%= LanguageName(LangT) %></a></li>
	   <%Next%>
	</ul>
	<div id="tabcontentcontainer">
	<%For LangT = 1 To TotalLang%>
	   <div id="tcontent<%= LangT %>" class="tabcontent">
	   <table width="98%" align="center" border="0" cellspacing="0" cellpadding="0" style="margin-top:5px">
	    <tr><td>
		<textarea name="notice<%= LanguageTxt(LangT) %>" id="notice<%= LanguageTxt(LangT) %>" rows="15" cols="80" class="text" style="width:99%"><%
		If Not IsNull(rs("notice"& LanguageTxt(LangT))) Then 
			Response.write server.htmlencode(rs("notice"& LanguageTxt(LangT))) 
		End If 
		%></textarea>
		<span id="btn_showFCK<%= LanguageTxt(LangT) %>"><br /><input type="button" value="<%=Lang_sys(65)%>" onclick="showFCK<%= LanguageTxt(LangT) %>()" class="button"></span>
		<script type="text/javascript">
		function showFCK<%= LanguageTxt(LangT) %>(){
			document.getElementById("btn_showFCK<%= LanguageTxt(LangT) %>").style.display = 'none' ;
			CKEDITOR.replace('notice<%= LanguageTxt(LangT) %>',{height:300});
		}
		</script>
		<%If Config_Lebi_Eshop(19) = "0" Then%><script type="text/javascript">showFCK<%= LanguageTxt(LangT) %>()</script><%End If%>
		</td></tr>
		</table>
		</div>
	<%Next%>
	</div>
	<script>showtabcontent("tablist")</script>
	</td>
	</tr>
    <tr>
      <td height="30" colspan="2" align="left" class="classfooter">
        <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
      </td>
    </tr>
  </form>
  </table>
<%
		rs.close : set rs=nothing
end Sub
%>