<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% dim king,action:action=request("action") set king=new kingcms select case action case"edt" :king_edt()'king_save case else :response.write("[err]未提供action参数[/err]") end select set king=nothing 'edt *** *** www.KingCMS.com *** *** 'ET增加函数,替换KINGCMS函数 function ETrequest(l1) if len(l1)>0 then ETrequest=replace(killjapan(trim(cstr(request(l1)))),"'", "''") end if end function 'ET函数结束 sub king_edt() server.scripttimeout=6600 dim slip,rs,i,menuid,menuids,sliptitle,sql,data,dataform,datamenu,menucount,artimg dim text2html,artid,sqlstr,re,artorder,artpath,insql,rs_artid,j:j=0 dim ssnap,suplist,srepeat dim checked,selected ssnap="0":suplist="0":srepeat="0" artid="" sql="arttitle,artauthor,artfrom,artcontent,artshow,artcommend,artup,arthead,artinput"'8 sql=sql&",artkeyword,artdescription,artpath,artimg,artdate,sysdate,menuid,menuids,artgrade"'17 'if len(artid)>0 then sliptitle=king.lang("common/edit") 'else sliptitle=king.lang("common/add") 'end if 'king.head "sub2",sliptitle'显示头信息 'ET增加验证身份 dim cookiesname,cookiespass,mode,adminkey cookiesname=ETrequest("adminname") cookiespass=ETrequest("adminpass") set rs=conn.execute("select adminid,admintheme,adminlanguage,admineditor,adminlevel,adminkey,admininput,adminpass,adminfontsize,adminmode from kingadmin where onoff=0 and adminlock<=7 and adminname='"&cookiesname&"';")'10 if not rs.eof and not rs.bof then 'level=rs(4) king.id=rs(0) 'name=cookiesname 'theme=rs(1) 'language=rs(2) 'editorname=rs(3) adminkey=rs(5) 'input=rs(6) 'fontsize=rs(8) if cstr(rs(9))="1" then mode=true else mode=false if ll11("0,1",ETrequest("mode")) then if ETrequest("mode")="1" then mode=true else mode=false end if dim adminpass:adminpass=rs(7) if adminpass<>md5(cookiespass&adminkey,1) then 'response.redirect "login.asp" response.write "[err]管理员帐号密码错误[/err]" response.end end if else '转到登录页面 'response.redirect "login.asp" response.write "[err]管理员帐号密码错误[/err]" response.end end if set rs=nothing '公共参数 king.pid=l1ll("pid",2):if cstr(king.pid)="" then king.pid=1 king.rn=l1ll("rn",2):if cstr(king.rn)="" or cstr(king.rn)="0" then king.rn=20 if cdbl(king.rn)>cdbl(king_maxrn) then king.rn=king_maxrn king.code=l1ll("code",0):if cstr(king.code)="" then king.code=etrequest("code"):if king.code="" then king.code="utf-8" if ll11(king_code,king.code)=false then response.write("[err]编码不匹配[/err]") if len(king.language)=0 then king.language=l1ll("language",0) if len(king.language)=0 then king.language=king_lang '结束ET增加代码 'if len(artid)=0 then'添加或发生提交操作时 dataform=split(sql,",") redim data(ubound(dataform),0) for i=0 to ubound(dataform) data(i,0)=ETrequest(dataform(i)) next 'if ETrequest(l1l(left(ll11l("111"),16)))="" then'添加文章的时候,数据初始化 menuid=ETrequest("menuid") if len(data(4,0))=0 then data(4,0)=1 if len(data(8,0))=0 then data(8,0)=king.input'录入 ' data(11,0)=为空? 当路径为空的时候,添加前通过title中的内容来获得新的名称 if len(data(17,0))=0 then data(17,0)=0 if len(data(13,0))=0 then data(13,0)=tnow'artdate if len(data(14,0))=0 then data(14,0)=tnow'sysdate 'else ' menuid=ETrequest("menuid") ssnap=ETrequest("snap"):suplist=ETrequest("uplist"):srepeat=ETrequest("repeat") 'end if 'else'读取已经存在的项目 ' set rs=conn.execute("select "&sql&" from kingart where artid="&artid&";") ' if not rs.eof and not rs.bof then ' data=rs.getrows() ' menuid=data(15,0) ' else ' king.error("system/error") ' end if ' set rs=nothing 'end if 're=ETrequest("re")'返回路径 'if re="" then ' re=request.servervariables("http_referer") ' if re="" then re=king.page&"?menuid="&menuid 'else ' re=lll("re") 'end if if II11(menuid,2)=false then response.write("[err]未选择主栏目[/err]") response.end end if set rs=conn.execute("select menuname,menuauthor,menufrom from kingmenu where menuid="&menuid&";") if not rs.eof and not rs.bof then datamenu=rs.getrows() else response.write("[err]主栏目编号错误[/err]") response.end end if set rs=nothing 'sql="arttitle,artauthor,artfrom,artcontent,artshow,artcommend,artup,arthead,artinput"'8 'sql=sql&",artkeyword,artdescription,artpath,artimg,artdate,sysdate,menuid,menuids,artgrade"'17 'if king.checkerr and llll(l1l(left(ll11l("111"),16)))=l1l(ll11l("111")) then artimg=data(12,0) 'for i=0 to ubound(dataform) ' data(i,0)=ETrequest(dataform(i)) 'next if len(data(0,0))=0 or len(data(3,0))=0 then response.write("[err]缺少标题或内容[/err]") response.end end if if cstr(data(4,0))="1" then data(4,0)=1 else data(4,0)=0'show if cstr(data(5,0))="1" then data(5,0)=1 else data(5,0)=0'commend if cstr(data(6,0))="1" then data(6,0)=1 else data(6,0)=0'up if cstr(data(7,0))="1" then data(7,0)=1 else data(7,0)=0'head if len(data(9,0))>0 then data(9,0)=I1111(data(9,0),1) else data(9,0)=I1111(data(0,0),0)'keyword if len(data(10,0))>0 then data(10,0)=left(llIIl(data(10,0)),250) else data(10,0)=lll1(left(llIIl(ETrequest("artcontent")),250))'description if len(data(16,0))=0 then data(16,0)=0 data(16,0)=","&data(16,0)&"," if cstr(ssnap)="1" then data(3,0)=king.snap(data(3,0))'抓图 if cstr(ETrequest("text2html"))="1" then data(3,0)=ll111(data(3,0))'文本转换 '添加文章的时候,获得文章排列数字 if conn.execute("select top 1 count(artid) from kingart")(0)=0 then artorder="1" else artorder=conn.execute("select top 1 artid from kingart order by artid desc")(0)+1 end if if len(data(11,0))=0 then data(11,0)=left(king.getpath(data(0,0)),250)'如果内容为空,就从标题里获得 ' if len(data(11,0))=0 then data(11,0)=cdbl(right(year(tnow),2)&month(tnow)&day(tnow)&replace(cstr(timer()),".",""))'如果标题非英文,就赋日期 artpath=data(11,0) if len(artid)>0 then insql=" and artid<>"&artid'update while(conn.execute("select count(artid) from kingart where artpath='"&artpath&"'"&insql&";")(0)>0) artpath=data(11,0)&"_"&j j=j+1 wend data(11,0)=artpath 'if cstr(artid)="" then'insert 'response.write "insert into kingart ("&sql&",artorder) values ('"&data(0,0)&"','"&data(1,0)&"','"&data(2,0)&"','"&data(3,0)&"',"&data(4,0)&","&data(5,0)&","&data(6,0)&","&data(7,0)&",'"&data(8,0)&"','"&data(9,0)&"','"&data(10,0)&"','"&data(11,0)&"','"&artimg&"','"&data(13,0)&"','"&data(14,0)&"',"&menuid&",'"&data(16,0)&"',"&data(17,0)&","&artorder&");" 'response.end conn.execute "insert into kingart ("&sql&",artorder) values ('"&data(0,0)&"','"&data(1,0)&"','"&data(2,0)&"','"&data(3,0)&"',"&data(4,0)&","&data(5,0)&","&data(6,0)&","&data(7,0)&",'"&data(8,0)&"','"&data(9,0)&"','"&data(10,0)&"','"&data(11,0)&"','"&artimg&"','"&data(13,0)&"','"&data(14,0)&"',"&menuid&",'"&data(16,0)&"',"&data(17,0)&","&artorder&");" '获得articleid的值 set rs=server.createobject("adodb.recordset") rs.open ("select top 1 artid from kingart order by artid desc"),conn set rs_artid=rs(0) artid=rs_artid set rs=nothing '更新文章数量 conn.execute "update kingmenu set menucount=menucount+1 where menuid="&menuid&";" 'else'update ' if cstr(menuid)<>"0" then'稿源库无需操作文件 ' menucount=conn.execute("select count(artid) from kingart where menuid="&menuid&";")(0) ' conn.execute "update kingmenu set menucount="&menucount&" where menuid="&menuid&";" ' end if 'update ' conn.execute "update kingart set arttitle='"&data(0,0)&"',artauthor='"&data(1,0)&"',artfrom='"&data(2,0)&"',artcontent='"&data(3,0)&"',artshow="&data(4,0)&",artcommend="&data(5,0)&",artup="&data(6,0)&",arthead="&data(7,0)&",artinput='"&data(8,0)&"',artkeyword='"&data(9,0)&"',artdescription='"&data(10,0)&"',artpath='"&data(11,0)&"',artimg='"&artimg&"',artdate='"&data(13,0)&"',sysdate='"&data(14,0)&"',menuid="&menuid&",menuids='"&data(16,0)&"',artgrade="&data(17,0)&" where artid="&artid&";" 'end if '更新资料 datamenu(1,0)=lIIlI(datamenu(1,0),data(1,0)) datamenu(2,0)=lIIlI(datamenu(2,0),data(2,0)) conn.execute "update kingmenu set menuauthor='"&datamenu(1,0)&"',menufrom='"&datamenu(2,0)&"' where menuid="&menuid&";" conn.execute "update kingadmin set admininput='"&data(8,0)&"' where adminid="&king.id&";" 'sql="arttitle,artauthor,artfrom,artcontent,artshow,artcommend,artup,arthead,artinput"'8 'sql=sql&",artkeyword,artdescription,artpath,artimg,artdate,sysdate,menuid,menuids,artgrade"'17 if ll11(data(16,0),menuid)=false then menuids=data(16,0)&menuid '判断是否一起生成列表 if cstr(suplist)="1" then 'll "sub2="&artid&"&menuid="&menuids&"&cmd=one",re ll "sub2="&artid&"&menuid="&menuids&"&cmd=one","" else 'll "sub2="&artid&"&cmd=one",re ll "sub2="&artid&"&cmd=one","" end if 'end if response.write("1") end sub %>