Файл: modules/news/add_comment.php
Строк: 73
<?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::logged() || !isset($_GET['news_id'])) { go('/'); }
if(isset($_POST['create']) && $_GET['act'] == 'create')
{
if(isset($_GET['reply_to']))
{
$_user_id = num($_GET['reply_to']);
if($_user_id !== User::Id())
{
$db->query("INSERT INTO `notify` SET `user_id` = '". $_user_id ."', `from_id` = '". User::Id() ."', `request_id` = '/news/comments/".abs(intval($_GET['news_id']))."', `type` = 'notify_comments_reply', `read` = '0', `time` = '". time() ."'");
// print_r($db->errorInfo());
}
}
$comments = new Comments('news', num($_GET['news_id']));
$comments->add($_POST['text']);
redirect('/news/comments/'.num($_GET['news_id']));
}
$title = _t('add_comment');
include_header($title);
$tpl->div('title', _t('add_comment'));
echo '<form action="/news/add_comment?act=create&news_id='.abs(intval($_GET['news_id'])).(isset($_GET['reply_to']) ? '&reply_to='.num($_GET['reply_to']) : null).'" method="post">
<div class="menu">
<b>'. _t('message') .'</b>:<br/>
<textarea name="text" rows="5" cols="26">'.(isset($_GET['reply_to']) ? '[b]'.tnick(num($_GET['reply_to'])).'[/b], ' : NULL).'</textarea><br/>
<input name="create" type="submit" value="'. _t('create') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/news/comments/'. abs(intval($_GET['news_id'])) .'">'. _t('back') .'</a><br/>' .
NAV .'<a href="/news/">'. _t('news') .'</a><br/>' .
HICO .'<a href="/">'. _t('home').'</a>');
include_footer();
?>