Файл: modules/news/add_news.php
Строк: 52
<?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_news';
if($user['level'] < 5) { go('/'); }
if(isset($_POST['create']) && $_GET['act'] == 'create') {
$name = substr(input($_POST['name']), 0, 100);
$text = substr(input($_POST['text']), 0, 50000);
$db->query("INSERT INTO `news`(`name`, `text`, `time`, `user_id`) VALUES('".$name."', '". $text ."', '". time() ."', '". $user['id']."')");
go('/news/');
}
$title = _t('add_news');
include_header($title);
$tpl->div('title', _t('add_news'));
echo '<form action="/news/add_news?act=create" method="post">
<div class="menu">
<b>'. _t('name') .'</b>:<br/>
<input name="name" type="text" /><br/>
<b>'. _t('message') .'</b>:<br/>
<textarea name="text" rows="5" cols="26"></textarea><br/>
<input name="create" type="submit" value="'. _t('create') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/news/">'. _t('news') .'</a><br/>' . HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>