diff --git a/app/Controllers/Api/Admin/Images/SetVisibility.php b/app/Controllers/Api/Admin/Images/SetVisibility.php new file mode 100644 index 0000000..4bc2cfd --- /dev/null +++ b/app/Controllers/Api/Admin/Images/SetVisibility.php @@ -0,0 +1,18 @@ +$_GET['id'], ':mod'=>$_GET['mod'])); + header('Location: ' . $_SERVER['HTTP_REFERER']); + } +} \ No newline at end of file diff --git a/app/Controllers/Api/Images/Comment.php b/app/Controllers/Api/Images/Comment.php deleted file mode 100644 index e69de29..0000000 diff --git a/app/Controllers/Api/Images/CommentsLoad.php b/app/Controllers/Api/Images/CommentsLoad.php deleted file mode 100644 index e69de29..0000000 diff --git a/app/Controllers/Api/Images/Compress.php b/app/Controllers/Api/Images/Compress.php index f1fc56a..ca21955 100644 --- a/app/Controllers/Api/Images/Compress.php +++ b/app/Controllers/Api/Images/Compress.php @@ -64,6 +64,9 @@ class Compress { $quality = 40; $max_width = 400; $max_height = 400; + if (!file_exists($_SERVER['DOCUMENT_ROOT'].'/cdn/imgcache')) { + mkdir($_SERVER['DOCUMENT_ROOT'].'/cdn/imgcache', 0777, true); + } $cache_filename = self::generateCacheFilename($source_url, $quality, $max_width, $max_height); diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index cb6366f..f74e6dd 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -12,6 +12,7 @@ use \App\Controllers\Api\Images\Comments\Create as PhotoComment; use \App\Controllers\Api\Images\Comments\Load as PhotoCommentLoad; use \App\Controllers\Api\Images\Comments\Rate as PhotoCommentVote; use \App\Controllers\Api\Profile\Update as ProfileUpdate; +use \App\Controllers\Api\Admin\Images\SetVisibility as AdminPhotoSetVisibility; class ApiController { @@ -43,6 +44,9 @@ class ApiController public static function photocompress() { return new PhotoCompress(); } + public static function adminsetvis() { + return new AdminPhotoSetVisibility(); + } } \ No newline at end of file diff --git a/app/Core/Routes.php b/app/Core/Routes.php index f885024..6573208 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -6,7 +6,6 @@ use \App\Services\{Router, Auth, DB}; use \App\Core\{Page}; - class Routes { public static function init() @@ -26,6 +25,7 @@ class Routes if (Auth::userid() > 0) { + $user = new \App\Models\User(Auth::userid()); Router::get('/lk', 'ProfileController@lk'); Router::get('/lk/upload', 'ProfileController@upload'); Router::get('/lk/history', 'ProfileController@lkhistory'); @@ -40,9 +40,10 @@ class Routes Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload'); Router::get('/api/photo/vote', 'ApiController@photovote'); Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote'); - - Router::any('/admin', 'AdminController@index'); - + if ($user->i('admin') > 0) { + Router::any('/admin', 'AdminController@index'); + Router::any('/api/admin/images/setvisibility', 'AdminController@adminsetvis'); + } Router::get('/logout', 'MainController@logout'); Router::get('/404', 'ExceptionRegister@notfound'); } else { diff --git a/views/components/Navbar.php b/views/components/Navbar.php index 22b1dc3..c1400aa 100644 --- a/views/components/Navbar.php +++ b/views/components/Navbar.php @@ -74,7 +74,7 @@ if (NGALLERY['root']['title'] != null && NGALLERY['root']['showtitle'] === true)