From 882c0eb89b375cbfdd9c04b236cbab0d3f39a128 Mon Sep 17 00:00:00 2001
From: horus
Date: Wed, 26 Oct 2022 01:23:50 +0200
Subject: integrates ghrss
---
.gitignore | 2 +
functions.php | 6 +++
public/feed/ghrss/index.php | 1 +
public/feed/index.php | 3 ++
public/index.php | 14 ++++++-
views/feeds.html | 30 +++++++++++++++
views/tools.html | 21 +++++++++--
views/tools/ghrss/composer.json | 5 +++
views/tools/ghrss/composer.lock | 84 +++++++++++++++++++++++++++++++++++++++++
views/tools/ghrss/feed.php | 47 +++++++++++++++++++++++
views/tools/ghrss/ghrss.db.php | 14 +++++++
views/tools/ghrss/index.html | 32 ++++++++++++++++
12 files changed, 254 insertions(+), 5 deletions(-)
create mode 120000 public/feed/ghrss/index.php
create mode 100644 public/feed/index.php
create mode 100644 views/feeds.html
create mode 100644 views/tools/ghrss/composer.json
create mode 100644 views/tools/ghrss/composer.lock
create mode 100644 views/tools/ghrss/feed.php
create mode 100644 views/tools/ghrss/ghrss.db.php
create mode 100644 views/tools/ghrss/index.html
diff --git a/.gitignore b/.gitignore
index 3b14e50..0436310 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
*.swp
*~
+db_passwd.php
+
vendor/
img/
diff --git a/functions.php b/functions.php
index 9bd65e4..8a31111 100644
--- a/functions.php
+++ b/functions.php
@@ -23,3 +23,9 @@ function str_ends_with( $haystack, $needle) {
}
return substr($haystack, -$len) === $needle;
}
+
+function get_ghrss_feeds() {
+ require_once __DIR__ . '/views/tools/ghrss/ghrss.db.php';
+ $result = $db->query("SELECT name FROM language ORDER BY name;");
+ return $result->fetchAll();
+}
diff --git a/public/feed/ghrss/index.php b/public/feed/ghrss/index.php
new file mode 120000
index 0000000..49697a9
--- /dev/null
+++ b/public/feed/ghrss/index.php
@@ -0,0 +1 @@
+../../../views/tools/ghrss/feed.php
\ No newline at end of file
diff --git a/public/feed/index.php b/public/feed/index.php
new file mode 100644
index 0000000..d29aba0
--- /dev/null
+++ b/public/feed/index.php
@@ -0,0 +1,3 @@
+render('projects.html');
break;
+case("/tool"):
+ header("Location: https://" . $_SERVER["HTTP_HOST"] . "/tools/");
+ exit;
+ break;
case("/tools/"):
echo $twig->render('tools.html');
break;
@@ -31,11 +35,17 @@ case("/tools/untrack/"):
}
echo $twig->render('tools/untrack/index.html', [ "url" => $_url ]);
break;
+case("/tools/tanz/"):
+ echo $twig->render('tools/bpm/index.html', [ "dances" => get_dances() ]);
+ break;
+case("/feeds/"):
+ echo $twig->render('feeds.html');
+ break;
case("/tools/zeitumstellung/"):
echo $twig->render('tools/zeitumstellung/index.html', [ "tc" => new Zeitumstellung() ]);
break;
-case("/tools/tanz/"):
- echo $twig->render('tools/bpm/index.html', [ "dances" => get_dances() ]);
+case("/tools/ghrss/"):
+ echo $twig->render('tools/ghrss/index.html', [ "data" => get_ghrss_feeds() ]);
break;
default:
if ( str_ends_with($url, "/") ) {
diff --git a/views/feeds.html b/views/feeds.html
new file mode 100644
index 0000000..3776541
--- /dev/null
+++ b/views/feeds.html
@@ -0,0 +1,30 @@
+{% extends "snippets/layout.html" %}
+
+{% block title "feeds | Maximilian Möhring" %}
+
+{% block css %}
+{% endblock %}
+{% block main %}
+
+
+
+
+
iCal- / RSS-Feeds
+ Fun fact: I structure my whole life around feeds!
+
+
+
+
+
+
+{% endblock %}
diff --git a/views/tools.html b/views/tools.html
index 30c4697..d522d67 100644
--- a/views/tools.html
+++ b/views/tools.html
@@ -3,6 +3,9 @@
{% block title "tools | Maximilian Möhring" %}
{% block css %}
+.feed-flavor {
+ margin-top: 4rem;
+}
{% endblock %}
{% block main %}
@@ -15,7 +18,6 @@
+
+
+
iCal- / RSS-Feeds
+
+
+
+
diff --git a/views/tools/ghrss/composer.json b/views/tools/ghrss/composer.json
new file mode 100644
index 0000000..ba92705
--- /dev/null
+++ b/views/tools/ghrss/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "tronice/php-rss-writer": "^1.6"
+ }
+}
diff --git a/views/tools/ghrss/composer.lock b/views/tools/ghrss/composer.lock
new file mode 100644
index 0000000..1fc94a1
--- /dev/null
+++ b/views/tools/ghrss/composer.lock
@@ -0,0 +1,84 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "4114942d462b753781b80a9c5cdfb1f0",
+ "packages": [
+ {
+ "name": "tronice/php-rss-writer",
+ "version": "1.6.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/TRONICE/php-rss-writer.git",
+ "reference": "a5ef3db462b70f896778faff508fd88b71c051df"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/TRONICE/php-rss-writer/zipball/a5ef3db462b70f896778faff508fd88b71c051df",
+ "reference": "a5ef3db462b70f896778faff508fd88b71c051df",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "johnpupu/xoopsunit": ">=1.2",
+ "mockery/mockery": ">=0.9 <1.0",
+ "phpunit/phpunit": ">=4.8.36 <6.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Suin\\RSSWriter": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "suin",
+ "email": "suinyeze@gmail.com",
+ "role": "Author"
+ },
+ {
+ "name": "John Chen",
+ "email": "john@tronice.com",
+ "homepage": "https://www.tronice.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Firch Tsai",
+ "email": "firch@tronice.com",
+ "homepage": "https://www.tronice.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "Yet another simple RSS writer library for PHP 5.4 or later.",
+ "homepage": "https://github.com/TRONICE/php-rss-writer",
+ "keywords": [
+ "feed",
+ "generator",
+ "php",
+ "rss",
+ "writer"
+ ],
+ "support": {
+ "source": "https://github.com/TRONICE/php-rss-writer/tree/1.6.3"
+ },
+ "time": "2020-05-17T17:20:36+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "2.0.0"
+}
diff --git a/views/tools/ghrss/feed.php b/views/tools/ghrss/feed.php
new file mode 100644
index 0000000..7276200
--- /dev/null
+++ b/views/tools/ghrss/feed.php
@@ -0,0 +1,47 @@
+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( "" . $item["synopsis"] . "
" . $item["language"] . " / " . $item["update_period"] . " / " . $item["stars"] . " Stars
" )
+ ->url($item["url"])
+ ->pubDate(strtotime(date($item["created_at"])))
+ ->author($item["owner"])
+ ->appendTo($channel);
+}
+
+echo $feed;
+
diff --git a/views/tools/ghrss/ghrss.db.php b/views/tools/ghrss/ghrss.db.php
new file mode 100644
index 0000000..d96f881
--- /dev/null
+++ b/views/tools/ghrss/ghrss.db.php
@@ -0,0 +1,14 @@
+
+
+
+
Trending Repos from Github as RSS-Feed
+
Choose your language, get the result of github.com/trending as RSS-Feed
+
+
+
+
+
+
+{% endblock %}
--
cgit v1.2.3