Файл: modules/forum/add_subforum.php
Строк: 49
<?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';
$f_id = abs(intval($_GET['id']));
if(User::level() < 6 || !isset($f_id)) { redirect('/'); exit;}
if($db->query("SELECT * FROM `forum` WHERE `id` = '". $f_id ."'")->rowCount() == 0) {
redirect('/forum/');
}
if(isset($_POST['create']) && $_GET['act'] == 'create') {
$name = substr(input($_POST['name']), 0, 90);
$descr = substr(input($_POST['desc']), 0, 160);
$db->query("INSERT INTO `forum_c`(`name`, `f_id`, `desc`, `pos`) VALUES('".$name."', '". abs(intval($f_id))."', '".$descr."', 0)");
redirect('/forum/category/'. $f_id);
// print_r($db->errorInfo());
}
$title = _t('create_subforum');
include_header($title);
$tpl->div('title', _t('create_subforum'));
echo '<form action="/forum/add_subforum/'. $f_id .'?act=create" method="post">
<div class="menu">
<b>'. _t('name') .'</b>:<br/>
<input name="name" type="text" /><br/>
<b>'. _t('desc') .'</b>:<br/>
<input name="desc" type="text" /><br/>
<input name="create" type="submit" value="'. _t('create') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/forum/">'. _t('forum') .'</a><br/>' . HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>