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

📄 rss.php

📁 M-logger v0.3.1 中文版
💻 PHP
字号:
<?
/**
 * Title:	The rss list
 * File Name:	./rss.php
 * Copyright (c) 2004 M-logger
 * Author:	milkliker
 * Modify:	milkliker
 * Last Change:	13:42 04-8-6
 * Version:	0.3.0
 **/

//---[Require Files]----------------------------------------
require_once("config.php");
require_once("class/TxtDb.inc.php");
require_once("class/UserClass.inc.php");

//---[Basic Set]--------------------------------------------
define('DATADIR','./db');
define('CACHEDIR','./cache');
define('SESSIONDIR','./tmp');

//---[Page Start]-------------------------------------------
if($config['GZipOutput']=='y'){
	ob_start('ob_gzhandler');
}else{
	ob_start();
}

session_save_path(SESSIONDIR);
if(function_exists(session_cache_limiter)) { 
	session_cache_limiter('nocache');
}
session_start();

header("Content-Type: text/xml");

//---[Load Config]------------------------------------------
$configFile='./config.php';
$configCache=CACHEDIR.'/config.cache.php';
getCache($config,$configFile,$configCache);//function getCache() in TxtDb.inc.php

//---[Set Vars]---------------------------------------------
$thisTime=explode("-",date("Y-m-d-H-i-s"));
$thisTime[3]=$thisTime[3]+intval($config['HourOff']);
$thisTime[4]=$thisTime[4]+intval($config['MiniOff']);
$thisTime=mktime($thisTime[3],$thisTime[4],$thisTime[5],$thisTime[1],$thisTime[2],$thisTime[0]);

$a=trim($_GET['a']);
$year= empty($_GET['year']) ? date("Y",$thisTime) : $_GET['year'];
$month= empty($_GET['month']) ? date("n",$thisTime) : $_GET['month'];
$date= empty($_GET['date']) ? date("j",$thisTime) : $_GET['date'];
$displayNewLogs= empty($_GET['n']) ? $config['DisplayNewLogs'] : $_GET['n'];

$xmlVersion="1.0";

//---[Creat Object]-----------------------------------------
$user=new user;
$user->txtdb(DATADIR,CACHEDIR);
$user->userIsLogged();

//---[Output XML]-------------------------------------------
echo '<?xml version="'.$xmlVersion.'" encoding="UTF-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns="http://purl.org/rss/1.0/">
<channel rdf:about="'.$config['LogUrl'].'">
<title>'.$config['LogName'].'</title>
<webMaster>'.$config['MasterMail'].'('.$config['LogMaster'].')</webMaster>
<link>'.$config['LogUrl'].'</link>
<language>zh-cn</language>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>M-Logger v0.3.X</generator>
<description>The latest news of '.$displayNewLogs.' days from '.$config['LogName'].'('.$config['LogUrl'].')</description>
<copyright>'.$config['Copyright'].'</copyright>
</channel>';

//---[Display Function]-------------------------------------
function display($tblName){
	global $user;
	if(!$user->exists($tblName)){
		return false;
	}
	$data=$user->get("'{type}'=='log'",true,null,$tblName);//[11]NO CACHE..
	if(empty($data)){
		return false;
	}
	foreach($data as $value){
		if($user->user['rank'] <= $value['view'] or $user->user['name']==$value['author']){
			$out[]=$value;
		}
	}
	return $out;
}

$i=0;

//---[Display List]-----------------------------------------
for(;true;){
	$tblName='content/'.$year.'_'.$month.'_'.$date;
	$outDate=$year.'-'.$month.'-'.$date;
	$out=display($tblName,$outDate);
	if(!empty($out)){
		foreach($out as $value){
			echo "<item rdf:about=\"".$config['LogUrl']."\">\n";
			echo "<title><![CDATA[".$value['title']."]]></title>\n";
			echo "<link><![CDATA[".$config['LogUrl']."?date=".$outDate."&id=".$value['id']."]]></link>\n";
			echo "<description><![CDATA[".$value['describe']."]]></description>\n";
			echo "<dc:creator><![CDATA[".$value['author']."]]></dc:creator>\n";
			echo "<dc:date>".date("Y-m-d\TH:i:s",$value['time'])."+08:00</dc:date>\n";
			echo "<comments><![CDATA[".$config['LogUrl']."mods/comment.php?date=".$outDate."&id=".$value['id']."]]></comments>\n";
			echo "</item>\n";
			$i++;
		}
	}
	if(intval($date)!=1){
		$date--;
	}elseif(intval($month)!=1){
		$month--;
		$time=@mktime(0,0,1,$month,1,$year);
		$date=date("t",$time);
	}else{
		$year--;
		$month=12;
		$date=31;
	}
	if($i>$displayNewLogs or intval($year)<2003) break;
}
echo '</rdf:RDF>';
ob_end_flush;
?>

⌨️ 快捷键说明

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