diff --git a/app/Controllers/AdminController.php b/app/Controllers/AdminController.php index e69de29..07494cf 100644 --- a/app/Controllers/AdminController.php +++ b/app/Controllers/AdminController.php @@ -0,0 +1,54 @@ +getType() !== null) { + $this->photourl = $upload->getSrc(); } else { + $this->photourl = $user->i('photourl'); } } else { diff --git a/app/Core/Routes.php b/app/Core/Routes.php index 0abb501..706c43d 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -39,6 +39,8 @@ class Routes Router::get('/api/photo/vote', 'ApiController@photovote'); Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote'); + Router::get('/admin', 'AdminController@index'); + Router::get('/logout', 'MainController@logout'); Router::get('/404', 'ExceptionRegister@notfound'); } else { diff --git a/app/Services/Upload.php b/app/Services/Upload.php index 5201889..1f9d4ca 100644 --- a/app/Services/Upload.php +++ b/app/Services/Upload.php @@ -24,7 +24,9 @@ class Upload } public function __construct($file, $location) { - $filecdn = bin2hex(openssl_random_pseudo_bytes(64, $cstrong)) . '.' . pathinfo($file['name'])['extension']; + + $cstrong = True; + $filecdn = bin2hex(openssl_random_pseudo_bytes(64, $cstrong)) . '.' . 'jpeg'; $folder = $location . $filecdn; $s3 = new \Aws\S3\S3Client([ 'region' => NGALLERY['root']['storage']['s3']['credentials']['region'], @@ -35,10 +37,10 @@ class Upload ], 'endpoint' => NGALLERY['root']['storage']['s3']['domains']['gateway'], ]); - $cstrong = True; - $result = $s3->putObject([ + + $s3->putObject([ 'Bucket' => NGALLERY['root']['storage']['s3']['credentials']['bucket'], - 'Key' => $folder, + 'Key' => 'cdn/img/'.$filecdn, 'SourceFile' => $file['tmp_name'] ]); $this->type = explode('/', $file['type'])[0]; diff --git a/views/components/AdminSidebar.php b/views/components/AdminSidebar.php new file mode 100644 index 0000000..dadd239 --- /dev/null +++ b/views/components/AdminSidebar.php @@ -0,0 +1,112 @@ + + + \ No newline at end of file diff --git a/views/components/Navbar.php b/views/components/Navbar.php index 35ed498..a22aead 100644 --- a/views/components/Navbar.php +++ b/views/components/Navbar.php @@ -78,6 +78,10 @@ if (NGALLERY['root']['title'] != null && NGALLERY['root']['showtitle'] === true)