From: Banana Date: Wed, 1 Jan 2020 19:29:00 +0000 (+0100) Subject: 2020 safe. Lifetime calculation rewritten. Documentation updated. Update information... X-Git-Tag: v0.3-beta~3 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=695d25dfb2cd28028a39bd861356ee1527dd2dc6;p=selfpaste.git 2020 safe. Lifetime calculation rewritten. Documentation updated. Update information also available now. --- diff --git a/CHANGELOG b/CHANGELOG index 2afb306..1fd6566 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ TBA version x.x Lithium +* Update information now included +* Rewritten lifetime calculation 20191223 version 0.2-beta Helium * First public beta release diff --git a/TODO b/TODO index 80befee..0240a0d 100644 --- a/TODO +++ b/TODO @@ -8,3 +8,4 @@ * abstract storage to support different storage solutions * config file for client script * proxy setting for client script +* Lifetimecheck as cronjob diff --git a/client/selfpaste.default.sh b/client/selfpaste.default.sh index b1c6988..65dea84 100644 --- a/client/selfpaste.default.sh +++ b/client/selfpaste.default.sh @@ -6,7 +6,7 @@ # COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 # along with this program. If not, see http://www.sun.com/cddl/cddl.html # -# 2020 https://www.bananas-playground.net/projekt/selfpaste +# 2019 - 2020 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/documentation/lifetime.txt b/documentation/lifetime.txt index f010fe2..2010874 100644 --- a/documentation/lifetime.txt +++ b/documentation/lifetime.txt @@ -1,3 +1,4 @@ -The default lifetime of a paste is 7 days. Anything older will be deleted. +The default lifetime of a paste is 30 days. Anything older will be deleted. +The config value is on days. The default flood prevention time maximum is 30 sec. \ No newline at end of file diff --git a/documentation/security.txt b/documentation/security.txt index dea5fd1..dc98d85 100644 --- a/documentation/security.txt +++ b/documentation/security.txt @@ -3,7 +3,7 @@ Unless you: - Keep your secret a secret - Do not use it publicly - - Do not promote it as a new paste plattform + - Do not promote it as a new paste platform - Change your secret often diff --git a/documentation/update.txt b/documentation/update.txt new file mode 100644 index 0000000..20d28a7 --- /dev/null +++ b/documentation/update.txt @@ -0,0 +1,2 @@ +If you update from a previous version make sure every update step is done +since your current used version. \ No newline at end of file diff --git a/webroot/config.default.php b/webroot/config.default.php index 0171410..a613853 100644 --- a/webroot/config.default.php +++ b/webroot/config.default.php @@ -7,7 +7,7 @@ * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 * along with this program. If not, see http://www.sun.com/cddl/cddl.html * - * 2020 https://www.bananas-playground.net/projekt/selfpaste + * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste */ # this is your installation secret. Could be anything. @@ -23,7 +23,7 @@ define('SELFPASTE_ALLOWED_FILETYPES','text/plain,text/comma-separated-values,tex # needed to respond with the correct link for your paste # please NO / at the end define('SELFPASTE_URL','http://your.tld/path/selfpaste/webroot'); -# time in seconds how long a paste will be available. Default 7 days = 604800 sec -define('SELFPASTE_PASTE_LIFETIME',604800); +# time in days how long a paste will be available. Default 30 days +define('SELFPASTE_PASTE_LIFETIME',30); # time in seconds how long the flood protection should take action. Default 30sec define('SELFPASTE_FLOOD_LIFETIME',30); diff --git a/webroot/index.php b/webroot/index.php index ce48e0b..a16ad8f 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -7,7 +7,7 @@ * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 * along with this program. If not, see http://www.sun.com/cddl/cddl.html * - * 2020 https://www.bananas-playground.net/projekt/selfpaste + * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste */ # global debug setting diff --git a/webroot/lib/mancubus.class.php b/webroot/lib/mancubus.class.php index 0eed321..5168548 100644 --- a/webroot/lib/mancubus.class.php +++ b/webroot/lib/mancubus.class.php @@ -7,7 +7,7 @@ * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 * along with this program. If not, see http://www.sun.com/cddl/cddl.html * - * 2020 https://www.bananas-playground.net/projekt/selfpaste + * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste */ /** @@ -307,7 +307,7 @@ class Mancubus { */ private function _checkLifetime() { $iterator = new RecursiveDirectoryIterator(SELFPASTE_UPLOAD_DIR); - $now = time(); + $datepointInThePastInSec = strtotime('-'.SELFPASTE_PASTE_LIFETIME.' days'); foreach (new RecursiveIteratorIterator($iterator) as $file) { $fname = $file->getFilename(); @@ -315,8 +315,10 @@ class Mancubus { || Summoner::startsWith($file->getFilename(),'.') || isset($fname[4]) ) continue; - if ($now - $file->getCTime() >= SELFPASTE_PASTE_LIFETIME) { - unlink(SELFPASTE_UPLOAD_DIR.'/'.$fname); + if ($file->getMTime() <= $datepointInThePastInSec) { + if(is_writable($file->getPathname())) { + unlink($file->getPathname()); + } } } } diff --git a/webroot/lib/summoner.class.php b/webroot/lib/summoner.class.php index cd34240..7c2ea3a 100644 --- a/webroot/lib/summoner.class.php +++ b/webroot/lib/summoner.class.php @@ -7,7 +7,7 @@ * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 * along with this program. If not, see http://www.sun.com/cddl/cddl.html * - * 2020 https://www.bananas-playground.net/projekt/selfpaste + * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste */ /** diff --git a/webroot/view/created.inc.php b/webroot/view/created.inc.php index 46ce746..aee9608 100644 --- a/webroot/view/created.inc.php +++ b/webroot/view/created.inc.php @@ -7,6 +7,6 @@ * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 * along with this program. If not, see http://www.sun.com/cddl/cddl.html * - * 2020 https://www.bananas-playground.net/projekt/selfpaste + * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste */ echo json_encode($contentBody)."\n"; \ No newline at end of file diff --git a/webroot/view/view.inc.php b/webroot/view/view.inc.php index fcca9a5..42a7bf4 100644 --- a/webroot/view/view.inc.php +++ b/webroot/view/view.inc.php @@ -7,7 +7,7 @@ * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 * along with this program. If not, see http://www.sun.com/cddl/cddl.html * - * 2020 https://www.bananas-playground.net/projekt/selfpaste + * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste */ if (file_exists($contentBody)) { header('Expires: 0'); diff --git a/webroot/view/welcome.inc.php b/webroot/view/welcome.inc.php index b8dda95..542a7b7 100644 --- a/webroot/view/welcome.inc.php +++ b/webroot/view/welcome.inc.php @@ -7,7 +7,7 @@ * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 * along with this program. If not, see http://www.sun.com/cddl/cddl.html * - * 2020 https://www.bananas-playground.net/projekt/selfpaste + * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste */ ?>