Файл: forum/replay.php
Строк: 43
<?php
define('R', $_SERVER['DOCUMENT_ROOT']);
define('S', R.'/system');
require_once(R.'/system/kernel.php');
$id = $db->guard($_GET['id']);
$tmp->header('forum');
$p=$db->fass("select * from `forum_topic` where `id` = '".$id."' ");
$s=$db->fass("select * from `forum_section` where `id` = '".$p['section']."'");
$r=$db->fass("select * from `forum_razdel` where `id` = '".$p['razdel']."'");
$tmp->div('title', Language::config('forum').' / '. $r['name'].' / '.$s['name']. ' / '.$p['name']);
User::panel();
$o = $db->guard($_GET['replay']);
$ot=$db->fass("SELECT * FROM `forum_message` where `id` = '".$o."'");
if(!$ot){
$tmp->div('block', Language::config('error'));
$tmp->div('menu', '<a href="/forum/topic'.$id.'">'.Language::config('back').'</a>');
$tmp->footer();
exit();
}
if($ot['kto'] != User::ID()){
if(isset($_REQUEST['submit']))
{
$message = $db->guard($_POST['message']);
if(empty($_POST['message']) )
{
$error .= Language::config('error');
}
if( mb_strlen($_POST['message'], 'UTF-8')<2)
{
$error .= Language::config('error');
}
if(!isset($error))
{
$db->query("insert into `forum_message` set `razdel` = '".$p['razdel']."', `section` = '".$p['section']."', `topic` = '".$id."', `kto` = '".User::ID()."', `message` = '[b]".notv($ot['kto'])."[/b], ".$message."', `time` = '".time()."' ");
header('location: /forum/topic'.$id);
}
}
$tmp->div('block', bb(smile($ot['message'])));
error($error);
$tmp->div('menu', '<form method="POST" action="">
'.Language::config('message').':<br/>
<textarea name="message" ></textarea><br />
<input type="submit" name="submit" value="'.Language::config('send').'" /></form>');
$tmp->div('menu', '<a href="/forum/topic'.$id.'">'.Language::config('back').'</a>');
$tmp->footer();
exit();
}
else{
header('location: /forum/topic'.$id);
}
$tmp->footer();
?>