Файл: modules/forum/edit_cat.php
Строк: 54
<?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
*/
$locate = 'in_forum';
if(User::level() < 6 || !isset($_GET['id'])) { redirect('/'); exit;}
if($db->query("SELECT * FROM `forum_c` WHERE `id` = '".abs(intval($_GET['id']))."'")->rowCount() == 0)
{
redirect('/forum/');
}
$edit_cat = $db->query("SELECT * FROM `forum_c` WHERE `id` = '".abs(intval($_GET['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_c` SET `name` = '". $name ."', `desc` = '$desc' WHERE `id` = '".abs(intval($_GET['id']))."'");
redirect('/forum/section/'.abs(intval($_GET['id'])).'/');
// print_r($db->errorInfo());
}
$title = _t('edit');
include_header($title);
$tpl->div('title', _t('edit'));
echo '<form action="/forum/edit_cat/'.abs(intval($_GET['id'])).'/?act=edit" method="post">
<div class="menu">
<b>'. _t('name') .'</b>:<br/>
<input typr="text" name="name" value="'. $edit_cat['name'] .'" /><br/>
<b>'. _t('desc') .'</b>:<br/>
<input typr="text" name="desc" value="'. $edit_cat['desc'] .'" /><br/>
<input name="edit" type="submit" value="'. _t('edit') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/forum/">'. _t('forum') .'</a><br/>' . HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>