From 0f7c18f115eb7148c53994af0bbbf025716b7445 Mon Sep 17 00:00:00 2001 From: Banana Date: Tue, 3 Oct 2023 11:51:01 +0200 Subject: [PATCH] webclient php8 bash client cleanup --- CHANGELOG | 3 +++ client/bash/README | 4 ++++ client/bash/selfpaste.default.sh | 17 ++++++++++----- client/webclient/config.default.php | 26 ++++++++++++++--------- client/webclient/index.php | 32 ++++++++++++++++++----------- documentation/update.txt | 1 + 6 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 client/bash/README diff --git a/CHANGELOG b/CHANGELOG index 7bf9ad2..d9853a6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,9 @@ * New syntax in config file. Switched from define() to const syntax. Use config.default.php as a template to update your config. * Update requirements for server and webclient code to PHP 8.1 +* Changes to webclient: + New syntax in config file. Switched from define() to const syntax. + Use config.default.php as a template to update your config. * Licence change to GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 20220316 version 1.4 Oxygen diff --git a/client/bash/README b/client/bash/README new file mode 100644 index 0000000..f0c8f3b --- /dev/null +++ b/client/bash/README @@ -0,0 +1,4 @@ +Copy selfpaste.default.sh to selfpase.sh +Open in edit mode and change the two values to match with your selfpaste installation +ENDPOINT="http://your.tld/selfpaste/webroot/"; +SELFPASTE_UPLOAD_SECRET="PLEASE CHANGE YOUR SECRET"; diff --git a/client/bash/selfpaste.default.sh b/client/bash/selfpaste.default.sh index 5d3c7a2..9a99dfc 100644 --- a/client/bash/selfpaste.default.sh +++ b/client/bash/selfpaste.default.sh @@ -1,12 +1,19 @@ #!/usr/bin/env bash # This program is free software: you can redistribute it and/or modify -# it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE -# You should have received a copy of the -# COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 -# along with this program. If not, see http://www.sun.com/cddl/cddl.html +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0. +# +# 2019 - 2023 https://://www.bananas-playground.net/projekt/selfpaste command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl (https://curl.haxx.se/) but it's not installed. Aborting."; exit 1; } command -v jq >/dev/null 2>&1 || { echo >&2 "I require jq (https://stedolan.github.io/jq/) but it's not installed. Aborting."; exit 1; } diff --git a/client/webclient/config.default.php b/client/webclient/config.default.php index b624570..545ba57 100644 --- a/client/webclient/config.default.php +++ b/client/webclient/config.default.php @@ -1,13 +1,19 @@ - + selfpaste - add a new one @@ -109,11 +115,13 @@ if(isset($_POST['doSome'])) { /** * execute a curl call to the given $url + * * @param string $url The request url - * @param bool $port + * @param array $data + * @param string $port * @return bool|mixed */ -function curlPostUploadCall($url,$data,$port=false) { +function curlPostUploadCall(string $url,array $data, string $port=''): mixed { $ret = false; $ch = curl_init(); @@ -138,7 +146,7 @@ function curlPostUploadCall($url,$data,$port=false) { $ret = $do; } else { - error_log(var_export(curl_error($ch),true)); + error_log(var_export(curl_error($ch),true),3,'./sp-webclient.log'); } curl_close($ch); diff --git a/documentation/update.txt b/documentation/update.txt index 6ad727f..928d042 100644 --- a/documentation/update.txt +++ b/documentation/update.txt @@ -7,6 +7,7 @@ Update process is as follows: ## 1.4 Oxygen New syntax in config file. Switched from define() to const syntax. +This change apply also to the included webclient Example: old: define('LOG_CREATION',true); new: const LOG_CREATION = true; -- 2.39.5