diff options
Diffstat (limited to 'views/tools/ghrss/feed.php')
| -rw-r--r-- | views/tools/ghrss/feed.php | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/views/tools/ghrss/feed.php b/views/tools/ghrss/feed.php deleted file mode 100644 index 7276200..0000000 --- a/views/tools/ghrss/feed.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -use DiDom\Document; -use Suin\RSSWriter\Channel; -use Suin\RSSWriter\Feed; -use Suin\RSSWriter\Item; - -require_once __DIR__ . '/ghrss.db.php'; -require_once __DIR__ . '/vendor/autoload.php'; - -header("content-type: application/rss+xml"); - -if ( isset($_REQUEST["l"]) && "" != $_REQUEST["l"] ) { - $stmt = $db->prepare("SELECT * FROM entry_view WHERE language = ? ORDER BY created_at DESC LIMIT 20;"); - $stmt->execute([$_REQUEST["l"]]); -} else { - $stmt = $db->prepare("SELECT * FROM entry_view WHERE created_at >= NOW() - INTERVAL 2 DAY ORDER BY created_at DESC;"); - $stmt->execute([$_REQUEST["l"]]); -} -$result = $stmt->fetchAll(); - -$feed = new Feed(); - -$channel = new Channel(); -$channel - ->title("GHRSS") - ->description("Trending Repos from Github") - ->url( "https://www.maximilianmoehring.com/tools/ghrss/" ) - ->pubDate(strtotime(date("r", time()))) - ->lastBuildDate(strtotime(date("r", time()))) - ->ttl(5) - ->appendTo($feed); - -foreach($result as $item) { - $item_out = new Item(); - - $item_out - ->title($item["title"]) - ->description( "<p>" . $item["synopsis"] . "<br><em>" . $item["language"] . " / " . $item["update_period"] . " / " . $item["stars"] . " Stars</em></p>" ) - ->url($item["url"]) - ->pubDate(strtotime(date($item["created_at"]))) - ->author($item["owner"]) - ->appendTo($channel); -} - -echo $feed; - |
