File size: 2.78Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.ru *
**********************************/
$locate = 'in_share';
if(!isset($_GET['id'])) { go('/share/'); }
$id = abs(intval($_GET['id']));
if($db->query("SELECT * FROM `share_files` WHERE `id` = '". $id ."'")->rowCount() == 0) {
$title = $lang->word('share');
require_once(SYS.'/view/header.php');
$tpl->div('menu', $lang->word('file_not_exists'));
$tpl->div('block', NAV.' <a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
exit;
}
$file_a = $db->query("SELECT * FROM `share_files` WHERE `id` = '". $id ."'")->fetch();
$title = $file_a['name'] .' | '. $lang->word('share');
require_once(SYS .'/view/header.php');
$tpl->div('title', $file_a['name']);
$file_q = $db->query("SELECT * FROM `share_files` WHERE `id` = '". $id ."'");
while($file = $file_q->fetch()) {
echo '<div class="menu">
'.(preg_match('/jpeg|jpg|gif|png|bmp/i', $file['ext']) ? '<img style="border: 1px solid #000;" weight="80" height="60" src="/files/share/'. $file['path_name'] .'" alt="Screen" /><br/>'."\n" : (file_exists(ROOT.'/files/preview/'.$file['path_name'].'.png') ? '<a href="/files/preview/'.$file['path_name'].'.png"><img style="border: 1px solid #000;" weight="100" height="80" src="/files/preview/'.$file['path_name'].'.png" alt="Screen" /></a><br/>'."\n" : NULL)) .'
'. output($file['text']) .'</div>
<div class="post">
'.img('download.png').' <a href="/share/download/'. $file['id'] .'/">'. $lang->word('download') .' '.strtoupper($file['ext']).'</a> ('.size($file['size']).')<br/>
'. NAV . $lang->word('uploader').': <a href="/user/'.$file['user_id'].'">'. tnick($file['user_id']) .'</a> ('.rtime($file['time']).')<br/>
'. img('globe.png') . $lang->word('downloaded').': '.$file['dload_times'].'<br/>
'.($user['id'] == $file['user_id'] || $user['level'] == 4 || $user['level'] >=6 ? img('delete.png') .' <a href="/share/delete_file/?file_id='. $file['id'] .'">'. $lang->word('delete').'</a><br/>
'.img('edit.png').' <a href="/share/edit_file/'. $file['id'].'/">'. $lang->word('edit') .'</a>' : NULL).'
</div>';
}
$tpl->div('block', NAV.' <a href="/share/'. $file_a['id'] .'/comments/">'. $lang->word('comments') .'</a> ('. $db->query("SELECT * FROM `share_comms` WHERE `share_id` = '". $file_a['id'] ."'")->rowCount().')<br/>' . NAV.'<a href="/share/folder/'. $file_a['cat_id'] .'/">'. $db->query("SELECT name FROM `share_c` WHERE `id` = '". $file_a['cat_id'] ."'")->fetchColumn() .'</a><br/>' . NAV .'<a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home') .'</a>');
require_once(SYS .'/view/footer.php');
?>