* 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
--- /dev/null
+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";
#!/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; }
<?php
/**
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
+ * 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.
*
- * 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
+ * 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.
*
- * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
+ * 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
*/
/**
*/
/* please provide a unique username for this installation */
-define('FRONTEND_USERNAME','some');
+const FRONTEND_USERNAME = 'some';
/* please provide a unique password for this installation */
-define('FRONTEND_PASSWORD', 'admin');
-/* please provide a unique secret for this installation and add this to the allowed of your selfpase installation ones*/
-define('THE_SECRET','your super duper secret');
+const FRONTEND_PASSWORD = 'admin';
+/* please provide a unique secret for this installation and add this to the allowed of your selfpaste installation ones*/
+const THE_SECRET = 'your super duper secret';
/* the selfpaste installation endpoint url. Absolute or relative */
-define('THE_ENDPOINT','http://www.some.tld/path/to/selfpaste/index.php');
+const THE_ENDPOINT = 'http://www.some.tld/path/to/selfpaste/index.php';
<?php
/**
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
+ * 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.
*
- * 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
+ * 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.
*
- * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
+ * 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
*/
/**
* copy the config.default.php file to config.php and update its settings
*/
-define('DEBUG',false);
+const DEBUG = false;
require_once 'config.php';
# Encoding and error reporting setting
mb_http_output('UTF-8');
mb_internal_encoding('UTF-8');
-ini_set('error_reporting',-1); // E_ALL & E_STRICT
+error_reporting(-1); // E_ALL & E_STRICT
# default time setting
date_default_timezone_set('Europe/Berlin');
# check request
-$_urlToParse = filter_var($_SERVER['QUERY_STRING'],FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
+$_urlToParse = filter_var($_SERVER['QUERY_STRING'],FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW);
if(!empty($_urlToParse)) {
if(preg_match('/[\p{C}\p{M}\p{Sc}\p{Sk}\p{So}\p{Zl}\p{Zp}]/u',$_urlToParse) === 1) {
die('Malformed request. Make sure you know what you are doing.');
}
?>
-<html>
+<html lang="en">
<head>
<title>selfpaste - add a new one</title>
</head>
/**
* 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();
$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);
## 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;