Файл: public_html/modules/forum/edit_post.php
Строк: 32
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.net *
* ------------------------------- *
* @package: PerfCMS Ultra *
* @year: 2013 *
* @author: wanya26ua & Tesla *
* @link: http://perfclub.ru *
**********************************/
$locate = 'in_forum';
$edit_post = $db->query("SELECT * FROM `forum_pt` WHERE `id` = '".abs(intval($_GET['id']))."'")->fetch();
if($user['id'] != $edit_post['user_id'] && $user['level'] < 2 && $user['level'] < 5 || !isset($_GET['id'])) { go('/'); exit;}
if($db->query("SELECT * FROM `forum_pt` WHERE `id` = '".abs(intval($_GET['id']))."'")->rowCount() == 0) {
go('/forum/');
exit;
}
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$text = substr(input($_POST['text']), 0, 10000);
$db->query("UPDATE `forum_pt` SET `text` = '". $text ."', `edit_time` = '". time() ."', `edit_user_id` = '". $user['id'] ."', `count_edit` = '". ($edit_post['count_edit']+1) ."' WHERE `id` = '".abs(intval($_GET['id']))."'");
go('/forum/topic'.abs(intval($_GET['topic_id'])).'/?page=end');
// print_r($db->errorInfo());
}
$title = $lang->word('edit_post');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('edit_post'));
echo '<form action="/forum/edit_post/'.abs(intval($_GET['id'])).'/'.abs(intval($_GET['topic_id'])).'/?act=edit" method="post">
<div class="menu">
<b>'. $lang->word('message') .'</b>:<br/>
<textarea name="text">'. $edit_post['text'] .'</textarea><br/>
<input name="edit" type="submit" value="'. $lang->word('edit') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/forum/">'. $lang->word('forum') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>