Файл: modules/mail/delete_post.php
Строк: 47
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$delete = $db->query("SELECT * FROM `mail` WHERE `id` = '".abs(intval($_GET['id']))."'")->fetch();
if(!isset($_GET['id']) || $db->query("SELECT * FROM `mail` WHERE `id` = '".abs(intval($_GET['id']))."'")->rowCount() == 0 || $delete['del'] == $user['id'] || $delete['user_id'] != $user['id'] && $delete['who_id'] != $user['id'])
{
redirect('/');
}
$locate = 'in_cabinet';
if(isset($_POST['yes'])) {
if ($delete['del'] == $delete['user_id'] || $delete['del'] == $delete['who_id']) {
$db->query("DELETE FROM `mail` WHERE `id` = '".abs(intval($_GET['id']))."'");
} else {
$db->query("UPDATE `mail` SET `del` = '".$user['id'] . "' WHERE `id` = '".abs(intval($_GET['id']))."'");
}
redirect('/mail/chat/'.($delete['user_id'] == $user['id'] ? $delete['who_id'] : $delete['user_id']).'/');
} elseif(isset($_POST['no'])) {
redirect('/mail/chat/'.($delete['user_id'] == $user['id'] ? $delete['who_id'] : $delete['user_id']).'/');
}
$title = _t('delete_post');
include_header($title);
Template::div('title', $title);
echo '<form action="" method="post">
<div class="menu">
'.($delete['user_id'] == $user['id'] ? _t('your_post') : NULL).': <br/>
'. nick($delete['user_id'], rtime($delete['time'])) .'
'. output($delete['text']) .'<br/><hr>
<b>'._t('delete').'?</b><br/>
<input name="yes" type="submit" value="'. _t('yyes') .'" /> <input name="no" type="submit" value="'. _t('yno') .'" /><br/>
</div>
</form>';
Template::div('block', img('mail.png') .'<a href="/mail/">'._t('u_mail').'</a><br/>'
. NAV .'<a href="/mail/chat/'.($delete['user_id'] == $user['id'] ? ''.$delete['who_id'].'': ''.$delete['user_id'].'').'/">'._t('back_mail').'</a><br/>'
. NAV .'<a href="/user/panel/">'._t('user_panel').'</a><br/>'
. HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>