Файл: 2/3020.ru/modules/files/plugins/file/likes.php
Строк: 69
<?php
ECHO "<div id='like_id'>";
IF (ISSET($user)){
IF (GET('get') == 'like' && DB::GET_COLUMN("SELECT COUNT(*) FROM `FILES_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `FILE_ID` = '".$files['ID']."' LIMIT 1") == 0){
CSRF::GET_CHECK_VALID('get');
DB_FILTER();
DB::GET_ADD("INSERT INTO `FILES_LIKES` (`USER_ID`, `TIME`, `FILE_ID`) VALUES ('".$user['ID']."', '".TIME()."', '".$files['ID']."')");
IF ($files['USER_ID'] != $user['ID'] && DB::GET_COLUMN("SELECT COUNT(*) FROM `NOTIFICATIONS_SETTINGS` WHERE `USER_ID` = '".$files['USER_ID']."' AND `FILES_LIKES` = '1' LIMIT 1") == 1){
DB::GET_ADD("INSERT INTO `NOTIFICATIONS` (`USER_ID`, `OBJECT_ID`, `OBJECT_ID_LIST`, `TIME`, `TYPE`) VALUES ('".$files['USER_ID']."', '".$user['ID']."', '".$files['ID']."', '".TIME()."', 'files_likes')");
}
}
IF (GET('get') == 'like_no' && DB::GET_COLUMN("SELECT COUNT(*) FROM `FILES_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `FILE_ID` = '".$files['ID']."' LIMIT 1") == 1){
CSRF::GET_CHECK_VALID('get');
DB_FILTER();
DB::GET_SET("DELETE FROM `FILES_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `FILE_ID` = '".$files['ID']."' LIMIT 1");
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `FILES_LIKES` WHERE `USER_ID` = '".$user['ID']."' AND `FILE_ID` = '".$files['ID']."' LIMIT 1") == 0){
?><a class="btn-request-likes-photo heartwrap" onclick="request('file', '/modules/?path=files§ion=show&id=<?=$files['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('file', '/modules/?path=files§ion=show&id=<?=$files['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'>";
IF ($account['SEX'] == 2){
ECHO "".LG('Добавила:')." ";
}ELSE{
ECHO "".LG('Добавил:')." ";
}
ECHO "".USER::LOGIN($account['ID'], 1, 1)."";
ECHO " <span class='time'>- ".STIME($files['TIME'])."</span><br />";
IF ($id_dir > 0){
$dir_name = "<a href='/modules/?path=files§ion=users&id=".$account['ID']."&dir=".$dir['ID']."'>".TEXT_ABSOLUTE($dir['NAME'])."</a>";
}ELSE{
$dir_name = "<a href='/modules/?path=files§ion=users&id=".$account['ID']."'>".LG('Файлы')."</a>";
}
ECHO LG('В папку:')." <font color='#DFCD5E' style='position: relative; top: 1px;'>".ICONS('folder', 17, 'fa-fw')."</font> ".$dir_name;
$count_eye_us = DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FILES_EYE_USERS` WHERE `FILE_ID` = '".$files['ID']."'");
$count_eye_guest = DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FILES_EYE_GUESTS` WHERE `FILE_ID` = '".$files['ID']."'");
IF (ISSET($user) && MANAGEMENT == 1){
$gc = "<a href='/modules/?path=files§ion=show&id=".$files['ID']."&get=eye_guests_list'><span class='count'>".$count_eye_guest."</span></a>";
$uc = "<a href='/modules/?path=files§ion=show&id=".$files['ID']."&get=eye_users_list'><span class='count'>".$count_eye_us."</span></a>";
}ELSE{
$gc = "<span class='count'>".$count_eye_guest."</span>";
$uc = "<span class='count'>".$count_eye_us."</span>";
}
ECHO "<br /><br /><span class='icons'>".ICONS('eye', 17, 'fa-fw')."</span> <b>".LG('Просмотры')."</b> (".LG('пользователи')."): ".$uc."<br />";
ECHO "<span class='icons'>".ICONS('eye', 17, 'fa-fw')."</span> <b>".LG('Просмотры')."</b> (".LG('гости')."): ".$gc."";
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FILES_LIKES` WHERE `FILE_ID` = '".$files['ID']."'") > 0){
ECHO "<br /><a href='/modules/?path=files§ion=show&id=".$files['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 `FILES_LIKES` WHERE `FILE_ID` = '".$files['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>";
?>