From 1dd6167d9893d05d0d968f0aac90e71cb3a16003 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sat, 15 Dec 2018 23:36:06 +0100 Subject: [PATCH 1/9] Use dependency installation via composer --- .gitignore | 1 + composer.json | 8 + composer.lock | 516 +++++++++++++++++++++++++++++++++++++++ src/anoweco/autoload.php | 1 + www/www-header.php | 2 - 5 files changed, 526 insertions(+), 2 deletions(-) create mode 100644 composer.json create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index d1e93ef..689f977 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /data/config.php /README.html +/vendor/ diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..a4340c1 --- /dev/null +++ b/composer.json @@ -0,0 +1,8 @@ +{ + "require": { + "pear/net_url2": "^2.2", + "twig/twig": "^2.5", + "pear/services_libravatar": "^0.2.4", + "pear2/services_linkback": "^0.3.0" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..e0d4701 --- /dev/null +++ b/composer.lock @@ -0,0 +1,516 @@ +{ + "_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": "8f0806c1db09f689e6499c38f58669bd", + "packages": [ + { + "name": "pear/http2", + "version": "v1.1.2", + "source": { + "type": "git", + "url": "https://github.com/pear/HTTP2.git", + "reference": "b87527415aa1439d5abc2c620a37f0047c3b1568" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/HTTP2/zipball/b87527415aa1439d5abc2c620a37f0047c3b1568", + "reference": "b87527415aa1439d5abc2c620a37f0047c3b1568", + "shasum": "" + }, + "require-dev": { + "pear/pear-core": "*" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTTP2": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Michael Wallner", + "email": "mike@php.net", + "role": "Lead" + }, + { + "name": "Philippe Jausions", + "email": "jausions@php.net", + "role": "Lead" + } + ], + "description": "Miscellaneous HTTP utilities", + "homepage": "http://pear.php.net/package/HTTP2", + "time": "2016-08-10T19:11:15+00:00" + }, + { + "name": "pear/http_request2", + "version": "v2.3.0", + "source": { + "type": "git", + "url": "https://github.com/pear/HTTP_Request2.git", + "reference": "3599cf0fe455a4e281da464f6510bfc5c2ce54c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/HTTP_Request2/zipball/3599cf0fe455a4e281da464f6510bfc5c2ce54c4", + "reference": "3599cf0fe455a4e281da464f6510bfc5c2ce54c4", + "shasum": "" + }, + "require": { + "pear/net_url2": "^2.2.0", + "pear/pear_exception": "^1.0.0", + "php": ">=5.2.0" + }, + "suggest": { + "ext-fileinfo": "Adds support for looking up mime-types using finfo.", + "ext-zlib": "Allows handling gzip compressed responses.", + "lib-curl": "Allows using cURL as a request backend.", + "lib-openssl": "Allows handling SSL requests when not using cURL." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-trunk": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "HTTP_Request2": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Alexey Borzov", + "email": "avb@php.net" + } + ], + "description": "Provides an easy way to perform HTTP requests.", + "homepage": "http://pear.php.net/package/HTTP_Request2", + "keywords": [ + "PEAR", + "curl", + "http", + "request" + ], + "time": "2016-02-13T20:20:39+00:00" + }, + { + "name": "pear/net_url2", + "version": "v2.2.2", + "source": { + "type": "git", + "url": "https://github.com/pear/Net_URL2.git", + "reference": "07fd055820dbf466ee3990abe96d0e40a8791f9d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Net_URL2/zipball/07fd055820dbf466ee3990abe96d0e40a8791f9d", + "reference": "07fd055820dbf466ee3990abe96d0e40a8791f9d", + "shasum": "" + }, + "require": { + "php": ">=5.1.4" + }, + "require-dev": { + "phpunit/phpunit": ">=3.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "Net/URL2.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "David Coallier", + "email": "davidc@php.net" + }, + { + "name": "Tom Klingenberg", + "email": "tkli@php.net" + }, + { + "name": "Christian Schmidt", + "email": "chmidt@php.net" + } + ], + "description": "Class for parsing and handling URL. Provides parsing of URLs into their constituent parts (scheme, host, path etc.), URL generation, and resolving of relative URLs.", + "homepage": "https://github.com/pear/Net_URL2", + "keywords": [ + "PEAR", + "net", + "networking", + "rfc3986", + "uri", + "url" + ], + "time": "2017-08-25T06:16:11+00:00" + }, + { + "name": "pear/pear_exception", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/pear/PEAR_Exception.git", + "reference": "8c18719fdae000b690e3912be401c76e406dd13b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/8c18719fdae000b690e3912be401c76e406dd13b", + "reference": "8c18719fdae000b690e3912be401c76e406dd13b", + "shasum": "" + }, + "require": { + "php": ">=4.4.0" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "type": "class", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "PEAR": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "." + ], + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Helgi Thormar", + "email": "dufuz@php.net" + }, + { + "name": "Greg Beaver", + "email": "cellog@php.net" + } + ], + "description": "The PEAR Exception base class.", + "homepage": "https://github.com/pear/PEAR_Exception", + "keywords": [ + "exception" + ], + "time": "2015-02-10T20:07:52+00:00" + }, + { + "name": "pear/services_libravatar", + "version": "v0.2.4", + "source": { + "type": "git", + "url": "https://github.com/pear/Services_Libravatar.git", + "reference": "8b9fda8c896afb18fdedc60ead29ee305ea222e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Services_Libravatar/zipball/8b9fda8c896afb18fdedc60ead29ee305ea222e9", + "reference": "8b9fda8c896afb18fdedc60ead29ee305ea222e9", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Services": "./Services/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@php.net", + "role": "Developer" + }, + { + "name": "Melissa Draper", + "email": "melissa@meldraweb.com", + "role": "Lead" + } + ], + "description": "API interfacing class for libravatar.org", + "homepage": "http://pear.php.net/package/Services_Libravatar", + "time": "2017-08-23T20:23:02+00:00" + }, + { + "name": "pear2/services_linkback", + "version": "v0.3.0", + "source": { + "type": "git", + "url": "https://github.com/pear2/Services_Linkback.git", + "reference": "afee0b32c171c999e20ac199361eb6df650f6483" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear2/Services_Linkback/zipball/afee0b32c171c999e20ac199361eb6df650f6483", + "reference": "afee0b32c171c999e20ac199361eb6df650f6483", + "shasum": "" + }, + "require": { + "pear/http2": "~1.1", + "pear/http_request2": "~2.2", + "pear/net_url2": "~2.2" + }, + "require-dev": { + "phpunit/phpunit": "*", + "squizlabs/php_codesniffer": "~2.6" + }, + "type": "library", + "autoload": { + "psr-0": { + "PEAR2\\Services\\Linkback\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0+" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@php.net", + "homepage": "http://cweiske.de/" + } + ], + "description": "Pingback+webmention client and server implementation ", + "homepage": "http://pear2.php.net/PEAR2_Services_Linkback", + "time": "2016-08-10T19:33:01+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-09-21T13:07:52+00:00" + }, + { + "name": "twig/twig", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "6a5f676b77a90823c2d4eaf76137b771adf31323" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/6a5f676b77a90823c2d4eaf76137b771adf31323", + "reference": "6a5f676b77a90823c2d4eaf76137b771adf31323", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "^2.7", + "symfony/phpunit-bridge": "^3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "https://twig.symfony.com/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "time": "2018-07-13T07:18:09+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/src/anoweco/autoload.php b/src/anoweco/autoload.php index 5fb876a..515e8fa 100644 --- a/src/anoweco/autoload.php +++ b/src/anoweco/autoload.php @@ -26,6 +26,7 @@ if (file_exists(__DIR__ . '/../../lib/PEAR.php')) { ); } +require_once __DIR__ . '/../../vendor/autoload.php'; spl_autoload_register( function ($class) { $file = str_replace(array('\\', '_'), '/', $class) . '.php'; diff --git a/www/www-header.php b/www/www-header.php index 3a7d606..dbca097 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -4,8 +4,6 @@ require_once __DIR__ . '/../src/anoweco/autoload.php'; header("Access-Control-Allow-Origin: *"); -\Twig_Autoloader::register(); - $loader = new \Twig_Loader_Filesystem(__DIR__ . '/../data/templates/'); $twig = new \Twig_Environment( $loader, -- 2.30.2 From c394828fb0aea51bcdfad1fd30432ef3adddcde4 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sun, 13 Mar 2022 01:58:56 +0100 Subject: [PATCH 2/9] Upgrade twig to version 3 for php 8.1 --- composer.json | 2 +- composer.lock | 50 +++++++++++++++++++++-------------- data/templates/post-like.htm | 4 +-- data/templates/post-reply.htm | 4 +-- www/www-header.php | 8 +++--- 5 files changed, 39 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index a4340c1..f751efe 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "require": { "pear/net_url2": "^2.2", - "twig/twig": "^2.5", + "twig/twig": "^3.0", "pear/services_libravatar": "^0.2.4", "pear2/services_linkback": "^0.3.0" } diff --git a/composer.lock b/composer.lock index e0d4701..228711b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8f0806c1db09f689e6499c38f58669bd", + "content-hash": "6f5e8d10b4a20c2586020514fcd648c6", "packages": [ { "name": "pear/http2", @@ -439,38 +439,34 @@ }, { "name": "twig/twig", - "version": "v2.5.0", + "version": "v3.3.8", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "6a5f676b77a90823c2d4eaf76137b771adf31323" + "reference": "972d8604a92b7054828b539f2febb0211dd5945c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/6a5f676b77a90823c2d4eaf76137b771adf31323", - "reference": "6a5f676b77a90823c2d4eaf76137b771adf31323", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c", + "reference": "972d8604a92b7054828b539f2febb0211dd5945c", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.2.5", "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "~1.0" + "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { "psr/container": "^1.0", - "symfony/debug": "^2.7", - "symfony/phpunit-bridge": "^3.3" + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "3.3-dev" } }, "autoload": { - "psr-0": { - "Twig_": "lib/" - }, "psr-4": { "Twig\\": "src/" } @@ -486,15 +482,14 @@ "homepage": "http://fabien.potencier.org", "role": "Lead Developer" }, + { + "name": "Twig Team", + "role": "Contributors" + }, { "name": "Armin Ronacher", "email": "armin.ronacher@active-4.com", "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", - "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", @@ -502,7 +497,21 @@ "keywords": [ "templating" ], - "time": "2018-07-13T07:18:09+00:00" + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v3.3.8" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2022-02-04T06:59:48+00:00" } ], "packages-dev": [], @@ -512,5 +521,6 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.2.0" } diff --git a/data/templates/post-like.htm b/data/templates/post-like.htm index 463e703..61406be 100644 --- a/data/templates/post-like.htm +++ b/data/templates/post-like.htm @@ -6,11 +6,11 @@

Like #{{crow.comment_id}}

- {% spaceless %} + {% apply spaceless %} {{author.name}} - {% endspaceless %} + {% endapply %} likes {{attribute(json, 'like-of').0}}. diff --git a/data/templates/post-reply.htm b/data/templates/post-reply.htm index 2c2e7cd..1839e7c 100644 --- a/data/templates/post-reply.htm +++ b/data/templates/post-reply.htm @@ -6,11 +6,11 @@

Comment #{{crow.comment_id}}

- {% spaceless %} + {% apply spaceless %} {{author.name}} - {% endspaceless %} + {% endapply %} wrote the following reply to '/path/to/compilation_cache', @@ -65,7 +65,7 @@ function error($description, $status = 'HTTP/1.0 400 Bad Request') function render($tplname, $vars = array(), $return = false) { - $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm'); + $template = $GLOBALS['twig']->load($tplname . '.htm'); if ($return) { return $template->render($vars); @@ -73,4 +73,4 @@ function render($tplname, $vars = array(), $return = false) echo $template->render($vars); } } -?> \ No newline at end of file +?> -- 2.30.2 From 6aa44cad670d4947e4473c36462bd3fef664f2ee Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 14 Mar 2022 18:29:44 +0100 Subject: [PATCH 3/9] Add html5 doctype --- data/templates/index.htm | 1 + data/templates/latest.htm | 1 + data/templates/post-like.htm | 1 + data/templates/post-reply.htm | 1 + 4 files changed, 4 insertions(+) diff --git a/data/templates/index.htm b/data/templates/index.htm index 2443e26..4862aac 100644 --- a/data/templates/index.htm +++ b/data/templates/index.htm @@ -1,3 +1,4 @@ + {{title}} diff --git a/data/templates/latest.htm b/data/templates/latest.htm index e574bc0..29f4e71 100644 --- a/data/templates/latest.htm +++ b/data/templates/latest.htm @@ -1,3 +1,4 @@ + diff --git a/data/templates/post-like.htm b/data/templates/post-like.htm index 61406be..ec3ea6f 100644 --- a/data/templates/post-like.htm +++ b/data/templates/post-like.htm @@ -1,3 +1,4 @@ + diff --git a/data/templates/post-reply.htm b/data/templates/post-reply.htm index 1839e7c..b95803d 100644 --- a/data/templates/post-reply.htm +++ b/data/templates/post-reply.htm @@ -1,3 +1,4 @@ + -- 2.30.2 From 95600408e26e7c84cd5a788d6447c7022a24d4e2 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 14 Mar 2022 18:31:03 +0100 Subject: [PATCH 4/9] Add "generator" meta tag --- data/templates/index.htm | 2 ++ data/templates/latest.htm | 1 + data/templates/post-like.htm | 1 + data/templates/post-reply.htm | 1 + 4 files changed, 5 insertions(+) diff --git a/data/templates/index.htm b/data/templates/index.htm index 4862aac..bcf7ee8 100644 --- a/data/templates/index.htm +++ b/data/templates/index.htm @@ -6,6 +6,8 @@ + +

{{title}}

diff --git a/data/templates/latest.htm b/data/templates/latest.htm index 29f4e71..6286819 100644 --- a/data/templates/latest.htm +++ b/data/templates/latest.htm @@ -4,6 +4,7 @@ Latest comments +

Latest comments

diff --git a/data/templates/post-like.htm b/data/templates/post-like.htm index ec3ea6f..2b7445d 100644 --- a/data/templates/post-like.htm +++ b/data/templates/post-like.htm @@ -3,6 +3,7 @@ Like of {{attribute(json, 'like-of').0}} +

Like #{{crow.comment_id}}

diff --git a/data/templates/post-reply.htm b/data/templates/post-reply.htm index b95803d..bbebfa5 100644 --- a/data/templates/post-reply.htm +++ b/data/templates/post-reply.htm @@ -3,6 +3,7 @@ Comment to {{attribute(json, 'in-reply-to').0}} +

Comment #{{crow.comment_id}}

-- 2.30.2 From 64889398b7954e6c152cbcb13599cec40dea0f7e Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 14 Mar 2022 18:31:18 +0100 Subject: [PATCH 5/9] Link latest.php --- data/templates/index.htm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/templates/index.htm b/data/templates/index.htm index bcf7ee8..3d20c28 100644 --- a/data/templates/index.htm +++ b/data/templates/index.htm @@ -42,5 +42,13 @@ simply type:

{{baseurl}}
+ + +

Misc

+

+ anoweco is open source. + You may view the + latest posts. +

-- 2.30.2 From c447c2a0be38d5f67988ba0a4675e3f92e62e205 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 14 Mar 2022 18:34:57 +0100 Subject: [PATCH 6/9] Add latest posts atom feed --- data/templates/latest-atom.htm | 23 +++++++++++++++++++++++ data/templates/latest.htm | 1 + www/latest-atom.php | 20 ++++++++++++++++++++ www/www-header.php | 9 +++++++++ 4 files changed, 53 insertions(+) create mode 100644 data/templates/latest-atom.htm create mode 100644 www/latest-atom.php diff --git a/data/templates/latest-atom.htm b/data/templates/latest-atom.htm new file mode 100644 index 0000000..e3c40ff --- /dev/null +++ b/data/templates/latest-atom.htm @@ -0,0 +1,23 @@ + + + Latest comments + + {{lastComment.comment_published|date("c")}} + {{baseUrl}}/latest-atom.php + + {% for comment in comments %} + + {{comment.comment_type}} #{{comment.comment_id}} to {{comment.domain}} + + {{baseUrl}}{{comment.url}} + {{comment.comment_published|date("c")}} + + {{comment.user.user_name}} + + + {{comment.comment_type}} to + {{comment.comment_of_url}} + + + {% endfor %} + diff --git a/data/templates/latest.htm b/data/templates/latest.htm index 6286819..5d9d380 100644 --- a/data/templates/latest.htm +++ b/data/templates/latest.htm @@ -4,6 +4,7 @@ Latest comments + diff --git a/www/latest-atom.php b/www/latest-atom.php new file mode 100644 index 0000000..6232b57 --- /dev/null +++ b/www/latest-atom.php @@ -0,0 +1,20 @@ +listLatest(); + +foreach ($comments as $comment) { + $comment->url = Urls::comment($comment->comment_id); + $comment->domain = parse_url($comment->comment_of_url, PHP_URL_HOST); +} + +$vars = [ + 'baseUrl' => getBaseUrl(), + 'comments' => $comments, + 'lastComment' => $comments[0], +]; +header('Content-Type: application/atom+xml'); +render('latest-atom', $vars); +?> diff --git a/www/www-header.php b/www/www-header.php index 37dd4b1..ec7e8b3 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -73,4 +73,13 @@ function render($tplname, $vars = array(), $return = false) echo $template->render($vars); } } + +/** + * No trailing slash + */ +function getBaseUrl() +{ + return $_SERVER['REQUEST_SCHEME'] + . '://' . $_SERVER['HTTP_HOST']; +} ?> -- 2.30.2 From d716e73994fdf74e1f2a17ef6466a0d36a397fed Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 14 Mar 2022 18:41:06 +0100 Subject: [PATCH 7/9] Fix URLs in atom feed --- data/templates/latest-atom.htm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/templates/latest-atom.htm b/data/templates/latest-atom.htm index e3c40ff..3c8ac13 100644 --- a/data/templates/latest-atom.htm +++ b/data/templates/latest-atom.htm @@ -1,9 +1,11 @@ Latest comments - + + {{lastComment.comment_published|date("c")}} {{baseUrl}}/latest-atom.php + anoweco {% for comment in comments %} -- 2.30.2 From 3f4c5f5fb33d7d8c1bc425109d7965a3dddd6099 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 30 Nov 2023 10:50:56 +0100 Subject: [PATCH 8/9] Update composer packages Mainly to get a new HTTP_Request2 to fix the magic quotes error. pear/http_request2 (v2.3.0 => v2.6.0) pear/pear_exception (v1.0.0 => v1.0.2) symfony/polyfill-ctype (v1.10.0 => v1.28.0) symfony/polyfill-mbstring (v1.10.0 => v1.28.0) symfony/polyfill-php80 (v1.28.0) twig/twig (v3.3.8 => v3.8.0) --- composer.lock | 282 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 215 insertions(+), 67 deletions(-) diff --git a/composer.lock b/composer.lock index 228711b..56f5a63 100644 --- a/composer.lock +++ b/composer.lock @@ -50,48 +50,47 @@ ], "description": "Miscellaneous HTTP utilities", "homepage": "http://pear.php.net/package/HTTP2", + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=HTTP2", + "source": "https://github.com/pear/HTTP2" + }, "time": "2016-08-10T19:11:15+00:00" }, { "name": "pear/http_request2", - "version": "v2.3.0", + "version": "v2.6.0", "source": { "type": "git", "url": "https://github.com/pear/HTTP_Request2.git", - "reference": "3599cf0fe455a4e281da464f6510bfc5c2ce54c4" + "reference": "f010a16ccddd1ee7d2ee085e8006ee712c00f706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/HTTP_Request2/zipball/3599cf0fe455a4e281da464f6510bfc5c2ce54c4", - "reference": "3599cf0fe455a4e281da464f6510bfc5c2ce54c4", + "url": "https://api.github.com/repos/pear/HTTP_Request2/zipball/f010a16ccddd1ee7d2ee085e8006ee712c00f706", + "reference": "f010a16ccddd1ee7d2ee085e8006ee712c00f706", "shasum": "" }, "require": { "pear/net_url2": "^2.2.0", "pear/pear_exception": "^1.0.0", - "php": ">=5.2.0" + "php": ">=5.6.0" + }, + "require-dev": { + "yoast/phpunit-polyfills": "^1.0.0" }, "suggest": { + "ext-curl": "Allows using cURL as a request backend.", "ext-fileinfo": "Adds support for looking up mime-types using finfo.", - "ext-zlib": "Allows handling gzip compressed responses.", - "lib-curl": "Allows using cURL as a request backend.", - "lib-openssl": "Allows handling SSL requests when not using cURL." + "ext-openssl": "Allows handling SSL requests when not using cURL.", + "ext-zlib": "Allows handling gzip compressed responses." }, "type": "library", - "extra": { - "branch-alias": { - "dev-trunk": "2.2-dev" - } - }, "autoload": { "psr-0": { "HTTP_Request2": "" } }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "./" - ], "license": [ "BSD-3-Clause" ], @@ -102,14 +101,19 @@ } ], "description": "Provides an easy way to perform HTTP requests.", - "homepage": "http://pear.php.net/package/HTTP_Request2", + "homepage": "https://pear.php.net/package/HTTP_Request2", "keywords": [ "PEAR", "curl", "http", "request" ], - "time": "2016-02-13T20:20:39+00:00" + "support": { + "docs": "https://pear.php.net/manual/en/package.http.http-request2.php", + "issues": "https://github.com/pear/HTTP_Request2/issues", + "source": "https://github.com/pear/HTTP_Request2" + }, + "time": "2023-11-01T19:51:41+00:00" }, { "name": "pear/net_url2", @@ -173,27 +177,31 @@ "uri", "url" ], + "support": { + "issues": "https://pear.php.net/bugs/search.php?cmd=display&package_name[]=Net_URL2", + "source": "https://github.com/pear/Net_URL2" + }, "time": "2017-08-25T06:16:11+00:00" }, { "name": "pear/pear_exception", - "version": "v1.0.0", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/pear/PEAR_Exception.git", - "reference": "8c18719fdae000b690e3912be401c76e406dd13b" + "reference": "b14fbe2ddb0b9f94f5b24cf08783d599f776fff0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/8c18719fdae000b690e3912be401c76e406dd13b", - "reference": "8c18719fdae000b690e3912be401c76e406dd13b", + "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/b14fbe2ddb0b9f94f5b24cf08783d599f776fff0", + "reference": "b14fbe2ddb0b9f94f5b24cf08783d599f776fff0", "shasum": "" }, "require": { - "php": ">=4.4.0" + "php": ">=5.2.0" }, "require-dev": { - "phpunit/phpunit": "*" + "phpunit/phpunit": "<9" }, "type": "class", "extra": { @@ -202,9 +210,9 @@ } }, "autoload": { - "psr-0": { - "PEAR": "" - } + "classmap": [ + "PEAR/" + ] }, "notification-url": "https://packagist.org/downloads/", "include-path": [ @@ -228,7 +236,11 @@ "keywords": [ "exception" ], - "time": "2015-02-10T20:07:52+00:00" + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR_Exception", + "source": "https://github.com/pear/PEAR_Exception" + }, + "time": "2021-03-21T15:43:46+00:00" }, { "name": "pear/services_libravatar", @@ -274,6 +286,10 @@ ], "description": "API interfacing class for libravatar.org", "homepage": "http://pear.php.net/package/Services_Libravatar", + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Services_Libravatar", + "source": "https://github.com/pear/Services_Libravatar" + }, "time": "2017-08-23T20:23:02+00:00" }, { @@ -318,24 +334,32 @@ ], "description": "Pingback+webmention client and server implementation ", "homepage": "http://pear2.php.net/PEAR2_Services_Linkback", + "support": { + "email": "pear-general@lists.php.net", + "issues": "https://github.com/pear2/Services_Linkback/issues/", + "source": "https://github.com/pear2/Services_Linkback/tree/v0.3.0" + }, "time": "2016-08-10T19:33:01+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.10.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" @@ -343,29 +367,33 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -376,24 +404,44 @@ "polyfill", "portable" ], - "time": "2018-08-06T14:22:27+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.10.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" }, "suggest": { "ext-mbstring": "For best performance" @@ -401,15 +449,99 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-28T09:04:16+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { "files": [ "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -417,6 +549,10 @@ "MIT" ], "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -426,46 +562,58 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", "polyfill", "portable", "shim" ], - "time": "2018-09-21T13:07:52+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" }, { "name": "twig/twig", - "version": "v3.3.8", + "version": "v3.8.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "972d8604a92b7054828b539f2febb0211dd5945c" + "reference": "9d15f0ac07f44dc4217883ec6ae02fd555c6f71d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c", - "reference": "972d8604a92b7054828b539f2febb0211dd5945c", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/9d15f0ac07f44dc4217883ec6ae02fd555c6f71d", + "reference": "9d15f0ac07f44dc4217883ec6ae02fd555c6f71d", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-mbstring": "^1.3" + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php80": "^1.22" }, "require-dev": { - "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + "psr/container": "^1.0|^2.0", + "symfony/phpunit-bridge": "^5.4.9|^6.3|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, "autoload": { "psr-4": { "Twig\\": "src/" @@ -499,7 +647,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.3.8" + "source": "https://github.com/twigphp/Twig/tree/v3.8.0" }, "funding": [ { @@ -511,7 +659,7 @@ "type": "tidelift" } ], - "time": "2022-02-04T06:59:48+00:00" + "time": "2023-11-21T18:54:41+00:00" } ], "packages-dev": [], @@ -522,5 +670,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } -- 2.30.2 From 77cb769b94d16b424ec7a0b1a8186000dd397b30 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 30 Nov 2023 11:00:40 +0100 Subject: [PATCH 9/9] Update composer package pear2/services_linkback from v0.3.0 to v0.4.0 .. so we get pear/http2 2.0.0 that works on PHP8 --- composer.json | 2 +- composer.lock | 39 +++++++++++++++++++-------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index f751efe..b26790c 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,6 @@ "pear/net_url2": "^2.2", "twig/twig": "^3.0", "pear/services_libravatar": "^0.2.4", - "pear2/services_linkback": "^0.3.0" + "pear2/services_linkback": "^0.4.0" } } diff --git a/composer.lock b/composer.lock index 56f5a63..9ded57a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,24 +4,24 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6f5e8d10b4a20c2586020514fcd648c6", + "content-hash": "875fa1befaae8ac8d43aa38d81775c35", "packages": [ { "name": "pear/http2", - "version": "v1.1.2", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/pear/HTTP2.git", - "reference": "b87527415aa1439d5abc2c620a37f0047c3b1568" + "reference": "72e15b4faa86f6109c6fc3aa82c5515b6453b3b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/HTTP2/zipball/b87527415aa1439d5abc2c620a37f0047c3b1568", - "reference": "b87527415aa1439d5abc2c620a37f0047c3b1568", + "url": "https://api.github.com/repos/pear/HTTP2/zipball/72e15b4faa86f6109c6fc3aa82c5515b6453b3b5", + "reference": "72e15b4faa86f6109c6fc3aa82c5515b6453b3b5", "shasum": "" }, "require-dev": { - "pear/pear-core": "*" + "phpunit/phpunit": "^9" }, "type": "library", "autoload": { @@ -30,9 +30,6 @@ } }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "./" - ], "license": [ "BSD-2-Clause" ], @@ -54,7 +51,7 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=HTTP2", "source": "https://github.com/pear/HTTP2" }, - "time": "2016-08-10T19:11:15+00:00" + "time": "2023-03-22T20:22:11+00:00" }, { "name": "pear/http_request2", @@ -294,25 +291,27 @@ }, { "name": "pear2/services_linkback", - "version": "v0.3.0", + "version": "v0.4.0", "source": { "type": "git", "url": "https://github.com/pear2/Services_Linkback.git", - "reference": "afee0b32c171c999e20ac199361eb6df650f6483" + "reference": "61790889871cae0bc6e54adb2637b9e0ec93275f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear2/Services_Linkback/zipball/afee0b32c171c999e20ac199361eb6df650f6483", - "reference": "afee0b32c171c999e20ac199361eb6df650f6483", + "url": "https://api.github.com/repos/pear2/Services_Linkback/zipball/61790889871cae0bc6e54adb2637b9e0ec93275f", + "reference": "61790889871cae0bc6e54adb2637b9e0ec93275f", "shasum": "" }, "require": { - "pear/http2": "~1.1", - "pear/http_request2": "~2.2", - "pear/net_url2": "~2.2" + "ext-xmlrpc": "*", + "pear/http2": "^2.0", + "pear/http_request2": "^2.5", + "pear/net_url2": "^2.2" }, "require-dev": { - "phpunit/phpunit": "*", + "pear/stream_var": "^2.0", + "phpunit/phpunit": "^9", "squizlabs/php_codesniffer": "~2.6" }, "type": "library", @@ -337,9 +336,9 @@ "support": { "email": "pear-general@lists.php.net", "issues": "https://github.com/pear2/Services_Linkback/issues/", - "source": "https://github.com/pear2/Services_Linkback/tree/v0.3.0" + "source": "https://github.com/pear2/Services_Linkback/tree/v0.4.0" }, - "time": "2016-08-10T19:33:01+00:00" + "time": "2023-03-22T21:18:04+00:00" }, { "name": "symfony/polyfill-ctype", -- 2.30.2