From bde3a740c913aad103f4e0195792a868695aa417 Mon Sep 17 00:00:00 2001 From: Sam Tuke Date: Tue, 2 Jul 2019 16:15:52 +0200 Subject: [PATCH 1/5] Update class constructor to use __construct --- phplistHostedClient.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phplistHostedClient.class.php b/phplistHostedClient.class.php index 8d95331..b762451 100644 --- a/phplistHostedClient.class.php +++ b/phplistHostedClient.class.php @@ -19,7 +19,7 @@ class phpListHostedSoapClient { private $soap_url = ''; private $soap; - function phpListHostedSoapClient($soap_url) { + function __construct($soap_url) { $this->soap_url = $soap_url; $this->xCreateSoap(); } From 3c2c038260c26541bf7b88f52d00ed978c2aa27e Mon Sep 17 00:00:00 2001 From: Sam Tuke Date: Tue, 2 Jul 2019 16:59:53 +0200 Subject: [PATCH 2/5] Add support for http auth via wrapper method for setCredentials --- phplistHostedClient.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phplistHostedClient.class.php b/phplistHostedClient.class.php index b762451..0b30171 100644 --- a/phplistHostedClient.class.php +++ b/phplistHostedClient.class.php @@ -8,7 +8,6 @@ * version 0.1 - 2011-07-20, Michiel Dethmers phpList Ltd * * requires nuSoap: http://sourceforge.net/projects/nusoap/ - * unpack nuSoap in ./lib/ * * for more info https://www.phplist.com/contactus * @@ -24,6 +23,10 @@ function __construct($soap_url) { $this->xCreateSoap(); } + function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) { + $this->soap->setCredentials($username, $password, $authtype, $digestRequest, $certRequest); + } + function getMessageLittleStats($message_id) { return $this->soap->call('phpListHosted.getMessageLittleStats', array('message_id' => $message_id)); } From 377cf89dddd03d6ad6820ded0bd4adcf1c02e74d Mon Sep 17 00:00:00 2001 From: Sam Tuke Date: Tue, 2 Jul 2019 17:00:35 +0200 Subject: [PATCH 3/5] Switch to using an updated copy of nusoap from composer --- composer.json | 15 +++++++++++++++ phplistHostedClient.class.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3955920 --- /dev/null +++ b/composer.json @@ -0,0 +1,15 @@ +{ + "name": "phplist/phplist-soap-api", + "description": "A simple SOAP API for phpList Hosted", + "type": "library", + "require": { + "econea/nusoap": "v0.9.6" + }, + "license": "AGPL3", + "authors": [ + { + "name": "Sam Tuke", + "email": "mail@samtuke.com" + } + ] +} diff --git a/phplistHostedClient.class.php b/phplistHostedClient.class.php index 0b30171..ed687a5 100644 --- a/phplistHostedClient.class.php +++ b/phplistHostedClient.class.php @@ -53,7 +53,7 @@ function HelloWorld() { function xCreateSoap() { if (is_null($this->soap)) { - require(dirname(__FILE__)."/lib/nusoap.php"); + require(dirname(__FILE__)."/vendor/econea/nusoap/src/nusoap.php"); $this->soap = new nusoap_client($this->soap_url); } } From 7e0a2065c4ba2dadd3cdb7b75c65d2b5440fd3f7 Mon Sep 17 00:00:00 2001 From: Sam Tuke Date: Mon, 23 Sep 2019 15:41:51 +0200 Subject: [PATCH 4/5] Add gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57872d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor/ From 9da48d968d4d86b99f8365c95221f5711a085b82 Mon Sep 17 00:00:00 2001 From: Sam Tuke Date: Mon, 23 Sep 2019 15:51:58 +0200 Subject: [PATCH 5/5] Add version controlled git hooks --- .githooks/post-receive | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 .githooks/post-receive diff --git a/.githooks/post-receive b/.githooks/post-receive new file mode 100755 index 0000000..ecd7f94 --- /dev/null +++ b/.githooks/post-receive @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Script to update dependencies after reception + +# Check if composer is available +if ! [ -x "$(command -v composer)" ]; then + echo 'Error: composer is not installed.' >&2 + exit 1 +fi + +# Update dependencies +composer update;