mirror of
https://github.com/claradex/nativegallery.git
synced 2024-11-15 03:31:10 +03:00
edited comment status
This commit is contained in:
parent
0f6feb123a
commit
78ace421d5
2 changed files with 16 additions and 1 deletions
|
@ -11,11 +11,19 @@ class Edit
|
||||||
|
|
||||||
|
|
||||||
$postId = explode('/', $_SERVER['REQUEST_URI'])[4];
|
$postId = explode('/', $_SERVER['REQUEST_URI'])[4];
|
||||||
|
$data = DB::query('SELECT * FROM photos_comments WHERE id=:id', array(':id' => $postId))[0];
|
||||||
|
$content = json_decode($data['content'], true);
|
||||||
$postuserid = DB::query('SELECT user_id FROM photos_comments WHERE id=:id', array(':id' => $postId))[0]['user_id'];
|
$postuserid = DB::query('SELECT user_id FROM photos_comments WHERE id=:id', array(':id' => $postId))[0]['user_id'];
|
||||||
if ($postuserid === Auth::userid()) {
|
if ($postuserid === Auth::userid()) {
|
||||||
$json = file_get_contents('php://input');
|
$json = file_get_contents('php://input');
|
||||||
$data = json_decode($json, true);
|
$data = json_decode($json, true);
|
||||||
DB::query('UPDATE photos_comments SET body=:body WHERE id=:id', array(':id' => $postId, ':body' => $data['value']));
|
$json_arr = $content;
|
||||||
|
if ($data['value'] != DB::query('SELECT body FROM photos_comments WHERE id=:id', array(':id' => $postId))[0]['body']) {
|
||||||
|
$json_arr['edited'] = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
|
$json_str_updated = json_encode($json_arr);
|
||||||
|
DB::query('UPDATE photos_comments SET body=:body, content=:c WHERE id=:id', array(':id' => $postId, ':body' => $data['value'], ':c'=>$json_str_updated));
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
array(
|
array(
|
||||||
'errorcode' => '0',
|
'errorcode' => '0',
|
||||||
|
|
|
@ -16,12 +16,16 @@ class Comment {
|
||||||
}
|
}
|
||||||
public function i() {
|
public function i() {
|
||||||
$user = new User($this->c['user_id']);
|
$user = new User($this->c['user_id']);
|
||||||
|
$content = json_decode($this->c['content'], true);
|
||||||
echo '<div class="'.$this->class.' comment" wid="'.$this->c['id'].'">
|
echo '<div class="'.$this->class.' comment" wid="'.$this->c['id'].'">
|
||||||
<div style="float:right; text-align:right" class="sm">
|
<div style="float:right; text-align:right" class="sm">
|
||||||
<span class="message_date">'.Date::zmdate($this->c['posted_at']).'</span><br>
|
<span class="message_date">'.Date::zmdate($this->c['posted_at']).'</span><br>
|
||||||
<a href="#" class="quoteLink dot">Цитировать</a>
|
<a href="#" class="quoteLink dot">Цитировать</a>
|
||||||
·
|
·
|
||||||
<a href="#'.$this->c['id'].'" class="cmLink dot">Ссылка</a>
|
<a href="#'.$this->c['id'].'" class="cmLink dot">Ссылка</a>
|
||||||
|
';
|
||||||
|
|
||||||
|
echo '
|
||||||
</div>
|
</div>
|
||||||
<a name="2681468"></a><a name="last"></a>
|
<a name="2681468"></a><a name="last"></a>
|
||||||
<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">'.htmlspecialchars($user->i('username')).'</a></b> ·
|
<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">'.htmlspecialchars($user->i('username')).'</a></b> ·
|
||||||
|
@ -32,6 +36,9 @@ class Comment {
|
||||||
if (json_decode($user->i('content'), true)['aboutlive']['value'] != null) {
|
if (json_decode($user->i('content'), true)['aboutlive']['value'] != null) {
|
||||||
echo ' '.htmlspecialchars(json_decode($user->i('content'), true)['aboutlive']['value']);
|
echo ' '.htmlspecialchars(json_decode($user->i('content'), true)['aboutlive']['value']);
|
||||||
}
|
}
|
||||||
|
if ($content['edited'] === 'true') {
|
||||||
|
echo '<br>(отредактировано)';
|
||||||
|
}
|
||||||
if ($user->i('admin') === 1) {
|
if ($user->i('admin') === 1) {
|
||||||
$admintype = ' · Администратор сервера';
|
$admintype = ' · Администратор сервера';
|
||||||
} else if ($user->i('admin') === 2) {
|
} else if ($user->i('admin') === 2) {
|
||||||
|
|
Loading…
Reference in a new issue