Файл: 2/3020.ru/modules/blogs/plugins/likes.php
Строк: 32
<?php
ECHO "<div id='like_id'>";
IF (ISSET($user)){
IF (GET('get') == 'like' && DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `BLOGS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `BLOG_ID` = '".$blog['ID']."' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `BLOGS_LIKES` (`USER_ID`, `TIME`, `BLOG_ID`) VALUES ('".$user['ID']."', '".TIME()."', '".$blog['ID']."')");
IF ($blog['USER_ID'] != $user['ID'] && DB::GET_COLUMN("SELECT COUNT(*) FROM `NOTIFICATIONS_SETTINGS` WHERE `USER_ID` = '".$blog['USER_ID']."' AND `BLOGS_LIKES` = '1' LIMIT 1") == 1){
DB::GET_ADD("INSERT INTO `NOTIFICATIONS` (`USER_ID`, `OBJECT_ID`, `OBJECT_ID_LIST`, `TIME`, `TYPE`) VALUES ('".$blog['USER_ID']."', '".$user['ID']."', '".$blog['ID']."', '".TIME()."', 'blogs_likes')");
}
}
IF (GET('get') == 'like_no' && DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `BLOGS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `BLOG_ID` = '".$blog['ID']."' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `BLOGS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `BLOG_ID` = '".$blog['ID']."' LIMIT 1");
}
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `BLOGS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `BLOG_ID` = '".$blog['ID']."' LIMIT 1") == 0){
?><a class="btn-request-likes-photo heartwrap" onclick="request('blog', '/modules/?path=blogs§ion=show&id=<?=$blog['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('blog', '/modules/?path=blogs§ion=show&id=<?=$blog['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 `BLOGS_EYE` WHERE `BLOG_ID` = '".$blog['ID']."'");
ECHO "<span class='icons'>".ICONS('eye', 17, 'fa-fw')."</span> ".LG('Просмотров').": ".$count_eye."";
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `BLOGS_LIKES` WHERE `BLOG_ID` = '".$blog['ID']."'") > 0){
ECHO "<br /><a href='/modules/?path=blogs§ion=show&id=".$blog['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 `BLOGS_LIKES` WHERE `BLOG_ID` = '".$blog['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>";
?>