From 2e8718fb3a8dc4a2f01ec357a9678e6d7d345c7c Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Mon, 22 Jul 2024 00:57:25 +0300 Subject: [PATCH 1/6] fix(Upload): correct use of explode() function --- app/Controllers/Api/Images/Upload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/Api/Images/Upload.php b/app/Controllers/Api/Images/Upload.php index f7591e1..b63208c 100644 --- a/app/Controllers/Api/Images/Upload.php +++ b/app/Controllers/Api/Images/Upload.php @@ -105,7 +105,7 @@ class Upload 'type' => 'none', ) ); - } else if (explode($type, '/')[0] === 'image') { + } else if (explode('/', $type)[0] === 'image') { $exif = new EXIF($_FILES['image']['tmp_name']); From 731ff61d78aeb6f82bdb7c188ab2df6fef8c4cc8 Mon Sep 17 00:00:00 2001 From: GeorgNation <55389952+GeorgNation@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:12:34 +0600 Subject: [PATCH 2/6] =?UTF-8?q?=D0=9F=D0=B0=D0=BF=D0=BA=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BE=D0=BA?= =?UTF-8?q?=20=D1=84=D0=BE=D1=82=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- photos/.gitignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 photos/.gitignore diff --git a/photos/.gitignore b/photos/.gitignore new file mode 100644 index 0000000..e69de29 From f90a1796089497e39aea3e2c76972a00d3c9311e Mon Sep 17 00:00:00 2001 From: GeorgNation <55389952+GeorgNation@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:15:19 +0600 Subject: [PATCH 3/6] =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D1=83=D1=81=D0=BC?= =?UTF-8?q?=D0=BE=D1=82=D1=80=D0=B5=D0=BD=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9?= =?UTF-8?q?=20=D1=82=D0=B8=D0=BF=20=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=D0=B8=D1=89=D0=B0=20#7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #7 --- ngallery-example.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ngallery-example.yaml b/ngallery-example.yaml index cdbed3a..026d292 100644 --- a/ngallery-example.yaml +++ b/ngallery-example.yaml @@ -20,6 +20,10 @@ ngallery: websockets: messages: "" storage: + + # type: 's3' - загрузка файлов в хранилище S3 (Amazon S3, Cloudflare, MinIO и т.д) + # type: 'server' - загрузка файлов в папку photos (hardcode) + type: 's3' s3: domains: From 2ec7b5c61a80173e7be46970f54880f2fce587c2 Mon Sep 17 00:00:00 2001 From: GeorgNation <55389952+GeorgNation@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:19:39 +0600 Subject: [PATCH 4/6] =?UTF-8?q?=D0=94=D0=B0=D0=B6=D0=B5=20=D1=82=D0=B0?= =?UTF-8?q?=D0=BA=20#7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #7 --- ngallery-example.yaml | 2 +- {photos => uploads}/.gitignore | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {photos => uploads}/.gitignore (100%) diff --git a/ngallery-example.yaml b/ngallery-example.yaml index 026d292..8373996 100644 --- a/ngallery-example.yaml +++ b/ngallery-example.yaml @@ -22,7 +22,7 @@ ngallery: storage: # type: 's3' - загрузка файлов в хранилище S3 (Amazon S3, Cloudflare, MinIO и т.д) - # type: 'server' - загрузка файлов в папку photos (hardcode) + # type: 'server' - загрузка файлов в папку uploads (hardcode) type: 's3' s3: diff --git a/photos/.gitignore b/uploads/.gitignore similarity index 100% rename from photos/.gitignore rename to uploads/.gitignore From b7112238c3144b386ff58d962f56a53145ddfbb9 Mon Sep 17 00:00:00 2001 From: GeorgNation <55389952+GeorgNation@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:25:16 +0600 Subject: [PATCH 5/6] =?UTF-8?q?#7=20=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=B0=D0=BF=D0=BA=D1=83=20uploads?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #7 --- app/Services/Upload.php | 52 ++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/app/Services/Upload.php b/app/Services/Upload.php index 32a686d..d0c6bd7 100644 --- a/app/Services/Upload.php +++ b/app/Services/Upload.php @@ -38,25 +38,39 @@ class Upload $cstrong = True; $filecdn = bin2hex(openssl_random_pseudo_bytes(64, $cstrong)) . '.' . $fileext; $folder = $location . $filecdn; - $s3 = new \Aws\S3\S3Client([ - 'region' => NGALLERY['root']['storage']['s3']['credentials']['region'], - 'version' => NGALLERY['root']['storage']['s3']['credentials']['version'], - 'credentials' => [ - 'key' => NGALLERY['root']['storage']['s3']['credentials']['key'], - 'secret' => NGALLERY['root']['storage']['s3']['credentials']['secret'], - ], - 'endpoint' => NGALLERY['root']['storage']['s3']['domains']['gateway'], - ]); - - $s3->putObject([ - 'Bucket' => NGALLERY['root']['storage']['s3']['credentials']['bucket'], - 'Key' => $location.$filecdn, - 'SourceFile' => $tmpname - ]); - $this->type = $type; - $this->src = NGALLERY['root']['storage']['s3']['domains']['public'] . '/' . $location . $filecdn; - $this->size = self::human_filesize(filesize($tmpname)); - $this->name = $name; + + if (strtolower (NGALLERY['root']['storage']['type']) == "s3") + { + $s3 = new \Aws\S3\S3Client([ + 'region' => NGALLERY['root']['storage']['s3']['credentials']['region'], + 'version' => NGALLERY['root']['storage']['s3']['credentials']['version'], + 'credentials' => [ + 'key' => NGALLERY['root']['storage']['s3']['credentials']['key'], + 'secret' => NGALLERY['root']['storage']['s3']['credentials']['secret'], + ], + 'endpoint' => NGALLERY['root']['storage']['s3']['domains']['gateway'], + ]); + + $s3->putObject([ + 'Bucket' => NGALLERY['root']['storage']['s3']['credentials']['bucket'], + 'Key' => $location.$filecdn, + 'SourceFile' => $tmpname + ]); + $this->type = $type; + $this->src = NGALLERY['root']['storage']['s3']['domains']['public'] . '/' . $location . $filecdn; + $this->size = self::human_filesize(filesize($tmpname)); + $this->name = $name; + } + else + { + @mkdir ("{$_SERVER['DOCUMENT_ROOT']}/uploads/{$location}"); + move_uploaded_file ($tmpname, "{$_SERVER['DOCUMENT_ROOT']}/uploads/{$folder}"); + + $this->type = $type; + $this->src = "/uploads/{$folder}"; + $this->size = self::human_filesize(filesize($tmpname)); + $this->name = $name; + } } public function getType() { From f719c49e367b6680335015b751bb031bfc0aecc2 Mon Sep 17 00:00:00 2001 From: GeorgNation <55389952+GeorgNation@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:35:07 +0600 Subject: [PATCH 6/6] =?UTF-8?q?=D0=9D=D0=B5=20=D0=BF=D0=BE=D0=BD=D1=8F?= =?UTF-8?q?=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/MainController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Controllers/MainController.php b/app/Controllers/MainController.php index 5d1bf78..e6751f8 100644 --- a/app/Controllers/MainController.php +++ b/app/Controllers/MainController.php @@ -36,9 +36,7 @@ class MainController } public static function videoRules() { - $_GLOBAL['rules'] = '/config/videoRules.html'; - $_GLOBAL['title'] = 'Правила видеотеки'; - Page::set('Rules'); + Page::set('VideoRules'); } public static function update() {