📄 inc_default.asp
字号:
<script language="JScript" runat="server">
//============================================================
// Copyright 2006-2007 VAL/ZYI. All Rights Reserved.
//============================================================
function defaultList(arrPara){
var intPSize=arrPara["pSize"];
var intAPage=arrPara["aPage"];
var strQuery="select ";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_type='comment' and comm_state='publish') as commCount,";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_state='publish' and comm_type='pingback') as pingCount,";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_state='publish' and comm_type='trackback') as tbCount,";
strQuery+="cat_ID,cat_name,cat_state,post_ID,post_title,post_authorID,post_authorName,post_email,post_homepage,post_content,post_excerpt,post_textMode,post_postTime,post_viewCount,post_state "
strQuery+="from zd_post,zd_category ";
strQuery+="where post_catID=cat_ID and post_type='article' and post_state<>'draft' ";
if(zd_userGroup!="admin"){
strQuery+="and cat_state<>'private' and (post_state<>'private' or (post_authorID="+zd_userID+" and post_authorID<>0)) ";
}
strQuery+="order by post_postTime desc";
var arrArticle=dbConn.query(strQuery,intPSize,intAPage,false);
var arrOut=null;
var strAnnounce="";
var arrArea=theCache.area;
var arrTmp=func.searchArr(arrArea,"state","announce");
if(arrTmp!=null){
strAnnounce=arrTmp[0]["content"];
}
var strPage="";
if(arrArticle!=null){
var pCount=dbConn.pageCount;
var mainURL="./";
var plusURL="";
intAPage=intAPage>pCount?pCount:intAPage;
strPage=theHTML.pageLink(pCount,intAPage,mainURL,plusURL,true);
arrOut=checkArticle(arrArticle);
}
var arrInfo=getInfo("default",strAnnounce,strPage);
page_articleList(arrInfo,arrOut);
}
function cateList(arrPara){
var intPSize=arrPara["pSize"];
var intAPage=arrPara["aPage"];
var intCatID=arrPara["catID"];
var arrTmp=dbConn.query("select top 1 cat_name from zd_category where cat_ID="+intCatID+" and cat_type='category'");
if(arrTmp==null){
errorMsg("<li>"+zd_ls["error:error para"]+"</li>");
}else{
var arrArticle;
var strQuery="select ";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_type='comment' and comm_state='publish') as commCount,";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_state='publish' and comm_type='pingback') as pingCount,";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_state='publish' and comm_type='trackback') as tbCount,";
strQuery+="cat_ID,cat_name,cat_state,post_ID,post_title,post_authorID,post_authorName,post_email,post_homepage,post_content,post_excerpt,post_textMode,post_postTime,post_viewCount,post_state "
strQuery+="from zd_post,zd_category ";
strQuery+="where post_catID=cat_ID and post_type='article' and post_state<>'draft' ";
if(zd_userGroup!="admin"){
strQuery+="and cat_state<>'private' and (post_state<>'private' or (post_authorID="+zd_userID+" and post_authorID<>0)) ";
}
strQuery+="and post_catID="+intCatID+" ";
strQuery+="order by post_postTime desc";
var arrArticle=dbConn.query(strQuery,intPSize,intAPage,false);
var arrOut=null;
var strCatName=arrTmp[0]["cat_name"];
var strPage="";
if(arrArticle!=null){
var pCount=dbConn.pageCount;
var mainURL="./";
var plusURL="c"+intCatID;
intAPage=intAPage>pCount?pCount:intAPage;
strPage=theHTML.pageLink(pCount,intAPage,mainURL,plusURL,true);
arrOut=checkArticle(arrArticle);
}
var arrInfo=getInfo("category",strCatName,strPage);
page_articleList(arrInfo,arrOut);
}
}
function dateList(arrPara){
var intPSize=arrPara["pSize"];
var intAPage=arrPara["aPage"];
var intYear=func.checkInt(arrPara["date"][0]);
var intMonth=func.checkInt(arrPara["date"][1]);
var intDay=func.checkInt(arrPara["date"][2]);
if(
(intYear<1000||intYear>9999)||
(intMonth!=0&&(intMonth<1||intMonth>12))||
(intDay!=0&&(intMonth==0||intDay<1||intDay>31))
){
errorMsg("<li>"+zd_ls["error:error para"]+"</li>");
}else{
var arrArticle;
var strQuery="select ";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_type='comment' and comm_state='publish') as commCount,";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_state='publish' and comm_type='pingback') as pingCount,";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_state='publish' and comm_type='trackback') as tbCount,";
strQuery+="cat_ID,cat_name,cat_state,post_ID,post_title,post_authorID,post_authorName,post_email,post_homepage,post_content,post_excerpt,post_textMode,post_postTime,post_viewCount,post_state "
strQuery+="from zd_post,zd_category ";
strQuery+="where post_catID=cat_ID and post_type='article' and post_state<>'draft' ";
if(zd_userGroup!="admin"){
strQuery+="and cat_state<>'private' and (post_state<>'private' or (post_authorID="+zd_userID+" and post_authorID<>0)) ";
}
strQuery+="and year(post_postTime)="+intYear+" ";
if(intMonth!=0){
strQuery+="and month(post_postTime)="+intMonth+" ";
if(intDay!=0){
strQuery+="and day(post_postTime)="+intDay+" ";
}
}
strQuery+="order by post_postTime desc";
var arrArticle=dbConn.query(strQuery,intPSize,intAPage,false);
var arrOut=null;
var strDate=(intYear!=0?intYear:"")+(intMonth!=0?" - "+intMonth:"")+(intDay!=0?" - "+intDay:"");
var strPage=""
if(arrArticle!=null){
var pCount=dbConn.pageCount;
var mainURL="./";
var plusURL="d"+intYear+(intMonth!=0?"-"+intMonth:"")+(intDay!=0?"-"+intDay:"");
intAPage=intAPage>pCount?pCount:intAPage;
strPage=theHTML.pageLink(pCount,intAPage,mainURL,plusURL,true);
arrOut=checkArticle(arrArticle);
}
var arrInfo=getInfo("date",strDate,strPage);
page_articleList(arrInfo,arrOut);
}
}
function searchList(arrPara){
var intPSize=arrPara["pSize"];
var intAPage=arrPara["aPage"];
var strQS=arrPara["qs"];
if(!zd_set["enableSearch"]){
errorMsg("<li>"+zd_ls["error:search closed"]+"</li>");
}else if(strQS.length<2||strQS.length>16){
errorMsg("<li>"+zd_ls["error:error search"]+"</li>");
}else{
var strQuery="select ";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_type='comment' and comm_state='publish') as commCount,";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_state='publish' and comm_type='pingback') as pingCount,";
strQuery+="(select count(comm_ID) from zd_comment where comm_postID=post_ID and comm_state='publish' and comm_type='trackback') as tbCount,";
strQuery+="cat_ID,cat_name,cat_state,post_ID,post_title,post_authorID,post_authorName,post_email,post_homepage,post_content,post_excerpt,post_textMode,post_postTime,post_viewCount,post_state "
strQuery+="from zd_post,zd_category ";
strQuery+="where post_catID=cat_ID and post_type='article' and post_state<>'draft' ";
if(zd_userGroup!="admin"){
strQuery+="and cat_state<>'private' and (post_state<>'private' or (post_authorID="+zd_userID+" and post_authorID<>0)) ";
}
strQuery+="and (post_title like '%"+strQS+"%' or post_content like '%"+strQS+"%') ";
strQuery+="order by post_postTime desc";
var arrArticle=dbConn.query(strQuery,intPSize,intAPage,false);
var arrOut=null;
var strPage="";
if(arrArticle!=null){
var pCount=dbConn.pageCount;
var mainURL="./";
var plusURL="qs="+strQS;
intAPage=intAPage>pCount?pCount:intAPage;
strPage=theHTML.pageLink(pCount,intAPage,mainURL,plusURL,false);
arrOut=checkArticle(arrArticle);
}
var arrInfo=getInfo("search",strQS,strPage);
page_articleList(arrInfo,arrOut);
}
}
function getInfo(strMode,strValue,strPage){
var arr=new Array();
arr["mode"]=strMode;
arr["value"]=strValue;
arr["page"]=strPage;
return arr;
}
function checkArticle(arrArticle){
var arr=new Array();
for(var i=0;i<arrArticle.length;i++){
arr[i]=new Array();
arr[i]["ID"]=arrArticle[i]["post_ID"];
arr[i]["title"]=arrArticle[i]["post_title"];
arr[i]["postTime"]=func.dateStr(arrArticle[i]["post_postTime"],zd_ls["time:type_1"]);
arr[i]["content"]=arrArticle[i]["post_excerpt"]?arrArticle[i]["post_excerpt"]:arrArticle[i]["post_content"];
if(arrArticle[i]["post_textMode"]!="html"||arrArticle[i]["post_excerpt"]){
arr[i]["content"]=theHTML.ubb(arr[i]["content"]);
}
if(zd_set["cacheKeyword"]){
arr[i]["content"]=theHTML.keyword(arr[i]["content"]);
}
arr[i]["more"]=arrArticle[i]["post_excerpt"]?true:false;
arr[i]["catID"]=arrArticle[i]["cat_ID"];
arr[i]["catName"]=arrArticle[i]["cat_name"];
arr[i]["authorID"]=arrArticle[i]["post_authorID"];
arr[i]["authorName"]=arrArticle[i]["post_authorName"];
arr[i]["email"]=arrArticle[i]["post_email"];
arr[i]["homepage"]=arrArticle[i]["post_homepage"];
arr[i]["commentCount"]=arrArticle[i]["commCount"];
arr[i]["pingCount"]=arrArticle[i]["pingCount"];
arr[i]["tbCount"]=arrArticle[i]["tbCount"];
arr[i]["viewCount"]=arrArticle[i]["post_viewCount"];
}
return arr;
}
function doit(){
var arrPara=new Array();
var arrQS=func.getInput(0);
var strQS=sys.getStaticQuery();
var intPSize=zd_set["articlePerPage"]<1?10:zd_set["articlePerPage"];
var intAPage=1;
var intCatID=0;
var arrDate=null;
var re,arrMach;
if(func.checkStr(arrQS["qs"])!=""){
intAPage=(func.checkInt(arrQS["page"])==0?1:func.checkInt(arrQS["page"]));
}else{
re=/p([0-9]+)/i;
arrMach=re.exec(strQS);
if(arrMach!=null){
intAPage=func.checkInt(arrMach[1]);
}
}
re=/c([0-9]+)/i;
arrMach=re.exec(strQS);
if(arrMach!=null){
intCatID=func.checkInt(arrMach[1]);
}
re=/d([0-9\-]+)/i;
arrMach=re.exec(strQS);
if(arrMach!=null){
arrDate=arrMach[1].split("-");
}
arrPara["pSize"]=intPSize;
arrPara["aPage"]=intAPage;
if(func.checkStr(arrQS["qs"])!=""){
arrPara["qs"]=func.checkStr(arrQS["qs"]);
searchList(arrPara);
}else if(intCatID!=0){
arrPara["catID"]=intCatID;
cateList(arrPara);
}else if(arrDate!=null){
arrPara["date"]=arrDate;
dateList(arrPara);
}else{
defaultList(arrPara);
}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -