Файл: 2/3020.ru/modules/communities/plugins/forum_likes.php
Строк: 37
<?php
ECHO "<div id='like_id'>";
IF (ISSET($user)){
IF (GET('get') == 'like' && DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `COMMUNITIES_FORUM_THEM_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `THEM_ID` = '".$fthem['ID']."' LIMIT 1") == 0){
CSRF::GET_CHECK_VALID(GET('get'));
DB::GET_ADD("INSERT INTO `COMMUNITIES_FORUM_THEM_LIKES` (`USER_ID`, `TIME`, `THEM_ID`) VALUES ('".$user['ID']."', '".TIME()."', '".$fthem['ID']."')");
}
IF (GET('get') == 'like_no' && DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `COMMUNITIES_FORUM_THEM_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `THEM_ID` = '".$fthem['ID']."' LIMIT 1") == 1){
CSRF::GET_CHECK_VALID(GET('get'));
DB::GET_SET("DELETE FROM `COMMUNITIES_FORUM_THEM_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `THEM_ID` = '".$fthem['ID']."' LIMIT 1");
}
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `COMMUNITIES_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=communities§ion=forum_them_show&id=<?=$fthem['ID']?>&get=like&<?=$token_url?>', '#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=communities§ion=forum_them_show&id=<?=$fthem['ID']?>&get=like_no&<?=$token_url?>', '#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 `COMMUNITIES_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 `COMMUNITIES_FORUM_THEM_LIKES` WHERE `THEM_ID` = '".$fthem['ID']."'") > 0){
ECHO "<br /><a href='/modules/?path=communities§ion=forum_them_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 `COMMUNITIES_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>";
?>