diff options
Diffstat (limited to 'rss.php')
| -rw-r--r-- | rss.php | 334 |
1 files changed, 334 insertions, 0 deletions
| diff --git a/rss.php b/rss.php new file mode 100644 index 0000000..c9e866f --- /dev/null +++ b/rss.php | |||
| @@ -0,0 +1,334 @@ | |||
| 1 | <?php | ||
| 2 | /* | ||
| 3 | 444444444 | ||
| 4 | 4::::::::4 | ||
| 5 | 4:::::::::4 | ||
| 6 | 4::::44::::4 | ||
| 7 | 4::::4 4::::4 Four Island | ||
| 8 | 4::::4 4::::4 | ||
| 9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
| 10 | 4::::444444::::444 | ||
| 11 | 4::::::::::::::::4 rss.php | ||
| 12 | 4444444444:::::444 | ||
| 13 | 4::::4 Please do not use, reproduce or steal the | ||
| 14 | 4::::4 contents of this file without explicit | ||
| 15 | 4::::4 permission from Hatkirby. | ||
| 16 | 44::::::44 | ||
| 17 | 4::::::::4 | ||
| 18 | 4444444444 | ||
| 19 | */ | ||
| 20 | |||
| 21 | require('headerproc.php'); | ||
| 22 | |||
| 23 | include('../security/config.php'); | ||
| 24 | include('includes/db.php'); | ||
| 25 | include('includes/bbcode.php'); | ||
| 26 | include('includes/phpsvnclient.php'); | ||
| 27 | |||
| 28 | header('Content-type: application/rss+xml'); | ||
| 29 | |||
| 30 | echo('<?xml version="1.0" encoding="UTF-8"?>'); | ||
| 31 | |||
| 32 | ?> | ||
| 33 | <rss version="2.0"> | ||
| 34 | <channel> | ||
| 35 | <title>Four Island<?php | ||
| 36 | if (isset($_GET['mode'])) | ||
| 37 | { | ||
| 38 | switch ($_GET['mode']) | ||
| 39 | { | ||
| 40 | case 'blog': | ||
| 41 | if (isset($_GET['blog'])) | ||
| 42 | { | ||
| 43 | switch ($_GET['blog']) | ||
| 44 | { | ||
| 45 | case 'author': | ||
| 46 | ?> Blog Posts by <?php | ||
| 47 | echo($_GET['author']); | ||
| 48 | break; | ||
| 49 | case 'tag': | ||
| 50 | ?> Blog Posts tagged with <?php | ||
| 51 | echo($_GET['tag']); | ||
| 52 | break; | ||
| 53 | } | ||
| 54 | } else { | ||
| 55 | ?> Blog Posts<?php | ||
| 56 | } | ||
| 57 | break; | ||
| 58 | case 'quotes': | ||
| 59 | ?> Quotes<?php | ||
| 60 | break; | ||
| 61 | case 'poll': | ||
| 62 | ?> Polls<?php | ||
| 63 | break; | ||
| 64 | case 'projects': | ||
| 65 | ?> Projects<?php | ||
| 66 | break; | ||
| 67 | case 'comments': | ||
| 68 | ?> Comments<?php | ||
| 69 | break; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | ?></title> | ||
| 73 | |||
| 74 | <description><?php | ||
| 75 | if (isset($_GET['mode'])) | ||
| 76 | { | ||
| 77 | switch ($_GET['mode']) | ||
| 78 | { | ||
| 79 | case 'blog': | ||
| 80 | if (isset($_GET['blog'])) | ||
| 81 | { | ||
| 82 | switch ($_GET['blog']) | ||
| 83 | { | ||
| 84 | case 'author': | ||
| 85 | ?>An archive of all Four Island blog posts written by <?php | ||
| 86 | echo($_GET['author']); | ||
| 87 | break; | ||
| 88 | case 'tag': | ||
| 89 | ?>An archive of all Four Island blog posts tagged with <?php | ||
| 90 | echo($_GET['tag']); | ||
| 91 | break; | ||
| 92 | } | ||
| 93 | } else { | ||
| 94 | ?>An archive of all Four Island blog posts<?php | ||
| 95 | } | ||
| 96 | break; | ||
| 97 | case 'quotes': | ||
| 98 | ?>An archive of all Four Island quotes<?php | ||
| 99 | break; | ||
| 100 | case 'poll': | ||
| 101 | ?>An archive of all of the Four Island POTWs<?php | ||
| 102 | break; | ||
| 103 | case 'projects': | ||
| 104 | ?>An archive of all of the Four Island Project checkins<?php | ||
| 105 | break; | ||
| 106 | case 'comments': | ||
| 107 | ?>An archive of all of the comments people have left on Four Island<?php | ||
| 108 | break; | ||
| 109 | } | ||
| 110 | } else { | ||
| 111 | ?>All the wonderfour going-ons on Four Island<?php | ||
| 112 | } | ||
| 113 | ?></description> | ||
| 114 | |||
| 115 | <language>en</language> | ||
| 116 | |||
| 117 | <?php | ||
| 118 | |||
| 119 | $i=0; | ||
| 120 | |||
| 121 | if (!isset($_GET['mode']) || ($_GET['mode'] == 'blog')) | ||
| 122 | { | ||
| 123 | if ($_GET['blog'] == 'author') | ||
| 124 | { | ||
| 125 | $getposts = "SELECT * FROM updates WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; | ||
| 126 | } else if ($_GET['blog'] == 'tag') | ||
| 127 | { | ||
| 128 | $getposts = "SELECT * FROM updates WHERE tag1 = \"" . $_GET['tag'] . "\" OR tag2 = \"" . $_GET['tag'] . "\" OR tag3 = \"" . $_GET['tag'] . "\" ORDER BY id DESC"; | ||
| 129 | } else if (!isset($_GET['blog'])) { | ||
| 130 | $getposts = "SELECT * FROM updates ORDER BY id DESC"; | ||
| 131 | } | ||
| 132 | $getposts2 = mysql_query($getposts); | ||
| 133 | |||
| 134 | // $si = $i; | ||
| 135 | |||
| 136 | while (($items[$i] = mysql_fetch_array($getposts2))) | ||
| 137 | { | ||
| 138 | $items[$i]['sortDate'] = strtotime($items[$i]['pubDate']); | ||
| 139 | $items[$i]['itemType'] = 'post'; | ||
| 140 | $i++; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | if (!isset($_GET['mode']) || ($_GET['mode'] == 'quotes')) | ||
| 145 | { | ||
| 146 | $getquotes = "SELECT * FROM rash_quotes"; | ||
| 147 | $getquotes2 = mysql_query($getquotes); | ||
| 148 | |||
| 149 | // $si = $i; | ||
| 150 | |||
| 151 | while (($items[$i] = mysql_fetch_array($getquotes2))) | ||
| 152 | { | ||
| 153 | $items[$i]['sortDate'] = $items[$i]['date']; | ||
| 154 | $items[$i]['itemType'] = 'quote'; | ||
| 155 | $i++; | ||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | if ($_GET['mode'] == 'poll') | ||
| 160 | { | ||
| 161 | $getpolls = "SELECT * FROM polloftheweek"; | ||
| 162 | $getpolls2 = mysql_query($getpolls); | ||
| 163 | while (($items[$i] = mysql_fetch_array($getpolls2)) && ($i < ($si+10))) | ||
| 164 | { | ||
| 165 | $items[$i]['sortDate'] = strtotime($items[$i]['week']); | ||
| 166 | $items[$i]['itemType'] = 'poll'; | ||
| 167 | $i++; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | |||
| 171 | if (!isset($_GET['mode']) || ($_GET['mode'] == 'projects')) | ||
| 172 | { | ||
| 173 | $svn = new phpSVNclient(); | ||
| 174 | ob_start(); | ||
| 175 | $projs = explode(" ",system('dir /var/svn')); | ||
| 176 | ob_end_clean(); | ||
| 177 | |||
| 178 | // $si = $i; | ||
| 179 | |||
| 180 | foreach ($projs as $name) | ||
| 181 | { | ||
| 182 | $svn->setRespository('http://svn.fourisland.com/' . $name); | ||
| 183 | // $svn->setAuth('hatkirby','popstartwo506'); | ||
| 184 | $logs = $svn->getFileLogs(''); | ||
| 185 | |||
| 186 | $k=0; | ||
| 187 | while (($items[$i] = $logs[$k])) | ||
| 188 | { | ||
| 189 | $items[$i]['sortDate'] = strtotime($items[$i]['date']); | ||
| 190 | $items[$i]['itemType'] = 'project'; | ||
| 191 | $items[$i]['project'] = $name; | ||
| 192 | $i++; | ||
| 193 | $k++; | ||
| 194 | } | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | if (!isset($_GET['mode']) || ($_GET['mode'] == 'comments')) | ||
| 199 | { | ||
| 200 | $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,10"; | ||
| 201 | $getcomments2 = mysql_query($getcomments); | ||
| 202 | while ($items[$i] = mysql_fetch_array($getcomments2)) | ||
| 203 | { | ||
| 204 | $items[$i]['sortDate'] = strtotime($items[$i]['posttime']); | ||
| 205 | $items[$i]['itemType'] = 'comment'; | ||
| 206 | |||
| 207 | $page_id = $items[$i]['page_id']; | ||
| 208 | $comType = substr($page_id,0,strpos($page_id,'-')); | ||
| 209 | $comID = substr($page_id,strpos($page_id,'-')+1); | ||
| 210 | |||
| 211 | switch ($comType) | ||
| 212 | { | ||
| 213 | case 'updates': | ||
| 214 | $getpost = "SELECT * FROM updates WHERE id = " . $comID; | ||
| 215 | $getpost2 = mysql_query($getpost); | ||
| 216 | $getpost3 = mysql_fetch_array($getpost2); | ||
| 217 | |||
| 218 | $items[$i]['title'] = $getpost3['title']; | ||
| 219 | $items[$i]['url'] = 'blog/' . $getpost3['slug'] . '/'; | ||
| 220 | break; | ||
| 221 | case 'poll': | ||
| 222 | $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $comID; | ||
| 223 | $getpoll2 = mysql_query($getpoll); | ||
| 224 | $getpoll3 = mysql_fetch_array($getpoll2); | ||
| 225 | |||
| 226 | $items[$i]['title'] = $getpoll3['question']; | ||
| 227 | $items[$i]['url'] = 'poll/' . $getpoll3['id'] . '.php'; | ||
| 228 | break; | ||
| 229 | case 'quote': | ||
| 230 | $getquote = "SELECT * FROM rash_quotes WHERE id = " . $comID; | ||
| 231 | $getquote2 = mysql_query($getquote); | ||
| 232 | $getquote3 = mysql_fetch_array($getquote2); | ||
| 233 | |||
| 234 | $items[$i]['title'] = '#' . $getquote3['id']; | ||
| 235 | $items[$i]['url'] = 'quotes/' . $getquote3['id'] . '.php'; | ||
| 236 | break; | ||
| 237 | } | ||
| 238 | $i++; | ||
| 239 | } | ||
| 240 | } | ||
| 241 | |||
| 242 | function sortItems($a, $b) | ||
| 243 | { | ||
| 244 | if ($a['sortDate'] < $b['sortDate']) | ||
| 245 | { | ||
| 246 | return 1; | ||
| 247 | } else if ($a['sortDate'] == $b['sortDate']) | ||
| 248 | { | ||
| 249 | return 0; | ||
| 250 | } else if ($a['sortDate'] > $b['sortDate']) | ||
| 251 | { | ||
| 252 | return -1; | ||
| 253 | } | ||
| 254 | } | ||
| 255 | |||
| 256 | uasort($items,"sortItems"); | ||
| 257 | |||
| 258 | $j=0; | ||
| 259 | foreach ($items as $key => $value) | ||
| 260 | { | ||
| 261 | switch ($value['itemType']) | ||
| 262 | { | ||
| 263 | case 'post': | ||
| 264 | ?> | ||
| 265 | <item> | ||
| 266 | <title><?php echo($value['title']); ?></title> | ||
| 267 | |||
| 268 | <link>http://www.fourisland.com/blog/<?php echo($value['slug']); ?>/</link> | ||
| 269 | |||
| 270 | <description><?php echo(stripslashes(htmlentities(parseBBCode($value['text'])))); ?></description> | ||
| 271 | |||
| 272 | <pubDate><?php echo(date('D, d M Y H:i:s O',$value['sortDate'])); ?></pubDate> | ||
| 273 | </item> | ||
| 274 | <?php | ||
| 275 | break; | ||
| 276 | case 'quote': | ||
| 277 | ?> | ||
| 278 | <item> | ||
| 279 | <title>Quote #<?php echo($value['id']); ?></title> | ||
| 280 | |||
| 281 | <link>http://www.fourisland.com/quotes/<?php echo(urlencode($value['id'])); ?>.php</link> | ||
| 282 | |||
| 283 | <description><?php echo(htmlentities(nl2br($value['quote']))); ?></description> | ||
| 284 | |||
| 285 | <pubDate><?php echo(date('D, d M Y H:i:s O',$value['sortDate'])); ?></pubDate> | ||
| 286 | </item> | ||
| 287 | <?php | ||
| 288 | break; | ||
| 289 | case 'poll': | ||
| 290 | break; | ||
| 291 | case 'project': | ||
| 292 | $value['comment'] = str_replace('[','',str_replace(']','',$value['comment'])); | ||
| 293 | if (strpos($value['comment'],"\n") !== FALSE) | ||
| 294 | { | ||
| 295 | $title = htmlentities(substr($value['comment'],0,strpos($value['comment'],"\n"))); | ||
| 296 | } else { | ||
| 297 | $title = htmlentities($value['comment']); | ||
| 298 | } | ||
| 299 | ?> | ||
| 300 | <item> | ||
| 301 | <title><?php echo($value['project']); ?> r<?php echo($value['version']); ?> - <?php echo($title); ?></title> | ||
| 302 | |||
| 303 | <link>http://www.fourisland.com/projects/<?php echo($value['project']); ?>/changeset/<?php echo(urlencode($value['version'])); ?></link> | ||
| 304 | |||
| 305 | <description><?php echo(htmlentities(nl2br($value['comment']))); ?></description> | ||
| 306 | |||
| 307 | <pubDate><?php echo(date('D, d M Y H:i:s O',$value['sortDate'])); ?></pubDate> | ||
| 308 | </item> | ||
| 309 | <?php | ||
| 310 | break; | ||
| 311 | case 'comment': | ||
| 312 | ?> | ||
| 313 | <item> | ||
| 314 | <title>Comment on <?php echo($value['title']); ?> by <?php echo($value['username']); ?></title> | ||
| 315 | |||
| 316 | <link>http://www.fourisland.com/comments/<?php echo($value['id']); ?>/</link> | ||
| 317 | |||
| 318 | <description><?php echo(stripslashes(htmlentities(parseBBCode($value['comment'])))); ?></description> | ||
| 319 | |||
| 320 | <pubDate><?php echo(date('D, d M Y H:i:s O',$value['sortDate'])); ?></pubDate> | ||
| 321 | </item> | ||
| 322 | <?php | ||
| 323 | break; | ||
| 324 | } | ||
| 325 | $j++; | ||
| 326 | if ($j==9) | ||
| 327 | { | ||
| 328 | break; | ||
| 329 | } | ||
| 330 | } | ||
| 331 | |||
| 332 | ?> | ||
| 333 | </channel> | ||
| 334 | </rss> | ||
