From d2892b3139e570028cf5372614b2a08a59df9faf Mon Sep 17 00:00:00 2001 From: magikcypress Date: Thu, 27 Apr 2017 14:36:02 +0200 Subject: [PATCH] [fix] Add configuration variable for Nginx --- cfg/conf.ini.sample | 2 +- lib/Configuration.php | 2 +- lib/Persistence/AbstractPersistence.php | 26 ++++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cfg/conf.ini.sample b/cfg/conf.ini.sample index 4771d13..d616954 100644 --- a/cfg/conf.ini.sample +++ b/cfg/conf.ini.sample @@ -68,7 +68,7 @@ languageselection = false zerobincompatibility = false ; allows you to specify the name of the web server you are using to use ParseBin. -; If you use nginx or other webserver, delete semicolon +; if you use nginx or other webserver, delete semicolon ; webserver = "nginx" [expire] diff --git a/lib/Configuration.php b/lib/Configuration.php index 7e34f80..3eda851 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -52,7 +52,7 @@ class Configuration 'icon' => 'identicon', 'cspheader' => 'default-src \'none\'; manifest-src \'self\'; connect-src *; script-src \'self\'; style-src \'self\'; font-src \'self\'; img-src \'self\' data:; referrer no-referrer;', 'zerobincompatibility' => false, - 'webserver' => 'apache', + 'webserver' => 'Apache', ), 'expire' => array( 'default' => '1week', diff --git a/lib/Persistence/AbstractPersistence.php b/lib/Persistence/AbstractPersistence.php index 0492040..5a848c8 100644 --- a/lib/Persistence/AbstractPersistence.php +++ b/lib/Persistence/AbstractPersistence.php @@ -91,21 +91,21 @@ abstract class AbstractPersistence } } - if (property_exists($data->meta, 'webserver') && $data->meta->webserver && $this->_conf->getKey('webserver') == "Apache") { + if (property_exists($data->meta, 'webserver') && $data->meta->webserver && $this->_conf->getKey('webserver') == "Apache") { // Create .htaccess file if it does not exist. - $file = self::$_path . DIRECTORY_SEPARATOR . '.htaccess'; - if (!is_file($file)) { - $writtenBytes = @file_put_contents( - $file, - 'Allow from none' . PHP_EOL . - 'Deny from all' . PHP_EOL, - LOCK_EX - ); - if ($writtenBytes === false || $writtenBytes < 30) { - throw new Exception('unable to write to file ' . $file, 11); - } + $file = self::$_path . DIRECTORY_SEPARATOR . '.htaccess'; + if (!is_file($file)) { + $writtenBytes = @file_put_contents( + $file, + 'Allow from none' . PHP_EOL . + 'Deny from all' . PHP_EOL, + LOCK_EX + ); + if ($writtenBytes === false || $writtenBytes < 30) { + throw new Exception('unable to write to file ' . $file, 11); + } } - } + } } /**