Файл: my.net.ru/users/attachments/plugins/inc_blogs.php
Строк: 55
<?php
/*
----
Файл
----
*/
IF (GET('add_atcom_files') && DB::GET_COLUMN("SELECT COUNT(*) FROM `FILES` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".INTVAL(GET('add_atcom_files'))."' LIMIT 1") > 0){
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '0' LIMIT 1") >= 3){
ERROR('Нельзя прикреплять более 3 файлов к 1 записи', 'success');
REDIRECT(BASE64_DECODE(GET('url')));
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `OBJECT_ID` = '".INTVAL(GET('add_atcom_files'))."' AND `TYPE` = 'files' AND `ACT` = '0' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `ATTACHMENTS` (`USER_ID`, `OBJECT_ID`, `TYPE`, `TIME`, `BLOGS`) VALUES ('".$user['ID']."', '".INTVAL(GET('add_atcom_files'))."', 'files', '".TIME()."', '1')");
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `FILES_SHOW` WHERE `FILE_ID` = '".INTVAL(GET('add_atcom_files'))."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'atcom' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `FILES_SHOW` WHERE `USER_ID` = '".$user['ID']."' AND `FILE_ID` = '".INTVAL(GET('add_atcom_files'))."' AND `TYPE` = 'atcom'");
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `FILES_SHOW` WHERE `FILE_ID` = '".INTVAL(GET('add_atcom_files'))."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'atcom' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `FILES_SHOW` (`USER_ID`, `FILE_ID`, `TYPE`) VALUES ('".$user['ID']."', '".INTVAL(GET('add_atcom_files'))."', 'atcom')");
}
REDIRECT(BASE64_DECODE(GET('url')));
}
/*
------
Музыка
------
*/
IF (GET('add_atcom_music') && DB::GET_COLUMN("SELECT COUNT(*) FROM `MUSIC` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".INTVAL(GET('add_atcom_music'))."' LIMIT 1") > 0){
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '0' LIMIT 1") >= 3){
ERROR('Нельзя прикреплять более 3 файлов к 1 записи', 'success');
REDIRECT(''.BASE64_DECODE(GET('url')).'');
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `OBJECT_ID` = '".INTVAL(GET('add_atcom_music'))."' AND `TYPE` = 'music' AND `ACT` = '0' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `ATTACHMENTS` (`USER_ID`, `OBJECT_ID`, `TYPE`, `TIME`, `BLOGS`) VALUES ('".$user['ID']."', '".INTVAL(GET('add_atcom_music'))."', 'music', '".TIME()."', '1')");
}
REDIRECT(''.BASE64_DECODE(GET('url')).'');
}
/*
-----
Видео
-----
*/
IF (GET('add_atcom_videos') && DB::GET_COLUMN("SELECT COUNT(*) FROM `VIDEOS` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".INTVAL(GET('add_atcom_videos'))."' LIMIT 1") > 0){
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '0' LIMIT 1") >= 3){
ERROR('Нельзя прикреплять более 3 файлов к 1 записи', 'success');
REDIRECT(''.BASE64_DECODE(GET('url')).'');
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `OBJECT_ID` = '".INTVAL(GET('add_atcom_videos'))."' AND `TYPE` = 'videos' AND `ACT` = '0' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `ATTACHMENTS` (`USER_ID`, `OBJECT_ID`, `TYPE`, `TIME`, `BLOGS`) VALUES ('".$user['ID']."', '".INTVAL(GET('add_atcom_videos'))."', 'videos', '".TIME()."', '1')");
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `VIDEOS_SHOW` WHERE `VIDEO_ID` = '".INTVAL(GET('add_atcom_videos'))."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'atcom' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `VIDEOS_SHOW` WHERE `USER_ID` = '".$user['ID']."' AND `VIDEO_ID` = '".INTVAL(GET('add_atcom_videos'))."' AND `TYPE` = 'atcom'");
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `VIDEOS_SHOW` WHERE `VIDEO_ID` = '".INTVAL(GET('add_atcom_videos'))."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'atcom' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `VIDEOS_SHOW` (`USER_ID`, `VIDEO_ID`, `TYPE`) VALUES ('".$user['ID']."', '".INTVAL(GET('add_atcom_videos'))."', 'atcom')");
}
REDIRECT(''.BASE64_DECODE(GET('url')).'');
}
/*
----
Фото
----
*/
IF (GET('add_atcom_photos') && DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".INTVAL(GET('add_atcom_photos'))."' LIMIT 1") > 0){
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '0' LIMIT 1") >= 3){
ERROR('Нельзя прикреплять более 3 файлов к 1 записи', 'success');
REDIRECT(''.BASE64_DECODE(GET('url')).'');
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `OBJECT_ID` = '".INTVAL(GET('add_atcom_photos'))."' AND `TYPE` = 'photos' AND `ACT` = '0' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `ATTACHMENTS` (`USER_ID`, `OBJECT_ID`, `TYPE`, `TIME`, `BLOGS`) VALUES ('".$user['ID']."', '".INTVAL(GET('add_atcom_photos'))."', 'photos', '".TIME()."', '1')");
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS_SHOW` WHERE `PHOTO_ID` = '".INTVAL(GET('add_atcom_photos'))."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'atcom' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `PHOTOS_SHOW` WHERE `USER_ID` = '".$user['ID']."' AND `PHOTO_ID` = '".INTVAL(GET('add_atcom_photos'))."' AND `TYPE` = 'atcom'");
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS_SHOW` WHERE `PHOTO_ID` = '".INTVAL(GET('add_atcom_photos'))."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'atcom' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `PHOTOS_SHOW` (`USER_ID`, `PHOTO_ID`, `TYPE`) VALUES ('".$user['ID']."', '".INTVAL(GET('add_atcom_photos'))."', 'atcom')");
}
REDIRECT(''.BASE64_DECODE(GET('url')).'');
}
/*----------------------------------------*/
IF (GET('delete_atcom') && DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '0' AND `ID` = '".INTVAL(GET('delete_atcom'))."' LIMIT 1") > 0){
DB::GET_SET("DELETE FROM `ATTACHMENTS` WHERE `ID` = '".INTVAL(GET('delete_atcom'))."' LIMIT 1");
REDIRECT(''.REQUEST_URI.'');
}
ECHO "<div id='atcom-upgrade'>";
$count = DB::GET_COLUMN("SELECT COUNT(*) FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '0' LIMIT 1");
IF ($count > 0){
ECHO "<div style='position: relative; padding: 4px;'>";
$data = DB::GET_STRING_ALL("SELECT * FROM `ATTACHMENTS` WHERE `BLOGS` = '1' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '0' ORDER BY `TIME` DESC LIMIT 3");
WHILE ($list = $data->FETCH()){
IF ($list['TYPE'] == 'photos'){
$photos = DB::GET_STRING("SELECT * FROM `PHOTOS` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".$list['OBJECT_ID']."' LIMIT 1");
ECHO "<div style='display: inline-block; width: 110px; text-align: center; vertical-align: top; position: relative;'>";
ECHO "<a href='".REQUEST_URI."&delete_atcom=".$list['ID']."' class='btn-o' style='position: absolute; top: -2px; right: 8px; z-index: 1; padding: 1px 0.5em;'>".ICONS('trash', 15, 'fa-fw')."</a>";
ECHO FILE::ICONS($photos['EXT']);
ECHO "<br />";
ECHO "<a href='/modules/?path=photos§ion=show&photo_id=".$photos['ID']."'>";
ECHO CROP_TEXT($photos['NAME'], 0, 8);
ECHO "</a>";
ECHO "</div>";
}
IF ($list['TYPE'] == 'videos'){
$videos = DB::GET_STRING("SELECT * FROM `VIDEOS` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".$list['OBJECT_ID']."' LIMIT 1");
ECHO "<div style='display: inline-block; width: 110px; text-align: center; vertical-align: top; position: relative;'>";
ECHO "<a href='".REQUEST_URI."&delete_atcom=".$list['ID']."' class='btn-o' style='position: absolute; top: -2px; right: 8px; z-index: 1; padding: 1px 0.5em;'>".ICONS('trash', 15, 'fa-fw')."</a>";
ECHO FILE::ICONS($videos['EXT']);
ECHO "<br />";
ECHO "<a href='/modules/?path=videos§ion=show&video_id=".$videos['ID']."'>";
ECHO CROP_TEXT($videos['NAME'], 0, 8);
ECHO "</a>";
ECHO "</div>";
}
IF ($list['TYPE'] == 'music'){
$music = DB::GET_STRING("SELECT * FROM `MUSIC` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".$list['OBJECT_ID']."' LIMIT 1");
ECHO "<div style='display: inline-block; width: 110px; text-align: center; vertical-align: top; position: relative;'>";
ECHO "<a href='".REQUEST_URI."&delete_atcom=".$list['ID']."' class='btn-o' style='position: absolute; top: -2px; right: 8px; z-index: 1; padding: 1px 0.5em;'>".ICONS('trash', 15, 'fa-fw')."</a>";
ECHO FILE::ICONS($music['EXT']);
ECHO "<br />";
ECHO "<a href='/modules/?path=music§ion=users&id=".$user['ID']."'>";
ECHO CROP_TEXT($music['NAME'], 0, 8);
ECHO "</a>";
ECHO "</div>";
}
IF ($list['TYPE'] == 'files'){
$files = DB::GET_STRING("SELECT * FROM `FILES` WHERE `USER_ID` = '".$user['ID']."' AND `ID` = '".$list['OBJECT_ID']."' LIMIT 1");
ECHO "<div style='display: inline-block; width: 110px; text-align: center; vertical-align: top; position: relative;'>";
ECHO "<a href='".REQUEST_URI."&delete_atcom=".$list['ID']."' class='btn-o' style='position: absolute; top: -2px; right: 8px; z-index: 1; padding: 1px 0.5em;'>".ICONS('trash', 15, 'fa-fw')."</a>";
ECHO FILE::ICONS($files['EXT']);
ECHO "<br />";
ECHO "<a href='/modules/?path=files§ion=show&id=".$files['ID']."'>";
ECHO CROP_TEXT($files['NAME'], 0, 8);
ECHO "</a>";
ECHO "</div>";
}
}
ECHO "</div>";
}
ECHO "</div>";
ECHO "<div class='overlay'>";
ECHO "<div class='modal' id='at_comment'>";
ECHO "<div class='modal-title'>";
ECHO "<b>".LG('Прикрепить файл')."</b>";
?><a onclick="modal_close('#at_comment')" load="none" class="btn-modal-close"><?=ICONS('times', 20, 'fa-fw')?></a><?
ECHO "</div>";
ECHO "<div class='modal-optimize'>";
ECHO "<div id='upload2'></div>";
ECHO "</div>";
ECHO "</div>";
ECHO "</div>";
?>