From 6780ed3bd79c9df53ef5971ff4c15cca51286903 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 15 Feb 2019 13:34:27 +0100 Subject: index.php: show upstream news, too --- index.php | 128 +++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 80 insertions(+), 48 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 862cbba..319f414 100644 --- a/index.php +++ b/index.php @@ -67,70 +67,102 @@ print_header("", "home"); Latest News + RSS Feed RSS Feed \n"; - print " sorry, news are currently unavailable\n"; + print " sorry, arch 32 news are currently unavailable\n"; print " \n"; - } else { - - $news_count = -5; - foreach($news -> entry as $entry) { - $news_count ++; - if ($news_count == 0) { - print "

\n"; - print " Older News\n"; - print " \n"; - print "

\n"; - print "
\n"; - } - if ($news_count < 0) { - print "

\n"; - print " {'link'} -> attributes() -> {'href'}; - print "\" title=\"View full article: "; - print $entry -> title; - print "\">"; - print $entry -> title; - print "\n"; - print "

\n"; - print "

\n"; - print " " . explode('T', $entry -> published)[0] . "\n"; - print "

\n"; - print "
\n"; - print $entry -> content; - print "
\n"; - } else { - print "
"; - print explode('T', $entry -> published)[0]; - print "
\n"; - print "
\n"; - print " {'link'} -> attributes() -> {'href'}; - print "\" title=\"View full article: "; - print $entry -> title; - print "\">"; - print $entry -> title; - print "\n"; - print "
\n"; - } + foreach($news32 -> {'entry'} as $entry) { + $news[] = array ( + 'content' => $entry -> {'content'}, + 'date' => explode('T', $entry -> {'published'})[0], + 'link' => $entry -> {'link'} -> attributes() -> {'href'}, + 'title' => $entry -> {'title'} + ); } - if ($news_count >= 0) { - print "
\n"; +} +if ($news64 === false) { + print "

\n"; + print " sorry, upstream arch news are currently unavailable\n"; + print "

\n"; +} else { + foreach($news64 -> {'channel'} -> {'item'} as $entry) { + $news[] = array ( + 'content' => $entry -> {'description'}, + 'date' => date('Y-m-d', strtotime($entry -> {'pubDate'})), + 'link' => $entry -> {'link'}, + 'title' => $entry -> {'title'} + ); } +} + +function cmp_news_date($a, $b) { + return strtotime($b['date']) - strtotime($a['date']); +} +usort($news, 'cmp_news_date'); +$news_count = -5; +foreach($news as $entry) { + $news_count ++; + if ($news_count == 0) { + print "

\n"; + print " Older News\n"; + print " \n"; + print "

\n"; + print "
\n"; + } + if ($news_count < 0) { + print "

\n"; + print " "; + print $entry['title']; + print "\n"; + print "

\n"; + print "

\n"; + print " " . $entry['date'] . "\n"; + print "

\n"; + print "
\n"; + print $entry['content']; + print "
\n"; + } else { + print "
"; + print $entry['date']; + print "
\n"; + print "
\n"; + print " "; + print $entry['title']; + print "\n"; + print "
\n"; + } +} +if ($news_count >= 0) { + print "
\n"; } ?> -- cgit v1.2.3-70-g09d2