user_template.asp

来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 469 行 · 第 1/2 页

ASP
469
字号
	If iChk>0 Then
		oblog.showok "模板中存在系统禁止的字符!",""
		Response.End
	End If
	'脚本过滤
	If oblog.l_Group(15,0)=0 Then 	rs(0)=oblog.CheckScript(sContent)
	rs(0)=sContent
	rs.update
	rs.close
	set rs=nothing
	sContent=""
	updateindex()
	oblog.showok "修改成功,首页已经更新,其他页面请手动更新!","user_template.asp"
End sub

sub saveviceconfig()
	dim rs,sql,sContent
	Dim iChk
	If oblog.l_Group(14,0)=0 Then
		oblog.showok "你所在的组不允许修改模板!",""
		Exit Sub
	End If
	set rs=server.CreateObject("adodb.recordset")
	sql="select user_skin_showlog from [oblog_user] where userid="&oblog.l_uid
	rs.open sql,conn,1,3
	sContent=oblog.filtpath(oblog.filt_badword(trim(request("myTextArea"))))
	'内容检查
	iChk=oblog.chk_badword(sContent)
	If iChk>0 Then
		oblog.showok "模板中存在系统禁止的字符!",""
		Response.End
	End If
	'脚本过滤
	If oblog.l_Group(15,0)=0 Then 	rs(0)=oblog.CheckScript(sContent)
	rs(0)=sContent
	rs.update
	rs.close
	set rs=nothing
	sContent=""
	updateindex()
	oblog.showok "修改成功,首页已经更新,其他页面请手动更新!",""
End sub

sub modiconfig()
	If oblog.l_Group(14,0)=0 Then
		oblog.showok "你所在的组不允许修改模板!","user_template.asp"
		Exit Sub
	End If
	dim rs,rsshowlog
	set rs=oblog.execute("select user_skin_main,defaultskin from [oblog_user] where userid="&oblog.l_uid)
	If rs("defaultskin")=0  or rs("defaultskin")="" Then
		set rs=nothing
		oblog.adderrstr("请先选择一个默认模板!")
		oblog.showusererr
		exit sub		
	End If
%>
<ul id="user_page_top">
	<br />主模板决定页面整体风格,<a href="#" onclick="skin_help(0);">点击这里可以查看模板标签说明</a>,建议修改前先<a href="user_template.asp?action=bakskin">备份模板</a>。
</ul>
	<form method="POST" action="user_template.asp" id="oblogform" name="oblogform">
	<ul style=" margin:10px;">
	<textarea id="myTextArea" name="myTextArea" style="width:98%;height:380px; display:none"><%=Server.HtmlEncode(rs(0))%></textarea >
	</ul>
    <ul class="list_edit" style="margin:15px">
	<input name="Action" type="hidden" id="Action" value="saveconfig" />
	<input name="cmdSave" type="submit" id="cmdSave" value=" 保存修改 " />
	</ul>
	</form>

<%
set rs=nothing
End sub

sub modiviceconfig()
	If oblog.l_Group(14,0)=0 Then
		oblog.showok "你所在的组不允许修改模板!","user_template.asp"
		Exit Sub
	End If
	dim rs,rsshowlog
	set rs=oblog.execute("select user_skin_showlog,defaultskin from [oblog_user] where userid="&oblog.l_uid)
	If rs("defaultskin")=0  or rs("defaultskin")="" Then
		set rs=nothing
		set rs=nothing
		oblog.adderrstr("请先选择一个默认模板!")
		oblog.showusererr
		exit sub		
	End If
%>
<ul id="user_page_top">
	<br />
	副模板决定日志部分显示风格,<a href="#" onclick="skin_help(1);">点击这里可以查看模板标签说明</a>,建议修改前先<a href="user_template.asp?action=bakskin">备份模板</a>。
</ul>
	<form method="POST" action="user_template.asp?id=<%=clng(request.QueryString("id"))%>" id="oblogform" name="oblogform">
	<ul style="margin:10px">
	<textarea id="myTextArea" name="myTextArea" style="width:95%;height:380px; display:none"><%=Server.HtmlEncode(rs(0))%></textarea >
	</ul>
	<ul class="list_edit" style="margin:15px">
	<input name="action" type="hidden" id="action" value="saveviceconfig" />
	<input type="submit"  value="保存修改" />
	</ul>
	</form>
<%
	set rs=nothing
End sub

sub bakskin()
	dim bak,rs
	bak=request("bak")
	If bak="bak" Then
		oblog.execute("update oblog_user set bak_skin1=user_skin_main,bak_skin2=user_skin_showlog where userid="&oblog.l_uid)
		oblog.showok "备份模板成功!",""
	ElseIf bak="restore" Then
		set rs=oblog.execute("select bak_skin1,bak_skin2 from oblog_user where userid="&oblog.l_uid)
		If rs(0)="" or rs(1)="" or isnull(rs(0)) or isnull(rs(1)) Then
			set rs=nothing
			oblog.adderrstr("所备份的模板为空,不允许恢复!")
			oblog.showusererr
		End If
		oblog.execute("update oblog_user set user_skin_main=bak_skin1,user_skin_showlog=bak_skin2 where userid="&oblog.l_uid)
		set rs=nothing
		oblog.showok "恢复模板成功!",""
	End If
%>
	<table class='win_update_table' align='center' border='0' cellpadding='0' cellspacing='1'>
		<tr>
			<td colspan='2' class='win_update_table_top'>备份模板</td>
		</tr>
		<tr>
			<td colspan='2'>建议修改或者更换模板前先备份模板,误操作以后可以随时恢复!</td>
		</tr>
		<tr>
			<td class='win_update_table_td'>备份现在使用的模板</td>
			<td><form name="bakform" method="post" action="user_template.asp?action=bakskin">
	<input type="hidden" name="bak" id="bak" value="" />
	<input type="submit" name="Submit" value="备份现在使用的模板" onclick="setbak();" /></td>
		</tr>
		<tr>
			<td class='win_update_table_td'>恢复模板(将覆盖使用中的模板)</td>
			<td><input type="submit" name="Submit2" value="恢复模板" onclick="setrestore();" /></td>
		</tr>
		<tr>
			<td class='win_update_table_td'>查看已经备份的模板</td>
			<td><input type="button" name="Submit1" value="查看已经备份的模板" onclick="window.open('showskin.asp?userid=<%=oblog.l_uid%>')" />
	</form></td>
		</tr>
	</table>


<%End sub


sub good()
	dim good,rs,rsu,skinname
	good=request("good")
	If good="save" Then
		skinname=request("skinname")
		If skinname="" or oblog.strLength(skinname)>50  Then oblog.adderrstr("用户名不能为空(不能大于50)!")
		If oblog.errstr<>"" Then oblog.showusererr:exit sub
		set rsu=oblog.execute("select user_skin_main,user_skin_showlog from oblog_user where userid="&oblog.l_uid)
		set rs=server.CreateObject("adodb.recordset")
		rs.open "select top 1 * from [oblog_userskin]",conn,1,3
		rs.addnew
		rs("userskinname")=skinname
		rs("skinmain")=rsu(0)
		rs("skinshowlog")=rsu(1)
		rs("skinauthor")=oblog.l_uname
		rs("skinauthorurl")=oblog.l_udir&"/"&oblog.l_uid&"/index."&f_ext
		rs.update
		rs.close
		set rsu=nothing
		set rs=nothing		
		oblog.showok "推荐成功,请等待管理员审核!",""
	End If
%>
	<table class='win_update_table' align='center' border='0' cellpadding='0' cellspacing='1'>
		<tr>
			<td colspan='2' class='win_update_table_top'>推荐我的模板</td>
		</tr>
		<tr>
			<td colspan='2'>	如果你的模板很漂亮,推荐给管理员,可以放在模板数据库里,让更多人使用哦!<br />模板会注明作者和你的blog连接。请不要提交已经存在的用户模板!</td>
		</tr>
		<tr>
			<td class='win_update_table_td'>给我的模板取个名字:</td>
			<td><form name="good" action="user_template.asp?action=good&good=save" method="post"><input name="skinname"   type="text" value="" size="30" maxlength="20" /><input type="submit" value="推荐" /></form></td>
		</tr>
	</table>
<%End sub


sub updateindex()
	dim blog
	set blog=new class_blog
	blog.userid=oblog.l_uid
	blog.update_index 0
	blog.update_message 0
	blog.CreateFunctionPage
	set blog=nothing
End sub

Function GetSkinList(byref rst,byval defaultskin)
	Dim strSkins,ustr,iCount	
	iCount=0
	strSkins=""
	Do While Not rst.eof
		strSkins = strSkins & "<div class=""skinpic"">" & VBCRLF
		strSkins = strSkins & "<a href='showskin.asp?id=" & rst("id") & "' target=_blank>" & VBCRLF

		If rst("skinpic")="" or isnull(rst("skinpic")) Then
			strSkins = strSkins & "<img src=""images/nopic.gIf"" title=""对不起,该模板没有预览图"" width=200 height=122 border=""0"" />" & VBCRLF
		Else
			strSkins = strSkins & "<img src="""&oblog.filt_html(rst("skinpic"))&""" title=""点击预览"" width=200 height=122 border=""0"" />" & VBCRLF
		End If
		strSkins = strSkins & "</a><span title="""
		strSkins = strSkins & "模板:" & rst("userskinname") & VBCRLF
		strSkins = strSkins & "作者:" & rst("skinauthor")
		strSkins = strSkins & """>" & VBCRLF
		If rst("skinauthorurl")<>"" Then
			ustr="<a href="""&rst("skinauthorurl")&""" target=""_blank"">"&rst("skinauthor")&"</a>"
		Else
			ustr=rst("skinauthor")
		End If				
		strSkins = strSkins & "" & rst("userskinname") & ""
		strSkins = strSkins & "&nbsp;by:" & ustr & VBCRLF
		strSkins = strSkins & "</span><div class=""skin_used""><a href=""user_template.asp?action=savedefault&radiobutton=" & rst("id") & """ >应用此模板</a></div>"
		strSkins = strSkins & "</div>	" & VBCRLF & VBCRLF
		
		iCount = iCount+1
		if iCount >=iPage then exit do
		rst.movenext
	Loop
	GetSkinList = strSkins
End Function
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?