View file modules/forum/edit_forum.php

File size: 1.54Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.ru	  *
**********************************/
$locate = 'in_forum';
if($user['level'] < '6' || !isset($_GET['f_id'])) { go('/'); exit;}
if($db->query("SELECT * FROM `forum` WHERE `id` = '".abs(intval($_GET['f_id']))."'")->rowCount() == 0) {
go('/forum/');
}
$edit_cat = $db->query("SELECT * FROM `forum` WHERE `id` = '".abs(intval($_GET['f_id']))."'")->fetch();
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$name = substr(input($_POST['name']), 0, 99);
$desc = substr(input($_POST['desc']), 0, 160);

$db->query("UPDATE `forum` SET `name` = '". $name ."', `desc` = '$desc' WHERE `id` = '".abs(intval($_GET['f_id']))."'");
go('/forum/');
// print_r($db->errorInfo());
}
$title = $lang->word('edit');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('edit'));
echo '<form action="/forum/edit_forum/'.abs(intval($_GET['f_id'])).'/?act=edit" method="post">
		<div class="menu">
			<b>'. $lang->word('name') .'</b>:<br/>
			<input typr="text" name="name" value="'. $edit_cat['name'] .'" /><br/>
			<b>'. $lang->word('desc') .'</b>:<br/>
			<input typr="text" name="desc" value="'. $edit_cat['desc'] .'" /><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');
?>