source: t29-www/lib/news.php @ 516

Last change on this file since 516 was 436, checked in by sven, 11 years ago

Ein paar Detailaenderungen:

File size: 2.8 KB
Line 
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 
9if(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
16if(isset($_GET["format"])) {
17
18$news_file = "/de/news.php";
19$pubdate = filemtime("$lib/../".$news_file);
20
21require $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
30header("Content-Type: application/rss+xml");
31header("Last-Modified: " . gmdate("D, d M Y H:i:s", $pubdate) . " GMT");
32echo '<?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>&#x2117; &amp; &#xA9; 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.
90exit();
91
92} else {
93        require("$lib/technikum29.php");
94        return true;
95}
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License