From 83c344ee8096cb327ebcb88f5d21e0ba51d88179 Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Sun, 6 Oct 2024 01:47:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B3=D0=B0=D0=BB=D0=B5=D1=80=D0=B5=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controllers/MainController.php | 5 ++ app/Core/Routes.php | 1 + views/pages/Gallery.php | 101 +++++++++++++++++++++++++++++ views/pages/Photo.php | 5 ++ 4 files changed, 112 insertions(+) create mode 100644 views/pages/Gallery.php diff --git a/app/Controllers/MainController.php b/app/Controllers/MainController.php index 18ccb5f..146f5df 100644 --- a/app/Controllers/MainController.php +++ b/app/Controllers/MainController.php @@ -62,6 +62,11 @@ class MainController { Page::set('Fav'); + } + public static function gallery() + { + Page::set('Gallery'); + } public static function favauthors() { diff --git a/app/Core/Routes.php b/app/Core/Routes.php index 1e7c09c..e2a0c4b 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -33,6 +33,7 @@ class Routes Router::get('/api/photo/compress', 'ApiController@photocompress'); Router::get('/api/photo/loadrecent', 'ApiController@recentphotos'); Router::get('/api/users/load/$id', 'ApiController@loaduser'); + Router::get('/article/$id', 'MainController@gallery'); if (Auth::userid() > 0) { diff --git a/views/pages/Gallery.php b/views/pages/Gallery.php new file mode 100644 index 0000000..0e56fc5 --- /dev/null +++ b/views/pages/Gallery.php @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + +
+ + explode('/', $_SERVER['REQUEST_URI'])[2])); + ?> + + + + + + +
+

+ + + $gallery['id'])); + foreach ($photos as $p) { + $photo = new Photo($p['photo_id']); + $user = new User($p['user_id']); + echo '
+ + + + + + +
598 КБ +
+
'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$photo->i('id')))[0]['COUNT(*)'].'
+
+
+

'.htmlspecialchars($photo->i('postbody')).'

+

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

+

'.Date::zmdate($photo->i('posted_at')).'
Автор: '.$user->i('username').'

+
+

'; + } + ?> + + + +
+
+ + + + \ No newline at end of file diff --git a/views/pages/Photo.php b/views/pages/Photo.php index 94177ac..3c974d8 100644 --- a/views/pages/Photo.php +++ b/views/pages/Photo.php @@ -174,6 +174,11 @@ if ($photo->i('id') !== null) { + i('gallery_id') != 0 || $photo->i('gallery_id') != null) { + echo '
'.DB::query('SELECT title FROM galleries WHERE id=:id', array(':id'=>$photo->i('gallery_id')))[0]['title'].'
'; + } + ?>