[436] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * Main include for news pages, comparable to |
---|
| 4 | * /lib/search.php, used only by /{de,en}/news.php |
---|
| 5 | * |
---|
| 6 | * |
---|
| 7 | **/ |
---|
| 8 | |
---|
| 9 | if(defined('T29')) return false; // no nesting (e.g. if called by menu.php) |
---|
| 10 | |
---|
| 11 | // Diese Datei macht eigentlich nur eines: Den RSS-Newsfeed erzeugen, |
---|
| 12 | // wenn gewüscht. |
---|
| 13 | |
---|
| 14 | $lib = dirname(__FILE__); |
---|
| 15 | |
---|
| 16 | if(isset($_GET["format"])) { |
---|
| 17 | |
---|
| 18 | $news_file = "/de/news.php"; |
---|
| 19 | $pubdate = filemtime("$lib/../".$news_file); |
---|
| 20 | |
---|
| 21 | require $lib.'/spyc.php'; |
---|
| 22 | $data = Spyc::YAMLLoad($neues_menu); |
---|
| 23 | $required_fields = array('titel', 'text', 'link', /*'bild'*/); |
---|
| 24 | |
---|
| 25 | # und hostname davor. |
---|
| 26 | # $this->conf['lang_path'].'/'.self::news_file |
---|
| 27 | $news_url = "http://www.technikum29.de/de/news"; |
---|
| 28 | # if($host) $url = $host->rewrite_link($url); |
---|
| 29 | |
---|
| 30 | header("Content-Type: application/rss+xml"); |
---|
| 31 | header("Last-Modified: " . gmdate("D, d M Y H:i:s", $pubdate) . " GMT"); |
---|
| 32 | echo '<?xml version="1.0" encoding="utf-8"?>'; |
---|
| 33 | ?> |
---|
| 34 | |
---|
| 35 | <rss |
---|
| 36 | xmlns:atom="http://www.w3.org/2005/Atom" |
---|
| 37 | xml:lang="de-DE" |
---|
| 38 | version="2.0"> |
---|
| 39 | <channel> |
---|
| 40 | <title>technikum29 Computer Museum - Was gibt es Neues?</title> |
---|
| 41 | <link>http://www.technikum29.de</link> |
---|
| 42 | <description>Neuste Geräte und Erweiterungen im technikum29-Computermuseum</description> |
---|
| 43 | <language>de-DE</language> |
---|
| 44 | <copyright>℗ & © 2033-<?=date('Y'); ?> Heribert Müller und das technikum29-Team</copyright> |
---|
| 45 | <pubDate><?=date('r', $pubdate); ?></pubDate> |
---|
| 46 | <image> |
---|
| 47 | <url>http://www.technikum29.de/shared/img-v6/banner.de.png</url> |
---|
| 48 | <title>technikum29 Computermuseum</title> |
---|
| 49 | <link>http://www.technikum29.de/</link> |
---|
| 50 | </image> |
---|
| 51 | <!-- Time To Live: Cache validity time for channel until update in minutes --> |
---|
| 52 | <!--<ttl><?=60*12; ?></ttl>--><!-- half a day --> |
---|
| 53 | |
---|
| 54 | <atom:link href="http://www.technikum29.de/de/news.php?format=rss" rel="self" type="application/rss+xml" /> |
---|
| 55 | |
---|
| 56 | <?php |
---|
| 57 | foreach($data as $e) { |
---|
| 58 | if(!array_reduce(array_map(function($x) use ($required_fields,$e){ return isset($e[$x]); }, $required_fields), |
---|
| 59 | function($a,$b){ return $a && $b;}, true)) { |
---|
| 60 | ?> |
---|
| 61 | <item> |
---|
| 62 | <title>Fehlformatierung</title> |
---|
| 63 | <description>Leider ist dieser Eintrag nicht richtig formatiert. Schauen Sie sich die News-Seite direkt an.</description> |
---|
| 64 | <link>http://www.technikum29.de/de/news</link> |
---|
| 65 | </item> |
---|
| 66 | <?php |
---|
| 67 | } else { |
---|
| 68 | ?> |
---|
| 69 | <item> |
---|
| 70 | <title><?=$e['titel']; ?></title> |
---|
| 71 | <description><?=$e['text']; ?></description> |
---|
| 72 | <author>Heribert Müller</author> |
---|
| 73 | <?php |
---|
| 74 | $link = ($e['link']{0} == '#' ? $news_url : '').$e['link']; |
---|
| 75 | ?> |
---|
| 76 | <link>http://www.technikum29.de/<?=$link; ?></link> |
---|
| 77 | <guid idPermaLink="true">http://www.example.com/<?=$link; ?></guid> |
---|
| 78 | <pubDate><?=date('r', $pubdate); ?></pubDate> |
---|
| 79 | </item> |
---|
| 80 | <?php |
---|
| 81 | } |
---|
| 82 | } |
---|
| 83 | ?> |
---|
| 84 | |
---|
| 85 | </channel> |
---|
| 86 | </rss> |
---|
| 87 | <?php |
---|
| 88 | |
---|
| 89 | // rss ausgegeben, jetzt: exit um nicht noch Seite auszugeben. |
---|
| 90 | exit(); |
---|
| 91 | |
---|
| 92 | } else { |
---|
| 93 | require("$lib/technikum29.php"); |
---|
| 94 | return true; |
---|
| 95 | } |
---|