This commit is contained in:
themohooks 2024-07-05 13:59:22 +03:00
parent 8ee5f1c486
commit f7595364d8
4 changed files with 12 additions and 4 deletions

View file

@ -1,7 +1,7 @@
<?php
namespace App\Models;
use \App\Services\{DB, Date};
use \App\Models\User;
use \App\Models\{User, Photo};
class Comment {
@ -17,8 +17,8 @@ class Comment {
<span class="message_date">'.Date::zmdate($this->c['posted_at']).'</span><br>
</div>
<a name="2681468"></a><a name="last"></a>
<div><b><a href="/author/'.$this->c['user_id'].'/" class="message_author">'.$user->i('username').'</a></b> &middot; </div>
<div class="rank">Фото: 1585</div>
<div><img src="'.$user->i('photourl').'" width="32" style="border-radius: 3px; margin-right: 5px;"><b><a href="/author/'.$this->c['user_id'].'/" class="message_author">'.$user->i('username').'</a></b> &middot; </div>
<div class="rank">Фото: '.Photo::fetchAll($this->c['user_id']).'</div>
<div class="message-text">'.$this->c['body'].'</div>
<div class="comment-votes-block">
<div class="wvote" wid="'.$this->c['id'].'">

View file

@ -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];

View file

@ -59,7 +59,7 @@ $user = new \App\Models\User(Auth::userid());
<li class="mm-pad-right"><a href="/login" class="mm-item"><span class="mm-icon"><i class="fas fa-xs fa-address-card"></i></span><span class="mm-label">Войти</span></a></li>
<li><a href="/register" class="mm-item"><span class="mm-icon"><i class="fas fa-xs fa-user"></i></span><span class="mm-label">Регистрация</span></a></li>
<?php } else { ?>
<li class="mm-pad-right mm-wide"><a href="/author/32944/" class="mm-item"><span class="mm-icon"><i class="fas fa-xs fa-user"></i></span><span class="mm-label"><?=$user->i('username')?></span></a>
<li class="mm-pad-right mm-wide"><a href="/author/<?=Auth::userid()?>/" class="mm-item"><span class="mm-icon"><i class="fas fa-xs fa-user"></i></span><span class="mm-label"><?=$user->i('username')?></span></a>
<div>
<ul class="mm-level-2">
<li><a href="/lk/" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-info-circle"></i></span><span class="mm-label">Общая информация</span></a></li>

View file

@ -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 '
<tr class="s11 h21">