Файл: sys/system.comments.php
Строк: 27
<?php
class Comments {
function GetCommentsCount($db) {
$sql = "SELECT * FROM comments";
$res = $db->Query($sql, null);
return mysql_num_rows($res);
}
function GetFileComments($db, $fileid) {
$db->Filter($fileid);
$cnt = $this->GetCommentsCount($db);
for($i = 1; $i < $cnt + 1; $i++) {
$sql = "SELECT * FROM comments WHERE fileid=$fileid AND id=$i";
$arr[$i] = $db->QueryAndFetch($sql, null);
}
return $arr;
}
function SendComment($db, $fileid, $author, $text) {
$sql = "INSERT INTO `comments` (`author`, `fileid`, `text`, `date`, `id`) VALUES ('$author', '$fileid', '$text', '" . date("d:m:Y:H:i") . "', NULL)";
$res = $db->Query($sql, null);
}
}
?>