Файл: core/delpost.php
Строк: 19
<?php
/*
* @author mides <Mike Osendowski>
* @link http://midwm.org
* @copyright 2011-2014
*/
if (is_auth())
{
switch ($module)
{
case 'guestbook':
$table = 'guestbook';
break;
case 'forum':
$table = 'forum_posts';
break;
case 'news':
$table = 'news';
break;
case 'blogs':
$table = 'blogs_posts';
break;
}
$post = DB::run()->queryFetch("select * from `".$table."` where `id` = ?;", array($id));
if (access($module.($module == 'forum' ? $post['categid'] : '_delpost')))
{
if (!isset($_SESSION[$module]['delpost_refurl'][$id]) && $refurl)
{
$_SESSION[$module]['delpost_refurl'][$id] = $refurl;
}
$confirm = isset($_POST['confirm']) ? 1 : FALSE;
if ($confirm)
{
DB::run()->query("delete from `".$table."` where `id` = ?;", array($post['id']));
if ($module == 'blogs')
{
DB::run()->query("delete from `blogs_content` where `postid` = ?;", array($post['id']));
}
$redirect = isset($_SESSION[$module]['delpost_refurl'][$id]) ? $_SESSION[$module]['delpost_refurl'][$id] : '/'.$module;
unset($_SESSION[$module]['delpost_refurl'][$id]);
redirect($redirect);
}
$config['newtitle'] = $lang['Delete_post'];
$tpl['file'] = 'confirm';
require_once 'core/header.php';
}
else
{
redirect('/'.$module);
}
}
else
{
redirect('/'.$module);
}