From 06790f5ce6082ab0a75ba206bfffa0b1e50c7d73 Mon Sep 17 00:00:00 2001 From: Go Johansson Date: Fri, 16 Dec 2022 23:47:09 +0100 Subject: [PATCH] final fix --- src/Classes/Connector.php | 8 ++++---- src/config.json | 1 - src/static/php/grill.php | 21 --------------------- src/static/php/upload.php | 21 --------------------- 4 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/Classes/Connector.php b/src/Classes/Connector.php index 1ba6f00..4c82c17 100644 --- a/src/Classes/Connector.php +++ b/src/Classes/Connector.php @@ -35,18 +35,18 @@ */ public function __construct() { - if (!file_exists(__DIR__ . '../config.json')) { + if (!file_exists(__DIR__ . '/../config.json')) { throw new Exception('Cant read settings file.', 500); } try { $this->CONFIG = json_decode( - file_get_contents(__DIR__ . '../config.json'), + file_get_contents(__DIR__ . '/../config.json'), true, ); $this->assemble(); } - catch (Exception) { - throw new Exception('Cant populate settings.', 500); + catch (Exception $e) { + throw new Exception($e->getMessage(), 500); } } diff --git a/src/config.json b/src/config.json index d142fcd..5bcea55 100755 --- a/src/config.json +++ b/src/config.json @@ -39,7 +39,6 @@ "FILES_URL": "https://files.domain.com", "NAME_LENGTH": 8, "ID_CHARSET": "abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ", - "PHP_ERRORS": true, "BLOCKED_EXTENSIONS": [ "exe", "scr", diff --git a/src/static/php/grill.php b/src/static/php/grill.php index 0f0eda6..6472d53 100644 --- a/src/static/php/grill.php +++ b/src/static/php/grill.php @@ -1,26 +1,5 @@ . */ - function checkConfig() - { - if (!file_exists(__DIR__ . '/../config.json')) { - throw new Exception('Cant read settings file.', 500); - } - try { - $settings = json_decode( - file_get_contents(__DIR__ . '/../config.json'), - true, - ); - if ($settings['PHP_ERRORS']) { - error_reporting(E_ALL); - ini_set('display_errors', 1); - } - } - catch (Exception) { - throw new Exception('Cant populate settings.', 500); - } - } - - checkConfig(); require_once __DIR__ . '/../vendor/autoload.php'; use Pomf\Uguu\Classes\UploadGateway;