Файл: upload/core/ajax/profile/load_more_comments.php
Строк: 34
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/core/core.php');
header('Content-Type: application/json; charset=utf-8');
$id = intval($_POST['id'] ?? 0);
$offset = intval($_POST['offset'] ?? 0);
$limit = 20;
$q = dbquery("
SELECT *
FROM rating
WHERE worker = ?
ORDER BY id DESC
", [$id]);
$filtered = [];
while ($rt = FetchAssoc($q)) {
$flag = CryptorHash('1', $rt['salt']);
if ($rt['del'] === $flag) continue;
$ank_rating = FetchAssoc(dbquery("SELECT * FROM users WHERE id = ?", [$rt['us']]));
if (!$ank_rating) continue;
$filtered[] = [
'rt' => $rt,
'ank_rating' => $ank_rating
];
}
$total = count($filtered);
$chunk = array_slice($filtered, $offset, $limit);
$html = '';
foreach ($chunk as $item) {
$rt = $item['rt'];
$ank_rating = $item['ank_rating'];
include $_SERVER['DOCUMENT_ROOT'] . '/core/elements/comment-box.php';
$html .= $comment_box;
}
$show_more = ($offset + $limit < $total);
echo json_encode([
'html' => $html,
'show_more' => $show_more
], JSON_UNESCAPED_UNICODE);
exit;
?>