Файл: public_html/modules/downloads/comments.php
Строк: 89
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.net *
* ------------------------------- *
* @package: PerfCMS Ultra *
* @year: 2013 *
* @author: wanya26ua & Tesla *
* @link: http://perfclub.ru *
**********************************/
$locate = 'in_downloads';
$downloads_id = abs(intval($_GET['id']));
$_GET['downloads_id'] = $downloads_id;
$id = abs(intval($_GET['id']));
$downloads_t = $db->query("SELECT * FROM `downloads_files` WHERE `id` = '". $downloads_id ."'")->fetch();
if(isset($_GET['act']) && $_GET['act'] == 'edit') {
if(isset($_POST['edit'])) {
if(!empty($_POST['text'])) {
$text = substr(input($_POST['text']), 0, 5000);
$db->query("UPDATE `downloads_comms` SET `text` = '". $text ."' WHERE `id` = '".abs(intval($_GET['id']))."'");
}
header('location: /downloads/'.abs(intval($_GET['downloads_id'])).'/comments');
exit;
}
$downloads_c = $db->query("SELECT * FROM `downloads_comms` WHERE `id` = '". $id ."'")->fetch();
if(($_GET['id'] != 0 || !empty($_GET['id'])) && $user['level'] >= 5 or $downloads_c['user_id'] == $user['id']) {
$title = $lang->word('comments') .' | '. $downloads_t['name'] .' | '.$lang->word('downloads');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('comments') .' | '. $downloads_t['name']);
echo '<form action="" method="post">
<div class="menu">
<b>'. $lang->word('message') .'</b>:<br/>
<textarea name="text" rows="5" cols="26">'.$downloads_c['text'].'</textarea><br/>
<input name="edit" type="submit" value="'. $lang->word('edit') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/downloads/'.$downloads_id.'/comments">'. $lang->word('back') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
exit;
} else {$tpl->div('error', $lang->word('chat_not_g')); }
}
$title = $lang->word('comments') .' | '. $downloads_t['name'] .' | '.$lang->word('downloads');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('comments') .' | '. $downloads_t['name']);
if(isset($user)) {
$tpl->div('menu', '<a href="/downloads/add_comment/?downloads_id='. abs(intval($_GET['downloads_id'])) .'">'. $lang->word('add_comment') .'</a>');
}
$comments = new Comments('downloads', $downloads_id);
$comments->view();
$tpl->div('block', NAV .'<a href="/downloads/file/'. abs(intval($_GET['downloads_id'])) .'/">'. $lang->word('back') .'</a><br/>' . img('download.png') .' <a href="/downloads/">'. $lang->word('downloads') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>