diff options
author | Erich Eckner <git@eckner.net> | 2019-11-14 11:28:58 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-11-14 11:28:58 +0100 |
commit | 4443e2dac2e6f2cc6fed530daaec5898db805d0b (patch) | |
tree | d667f05b0aa51e76d88e351e112458cf525bea0f /index.php | |
parent | 812c8671fdaa3abf62f01b31068ed8a291635aea (diff) | |
download | archweb32-4443e2dac2e6f2cc6fed530daaec5898db805d0b.tar.xz |
index.php: pull archlinux32 news from the forum rss instead of news.archlinux32.org
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -75,14 +75,14 @@ print_header("", "home"); $news_reachable = apcu_fetch('news_reachable', $apcu_success); if ($apcu_success == false) { - if (site_is_reachable('https://news.archlinux32.org/rss.php')) + if (site_is_reachable('https://bbs.archlinux32.org/extern.php?action=feed&fid=12&type=atom')) $news_reachable = 'YES'; else $news_reachable = 'NO'; apcu_store('news_reachable', $news_reachable, 300); } if ($news_reachable == 'YES') { - $ch = curl_init('https://news.archlinux32.org/rss.php'); + $ch = curl_init('https://bbs.archlinux32.org/extern.php?action=feed&fid=12&type=atom'); curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); @@ -108,10 +108,10 @@ if ($news32 === false) { } else { foreach($news32 -> {'entry'} as $entry) { $news[] = array ( - 'content' => $entry -> {'content'}, - 'date' => explode('T', $entry -> {'published'})[0], - 'link' => $entry -> {'link'} -> attributes() -> {'href'}, - 'title' => $entry -> {'title'} + 'content' => preg_replace('#^<p>By [^<]*<br />On [^<]*</p>#', '', $entry -> {'summary'} -> __toString()), + 'date' => explode('T', $entry -> {'updated'} -> __toString())[0], + 'link' => $entry -> {'link'} -> attributes() -> {'href'} -> __toString(), + 'title' => $entry -> {'title'} -> __toString() ); } } |