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 '