From f7595364d83d3b2efba73262144b529f0143ddcc Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:59:22 +0300 Subject: [PATCH] fix exif --- app/Models/Comment.php | 6 +++--- app/Models/Photo.php | 5 +++++ views/components/Navbar.php | 2 +- views/pages/Photo.php | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 3f41012..5507faf 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -1,7 +1,7 @@ '.Date::zmdate($this->c['posted_at']).'
-
'.$user->i('username').' ·
-
Фото: 1585
+
'.$user->i('username').' ·
+
Фото: '.Photo::fetchAll($this->c['user_id']).'
'.$this->c['body'].'
diff --git a/app/Models/Photo.php b/app/Models/Photo.php index 69ece93..9578bb3 100644 --- a/app/Models/Photo.php +++ b/app/Models/Photo.php @@ -11,6 +11,11 @@ class Photo { public function i($table) { return DB::query("SELECT * FROM photos WHERE id=:id", array(':id'=>$this->photoid))[0][$table]; } + public static function fetchAll($user_id = NULL) { + if ($user_id != NULL) { + return DB::query("SELECT COUNT(*) FROM photos WHERE user_id=:id", array(':id'=>$user_id))[0]['COUNT(*)']; + } + } public function content($table) { $content = json_decode(self::i('content'), true); return $content[$table]; diff --git a/views/components/Navbar.php b/views/components/Navbar.php index 58542e0..592cce2 100644 --- a/views/components/Navbar.php +++ b/views/components/Navbar.php @@ -59,7 +59,7 @@ $user = new \App\Models\User(Auth::userid());
  • Войти
  • Регистрация
  • -
  • i('username')?> +
  • i('username')?>
    • Общая информация
    • diff --git a/views/pages/Photo.php b/views/pages/Photo.php index b8c77cd..0f21c6e 100644 --- a/views/pages/Photo.php +++ b/views/pages/Photo.php @@ -213,6 +213,9 @@ $photouser = new \App\Models\User($photo->i('user_id')); if ($key === 'FILE.FileDateTime') { $value = Date::zmdate($value); } + if (is_array($value)) { + $value = implode(', ', $value); // Convert array to a comma-separated string + } echo '