Файл: public_html/modules/share/comments.php
Строк: 54
<?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_share';
$share_id = abs(intval($_GET['share_id']));
$share_t = $db->query("SELECT * FROM `share_files` WHERE `id` = '". $share_id ."'")->fetch();
$id = abs(intval($_GET['id']));
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 `share_comms` SET `text` = '". $text ."' WHERE `id` = '".abs(intval($_GET['id']))."'");
}
header('location: /share/'.abs(intval($_GET['share_id'])).'/comments/');
exit;
}
$share_c = $db->query("SELECT * FROM `share_comms` WHERE `id` = '". $id ."'")->fetch();
if(($_GET['id'] != 0 || !empty($_GET['id'])) && $user['level'] >= 5 or $share_c['user_id'] == $user['id']) {
$title = $lang->word('comments') .' | '. $share_t['name'] .' | '.$lang->word('share');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('comments') .' | '. $share_t['name']);
echo '<form action="" method="post">
<div class="menu">
<b>'. $lang->word('message') .'</b>:<br/>
<textarea name="text" rows="5" cols="26">'.$share_c['text'].'</textarea><br/>
<input name="edit" type="submit" value="'. $lang->word('edit') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/share/'.$share_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') .' | '. $share_t['name'] .' | '.$lang->word('share');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('comments') .' | '. $share_t['name']);
if(isset($user)) {
$tpl->div('menu', '<a href="/share/add_comment/?share_id='. $share_id .'">'. $lang->word('add_comment') .'</a>');
}
$comments = new Comments('share', $share_id);
$comments->view();
$tpl->div('block', NAV .'<a href="/share/file/'. $share_id .'/">'. $lang->word('back') .'</a><br/>' . SHARE_ICON .' <a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>