From 51d65acaa3a4f4c5a0d8daea92e31298b2709184 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 21 Jun 2016 17:06:19 +0200 Subject: [PATCH 01/10] release 0.6.1 --- ChangeLog | 6 ++++++ README.rst | 4 +++- build.xml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53065e8..3c6f946 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-06-21 Christian Weiske + + * Inline CSS for HTML mails improves compatibility with mail clients + * Dummy data set for testing + * Version 0.6.1 + 2015-03-18 Christian Weiske * New source: CSV file diff --git a/README.rst b/README.rst index e503d3b..29e8bda 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,7 @@ Data sources - Any SQL database. - Multiple date fields per record supported. -- An LDAP server +- An LDAP server with ``evolutionPerson`` records - `Birthday reminder `_ files (``.bdf``) - CSV files @@ -62,6 +62,8 @@ To find out about all supported command line options, use ``--help``:: -e, --stoponempty Output nothing when list is empty -d date, --date=date Date to show events for -c FILE, --config=FILE Path to configuration file + --debug Development helper (mail) + --no-color Do not output ANSI color codes -h, --help show this help message and exit -v, --version show the program version and exit diff --git a/build.xml b/build.xml index 845a053..e89a894 100644 --- a/build.xml +++ b/build.xml @@ -1,7 +1,7 @@ - + -- 2.30.2 From 16f9c3c10d96b02f9ae63d04c08a8089c73558a5 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 15 Mar 2021 20:30:19 +0100 Subject: [PATCH 02/10] Support dependency installation via composer --- .gitignore | 1 + README.rst | 20 +- composer.json | 9 + composer.lock | 442 +++++++++++++++++++++++++++++++++++++++ src/bdrem/Autoloader.php | 6 +- 5 files changed, 469 insertions(+), 9 deletions(-) create mode 100644 composer.json create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 17e3ba1..2512199 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /lib /bin/phar-bdrem.php /README.html +vendor/ diff --git a/README.rst b/README.rst index 29e8bda..81a729d 100644 --- a/README.rst +++ b/README.rst @@ -41,9 +41,9 @@ After configuration_, you can test and use *bdrem* via command line:: ----------------------------------------------------------- Days Age Name Event Date Day ----------------------------------------------------------- - 0 32 Foo Bar Birthday 20.03.1982 Do - 1 33 Andrea Milestone Birthday 21.03.1981 Fr - 7 32 Hugh Success Birthday 27.03.1982 Do + 0 32 Foo Bar Birthday 20.03.1982 Do + 1 33 Andrea Milestone Birthday 21.03.1981 Fr + 7 32 Hugh Success Birthday 27.03.1982 Do 12 Welt Scherztag 01.04.???? Di Help @@ -53,7 +53,7 @@ To find out about all supported command line options, use ``--help``:: Usage: ./bin/bdrem.php [options] ./bin/bdrem.php [options] [options] - + Options: -n NUM, --next=NUM Show NUM days after date -p NUM, --prev=NUM Show NUM days before date @@ -66,7 +66,7 @@ To find out about all supported command line options, use ``--help``:: --no-color Do not output ANSI color codes -h, --help show this help message and exit -v, --version show the program version and exit - + Commands: readme Show README.rst file config Extract configuration file @@ -132,8 +132,8 @@ Configure your source as follows:: $source = array('Bdf', '/path/to/birthday.bdf'); -__ http://cweiske.de/birthday.htm -__ http://cweiske.de/birthday3.htm +__ http://cweiske.de/birthday.htm +__ http://cweiske.de/birthday3.htm CSV file @@ -176,7 +176,7 @@ Configuration options Default: ``array('name' => 0, 'event' => 1, 'date' => 2)`` - + ``defaultEvent`` Text to use as event if there is no event column. @@ -278,6 +278,10 @@ Dependencies Note that the ``.phar`` file already includes all dependencies; you do not need to install anything. +When running from a git checkout, install the dependencies with composer:: + + $ composer install + ======= License diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3941d41 --- /dev/null +++ b/composer.json @@ -0,0 +1,9 @@ +{ + "require": { + "pear/console_color2": "^0.1.2", + "pear/console_commandline": "^1.2", + "pear/console_table": "^1.3", + "pear/mail_mime": "^1.10", + "pear/net_ldap2": "^2.2" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..87c160a --- /dev/null +++ b/composer.lock @@ -0,0 +1,442 @@ +{ + "_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": "3c1f0b1522a2c5b6d68ba625069b424a", + "packages": [ + { + "name": "pear/console_color2", + "version": "0.1.2", + "source": { + "type": "git", + "url": "https://github.com/pear/Console_Color2.git", + "reference": "cab2b886aa55cc9e23464d1f49edf97bee9f5a63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Console_Color2/zipball/cab2b886aa55cc9e23464d1f49edf97bee9f5a63", + "reference": "cab2b886aa55cc9e23464d1f49edf97bee9f5a63", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Console_Color2": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel O'Connor", + "email": "daniel.oconnor@gmail.com", + "role": "Pear Developer" + }, + { + "name": "Stefan Walk", + "email": "et@php.net" + }, + { + "name": "Scott Mattocks", + "email": "scottmattocks@php.net" + } + ], + "description": "This Class allows you to easily use ANSI console colors in your application.", + "homepage": "https://github.com/pear/Console_Color2", + "keywords": [ + "console" + ], + "support": { + "source": "https://github.com/pear/Console_Color2/tree/0.1.2" + }, + "time": "2012-10-23T11:52:18+00:00" + }, + { + "name": "pear/console_commandline", + "version": "v1.2.3", + "source": { + "type": "git", + "url": "https://github.com/pear/Console_CommandLine.git", + "reference": "331b295d00c9fa2dae30fe14538d430d72d954c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Console_CommandLine/zipball/331b295d00c9fa2dae30fe14538d430d72d954c6", + "reference": "331b295d00c9fa2dae30fe14538d430d72d954c6", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xml": "*", + "pear/pear_exception": "^1.0.0", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "type": "library", + "autoload": { + "psr-0": { + "Console": "./" + }, + "exclude-from-classmap": [ + "tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Richard Quadling", + "email": "rquadling@gmail.com" + }, + { + "name": "David Jean Louis", + "email": "izimobil@gmail.com" + } + ], + "description": "A full featured command line options and arguments parser.", + "homepage": "https://github.com/pear/Console_CommandLine", + "keywords": [ + "console" + ], + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_CommandLine", + "source": "https://github.com/pear/Console_CommandLine" + }, + "time": "2020-04-16T15:04:15+00:00" + }, + { + "name": "pear/console_getopt", + "version": "v1.4.3", + "source": { + "type": "git", + "url": "https://github.com/pear/Console_Getopt.git", + "reference": "a41f8d3e668987609178c7c4a9fe48fecac53fa0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Console_Getopt/zipball/a41f8d3e668987609178c7c4a9fe48fecac53fa0", + "reference": "a41f8d3e668987609178c7c4a9fe48fecac53fa0", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Console": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Andrei Zmievski", + "email": "andrei@php.net", + "role": "Lead" + }, + { + "name": "Stig Bakken", + "email": "stig@php.net", + "role": "Developer" + }, + { + "name": "Greg Beaver", + "email": "cellog@php.net", + "role": "Helper" + } + ], + "description": "More info available on: http://pear.php.net/package/Console_Getopt", + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_Getopt", + "source": "https://github.com/pear/Console_Getopt" + }, + "time": "2019-11-20T18:27:48+00:00" + }, + { + "name": "pear/console_table", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/pear/Console_Table.git", + "reference": "1930c11897ca61fd24b95f2f785e99e0f36dcdea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Console_Table/zipball/1930c11897ca61fd24b95f2f785e99e0f36dcdea", + "reference": "1930c11897ca61fd24b95f2f785e99e0f36dcdea", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "suggest": { + "pear/Console_Color2": ">=0.1.2" + }, + "type": "library", + "autoload": { + "classmap": [ + "Table.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jan Schneider", + "homepage": "http://pear.php.net/user/yunosh" + }, + { + "name": "Tal Peer", + "homepage": "http://pear.php.net/user/tal" + }, + { + "name": "Xavier Noguer", + "homepage": "http://pear.php.net/user/xnoguer" + }, + { + "name": "Richard Heyes", + "homepage": "http://pear.php.net/user/richard" + } + ], + "description": "Library that makes it easy to build console style tables.", + "homepage": "http://pear.php.net/package/Console_Table/", + "keywords": [ + "console" + ], + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_Table", + "source": "https://github.com/pear/Console_Table" + }, + "time": "2018-01-25T20:47:17+00:00" + }, + { + "name": "pear/mail_mime", + "version": "1.10.10", + "source": { + "type": "git", + "url": "https://github.com/pear/Mail_Mime.git", + "reference": "ede6128af4c1474394a65f44bf20358c0bf1977f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Mail_Mime/zipball/ede6128af4c1474394a65f44bf20358c0bf1977f", + "reference": "ede6128af4c1474394a65f44bf20358c0bf1977f", + "shasum": "" + }, + "require": { + "pear/pear-core-minimal": "*", + "php": ">=5.2.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Mail": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "./" + ], + "license": [ + "BSD-3-clause" + ], + "authors": [ + { + "name": "Cipriano Groenendal", + "email": "cipri@php.net", + "role": "Lead" + }, + { + "name": "Aleksander Machniak", + "email": "alec@php.net", + "role": "Lead" + } + ], + "description": "Mail_Mime provides classes to create MIME messages", + "homepage": "http://pear.php.net/package/Mail_Mime", + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Mail_Mime", + "source": "https://github.com/pear/Mail_Mime" + }, + "time": "2021-01-17T08:30:22+00:00" + }, + { + "name": "pear/net_ldap2", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/pear/Net_LDAP2.git", + "reference": "38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Net_LDAP2/zipball/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8", + "reference": "38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8", + "shasum": "" + }, + "require": { + "ext-ldap": "*", + "pear/pear-core-minimal": "^1.10.1" + }, + "type": "library", + "autoload": { + "classmap": [ + "Net/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "." + ], + "license": [ + "LGPL-3.0" + ], + "description": "Object oriented interface for searching and manipulating LDAP-entries", + "homepage": "http://pear.php.net/package/Net_LDAP2", + "keywords": [ + "PEAR", + "ldap" + ], + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Net_LDAP2", + "source": "https://github.com/pear/Net_LDAP2" + }, + "time": "2015-10-30T20:34:22+00:00" + }, + { + "name": "pear/pear-core-minimal", + "version": "v1.10.10", + "source": { + "type": "git", + "url": "https://github.com/pear/pear-core-minimal.git", + "reference": "625a3c429d9b2c1546438679074cac1b089116a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/625a3c429d9b2c1546438679074cac1b089116a7", + "reference": "625a3c429d9b2c1546438679074cac1b089116a7", + "shasum": "" + }, + "require": { + "pear/console_getopt": "~1.4", + "pear/pear_exception": "~1.0" + }, + "replace": { + "rsky/pear-core-min": "self.version" + }, + "type": "library", + "autoload": { + "psr-0": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "src/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@php.net", + "role": "Lead" + } + ], + "description": "Minimal set of PEAR core files to be used as composer dependency", + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR", + "source": "https://github.com/pear/pear-core-minimal" + }, + "time": "2019-11-19T19:00:24+00:00" + }, + { + "name": "pear/pear_exception", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/pear/PEAR_Exception.git", + "reference": "dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7", + "reference": "dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7", + "shasum": "" + }, + "require": { + "php": ">=4.4.0" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "type": "class", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "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" + ], + "support": { + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR_Exception", + "source": "https://github.com/pear/PEAR_Exception" + }, + "time": "2019-12-10T10:24:42+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/src/bdrem/Autoloader.php b/src/bdrem/Autoloader.php index cebd0eb..e3884d9 100644 --- a/src/bdrem/Autoloader.php +++ b/src/bdrem/Autoloader.php @@ -52,6 +52,10 @@ class Autoloader get_include_path() . PATH_SEPARATOR . __DIR__ . '/../' ); spl_autoload_register(array(new self(), 'load')); + + if (file_exists(__DIR__ . '/../../vendor/autoload.php')) { + require_once __DIR__ . '/../../vendor/autoload.php'; + } } } -?> \ No newline at end of file +?> -- 2.30.2 From 94994b9fbbf4574679f76616ec68959bf29c99ef Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 8 Aug 2023 10:09:13 +0200 Subject: [PATCH 03/10] Fix PHP8 error: string offset access syntax with curly braces Error was: PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported --- src/bdrem/Renderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bdrem/Renderer.php b/src/bdrem/Renderer.php index 7357af6..6612447 100644 --- a/src/bdrem/Renderer.php +++ b/src/bdrem/Renderer.php @@ -74,7 +74,7 @@ abstract class Renderer */ protected function getLocalDate($dateStr) { - if ($dateStr{0} != '?') { + if ($dateStr[0] != '?') { return strftime('%x', strtotime($dateStr)); } -- 2.30.2 From 497b3a3ff3898fdb242ad3e29e7d88641a9d0735 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 12 Oct 2023 22:03:00 +0200 Subject: [PATCH 04/10] Use Net_LDAP2 2.3.0 for PHP8 support --- composer.json | 2 +- composer.lock | 63 +++++++++++++++++++++++++++------------------------ 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/composer.json b/composer.json index 3941d41..25a5ba7 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,6 @@ "pear/console_commandline": "^1.2", "pear/console_table": "^1.3", "pear/mail_mime": "^1.10", - "pear/net_ldap2": "^2.2" + "pear/net_ldap2": "^2.3" } } diff --git a/composer.lock b/composer.lock index 87c160a..3545e49 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": "3c1f0b1522a2c5b6d68ba625069b424a", + "content-hash": "ecbd614a29db70e304521a06550a4326", "packages": [ { "name": "pear/console_color2", @@ -60,16 +60,16 @@ }, { "name": "pear/console_commandline", - "version": "v1.2.3", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/pear/Console_CommandLine.git", - "reference": "331b295d00c9fa2dae30fe14538d430d72d954c6" + "reference": "611c5bff2e47ec5a184748cb5fedc2869098ff28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/Console_CommandLine/zipball/331b295d00c9fa2dae30fe14538d430d72d954c6", - "reference": "331b295d00c9fa2dae30fe14538d430d72d954c6", + "url": "https://api.github.com/repos/pear/Console_CommandLine/zipball/611c5bff2e47ec5a184748cb5fedc2869098ff28", + "reference": "611c5bff2e47ec5a184748cb5fedc2869098ff28", "shasum": "" }, "require": { @@ -116,7 +116,7 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Console_CommandLine", "source": "https://github.com/pear/Console_CommandLine" }, - "time": "2020-04-16T15:04:15+00:00" + "time": "2023-04-02T18:49:53+00:00" }, { "name": "pear/console_getopt", @@ -230,16 +230,16 @@ }, { "name": "pear/mail_mime", - "version": "1.10.10", + "version": "1.10.11", "source": { "type": "git", "url": "https://github.com/pear/Mail_Mime.git", - "reference": "ede6128af4c1474394a65f44bf20358c0bf1977f" + "reference": "d4fb9ce61201593d0f8c6db629c45e29c3409c14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/Mail_Mime/zipball/ede6128af4c1474394a65f44bf20358c0bf1977f", - "reference": "ede6128af4c1474394a65f44bf20358c0bf1977f", + "url": "https://api.github.com/repos/pear/Mail_Mime/zipball/d4fb9ce61201593d0f8c6db629c45e29c3409c14", + "reference": "d4fb9ce61201593d0f8c6db629c45e29c3409c14", "shasum": "" }, "require": { @@ -257,7 +257,7 @@ "./" ], "license": [ - "BSD-3-clause" + "BSD-3-Clause" ], "authors": [ { @@ -277,26 +277,29 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Mail_Mime", "source": "https://github.com/pear/Mail_Mime" }, - "time": "2021-01-17T08:30:22+00:00" + "time": "2021-09-05T08:42:45+00:00" }, { "name": "pear/net_ldap2", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/pear/Net_LDAP2.git", - "reference": "38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8" + "reference": "6eae6d20533469ffe1c01684923cd09f0fae3b77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/Net_LDAP2/zipball/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8", - "reference": "38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8", + "url": "https://api.github.com/repos/pear/Net_LDAP2/zipball/6eae6d20533469ffe1c01684923cd09f0fae3b77", + "reference": "6eae6d20533469ffe1c01684923cd09f0fae3b77", "shasum": "" }, "require": { "ext-ldap": "*", "pear/pear-core-minimal": "^1.10.1" }, + "require-dev": { + "phpunit/phpunit": "^9 || ^10.3" + }, "type": "library", "autoload": { "classmap": [ @@ -320,20 +323,20 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Net_LDAP2", "source": "https://github.com/pear/Net_LDAP2" }, - "time": "2015-10-30T20:34:22+00:00" + "time": "2023-10-12T20:00:01+00:00" }, { "name": "pear/pear-core-minimal", - "version": "v1.10.10", + "version": "v1.10.13", "source": { "type": "git", "url": "https://github.com/pear/pear-core-minimal.git", - "reference": "625a3c429d9b2c1546438679074cac1b089116a7" + "reference": "aed862e95fd286c53cc546734868dc38ff4b5b1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/625a3c429d9b2c1546438679074cac1b089116a7", - "reference": "625a3c429d9b2c1546438679074cac1b089116a7", + "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/aed862e95fd286c53cc546734868dc38ff4b5b1d", + "reference": "aed862e95fd286c53cc546734868dc38ff4b5b1d", "shasum": "" }, "require": { @@ -368,27 +371,27 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR", "source": "https://github.com/pear/pear-core-minimal" }, - "time": "2019-11-19T19:00:24+00:00" + "time": "2023-04-19T19:15:47+00:00" }, { "name": "pear/pear_exception", - "version": "v1.0.1", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/pear/PEAR_Exception.git", - "reference": "dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7" + "reference": "b14fbe2ddb0b9f94f5b24cf08783d599f776fff0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7", - "reference": "dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7", + "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": { @@ -427,7 +430,7 @@ "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR_Exception", "source": "https://github.com/pear/PEAR_Exception" }, - "time": "2019-12-10T10:24:42+00:00" + "time": "2021-03-21T15:43:46+00:00" } ], "packages-dev": [], @@ -438,5 +441,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.6.0" } -- 2.30.2 From 38760b905941993189a83cf8450dcf160631f174 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 12 Oct 2023 22:06:33 +0200 Subject: [PATCH 05/10] Add date header .. because that is not added automatically somehow when we define our own headers. --- src/bdrem/Renderer/Mail.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bdrem/Renderer/Mail.php b/src/bdrem/Renderer/Mail.php index 0efa3af..2d526c0 100644 --- a/src/bdrem/Renderer/Mail.php +++ b/src/bdrem/Renderer/Mail.php @@ -69,6 +69,7 @@ class Renderer_Mail extends Renderer $hdrs = array( 'From' => $this->config->get('mail_from', 'birthday@example.org'), + 'Date' => date('r'), 'Auto-Submitted' => 'auto-generated' ); $mime = new \Mail_mime( @@ -241,4 +242,4 @@ class Renderer_Mail extends Renderer return $html; } } -?> \ No newline at end of file +?> -- 2.30.2 From 4bbbffb1a2f194f85ae2629436dd9ac17b3c819f Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 20 Dec 2023 21:49:43 +0100 Subject: [PATCH 06/10] Add support for .vcf vCard files --- README.rst | 2 + composer.json | 3 +- composer.lock | 235 ++++++++++++++++++++++++++++++++++++- data/bdrem.config.php.dist | 8 ++ src/bdrem/Source/vCard.php | 102 ++++++++++++++++ 5 files changed, 348 insertions(+), 2 deletions(-) create mode 100644 src/bdrem/Source/vCard.php diff --git a/README.rst b/README.rst index 81a729d..1257d36 100644 --- a/README.rst +++ b/README.rst @@ -20,6 +20,8 @@ Data sources - An LDAP server with ``evolutionPerson`` records - `Birthday reminder `_ files (``.bdf``) - CSV files +- A directory of .vcf vCard files + Output formats ============== diff --git a/composer.json b/composer.json index 25a5ba7..9524114 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,7 @@ "pear/console_commandline": "^1.2", "pear/console_table": "^1.3", "pear/mail_mime": "^1.10", - "pear/net_ldap2": "^2.3" + "pear/net_ldap2": "^2.3", + "sabre/vobject": "^4.5" } } diff --git a/composer.lock b/composer.lock index 3545e49..7d7e616 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": "ecbd614a29db70e304521a06550a4326", + "content-hash": "39ce09afd7a686424abd7e671905368d", "packages": [ { "name": "pear/console_color2", @@ -431,6 +431,239 @@ "source": "https://github.com/pear/PEAR_Exception" }, "time": "2021-03-21T15:43:46+00:00" + }, + { + "name": "sabre/uri", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/uri.git", + "reference": "1774043c843f1db7654ecc93368a98be29b07544" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/uri/zipball/1774043c843f1db7654ecc93368a98be29b07544", + "reference": "1774043c843f1db7654ecc93368a98be29b07544", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.17", + "phpstan/extension-installer": "^1.3", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-phpunit": "^1.3", + "phpstan/phpstan-strict-rules": "^1.5", + "phpunit/phpunit": "^9.6" + }, + "type": "library", + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Sabre\\Uri\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "Functions for making sense out of URIs.", + "homepage": "http://sabre.io/uri/", + "keywords": [ + "rfc3986", + "uri", + "url" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/uri/issues", + "source": "https://github.com/fruux/sabre-uri" + }, + "time": "2023-06-09T07:04:02+00:00" + }, + { + "name": "sabre/vobject", + "version": "4.5.4", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/vobject.git", + "reference": "a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772", + "reference": "a6d53a3e5bec85ed3dd78868b7de0f5b4e12f772", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0", + "sabre/xml": "^2.1 || ^3.0 || ^4.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1", + "phpstan/phpstan": "^0.12", + "phpunit/php-invoker": "^2.0 || ^3.1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + }, + "suggest": { + "hoa/bench": "If you would like to run the benchmark scripts" + }, + "bin": [ + "bin/vobject", + "bin/generate_vcards" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sabre\\VObject\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + }, + { + "name": "Dominik Tobschall", + "email": "dominik@fruux.com", + "homepage": "http://tobschall.de/", + "role": "Developer" + }, + { + "name": "Ivan Enderlin", + "email": "ivan.enderlin@hoa-project.net", + "homepage": "http://mnt.io/", + "role": "Developer" + } + ], + "description": "The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects", + "homepage": "http://sabre.io/vobject/", + "keywords": [ + "availability", + "freebusy", + "iCalendar", + "ical", + "ics", + "jCal", + "jCard", + "recurrence", + "rfc2425", + "rfc2426", + "rfc2739", + "rfc4770", + "rfc5545", + "rfc5546", + "rfc6321", + "rfc6350", + "rfc6351", + "rfc6474", + "rfc6638", + "rfc6715", + "rfc6868", + "vCalendar", + "vCard", + "vcf", + "xCal", + "xCard" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/vobject/issues", + "source": "https://github.com/fruux/sabre-vobject" + }, + "time": "2023-11-09T12:54:37+00:00" + }, + { + "name": "sabre/xml", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/xml.git", + "reference": "99caa5dd248776ca6a1e1d2cfdef556a3fa63456" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/xml/zipball/99caa5dd248776ca6a1e1d2cfdef556a3fa63456", + "reference": "99caa5dd248776ca6a1e1d2cfdef556a3fa63456", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "lib-libxml": ">=2.6.20", + "php": "^7.4 || ^8.0", + "sabre/uri": ">=2.0,<4.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.38", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.6" + }, + "type": "library", + "autoload": { + "files": [ + "lib/Deserializer/functions.php", + "lib/Serializer/functions.php" + ], + "psr-4": { + "Sabre\\Xml\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + }, + { + "name": "Markus Staab", + "email": "markus.staab@redaxo.de", + "role": "Developer" + } + ], + "description": "sabre/xml is an XML library that you may not hate.", + "homepage": "https://sabre.io/xml/", + "keywords": [ + "XMLReader", + "XMLWriter", + "dom", + "xml" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/xml/issues", + "source": "https://github.com/fruux/sabre-xml" + }, + "time": "2023-11-09T10:47:15+00:00" } ], "packages-dev": [], diff --git a/data/bdrem.config.php.dist b/data/bdrem.config.php.dist index 3689d1b..1e877e8 100644 --- a/data/bdrem.config.php.dist +++ b/data/bdrem.config.php.dist @@ -53,6 +53,14 @@ $source = array( ) ); +//Source: Directory of .vcf vCard files (2 subfolder levels supported) +$source = [ + 'vCard', + [ + 'folder' => '/home/cweiske/dev/contacts-backup/contacts' + ] +]; + $daysPrev = 3; $daysNext = 14; diff --git a/src/bdrem/Source/vCard.php b/src/bdrem/Source/vCard.php new file mode 100644 index 0000000..98b8e00 --- /dev/null +++ b/src/bdrem/Source/vCard.php @@ -0,0 +1,102 @@ + + * @copyright 2023 Christian Weiske + * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 + * @link http://cweiske.de/bdrem.htm + */ +namespace bdrem; + +use Sabre\VObject; +use Sabre\VObject\Component\VCard; + +/** + * Read a folder of vcard files + * 2 subfolder levels are supported. + * + * @category Tools + * @package Bdrem + * @author Christian Weiske + * @copyright 2023 Christian Weiske + * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 + * @link http://cweiske.de/bdrem.htm + */ +class Source_vCard +{ + /** + * Full path to a folder with .vcf files + */ + protected string $folder; + + /** + * Set the VCard folder path + */ + public function __construct(array $config) + { + $this->folder = $config['folder']; + if (!is_dir($this->folder)) { + throw new \Exception( + 'VCard folder does not exist: ' . $this->folder + ); + } + } + + /** + * Return all events for the given date range + * + * @param string $strDate Date the events shall be found for, + * YYYY-MM-DD + * @param integer $nDaysPrevious Include number of days before $strDate + * @param integer $nDaysNext Include number of days after $strDate + * + * @return Event[] Array of matching event objects + */ + public function getEvents($strDate, $nDaysPrevious, $nDaysNext) + { + $vcfFiles = glob($this->folder . '/{*,*/*,*/*/*}.vcf', GLOB_BRACE); + if (count($vcfFiles) == 0) { + throw new \Exception('No .vcf files found in folder'); + } + + $arEvents = []; + foreach ($vcfFiles as $vcfFile) { + $vcard = VObject\Reader::read(file_get_contents($vcfFile)); + + if (isset($vcard->BDAY)) { + $event = new Event( + $this->getName($vcard), + 'Birthday', + $vcard->BDAY->getDateTime()->format('Y-m-d') + ); + if ($event->isWithin($strDate, $nDaysPrevious, $nDaysNext)) { + $arEvents[] = $event; + } + } + + if (isset($vcard->{'X-ANNIVERSARY'})) { + $event = new Event( + $this->getName($vcard), + 'Anniversary', + $vcard->{'X-ANNIVERSARY'}->getDateTime()->format('Y-m-d') + ); + if ($event->isWithin($strDate, $nDaysPrevious, $nDaysNext)) { + $arEvents[] = $event; + } + } + } + + return $arEvents; + } + + protected function getName(VCard $vcard) + { + return (string) $vcard->FN; + } +} +?> -- 2.30.2 From f50e644a31cb6949248ca1dcccc836df20aea4ef Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 20 Dec 2023 21:55:59 +0100 Subject: [PATCH 07/10] Use [] array syntax in example config --- data/bdrem.config.php.dist | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/data/bdrem.config.php.dist b/data/bdrem.config.php.dist index 1e877e8..46773ed 100644 --- a/data/bdrem.config.php.dist +++ b/data/bdrem.config.php.dist @@ -1,57 +1,57 @@ '/path/to/file.csv', - 'columns' => array( + 'columns' => [ 'name' => 0, 'event' => 1, 'date' => 2 - ), + ], 'firstLineIsHeader' => true, 'defaultEvent' => 'Birthday', 'separator' => ',', - ) -); + ] +]; //Source: SQL database -$source = array( +$source = [ 'Sql', - array( + [ 'dsn' => 'mysql:dbname=bdrem;host=127.0.0.1', 'user' => 'FIXME', 'password' => 'FIXME', 'table' => 'contacts', - 'fields' => array( - 'date' => array( + 'fields' => [ + 'date' => [ //column name => event title 'c_birthday' => 'Birthday' - ), + ], //column with name, or array with column names - 'name' => array('c_name'), + 'name' => ['c_name'], //sprintf-compatible name formatting instruction 'nameFormat' => '%s', - ) - ) -); + ] + ] +]; //Source: LDAP -$source = array( +$source = [ 'Ldap', - array( + [ 'host' => 'ldap.example.org', 'basedn' => 'ou=adressbuch,dc=example,dc=org', 'binddn' => 'cn=FIXME,ou=users,dc=example,dc=org', 'bindpw' => 'FIXME' - ) -); + ] +]; //Source: Directory of .vcf vCard files (2 subfolder levels supported) $source = [ @@ -68,5 +68,5 @@ $locale = 'de_DE.UTF-8'; //email settings $mail_from = 'birthday@example.org'; -$mail_to = array('a@example.org', 'b@example.org'); +$mail_to = ['a@example.org', 'b@example.org']; ?> -- 2.30.2 From e551d5037811aff231479067138946816f8c816d Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 20 Dec 2023 22:11:30 +0100 Subject: [PATCH 08/10] Support simple vCard configuration --- data/bdrem.config.php.dist | 7 +------ src/bdrem/Source/vCard.php | 7 ++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/bdrem.config.php.dist b/data/bdrem.config.php.dist index 46773ed..55dbe81 100644 --- a/data/bdrem.config.php.dist +++ b/data/bdrem.config.php.dist @@ -54,12 +54,7 @@ $source = [ ]; //Source: Directory of .vcf vCard files (2 subfolder levels supported) -$source = [ - 'vCard', - [ - 'folder' => '/home/cweiske/dev/contacts-backup/contacts' - ] -]; +$source = ['vCard', '/home/user/contacts/']; $daysPrev = 3; diff --git a/src/bdrem/Source/vCard.php b/src/bdrem/Source/vCard.php index 98b8e00..3d55915 100644 --- a/src/bdrem/Source/vCard.php +++ b/src/bdrem/Source/vCard.php @@ -37,8 +37,13 @@ class Source_vCard /** * Set the VCard folder path */ - public function __construct(array $config) + public function __construct($config) { + if (is_string($config)) { + $config = array( + 'folder' => $config + ); + } $this->folder = $config['folder']; if (!is_dir($this->folder)) { throw new \Exception( -- 2.30.2 From 98d69f6a72c8bcdd490804315e01ca2323a290e5 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 20 Dec 2023 22:11:46 +0100 Subject: [PATCH 09/10] Update changelog for 0.7.0 --- ChangeLog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3c6f946..eb0b2c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-12-20 Christian Weiske + + * Add support for vCard folder source + * Version 0.7.0 + 2016-06-21 Christian Weiske * Inline CSS for HTML mails improves compatibility with mail clients @@ -19,4 +24,3 @@ * Output: HTML * Output: iCalendar * Version 0.5.0 - -- 2.30.2 From b4955304d890a3882d95b38a85f15ff9e4feb5cb Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 20 Dec 2023 22:12:17 +0100 Subject: [PATCH 10/10] Update phing build script to use composer installation only --- build.xml | 49 ++++++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/build.xml b/build.xml index e89a894..008e4cb 100644 --- a/build.xml +++ b/build.xml @@ -1,7 +1,7 @@ - + @@ -12,17 +12,27 @@ + + + + + + + + + + + + + + - - - - - @@ -49,33 +59,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.30.2