adding this file to stop apache errors
[dana/openbox-web.git] / rss / refresh.php
1 <?
2 header('Content-type: text/html');
3
4 require_once('../h/agg.php'); // my rss to xml aggregator
5
6 print "<h2>Loading Config...</h2>\n";
7
8 // the config file for planet and miniplanet
9 $xml = simplexml_load_file('config/planet.xml');
10 if (!$xml) {
11   print "<div><b>Error</b> loading config/planet.xml</div>";
12   exit;
13 }
14
15 $feeds = array();
16
17 foreach ($xml->feed as $f) {
18   if ($f->planet->rss)
19     $feeds[] = array( 'url' => (string)$f->planet->rss,
20                       'name' => (string)$f->name,
21                       'image' => (string)$f->image,
22                       'nick' => (string)$f->nick);
23 }
24
25 $out = 'planet/.xml';
26 $tmp = $out.'.w';
27 $fh = fopen($tmp, 'w');
28 print "<h2>Reading Planet Openbox Feeds...</h2>\n";
29 $data = agg($feeds,
30             'Planet Openbox',
31             'http://icculus.org/openbox/discuss-planet.shtml',
32             'Blog entries from around the Openbox planet',
33             3, false);
34 if (fwrite($fh, $data))
35   rename($tmp, $out);
36 else
37   print "<div><b>Error</b> writing $out</div>";
38
39 $feeds = array();
40
41 foreach ($xml->feed as $f) {
42   if ($f->mini->rss)
43     $feeds[] = array( 'url' => (string)$f->mini->rss,
44                       'name' => (string)$f->name,
45                       'image' => (string)$f->image,
46                       'nick' => (string)$f->nick);
47 }
48
49 $out = 'mini/.xml';
50 $tmp = $out.'.w';
51 $fh = fopen($tmp, 'w');
52 print "<h2>Reading Mini Planet Openbox Feeds...</h2>\n";
53 $data = agg($feeds,
54             'Mini Planet Openbox',
55             'http://icculus.org/openbox/discuss-miniplanet.shtml',
56             'Tweets and dents from around the Openbox planet',
57             6, true);
58 if (fwrite($fh, $data))
59   rename($tmp, $out);
60 else
61   print "<div><b>Error</b> writing $out</div>";
62
63 $feeds = array(
64   array( 'url' => 'http://cia.vc/stats/project/Openbox/.rss',
65          'name' => 'Openbox'),
66   array( 'url' => 'http://cia.vc/stats/project/Obconf/.rss',
67          'name' => 'ObConf'));
68
69 $out = 'local/.xml.commits';
70 $tmp = $out.'.w';
71 $fh = fopen($tmp, 'w');
72 print "<h2>Reading Openbox Commits Feeds...</h2>\n";
73 $data = agg($feeds,
74             'Openbox Commits',
75             'http://icculus.org/openbox/develop.shtml',
76             'Commit log for Openbox and ObConf',
77             30, false);
78 if (fwrite($fh, $data))
79   rename($tmp, $out);
80 else
81   print "<div><b>Error</b> writing $out</div>";
82
83
84 // take this out one day when we replace the old site
85 $out = 'news/.xml';
86 $tmp = $out.'.w';
87 $fh = fopen($tmp, 'w');
88 print "<h2>Reading Openbox News Feed...</h2>\n";
89 $data = agg_single('http://icculus.org/openbox/rss.xml',
90                    30, false);
91 if (fwrite($fh, $data))
92   rename($tmp, $out);
93 else
94   print "<div><b>Error</b> writing $out</div>";
95
96 print "<h2>Done.</h2>\n";
97 ?>