⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inc_xmlrpc.asp

📁 ZD-BS是一个基于asp+access的个人blog系统 程序特点: 1.数据结构合理
💻 ASP
字号:
<script language="JScript" runat="server">

//============================================================
//     Copyright 2006-2007 VAL/ZYI. All Rights Reserved.
//============================================================

function pingback_ping(strTo,strFrom){
		
	var strErr="";
	
	var re=new RegExp("^"+zd_set["blogURL"],"i");
	var arrMach=re.exec(strTo);
	if(arrMach==null){
		return theAPI.IXRError(0,"no link to us.");
	}
	
	//local
	var intLogID=0,arrArticle;
	re=new RegExp("article.asp\\?\\/a([0-9]+)\\.(htm|html)","i");
	arrMach=re.exec(strTo);
	if(arrMach==null){
		strErr="The page isn't been found or its not a pingback-enabled resource";
	}else{
		intLogID=func.checkInt(arrMach[1]);
		arrArticle=dbConn.query("select top 1 post_pingback,post_enablePingIn,post_checkComment from zd_post where post_ID="+intLogID+" and post_type='article' and post_state='publish'");
		if(arrArticle==null){
			strErr="The page isn't been found or its not a pingback-enabled resource";
		}else if(!arrArticle[0]["post_enablePingIn"]){
			strErr="The page isn't been found or its not a pingback-enabled resource";
		}
	}
	if(strErr!=""){
		return theAPI.IXRError(33,strErr);
	}
	
	var arrPinged="";
	if(arrArticle[0]["post_pingback"]){
		arrPinged=arrArticle[0]["post_pingback"].split("<>");
		for(var i=0;i<arrPinged.length;i++){
			if(strFrom==arrPinged[i]){
				strErr="The pingback has already been registered.";
			}
		}
	}
	if(strErr!=""){
		return theAPI.IXRError(48,strErr);
	}
	//remote
	var strRemote=func.remoteRequest(strFrom,"GET","",null,false,3,"text");
	if(!strRemote){
		return theAPI.IXRError(16,"The source URL does not exist.");
	}
	
	strRemote=strRemote.replace(/\<\!doc/i,"<DOC");
	strRemote=strRemote.replace(/[\s\r\n\t]+/gi," ");
	strRemote=strRemote.replace(/\<(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^\>]*\>/gi,"\n\n");
	re=/\<title\>([^\<\>]*?)\<\/title\>/i;
	arrMach=re.exec(strRemote);
	if(arrMach==null){
		return theAPI.IXRError(32,"We cannot find a title on that page.");
	}
	var strTitle=theHTML.trim(theHTML.encodeHTML(arrMach[1]));

	var arrRemote=strRemote.split("\n\n");
	var strExcerpt="";
	re=new RegExp("article.asp\\?\\/a"+intLogID+"\\.(htm|html)","gi");
	for(var i=0;i<arrRemote.length;i++){
		arrMach=re.exec(arrRemote[i]);
		if(arrMach!=null){
			strExcerpt=theHTML.trim(theHTML.encodeHTML(theHTML.trimHTML(arrRemote[i])));
			strExcerpt=theHTML.sliceStr(strExcerpt,100,"...");
			break;
		}
	}
	if(strExcerpt==""){
		return theAPI.IXRError(17,"The source URL does not contain a link to the target URL.");
	}

	//that's OK
	var arrInsert={
		"comm_postID":intLogID,
		"comm_email":strTitle,
		"comm_homepage":strFrom,
		"comm_content":strExcerpt,
		"comm_ip":func.getIp(),
		"comm_state":(arrArticle[0]["post_checkComment"]?"unchecked":"publish"),
		"comm_type":"pingback"
	};
	dbConn.insert(arrInsert,"zd_comment");
	if(zd_set["cacheNewComment"]){
		theCache.loadNewComment();
	}
	if(zd_set["cacheCounter"]){
		theCache.loadCounter();
	}

	return "";
}

function pingback_extensions_getPingbacks(strURL){}

function doit(){
	var strRequest=Request.BinaryRead(Request.TotalBytes);
	theXML.loadXML(strRequest);
	var arrAct=theXML.getNodeText("methodName");
	if(arrAct!=null){
		switch(arrAct[0]){
			case "pingback.ping":
			var arrValue=theXML.getNodeText("string");
			if(arrValue!=null&&arrValue.length==2){
				theXML.output(pingback_ping(arrValue[1],arrValue[0]));
			}
			break;
		}
	}
}

</script>

⌨️ 快捷键说明

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