From 6aba39488f17bd03f1ba82bd54f2d6e18aac5677 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 22 Aug 2016 09:46:26 +0200 Subject: [PATCH] adding check for PATH ending in DIRECTORY_SEPARATOR, fixes #86 --- i18n/de.json | 4 +++- i18n/fr.json | 4 +++- i18n/pl.json | 4 +++- i18n/sl.json | 4 +++- i18n/zh.json | 4 +++- lib/PrivateBin.php | 4 ++++ 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/i18n/de.json b/i18n/de.json index e726bee6..7cbe3a0f 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -138,5 +138,7 @@ "Options": "Optionen", "Shorten URL": "URL verkürzen", "Editor": "Bearbeiten", - "Preview": "Vorschau" + "Preview": "Vorschau", + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": + "Der PATH muss bei PrivateBin mit einem \"%s\" enden. Bitte passe Deinen PATH in Deiner index.php an." } diff --git a/i18n/fr.json b/i18n/fr.json index fd4de966..a6f1852c 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -147,5 +147,7 @@ "Options": "Options", "Shorten URL": "Raccourcir URL", "Editor": "éditer", - "Preview": "avant-première" + "Preview": "avant-première", + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php." } diff --git a/i18n/pl.json b/i18n/pl.json index 0c60fbbe..8a977047 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -138,5 +138,7 @@ "Options": "Opcje", "Shorten URL": "Skróć adres URL", "Editor": "Edytować", - "Preview": "Zapowiedź" + "Preview": "Zapowiedź", + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php." } diff --git a/i18n/sl.json b/i18n/sl.json index 98978a4c..a6dde6cb 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -147,5 +147,7 @@ "Options": "Možnosti", "Shorten URL": "Skrajšajte URL", "Editor": "Uredi", - "Preview": "Predogled" + "Preview": "Predogled", + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php." } diff --git a/i18n/zh.json b/i18n/zh.json index f7e6395e..c8d3db72 100644 --- a/i18n/zh.json +++ b/i18n/zh.json @@ -138,5 +138,7 @@ "Options": "选项", "Shorten URL": "缩短链接", "Editor": "編輯", - "Preview": "預習" + "Preview": "預習", + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": + "PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php." } diff --git a/lib/PrivateBin.php b/lib/PrivateBin.php index fa9d353c..434f3dea 100644 --- a/lib/PrivateBin.php +++ b/lib/PrivateBin.php @@ -114,6 +114,7 @@ class PrivateBin * initializes and runs PrivateBin * * @access public + * @throws Exception * @return void */ public function __construct() @@ -121,6 +122,9 @@ class PrivateBin if (version_compare(PHP_VERSION, '5.3.0') < 0) { throw new Exception(I18n::_('PrivateBin requires php 5.3.0 or above to work. Sorry.'), 1); } + if (strlen(PATH) < 0 && substr(PATH, -1) !== DIRECTORY_SEPARATOR) { + throw new Exception(I18n::_('PrivateBin requires the PATH to end in a "%s". Please update the PATH in your index.php.', DIRECTORY_SEPARATOR), 5); + } // load config from ini file, initialize required classes $this->_init();