]> jfr.im git - uguu.git/commitdiff
wrong
authorGo Johansson <redacted>
Fri, 16 Dec 2022 22:16:57 +0000 (23:16 +0100)
committerGo Johansson <redacted>
Fri, 16 Dec 2022 22:16:57 +0000 (23:16 +0100)
src/Classes/Connector.php
src/Classes/CuteGrills.php
src/Classes/Database.php
src/Classes/GrillLoader.php [moved from src/GrillLoader.php with 89% similarity]
src/Classes/Response.php
src/Classes/Upload.php
src/Classes/UploadGateway.php [moved from src/UploadGateway.php with 92% similarity]
src/composer.json
src/static/php/grill.php
src/static/php/upload.php

index fc86b1de33e19a1e599cc54bf3773771ffc6f06d..fb57b26293631d50f08993b89b7845e5a477e69e 100644 (file)
@@ -1,70 +1,71 @@
 <?php
-
-/**
- * Uguu
- *
- * @copyright Copyright (c) 2022 Go Johansson (nokonoko) <neku@pomf.se>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-namespace Pomf\Uguu\Classes;
-
-use Exception;
-use PDO;
-
-class Connector extends Database
-{
-    public PDO $DB;
-    public array $CONFIG;
-    
     /**
-     * Reads the config.json file and populates the CONFIG property with the settings
+     * Uguu
      *
-     * @throws \Exception
-     */
-    public function __construct()
-    {
-        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'),
-                true
-            );
-            $this->assemble();
-        } catch (Exception) {
-            throw new Exception('Cant populate settings.', 500);
-        }
-    }
-    
-    /**
-     * > Tries to connect to the database
+     * @copyright Copyright (c) 2022 Go Johansson (nokonoko) <neku@pomf.se>
+     *
+     * This program is free software: you can redistribute it and/or modify
+     * it under the terms of the GNU General Public License as published by
+     * the Free Software Foundation, either version 3 of the License, or
+     * (at your option) any later version.
      *
-     * @throws \Exception
+     * This program is distributed in the hope that it will be useful,
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     * GNU General Public License for more details.
+     *
+     * You should have received a copy of the GNU General Public License
+     * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      */
-    public function assemble()
+    
+    namespace Pomf\Uguu;
+    
+    use Exception;
+    use PDO;
+    
+    class Connector extends Database
     {
-        try {
-            $this->DB = new PDO(
-                $this->CONFIG['DB_MODE'] . ':' . $this->CONFIG['DB_PATH'],
-                $this->CONFIG['DB_USER'],
-                $this->CONFIG['DB_PASS']
-            );
-        } catch (Exception) {
-            throw new Exception('Cant connect to DB.', 500);
+        public PDO $DB;
+        public array $CONFIG;
+        
+        /**
+         * Reads the config.json file and populates the CONFIG property with the settings
+         *
+         * @throws \Exception
+         */
+        public function __construct()
+        {
+            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'),
+                   true,
+                );
+                $this->assemble();
+            }
+            catch (Exception) {
+                throw new Exception('Cant populate settings.', 500);
+            }
+        }
+        
+        /**
+         * > Tries to connect to the database
+         *
+         * @throws \Exception
+         */
+        public function assemble()
+        {
+            try {
+                $this->DB = new PDO(
+                   $this->CONFIG['DB_MODE'] . ':' . $this->CONFIG['DB_PATH'],
+                   $this->CONFIG['DB_USER'],
+                   $this->CONFIG['DB_PASS']
+                );
+            }
+            catch (Exception) {
+                throw new Exception('Cant connect to DB.', 500);
+            }
         }
     }
-}
index af10590f9323e76260dc05803fc82331ee44bc66..82018ce864f7d911a7edf17121fa4b882af6835c 100644 (file)
@@ -18,7 +18,7 @@
      * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      */
     
-    namespace Pomf\Uguu\Classes;
+    namespace Pomf\Uguu;
     
     class CuteGrills
     {
index 52ba22e10f972ed8257412f93a8e915b1307cb02..252f435f74e506ab0a87af14d184d7ff999a6cd6 100644 (file)
@@ -18,7 +18,7 @@
      * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      */
     
-    namespace Pomf\Uguu\Classes;
+    namespace Pomf\Uguu;
     
     use Exception;
     use PDO;
similarity index 89%
rename from src/GrillLoader.php
rename to src/Classes/GrillLoader.php
index 9fe16766de353371c18ddb8820338fdb1d736645..f0f83237606c3060b74b06a729443f5a1b924915 100644 (file)
      * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      */
     
-    namespace Pomf\Uguu;
+    namespace Pomf\Uguu\Classes;
     
-    class GrillLoader extends Classes\CuteGrills
+    use Pomf\Uguu\CuteGrills;
+    
+    class GrillLoader extends CuteGrills
     {
         public function __construct()
         {
index 7c2fe4f16f9de7230d65c163617a777c477b1c96..8ff736714daff764bfd195e488831006a31e0895 100644 (file)
@@ -18,7 +18,7 @@
      * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      */
     
-    namespace Pomf\Uguu\Classes;
+    namespace Pomf\Uguu;
     
     class Response
     {
index b092cfec47fae6be81304560ff3536ceb2eb824e..c70a0af24c5166a6c37fc9f1a7954b51df304f78 100644 (file)
@@ -18,7 +18,7 @@
      * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      */
     
-    namespace Pomf\Uguu\Classes;
+    namespace Pomf\Uguu;
     
     use Exception;
     
similarity index 92%
rename from src/UploadGateway.php
rename to src/Classes/UploadGateway.php
index a1f7830f7e0168473d1a9d837e77901856343c81..66d7b1044bf07eb28fc97cc2c813d4b4b33c62d5 100644 (file)
      * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      */
     
-    namespace Pomf\Uguu;
+    namespace Pomf\Uguu\Classes;
     
     use Exception;
-    use Pomf\Uguu\Classes\Response;
+    use Pomf\Uguu\Response;
+    use Pomf\Uguu\Upload;
     
-    class UploadGateway extends Classes\Upload
+    use function Pomf\Uguu\count;
+    
+    class UploadGateway extends Upload
     {
         /**
          * It handles the file uploads.
index 71ec1a534401fe8f6af8adec4e74146945dd9bac..ba718a8e0d20255a56ecd15e6037ab146fe76efc 100644 (file)
@@ -5,7 +5,8 @@
   "license": "GPL-3.0",
   "autoload": {
     "psr-4": {
-      "Uguu\\": "Classes"
+      "Pomf\\Uguu\\": "/",
+      "Pomf\\Uguu\\Classes\\": "src/Classes"
     }
   },
   "authors": [
index d7e078cb620cfa7443a9bb5d86b6f196230dbe59..0f0eda62306d4e120fe970320632f212e1bd8f1d 100644 (file)
@@ -41,6 +41,6 @@
      */
     require_once __DIR__ . '/../vendor/autoload.php';
     
-    use Pomf\Uguu\GrillLoader;
+    use Pomf\Uguu\Classes\GrillLoader;
     
     new GrillLoader();
index e736a8543c205dec60c7ff75273ff36223785fee..1237ed7754955380a00202cde45b63812897efcf 100644 (file)
@@ -41,7 +41,7 @@
     checkConfig();
     require_once __DIR__ . '/../vendor/autoload.php';
     
-    use Pomf\Uguu\UploadGateway;
+    use Pomf\Uguu\Classes\UploadGateway;
     
     try {
         (new UploadGateway())->handleFile($_GET['output'], $_FILES['files']);