|
|
| 008 |
008 |
|
| 220 | 220 | header("Content-type: text/xml"); |
| 221 | 221 | echo '<?xml version="1.0"?>'; |
| 222 | 222 | ?> |
| 223 | | <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dcterms="http://purl.org/dc/terms/"> |
| 223 | <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:atom="http://www.w3.org/2005/Atom"> |
| 224 | 224 | <channel> |
| 225 | 225 | <title><?= htmlspecialchars(utf8_encode($feed_title)) ?></title> |
| 226 | 226 | <link>http://<?= $_SERVER['SERVER_NAME'] ?>/<?= ROOT_URL ?></link> |
| --- | --- | |
| 229 | 229 | <pubDate><?= rssdate("now") ?></pubDate> |
| 230 | 230 | <generator>Concerto API 0.08</generator> |
| 231 | 231 | <webMaster><?= SYSTEM_EMAIL ?> (Concerto Digital Signage)</webMaster> |
| 232 | <atom:link href="<?= 'http://' . $_SERVER['SERVER_NAME'] . htmlspecialchars($_SERVER['REQUEST_URI']) ?>" rel="self" type="application/rss+xml" /> |
| 232 | 233 | <image> |
| 233 | 234 | <url><?= 'http://' . $_SERVER['SERVER_NAME'] . ADMIN_BASE_URL ?>/images/concerto_48x48.png</url> |
| 234 | | <title>Concerto</title> |
| 235 | | <link><?= 'http://' . $_SERVER['SERVER_NAME'] . ADMIN_BASE_URL ?></link> |
| 235 | <title><?= htmlspecialchars(utf8_encode($feed_title)) ?></title> |
| 236 | <link>http://<?= $_SERVER['SERVER_NAME'] ?>/<?= ROOT_URL ?></link> |
| 236 | 237 | <width>48</width> |
| 237 | 238 | <height>48</height> |
| 238 | 239 | </image> |
| 239 | 240 | |
| 240 | | <? foreach($content_arr as $content){ |
| 241 | <? |
| 242 | /*Sometimes, including the 'index.php' portion of the URL breaks clients like the built-in OS X screensaver. |
| 243 | *By removing the reference to index.php, the screensaver doesn't know what to expect, and works. |
| 244 | *This has taken multiple months to find. |
| 245 | */ |
| 246 | $script_name = preg_replace('/(index\.php)$/', '', $_SERVER['SCRIPT_NAME']); |
| 247 | |
| 248 | foreach($content_arr as $content){ |
| 241 | 249 | $link = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . '?' . criteria_string($criteria) . '&select_id=' . $content->id . '&select=content&format=rss'; |
| 242 | 250 | $link = htmlspecialchars($link); |
| 243 | 251 | $feeds = $content->list_feeds(); |
| 244 | 252 | $user = new User($content->user_id); |
| 245 | 253 | $rss_link = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . '?' . criteria_string($criteria, 'rss') . '&select=content&select_id='.$content->id.'&format=raw'; |
| 246 | | $raw_link = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . '?' . criteria_string($criteria) . '&select=content&select_id='.$content->id.'&format=raw'; |
| 254 | |
| 255 | /* If mod_rewrite isn't enabled, this won't work, but it is required for some clients that care about file extensions |
| 256 | * Without mod_rewrite, you can just use remove "'image_' . $content->content" |
| 257 | */ |
| 258 | $raw_link = 'http://' . $_SERVER['SERVER_NAME'] . $script_name . 'image_' . $content->content . '?' . criteria_string($criteria) . '&select=content&select_id='.$content->id.'&format=raw'; |
| 247 | 259 | if(strpos($content->mime_type,'image') !== false){ |
| 248 | 260 | $desc = '<![CDATA[ <img src="' . $rss_link . '" /> ]]>'; |
| 249 | 261 | } elseif(strpos($content->mime_type, 'html')){ |
| --- | --- | |
| 258 | 270 | <description><?= $desc ?></description> |
| 259 | 271 | <pubDate><?= rssdate($content->submitted) ?></pubDate> |
| 260 | 272 | <author><?= $user->username ?>@rpi.edu (<?= htmlspecialchars(utf8_encode($user->name)) ?>)</author> |
| 261 | | <guid isPermaLink="false"><?= $content->id ?></guid> |
| 273 | <guid isPermaLink="false"><?= 'http://' . $_SERVER['SERVER_NAME'] . ADMIN_URL ?>/content/show/<?= $content->id ?></guid> |
| 262 | 274 | <? foreach($feeds as $feed_obj){ |
| 263 | 275 | if($feed_obj['moderation_flag'] == 1 && $feed_obj['feed']->type != 3){ |
| 264 | 276 | $feed = $feed_obj['feed']; |
| --- | --- | |
| 270 | 282 | } |
| 271 | 283 | if(strpos($content->mime_type,'image') !== false){ |
| 272 | 284 | ?> |
| 273 | | <enclosure url="<?= htmlspecialchars($raw_link) ?>" type="<?= $content->mime_type ?>" /> |
| 285 | <enclosure url="<?= htmlspecialchars($raw_link) ?>" type="<?= $content->mime_type ?>" length='0'/> |
| 274 | 286 | <media:content url="<?= htmlspecialchars($raw_link) ?>" type="<?= $content->mime_type ?>" expression="full" /> |
| 275 | 287 | <media:title type="plain"><?= htmlspecialchars($content->name) ?></media:title> |
| 276 | 288 | <media:thumbnail url="<?= htmlspecialchars($rss_link) ?>" width="100" height="100"/> |