Просмотр файла modules/forum/edit_post.php

Размер файла: 1.57Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate = 'in_forum';
if(!isset($user) || !isset($_GET['id'])) { go('/'); }
if($db->query("SELECT * FROM `forum_pt` WHERE `id` = '".abs(intval($_GET['id']))."'")->rowCount() == 0) {
go('/forum/');
}
$edit_post = $db->query("SELECT * FROM `forum_pt` WHERE `id` = '".abs(intval($_GET['id']))."'")->fetch();
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$text = substr(input($_POST['text']), 0, 3500);

$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'])).'/'.$_GET['topic_id'].'/?act=edit" method="post">
		<div class="menu">
			<b>'. $lang->word('message') .'</b>:<br/>
			<textarea name="text" rows="5" cols="26">'. $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');
?>