]> jfr.im git - uguu.git/commitdiff
final fix
authorGo Johansson <redacted>
Fri, 16 Dec 2022 22:47:09 +0000 (23:47 +0100)
committerGo Johansson <redacted>
Fri, 16 Dec 2022 22:47:09 +0000 (23:47 +0100)
src/Classes/Connector.php
src/config.json
src/static/php/grill.php
src/static/php/upload.php

index 1ba6f00dd76dc140a841d368b98069c2f47ffb51..4c82c1743ee855557580886126cd444eefd343fe 100644 (file)
          */
         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);
             }
         }
         
index d142fcd631136a9ce91f3b0fc94d4fec792799b6..5bcea55f0e561b3e9eb4e7a5344d24e7b175ca4b 100755 (executable)
@@ -39,7 +39,6 @@
   "FILES_URL": "https://files.domain.com",
   "NAME_LENGTH": 8,
   "ID_CHARSET": "abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ",
-  "PHP_ERRORS": true,
   "BLOCKED_EXTENSIONS": [
     "exe",
     "scr",
index 0f0eda62306d4e120fe970320632f212e1bd8f1d..6472d53a96eeb3ea479c17bb07c525dc5aacdceb 100644 (file)
@@ -1,26 +1,5 @@
 <?php
     
-    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();
     /**
      * Uguu
      *
index 1237ed7754955380a00202cde45b63812897efcf..3469b43bd93f667f7ad331b990fe18b7bc0ae9a1 100644 (file)
      * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      */
     
-    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;