From 5688dc07b706236ac73944a0dbb83d7910541afe Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Sat, 20 Jul 2024 23:50:52 +0300 Subject: [PATCH] check all photos --- app/Controllers/Api/Images/CheckAll.php | 13 ++++++++++ app/Controllers/ApiController.php | 4 +++ app/Core/Routes.php | 1 + views/pages/FavAuthors.php | 33 +++++++++++++++++++------ 4 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 app/Controllers/Api/Images/CheckAll.php diff --git a/app/Controllers/Api/Images/CheckAll.php b/app/Controllers/Api/Images/CheckAll.php new file mode 100644 index 0000000..90bb9e4 --- /dev/null +++ b/app/Controllers/Api/Images/CheckAll.php @@ -0,0 +1,13 @@ +Auth::userid())); + header('Location: /fav_authors'); + } +} +?> diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index 4df9d7d..8a8e7fe 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -9,6 +9,7 @@ use \App\Controllers\Api\Subscribe as SubscribeUser; use \App\Controllers\Api\Images\{Upload}; use \App\Controllers\Api\Images\Rate as PhotoVote; use \App\Controllers\Api\Images\Compress as PhotoCompress; +use \App\Controllers\Api\Images\CheckAll as PhotoCheckAll; 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; @@ -51,6 +52,9 @@ class ApiController public static function subscribeuser() { return new SubscribeUser(); } + public static function checkallphotos() { + return new PhotoCheckAll(); + } } \ No newline at end of file diff --git a/app/Core/Routes.php b/app/Core/Routes.php index 4e662f0..ff6e2d0 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -47,6 +47,7 @@ class Routes Router::get('/api/photo/compress', 'ApiController@photocompress'); Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload'); Router::get('/api/photo/vote', 'ApiController@photovote'); + Router::get('/api/photo/checkall', 'ApiController@checkallphotos'); Router::get('/api/photo/comment/rate', 'ApiController@photocommentvote'); if ($user->i('admin') > 0) { Router::any('/admin', 'AdminController@index'); diff --git a/views/pages/FavAuthors.php b/views/pages/FavAuthors.php index 92410f7..0c9698c 100644 --- a/views/pages/FavAuthors.php +++ b/views/pages/FavAuthors.php @@ -22,24 +22,29 @@ use \App\Models\{User, Photo};

Фотографии избранных авторов

Auth::userid())); + $followimgs = DB::query('SELECT * FROM followers_notifications WHERE follower_id=:id AND checked=0', array(':id'=>Auth::userid())); + if (count($followimgs) > 0) { + echo '
Отметить все фотографии просмотренными
'; + } else { + echo '

Новых фотографий пока нет.

'; + } foreach ($followimgs as $f) { - $author = new User($p['user_id']); + $author = new User($f['user_id']); $p = new Photo($f['photo_id']); echo '
-
620 КБ + 620 КБ
-
'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'].'
+
'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$f['photo_id']))[0]['COUNT(*)'].'
-

'.htmlspecialchars($p['place']).'

- '.htmlspecialchars($p['postbody']).' -

'.Date::zmdate($p['timeupload']).'
Автор: '.htmlspecialchars($author->i('username')).'

+

'.htmlspecialchars($p->i('place')).'

+ '.htmlspecialchars($p->i('postbody')).' +

'.Date::zmdate($p->i('timeupload')).'
Автор: '.htmlspecialchars($author->i('username')).'

@@ -52,6 +57,20 @@ use \App\Models\{User, Photo}; +