1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 | <?php
include('uaocode.php');
$bbs_path='/home/bbs/brd/';
$brd_name=$_GET['brd'];
$filename=$bbs_path.$brd_name.'/.DIR';
if (!file_exists($filename)) {
echo 'no such broad!';
exit;
}
header('Content-type: application/rss+xml; charset=utf-8');
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
$all_post=filesize($filename)/256;
$post_num=10;
for($i=1; $i <= $post_num ; ++$i){
$fp=fopen($filename,'r');
fseek($fp, ($all_post-$i)*256+12);
$match[$i]['post_id']=trim(fread($fp,32));
$post_path=$bbs_path.$brd_name.'/'.substr($match[$i]['post_id'], -1).'/'.$match[$i]['post_id'];
$fpp=fopen($post_path,'r');
$j=0;
while($current_line = fgets($fpp)){
++$j;
switch ($j){
case 1:
preg_match('/: (.*) \(/',$current_line,$match[$i]['post_userid']);
case 2:
$match[$i]['post_title']=trim(html_entity_decode(iconv("big5","UTF-8",uao_convert(substr($current_line,6))),ENT_QUOTES,"UTF-8"));
case 3:
$match[$i]['post_time']=date(DATE_RSS, strtotime(trim(substr($current_line,6))));
default;
$current_line=preg_replace('/\\x1b\\[([^m]*)m/i','',$current_line);
$match[$i]['post_conten'] .= trim(html_entity_decode(iconv("big5","UTF-8",uao_convert($current_line)),ENT_QUOTES,"UTF-8"),'\0');
}
}
}
?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
>
<channel>
<title>夢之大地rsstest</title>
<description>none</description>
<link>http://140.116.250.9/</link>
<atom:link href="http://140.116.250.9/paser.php" rel="self" type="application/rss+xml" />
<language>en</language>
<generator>http://www.renn999.twbbs.org/illustrator/RSS.php</generator>
<?php
foreach($match as $item){
echo "<item>\n";
echo "\t\t\t<title><![CDATA[".stripslashes($item["post_title"])."]]]]><![CDATA[></title>\n";
echo "\t\t\t<pubDate>".stripslashes($item["post_time"])."</pubDate>\n";
echo "\t\t\t<link>http://140.116.250.9/</link>\n";
//str_replace(' ',' ',nl2br(htmlspecialchars($item["post_conten"])));
echo "\t\t\t<description><![CDATA[".nl2br(str_replace(' ',' ',htmlspecialchars($item["post_conten"])))."]]]]><![CDATA[></description>\n";
echo "\t\t\t<guid isPermaLink=\"false\">",$item['post_id'],"</guid>";
echo "</item>\n";
}
?>
</channel>
</rss>
|