<?php
?><a id="upgrade-optima" action="/system/AJAX/php/mail.php?id_msg=<?=$list['ID']?>&page=<?=$page?>&id=<?=$account['ID']?>" style="color: #9AA2A8; float: right; width: 30px; text-align: right; position: relative; top: 2px;" onclick="modal_open('#msg')" load="none"><?=ICONS('ellipsis-v', 15, 'fa-fw')?></a><?
/*
-------------------------
Удаление сообщения у себя
-------------------------
*/
IF (GET('delete_my') && DB::GET_COLUMN("SELECT COUNT(*) FROM `MAIL_MESSAGE` WHERE (`USER_ID` = '".$user['ID']."' OR `MY_ID` = '".$user['ID']."') AND (`USER_ID` = '".$account['ID']."' OR `MY_ID` = '".$account['ID']."') AND `USER` = '".$user['ID']."' AND `ID` = '".INTVAL(GET('delete_my'))."' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `MAIL_MESSAGE` WHERE `ID` = '".INTVAL(GET('delete_my'))."' LIMIT 1");
REDIRECT('/users/profile/?path=mail§ion=message&id='.$account['ID'].'&page='.INTVAL(GET('page')).'');
}
/*
-------------------------
Удаление сообщения у всех
-------------------------
*/
IF (GET('delete_all') && DB::GET_COLUMN("SELECT COUNT(*) FROM `MAIL_MESSAGE` WHERE (`USER_ID` = '".$user['ID']."' OR `MY_ID` = '".$user['ID']."') AND (`USER_ID` = '".$account['ID']."' OR `MY_ID` = '".$account['ID']."') AND `USER` = '".$user['ID']."' AND `ID` = '".INTVAL(GET('delete_all'))."' LIMIT 1") == 1){
$mess_my = DB::GET_STRING("SELECT * FROM `MAIL_MESSAGE` WHERE `ID` = '".INTVAL(GET('delete_all'))."' LIMIT 1");
$mess_user = DB::GET_STRING("SELECT * FROM `MAIL_MESSAGE` WHERE (`USER_ID` = '".$user['ID']."' OR `MY_ID` = '".$user['ID']."') AND (`USER_ID` = '".$account['ID']."' OR `MY_ID` = '".$account['ID']."') AND `USER` = '".$account['ID']."' AND `TIME` = '".$mess_my['TIME']."' AND `MESSAGE` = '".$mess_my['MESSAGE']."' LIMIT 1");
DB::GET_SET("DELETE FROM `ATTACHMENTS` WHERE `ID_POST` = '".$mess_my['ID']."' AND `TYPE_POST` = 'mail_message'");
DB::GET_SET("DELETE FROM `ATTACHMENTS` WHERE `ID_POST` = '".$mess_user['ID']."' AND `TYPE_POST` = 'mail_message'");
DB::GET_SET("DELETE FROM `MAIL_MESSAGE` WHERE `ID` = '".$mess_my['ID']."' LIMIT 1");
DB::GET_SET("DELETE FROM `MAIL_MESSAGE` WHERE `ID` = '".$mess_user['ID']."' LIMIT 1");
REDIRECT('/users/profile/?path=mail§ion=message&id='.$account['ID'].'&page='.INTVAL(GET('page')).'');
}
?>