Файл: 2/3020.ru/modules/photos/plugins/photo/02_likes_and_author.php
Строк: 31
<?php
ECHO "<div id='like_id'>";
IF (ISSET($user)){
IF (GET('get') == 'like' && DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `PHOTOS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `PHOTO_ID` = '".$photo['ID']."' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `PHOTOS_LIKES` (`USER_ID`, `TIME`, `PHOTO_ID`) VALUES ('".$user['ID']."', '".TIME()."', '".$photo['ID']."')");
IF ($photo['USER_ID'] != $user['ID'] && DB::GET_COLUMN("SELECT COUNT(*) FROM `NOTIFICATIONS_SETTINGS` WHERE `USER_ID` = '".$photo['USER_ID']."' AND `PHOTOS_LIKES` = '1' LIMIT 1") == 1){
DB::GET_ADD("INSERT INTO `NOTIFICATIONS` (`USER_ID`, `OBJECT_ID`, `OBJECT_ID_LIST`, `TIME`, `TYPE`) VALUES ('".$photo['USER_ID']."', '".$user['ID']."', '".$photo['ID']."', '".TIME()."', 'photos_likes')");
}
}
IF (GET('get') == 'like_no' && DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `PHOTOS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `PHOTO_ID` = '".$photo['ID']."' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `PHOTOS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `PHOTO_ID` = '".$photo['ID']."' LIMIT 1");
}
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `PHOTOS_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `PHOTO_ID` = '".$photo['ID']."' LIMIT 1") == 0){
?><a class="btn-request-likes-photo heartwrap" onclick="request('photo', '/modules/?path=photos§ion=show&photo_id=<?=$photo['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('photo', '/modules/?path=photos§ion=show&photo_id=<?=$photo['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'>";
IF ($account['SEX'] == 2){
ECHO "".LG('Добавила:')." ";
}ELSE{
ECHO "".LG('Добавил:')." ";
}
ECHO "".USER::LOGIN($account['ID'], 1, 1)."";
ECHO " <span class='time'>- ".STIME($photo['TIME'])."</span>";
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `PHOTOS_LIKES` WHERE `PHOTO_ID` = '".$photo['ID']."'") > 0){
ECHO "<br /><br /><a href='/modules/?path=photos§ion=show&photo_id=".$photo['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 `PHOTOS_LIKES` WHERE `PHOTO_ID` = '".$photo['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>";
?>