-
Notifications
You must be signed in to change notification settings - Fork 0
/
rss.php
64 lines (62 loc) · 2.83 KB
/
rss.php
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
<?php // licence: gpl-signature.txt
$notype=1;
require('init.php');
$subdomain=strstr($_SERVER['PHP_SELF']);
if($subdomain>=2){$subd=preg_match('(\/.*/)',$subd);}
$server=stripslashes($_SERVER['HTTP_HOST']).$subd;
//header("Content-type: text/xml");
if($link!==false){
if(!file_exists('rss')){
mkdir('rss');chmod('rss',0755);
$fh=fopen('rss/.htaccess','a+');
fwrite($fh,'Options +Indexes');fclose($fh);
}
$ntypes=mysql_query('SELECT * FROM bible_node_types;');
$numtypes=mysql_numrows($ntypes);
$it=0;while($it<=$numtypes){
$feedtype=mysql_result($ntypes,$it,'name');
if(!empty($feedtype)){$dotype='type=\''.$feedtype.'\'';}
$st='1';
if($feedtype=='fc'){$dotype='type NOT IN(\'fc\')';$ft='All content';$feedtype='feed';}
elseif($feedtype=='ne'){$ft='News';$feedtype='news';}
elseif($feedtype=='ft'){$ft='Forum Topics';$feedtype='forum';}
elseif($feedtype=='ct'){$st='0';$ft='Comments';$feedtype='comments';}
elseif($feedtype=='ar'){$ft='Articles';$feedtype='articles';}
elseif($feedtype=='bl'){$ft='Blogs';$feedtype='blogs';}
elseif($feedtype=='po'){$ft='Podcasts';$feedtype='podcasts';}
elseif($feedtype=='ev'){$ft='Events';$feedtype='event';}
elseif($feedtype=='do'){$ft='Documentation';$feedtype='documentation';}
elseif($feedtype=='li'){$ft='Links';$feedtype='links';}
else{$ft=$feedtype;}
$s=mysql_query('SELECT * FROM bible_nodes WHERE status='.$st.' AND '.$dotype.' ORDER BY created DESC LIMIT 0,30;');
$n=mysql_numrows($s);
if(!empty($n)and!empty($ft)and($n!==0)){
echo$ft.' '.$n.N;
$fh=fopen('rss/'.$feedtype.'.rss','w+');
fwrite($fh,'<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<rss version=\'2.0\'><channel>
<title>'.$ft.' | '.$server.'</title>
<link>http://'.$server.'</link>
<description>'.$server.' Feeds</description>
<language>en-us</language>');
$i=0;while($i<$n){
//$svisitors=mysql_result($s,$i,'visitors');$supcate=mysql_result($s,$i,'uppercat');$scate=mysql_result($s,$i,'category');
$sdata=mysql_result($s,$i,'data');
if(strstr($sdata,'<![CDATA[')){$sdata=str_replace(']]>',"",$sdata);$sdata=preg_replace('/(<\!\[[^\[].*\[)/i',"",$sdata);}
fwrite($fh,'<item>
<title>'.mysql_result($s,$i,'title').'</title>
<link>http://'.$server.'?forum&nid='.mysql_result($s,$i,'nid').'</link>
<description><![CDATA['.$sdata.'<p></p>By uid['.mysql_result($s,$i,'uid').']]]></description>
<pubDate>'.date('r',mysql_result($s,$i,'created')).'</pubDate>
<category>'.mysql_result($s,$i,'type').'</category>
</item>');
++$i;
}
fwrite($fh,'</channel></rss>');
fclose($fh);
}
++$it;
}
echo'<a href="http://'.$server.'/rss">generation complete; you may now find them here</a>';
}
?>