Файл: 2/3020.ru/modules/forum/plugins/likes.php
Строк: 32
<?php
ECHO "<div id='like_id'>";
IF (ISSET($user)){
IF (GET('get') == 'like' && DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FORUM_THEM_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `THEM_ID` = '".$fthem['ID']."' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `FORUM_THEM_LIKES` (`USER_ID`, `TIME`, `THEM_ID`) VALUES ('".$user['ID']."', '".TIME()."', '".$fthem['ID']."')");
IF ($fthem['USER_ID'] != $user['ID'] && DB::GET_COLUMN("SELECT COUNT(*) FROM `NOTIFICATIONS_SETTINGS` WHERE `USER_ID` = '".$fthem['USER_ID']."' AND `FORUM_LIKES` = '1' LIMIT 1") == 1){
DB::GET_ADD("INSERT INTO `NOTIFICATIONS` (`USER_ID`, `OBJECT_ID`, `OBJECT_ID_LIST`, `TIME`, `TYPE`) VALUES ('".$fthem['USER_ID']."', '".$user['ID']."', '".$fthem['ID']."', '".TIME()."', 'forum_likes')");
}
}
IF (GET('get') == 'like_no' && DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FORUM_THEM_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `THEM_ID` = '".$fthem['ID']."' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `FORUM_THEM_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `THEM_ID` = '".$fthem['ID']."' LIMIT 1");
}
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FORUM_THEM_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `THEM_ID` = '".$fthem['ID']."' LIMIT 1") == 0){
?><a class="btn-request-likes-photo heartwrap" onclick="request('forum', '/modules/?path=forum§ion=show&id=<?=$fthem['ID']?>&get=like', '#like_id')" load="none"><span style='position: relative; top: 1px;'><?=ICONS('heart-o', 18, 'fa-fw')?></span></a><?
}ELSE{
?><a class="btn-request-likes-photo heartwrap" style="background-color: #F5574C;" onclick="request('forum', '/modules/?path=forum§ion=show&id=<?=$fthem['ID']?>&get=like_no', '#like_id')" load="none"><span style='position: relative; top: 1px;'><?=ICONS('heart', 18, 'fa-fw')?></span></a><?
}
}
ECHO "<div class='list-menu'>";
$count_eye = DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FORUM_THEM_EYE` WHERE `THEM_ID` = '".$fthem['ID']."'");
ECHO "<span class='icons'>".ICONS('eye', 17, 'fa-fw')."</span> ".LG('Просмотров').": ".$count_eye."";
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FORUM_THEM_LIKES` WHERE `THEM_ID` = '".$fthem['ID']."'") > 0){
ECHO "<br /><a href='/modules/?path=forum§ion=show&id=".$fthem['ID']."&get=like_list'><span class='icons'>".ICONS('heart', 17, 'fa-fw')."</span> ".LG('Понравилось')." ";
$s = 0;
$data = DB::GET_STRING_ALL("SELECT `USER_ID` FROM `FORUM_THEM_LIKES` WHERE `THEM_ID` = '".$fthem['ID']."' ORDER BY `TIME` DESC");
WHILE ($list = $data->FETCH()){
$s++;
IF ($s >= 1 && $s <= 5){
ECHO " ".USER::AVATAR($list['USER_ID'], 25)." ";
}
}
IF ($s > 5){
$count = $s - 5;
ECHO "".LG('и ещё')." ".$count." ".LG('чел.')."";
}
ECHO "</a>";
}
ECHO "</div>";
ECHO "</div>";
?>