"&c_year&"?&c_month&"?/div>"
calendar=calendar & "
- ?/font>
- 一
- ?/li>
- ?/li>
- ?/li>
- ?/li>
- ?/li>
"
'--->计算当前月份的日?
i=weekday(c_ym & "-" & 1)-1
ts_date=dateserial(c_year,c_month,1-i)
te_date=dateadd("d",42,ts_date)
s_date=year(ts_date)&"-"&month(ts_date)&"-"&day(ts_date)
e_date=year(te_date)&"-"&month(te_date)&"-"&day(te_date)
'--->保存日志日历缓存
dim link_count,link_days,calendararray,doupdate,uptime
uptime=year(now())&"-"&month(now())
doupdate=false
if not isarray(application(cookiename&"_blog_calendar")) then '判断日期更新条件
doupdate=true
elseif application(cookiename&"_blog_calendar")(1)<>uptime then
doupdate=true
elseif uptime<>c_year&"-"&c_month then
doupdate=true
elseif update=2 then
doupdate=true
end if
if doupdate then
redim link_days(4,0)
link_count=0
sql="select c.log_id,c.log_title,c.log_posttime,c.log_isshow from blog_content as c,blog_category as a where c.log_posttime between #"&s_date&" 00:00:00# and #"&e_date&" 23:59:59# and c.log_isdraft=false and c.log_cateid=a.cate_id and a.cate_secret=false order by c.log_posttime"
set rs_month=conn.execute(sql)
sqlquerynums=sqlquerynums+1
dim the_day,temptitle,tempcount,tempsplit
the_day=0
tempcount=0
temptitle=""
do while not rs_month.eof
if day(rs_month("log_posttime"))<>the_day then
the_day=day(rs_month("log_posttime"))
redim preserve link_days(4,link_count)
link_days(0,link_count)=year(rs_month("log_posttime"))
link_days(1,link_count)=month(rs_month("log_posttime"))
link_days(2,link_count)=day(rs_month("log_posttime"))
link_days(3,link_count)="default.asp?log_year="&year(rs_month("log_posttime"))&"&log_month="&month(rs_month("log_posttime"))&"&log_day="&day(rs_month("log_posttime"))
tempcount=1
if rs_month("log_isshow") then
temptitle=chr(13) & " - " & rs_month("log_title")
else
temptitle=chr(13) & " - [隐藏日志]"
end if
link_days(4,link_count)="当天共写? & tempcount &"篇日? & temptitle
link_count=link_count+1
else
tempcount=tempcount+1
if rs_month("log_isshow") then
link_days(4,link_count-1) = link_days(4,link_count-1) & chr(10) & " - " & rs_month("log_title")
else
link_days(4,link_count-1) = link_days(4,link_count-1) & chr(10) & " - [隐藏日志]"
end if
tempsplit = split(link_days(4,link_count-1),chr(13))
tempsplit(0)="当天共写? & tempcount &"篇日? & chr(13)
if ubound(tempsplit)>0 then link_days(4,link_count-1)=tempsplit(0) & tempsplit(1)
end if
rs_month.movenext
loop
set rs_month=nothing
'response.write ""
if uptime=c_year&"-"&c_month then
calendararray=array(link_days,uptime)
application.lock
application(cookiename&"_blog_calendar")=calendararray
application.unlock
'response.write ""
end if
else
link_days=application(cookiename&"_blog_calendar")(0)
link_count=ubound(link_days,2)+1
'response.write ""
end if
if update=2 then exit function
dim dayend,calendar_count
calendar_count=0
dayend=false
daycount=0:dclass="":daystr="":isdo=0:notcm=1
do until month(s_date)<>c_month and notcm=7
if daycount>6 then
calendar=calendar & "
"
daycount=0
daystr=""
end if
if calendar_count=link_count then calendar_count=link_count-1:dayend=true
if month(s_date)=c_month then notcm=0
if month(s_date)<>c_month then
dclass="class=""otherday"""
notcm=notcm+1
elseif year(s_date)=year(now()) and month(s_date)=month(now()) and day(s_date)=day(now()) then
dclass="class=""today"""
else
dclass=""
end if
if link_count>0 then
if link_days(1,calendar_count)=month(s_date) and link_days(2,calendar_count)=day(s_date) and dayend=false then
if month(s_date)<>c_month then
dclass="class=""otherday"""
elseif day(s_date)=c_day then
dclass="class=""click"""
elseif c_year=year(now()) and c_month=month(now()) and day(s_date)=day(now()) then
dclass="class=""dayd"""
else
dclass="class=""haved"""
end if
daystr=daystr&"
"&day(s_date)&""
calendar_count=calendar_count+1
else
daystr=daystr&"
"&day(s_date)&""
end if
else
daystr=daystr&"
"&day(s_date)&""
end if
daycount=daycount+1
s_date=dateadd("d",1,s_date)
loop
calendar=calendar & "
"
end function
'**********************************************
'用户面板
'**********************************************
function userpanel()
userpanel=""
if memname<>empty then userpanel=userpanel&"
"&memname&",欢迎你!
你的权限: "&stat_title&"
"
if stat_admin=true then userpanel=userpanel+"
系统管理"
if stat_addall=true or stat_add=true then userpanel=userpanel+"
发表新日?/a>"
if (stat_addall=true or stat_add=true) and (stat_editall or stat_edit) then
if isempty(session(cookiename&"_draft_"&memname)) then
session(cookiename&"_draft_"&memname)=conn.execute("select count(log_id) from blog_content where log_author='"&memname&"' and log_isdraft=true")(0)
sqlquerynums=sqlquerynums+1
end if
if session(cookiename&"_draft_"&memname)>0 then
userpanel=userpanel+"编辑草稿 ["&session(cookiename&"_draft_"&memname)&"]"
else
userpanel=userpanel+"
编辑草稿"
end if
end if
if memname<>empty then
userpanel=userpanel&"
修改个人资料退出系?/a>"
else
userpanel=userpanel&"登录用户注册"
end if
end function
'**********************************************
'输出日志统计信息
'**********************************************
function info_code(str)
dim vonline
vonline=getonline
str=replace(str,"$blog_lognums$",blog_lognums)
str=replace(str,"$blog_commnums$",blog_commnums)
str=replace(str,"$blog_tbcount$",blog_tbcount)
str=replace(str,"$blog_messagenums$",blog_messagenums)
str=replace(str,"$blog_memnums$",blog_memnums)
str=replace(str,"$blog_visitnums$",blog_visitnums)
str=replace(str,"$blog_onlinenums$",vonline)
info_code=str
end function
'**********************************************
'获取在线人数
'**********************************************
function getonline
getonline=1
if len(application(cookiename&"_onlinecount"))>0 then
if datediff("s",application(cookiename&"_useronlinecounttime"),now())>60 then
application.lock()
application(cookiename&"_online")=application(cookiename&"_onlinecount")
application(cookiename&"_onlinecount")=1
application(cookiename&"_onlinecountkey")=randomstr(2)
application(cookiename&"_useronlinecounttime")=now()
application.unlock()
else
if session(cookiename&"useronlinekey")<>application(cookiename&"_onlinecountkey") then
application.lock()
application(cookiename&"_onlinecount")=application(cookiename&"_onlinecount")+1
application.unlock()
session(cookiename&"useronlinekey")=application(cookiename&"_onlinecountkey")
end if
end if
else
application.lock
application(cookiename&"_online")=1
application(cookiename&"_onlinecount")=1
application(cookiename&"_onlinecountkey")=randomstr(2)
application(cookiename&"_useronlinecounttime")=now()
application.unlock
end if
getonline=application(cookiename&"_online")
end function
'**********************************************
'侧边模版处理
'**********************************************
sub side_module_replace()
'日历处理
dim cal_code
cal_code=calendar(log_year,log_month,log_day,1)
side_html_default=replace(side_html_default,"$calendar_code$",cal_code)
side_html=replace(side_html,"$calendar_code$",cal_code)
'用户面板处理
dim user_code
user_code=userpanel
side_html_default=replace(side_html_default,"$user_code$",user_code)
side_html=replace(side_html,"$user_code$",user_code)
'归档面板处理
dim archive_code
archive_code=archive(1)
side_html_default=replace(side_html_default,"$archive_code$",archive_code)
side_html=replace(side_html,"$archive_code$",archive_code)
'树形分类处理
categorylist(1)
side_html_default=replace(side_html_default,"$category_code$",category_code)
side_html=replace(side_html,"$category_code$",category_code)
'显示统计信息
side_html_default=info_code(side_html_default)
side_html=info_code(side_html)
'处理最新评论内? dim comment_code
comment_code=newcomment(1)
side_html_default=replace(side_html_default,"$comment_code$",comment_code)
side_html=replace(side_html,"$comment_code$",comment_code)
'处理友情链接内容
dim link_code
link_code=bloglinks(1)
side_html_default=replace(side_html_default,"$link_code$",link_code)
side_html=replace(side_html,"$link_code$",link_code)
end sub
'==============================================================
' blog class
'==============================================================
'*******************************************
' 分类读取class
'*******************************************
class category
public cate_id
public cate_name
public cate_order
public cate_intro
public cate_outlink
public cate_url
public cate_icon
public cate_count
public cate_lock
public cate_local
public cate_secret
private lastid
private loaded
private sub class_initialize()
cate_id=0
cate_name=""
cate_order=0
cate_intro=""
cate_outlink=false
cate_url=""
cate_icon=""
cate_count=""
cate_lock=false
cate_local=""
cate_secret=false
lastid=-99
loaded=false
end sub
private sub class_terminate()
end sub
public sub reload
categorylist(2) '更新分类缓存
end sub
public function load(id)
dim blog_cate,blog_catearray,category_len,i
if int(id)=lastid then exit function
if not isarray(application(cookiename&"_blog_category")) then reload
blog_catearray=application(cookiename&"_blog_category")
if ubound(blog_catearray,1)=0 then exit function
category_len=ubound(blog_catearray,2)
for i=0 to category_len
if int(blog_catearray(0,i))=int(id) then
cate_id=blog_catearray(0,i)
cate_name=blog_catearray(1,i)
cate_order=blog_catearray(2,i)
cate_intro=blog_catearray(3,i)
cate_outlink=blog_catearray(4,i)
cate_url=blog_catearray(5,i)
cate_icon=blog_catearray(6,i)
cate_count=blog_catearray(7,i)
cate_lock=blog_catearray(8,i)
cate_local=blog_catearray(9,i)
cate_secret=blog_catearray(10,i)
lastid=int(id)
loaded=true
exit function
end if
next
end function
end class
'*******************************************
' tag class
'*******************************************
class tag
private sub class_initialize()
if not isarray(application(cookiename&"_blog_tags")) then reload
end sub
private sub class_terminate()
end sub
public sub reload
tags(2) '更新tag缓存
end sub
public function insert(tagname) '插入标签,返回id? if checktag(tagname) then
conn.execute("update blog_tag set tag_count=tag_count+1 where tag_name='"&tagname&"'")
insert=conn.execute("select top 1 tag_id from blog_tag where tag_name='"&tagname&"'")(0)
else
conn.execute("insert into blog_tag (tag_name,tag_count) values ('"&tagname&"',1)")
insert=conn.execute("select top 1 tag_id from blog_tag order by tag_id desc")(0)
end if
end function
public function remove(tagid) '清除标签
if checktagid(tagid) then
conn.execute("update blog_tag set tag_count=tag_count-1 where tag_id="&tagid)
end if
end function
public function filterhtml(str) '过滤标签
if isempty(str) or isnull(str) or len(str)=0 then
exit function
filterhtml=str
else
dim log_tag,log_tagitem
for each log_tagitem in arr_tags
log_tag=split(log_tagitem,"||")
str=replace(str,"{"&log_tag(0)&"}","
"&log_tag(1)&""&log_tag(1)&" ")
next
dim re
set re=new regexp
re.ignorecase =true
re.global=true
re.pattern="\{(\d)\}"
str=re.replace(str,"")
filterhtml=str
end if
end function
public function filteredit(str) '过滤标签进行编辑
if isempty(str) or isnull(str) or len(str)=0 then
exit function
filteredit=str
else
dim log_tag,log_tagitem
for each log_tagitem in arr_tags
log_tag=split(log_tagitem,"||")
str=replace(str,"{"&log_tag(0)&"}",log_tag(1)&",")
next
dim re
set re=new regexp
re.ignorecase =true
re.global=true
re.pattern="\{(\d)\}"
str=re.replace(str,"")
filteredit=left(str,len(str)-1)
end if
end function
private function checktag(tagname) '检测是否存在此标签(根据名称)
checktag=false
dim log_tag,log_tagitem
for each log_tagitem in arr_tags
log_tag=split(log_tagitem,"||")
if lcase(log_tag(1))=lcase(tagname) then checktag=true:exit function
next
end function
private function checktagid(tagid) '检测是否存在此标签(根据Id? checktagid=false
dim log_tag,log_tagitem
for each log_tagitem in arr_tags
log_tag=split(log_tagitem,"||")
if int(log_tag(0))=int(tagid) then checktagid=true:exit function
next
end function
public function gettagid(tagname) '获得tag的Id
gettagid=0
dim log_tag,log_tagitem
for each log_tagitem in arr_tags
log_tag=split(log_tagitem,"||")
if lcase(log_tag(1))=lcase(clearhtml(tagname)) then gettagid=log_tag(0):exit function
next
end function
end class
%>
?%
'***************pjblog2 缓存处理*******************
' pjblog2 copyright 2006
' update:2006-1-25
'**************************************************
'-------------------------blog基本参数--------------------------
dim blog_infos,sitename,siteurl,blogperpage,blog_lognums,blog_commnums,blog_memnums
dim blog_visitnums,blogbookpage,blog_messagenums,blogcommpage,blogaffiche
dim blogabout,blogcolsize,blog_colnums,blog_tbcount,blog_showtotal,blog_commtimerout
dim blog_commubb,blog_commimg,blog_version,blog_updatedate,blog_defaultskin,blog_skinname,blog_splittype
dim blog_imglink,blog_postfile,blog_postcalendar,log_splittype,blog_introchar,blog_introline
dim blog_validate,register_usernames,register_username,filterips,filterip,blog_title
dim blog_commlength,blog_downlocal,blog_dismod,blog_disregister,blog_master,blog_email,blog_countnum
dim blog_wapnum,blog_wapimg,blog_waphtml,blog_waplogin,blog_wapcomment,blog_wap,blog_wapurl
'=========================日志基本信息缓存=======================
sub getinfo(byval action)
dim blog_infos
'--------------写入基本信息缓存------------------
if not isarray(application(cookiename&"_blog_infos")) or action=2 then
dim log_infos
sql="select top 1 blog_name,blog_url,blog_perpage,blog_lognums,blog_commnums,blog_memnums," & _
"blog_visitnums,blog_bookpage,blog_messagenums,blog_commpage,blog_affiche," & _
"blog_about,blog_colpage,blog_colnums,blog_tbnums,blog_showtotal," & _
"blog_filtername,blog_filterip,blog_commtimerout,blog_commubb,blog_commimg," & _
"blog_postfile,blog_postcalendar,blog_defaultskin,blog_skinname,blog_splittype," & _
"blog_introchar,blog_introline,blog_validate,blog_title,blog_imglink," & _
"blog_commlength,blog_downlocal,blog_dismod,blog_disregister,blog_master,blog_email,blog_countnum," & _
"blog_wapnum,blog_wapimg,blog_waphtml,blog_waplogin,blog_wapcomment,blog_wap,blog_wapurl" & _
" from blog_info"
set log_infos=conn.execute(sql)
sqlquerynums=sqlquerynums+1
blog_infos=log_infos.getrows()
set log_infos=nothing
application.lock
application(cookiename&"_blog_infos")=blog_infos
application.unlock
else
blog_infos=application(cookiename&"_blog_infos")
end if
'--------------读取基本信息缓存------------------
if action<>2 then
sitename=blog_infos(0,0)'站点名字
siteurl=blog_infos(1,0)'站点地址
blogperpage=int(blog_infos(2,0))'每页日志? blog_lognums=int(blog_infos(3,0))'日志总数
blog_commnums=int(blog_infos(4,0))'评论总数
blog_memnums=int(blog_infos(5,0))'会员总数
blog_visitnums=int(blog_infos(6,0))'访问? blogbookpage=int(blog_infos(7,0))'每页留言?备用)
blog_messagenums=int(blog_infos(8,0))'留言总数(备用)
blogcommpage=int(blog_infos(9,0))'每页评论? blogaffiche=blog_infos(10,0)'公告
blogabout=blog_infos(11,0)'备案信息
blogcolsize=int(blog_infos(12,0))'每页书签?备用)
blog_colnums=int(blog_infos(13,0))'书签总数(备用)
blog_tbcount=int(blog_infos(14,0))'引用通告总数
blog_showtotal=cbool(blog_infos(15,0))'是否显示统计(备用)
register_usernames=blog_infos(16,0)'注册名字过滤
register_username=split(register_usernames,"|")
filterips=blog_infos(17,0)'ip地址过滤
filterip=split(filterips,"|")
blog_commtimerout=int(blog_infos(18,0))'发表评论时间间隔
blog_commubb=int(blog_infos(19,0))'是否禁用评论ubb代码
blog_commimg=int(blog_infos(20,0))'是否禁用评论贴图
blog_postfile=cbool(blog_infos(21,0)) '动态输出日志文? blog_postcalendar=cbool(blog_infos(22,0)) '动态输出日志日历文? blog_defaultskin=blog_infos(23,0)'默认界面
blog_skinname=blog_infos(24,0)'界面名
blog_splittype=cbool(blog_infos(25,0))'日志分割类型
blog_introchar=blog_infos(26,0)'日志预览最大字符数
blog_introline=blog_infos(27,0)'日志预览切割行数
blog_validate=cbool(blog_infos(28,0))'发表评论是否都需要验? blog_title=blog_infos(29,0)'blog副标? blog_imglink=cbool(blog_infos(30,0))'是否在首页显示图片友情链? blog_commlength=int(blog_infos(31,0))'评论长度
blog_downlocal=cbool(blog_infos(32,0))'是否使用防盗链下? blog_dismod=cbool(blog_infos(33,0))'默认显示内容
blog_disregister=cbool(blog_infos(34,0))'是否允许注册
blog_master=blog_infos(35,0)'blog管理员姓? blog_email=blog_infos(36,0)'blog管理员邮件地址
blog_countnum=blog_infos(37,0)'访客统计最大次?
blog_wapnum=int(blog_infos(38,0))'wap 文章列表数量
blog_wapimg=cbool(blog_infos(39,0))'wap 文章显示图片
blog_waphtml=cbool(blog_infos(40,0))'wap 文章使用简单Html
blog_waplogin=cbool(blog_infos(41,0))'wap 允许登录
blog_wapcomment=cbool(blog_infos(42,0))'wap 允许评论
blog_wap=cbool(blog_infos(43,0))'使用 wap
blog_wapurl=cbool(blog_infos(44,0))'使用 wap 转换文章超链?
blog_version="2.6 build 02"'当前pjblog版本? blog_updatedate="2006-7-2"'pjblog最新更新时?
end if
end sub
'======================end sub=======================
'-------------------------blog权限变量---------------
dim stat_title,stat_addall,stat_editall,stat_delall,stat_add,stat_edit,stat_del,stat_commentadd
dim stat_commentdel,stat_admin,stat_code,up_filetype,up_filesize,up_filetypes,stat_fileupload
dim stat_commentedit,stat_showhiddencate
'=====================日志权限缓存===================
sub userright(byval action) '读取日志权限
dim blog_status
'--------------写入日志权限缓存------------------
if not isarray(application(cookiename&"_blog_rights")) or action=2 then
dim log_status,log_statuslist
sql="select stat_name,stat_title,stat_code,stat_attsize,stat_atttype from blog_status"
set log_status=conn.execute(sql)
sqlquerynums=sqlquerynums+1
blog_status=log_status.getrows()
set log_status=nothing
application.lock
application(cookiename&"_blog_rights")=blog_status
application.unlock
else
blog_status=application(cookiename&"_blog_rights")
end if
'--------------写入日志权限缓存------------------
if action<>2 then
dim blog_status_len,i
blog_status_len=ubound(blog_status,2)
for i=0 to blog_status_len
if blog_status(0,i)=memstatus then
stat_title=blog_status(1,i)
fillright blog_status(2,i)
up_filesize=blog_status(3,i)
up_filetypes=blog_status(4,i)
up_filetype=split(up_filetypes,"|")
'exit sub
end if
next
end if
end sub
sub fillright(statuscode) '写入权限变量
stat_addall=cbool(mid(statuscode,1,1))
stat_add=cbool(mid(statuscode,2,1))
stat_editall=cbool(mid(statuscode,3,1))
stat_edit=cbool(mid(statuscode,4,1))
stat_delall=cbool(mid(statuscode,5,1))
stat_del=cbool(mid(statuscode,6,1))
stat_commentadd=cbool(mid(statuscode,7,1))
stat_commentedit=cbool(mid(statuscode,8,1))
stat_commentdel=cbool(mid(statuscode,9,1))
stat_fileupload=cbool(mid(statuscode,10,1))
stat_admin=cbool(mid(statuscode,11,1))
stat_showhiddencate=cbool(mid(statuscode,12,1))
end sub
'=========================end sub========================
'========================日志分类缓存=========================
dim category_code
sub categorylist(byval action) '日志分类
'写入日志分类
'action=0 横向菜单 action=1 树状菜单 action=2重建分类
'--------------写入日志分类缓存------------------
dim arr_category,i
if not isarray(application(cookiename&"_blog_category")) or action=2 then
dim log_category
tempvar=""
sql="select cate_id,cate_name,cate_order,cate_intro,cate_outlink,cate_url,cate_icon,cate_count,cate_lock,cate_local,cate_secret from blog_category order by cate_order asc"
set log_category=conn.execute(sql)
sqlquerynums=sqlquerynums+1
if log_category.eof or log_category.bof then
redim arr_category(0,0)
else
arr_category=log_category.getrows()
end if
set log_category=nothing
application.lock
application(cookiename&"_blog_category")=arr_category
application.unlock
else
arr_category=application(cookiename&"_blog_category")
end if
dim category_len,menu_diver
'--------------输出日志横向菜单------------------
if action=0 then
menu_diver=""
response.write("
")
if ubound(arr_category,1)=0 then response.write("
"):exit sub
category_len=ubound(arr_category,2)
for i=0 to category_len
if int(arr_category(9,i))=0 or int(arr_category(9,i))=1 then
response.write(menu_diver)
if arr_category(4,i) then
if cbool(arr_category(10,i)) then
if stat_showhiddencate or stat_admin then response.write("
"&arr_category(1,i)&"")
else
response.write("
"&arr_category(1,i)&"")
end if
else
if cbool(arr_category(10,i)) then
if stat_showhiddencate or stat_admin then response.write("
"&arr_category(1,i)&"")
else
response.write("
"&arr_category(1,i)&"")
end if
end if
menu_diver="
"
end if
next
response.write("
")
end if
if action=1 then
category_code=""
if ubound(arr_category,1)=0 then exit sub
category_len=ubound(arr_category,2)
for i=0 to category_len
if int(arr_category(9,i))=0 or int(arr_category(9,i))=2 then
if arr_category(4,i) then
if cbool(arr_category(10,i)) then
if stat_showhiddencate or stat_admin then category_code=category_code&("