Просмотр файла wu-admin/eshop/view.php

Размер файла: 17.74Kb
<?php
require_once('../../wu-engine/wu_init.php');
$page_name = 'Просмотр товара';
$page_keys = 'Просмотр товара';
$page_desc = 'Просмотр товара';
$prevurl_1 = '/'.ADMINPATH.'/';
$prevname_1 = 'Панель управления';
$online_title = 'В панели управления';
$online_url = '/';
include('../../wu-engine/wu_header.php');
include('../../wu-engine/wu-functions/wu_functions.php');
if(!USER_LOGGED) { header ("Location: /"); exit; }

$getid = intval($_GET['id']);
$item = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT ".DB_PREFIX."_es.id,usr,inf,ty,siz,fi,cat,co,ti,tf,sec,buy,st,".DB_PREFIX."_es.dt,vo,va,u,v,log,rat FROM `".DB_PREFIX."_es` INNER JOIN ".DB_PREFIX."_users ON ".DB_PREFIX."_es.usr = ".DB_PREFIX."_users.uid WHERE ".DB_PREFIX."_es.id='$getid' LIMIT 1"));
if (!empty ($item['id'])) {
switch ($item['cat']) {
case '1': $cat = 'Скрипты порталов'; $caturl = PROTOCOL.SITE.'/category/port_script'; break;
case '2': $cat = 'Скрипты казино'; $caturl = PROTOCOL.SITE.'/category/kazino_script'; break;
case '3': $cat = 'Доски объявлений'; $caturl = PROTOCOL.SITE.'/category/doska_script'; break;
case '4': $cat = 'Интернет магазины'; $caturl = PROTOCOL.SITE.'/category/shop_script'; break;
case '5': $cat = 'Скрипты буксов,CAP'; $caturl = PROTOCOL.SITE.'/category/cap_script'; break;
case '6': $cat = 'Скрипты хайпов'; $caturl = PROTOCOL.SITE.'/category/hayp_script'; break;
case '7': $cat = 'Экономические игры'; $caturl = PROTOCOL.SITE.'/category/games_script'; break;
case '8': $cat = 'Модули для CMS'; $caturl = PROTOCOL.SITE.'/category/moduls_cms'; break;
case '9': $cat = 'Остальное'; $caturl = PROTOCOL.SITE.'/category/other'; break;
default: $pnamef = 'ошибка'; $pkey = 'ошибка';
}
$erre = 0;
}
?>

<link href="/wu-static/css/slider.css" rel="stylesheet" type="text/css">

<?php if ($erre == 0) { ?>
<div class="block row">
<div class="fsbig col-lg-9 col-md-6 col-sm-6 emargm">
<?php
$text = $item['tf'];
include '../../wu-engine/wu-functions/bbcode/bbdecoder.php';
$bb = new IRB_BBdecoder;
$text = !empty($text) ? $text : NULL;
$check = $bb -> stripBBtags($text);
echo $bb -> createBBtags($text);
?>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="panel panel-default espmb">
<div class="panel-heading">
<h6 class="panel-title"><i class="icon-credit"></i> Товар</h6>
</div>
<div style="padding: 10px">
<?php
if ($item['inf'] == 0 && $item['ty'] == 0) {
echo '<a href="/wu-engine/wu-actions/adm_eshop_download/'.$item['id'].'" class="btn btn-success btn-lg btnbuy">Скачать</a>';
}
if ($item['inf'] == 0 && $item['ty'] == 1) {
echo nl2br(htmlspecialchars($item['sec']));
}
if ($item['inf'] == 1) {
$units = mysqli_query($connect_db, "SELECT id,st,sec FROM ".DB_PREFIX."_es_u WHERE m = '$item[id]'");
$unitsh = mysqli_num_rows($units);
if ($unitsh > 0) {
while($rowu = mysqli_fetch_array($units)) { ?>
<center><font class="tip" data-placement="bottom" data-original-title="<?php if ($rowu['st'] == 0) { echo 'Продаётся'; } else { echo 'Продан'; } ?>"><?php echo nl2br(htmlspecialchars($rowu['sec'])); ?></font></center>
<?php } } else { echo '<div class="alert alert-info"><center>Экземпяров нет</center></div>'; } } ?>
</div>
</div>
<div class="panel panel-default espmb">
<div class="panel-heading">
<h6 class="panel-title"><i class="icon-info"></i> Информация</h6>
</div>
<ul class="list-group">
<li class="list-group-item">Стоимость: <font class="flright fbold"><?php echo $item['co']; ?> руб.</font></li>
<li class="list-group-item">Категория: <font class="flright"><a href="<?php echo $caturl; ?>"><?php echo $cat; ?></a></font></li>
<li class="list-group-item">Тип товара: <font class="flright"><?php if ($item['ty'] == 0) { echo 'Файл'; } if ($item['ty'] == 1) { echo 'Текст'; } ?></font></li>
<?php if ($item['inf'] == 0 && $item['ty'] == 0) { ?>
<li class="list-group-item">Имя файла: <font class="flright"><?php if (empty($item['siz'])) { echo 'Не загружен'; } else { echo $item['fi']; } ?></font></li>
<li class="list-group-item">Размер файла: <font class="flright"><?php echo number_format($item['siz'],2,'.',',');?> Мб</font></li>
<?php } ?>
<li class="list-group-item">Количество: <font class="flright"><?php if ($item['inf'] == 0) { echo 'Бесконечно'; } if ($item['inf'] == 1) { $unitsi = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `c` FROM ".DB_PREFIX."_es_u WHERE m = '$item[id]' AND st = '0'")); echo '<font class="tip" data-placement="left" data-original-title="Продаётся">'.$unitsi['c'].'</font>/<font class="tip" data-placement="left" data-original-title="Всего">'.$unitsh.'</font>'; } ?></font></li>
<li class="list-group-item">Рейтинг продавца: <font class="flright"><?php echo $item['rat']; ?></font></li>
<li class="list-group-item">Покупок: <font class="flright"><?php echo $item['buy']; ?></font></li>
</ul>
</div>
<?php
$img = mysqli_query($connect_db, "SELECT id,img FROM ".DB_PREFIX."_es_i WHERE m='$item[id]'");
$imgh = mysqli_num_rows($img);
?>
<div class="panel panel-default espmb marnone">
<div class="panel-heading">
<h6 class="panel-title"><i class="icon-screen"></i> Скриншот<?php if ($imgh > 1) { echo 'ы'; } ?> товара</h6>
</div>
<div class="flexslider">
<ul class="slides lightgallerys">
<?php
while ($imgr = mysqli_fetch_assoc($img)) {
?>
<li data-src="/eshop/images/<?php echo $imgr['img']; ?>" data-sub-html="<?php echo $item['ti']; ?>">
<img class="cspoint" src="/eshop/images/<?php echo $imgr['img']; ?>" alt="<?php echo $item['ti']; ?>" />
</li>
<?php } ?>
</ul>
</div>
<?php if ($imgh > 1) { ?>
<div class="custom-navigation row">
<div class="col-sm-2 col-xs-2">
<a href="#" class="flex-prev btn btn-default btn-icon"><i class="icon-arrow-left10"></i></a>
</div>
<div class="col-sm-8 col-xs-8 imghow">
Всего скриншотов: <?php echo $imgh; ?>
</div>
<div class="col-sm-2 col-xs-2">
<a href="#" class="flex-next btn btn-default btn-icon flright"><i class="icon-arrow-right11"></i></a>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="block panel-footer margt">
<div class="pull-left">
<ul class="footer-links-group">
<li><i class="icon-clock3"></i> Размещено <?php echo wudate($item['dt']); ?></li>
<li><i class="icon-eye4"></i> Просмотров: <?php echo $item['v']; ?></li>
<li><i class="icon-bubble5"></i> Комментариев: <?php $sumc = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `cnt` FROM ".DB_PREFIX."_es_c WHERE m='$item[id]'")); echo $sumc['cnt']; ?></li>
<li><i class="icon-user2"></i> Продавец: <a href="/user/<?php echo $item['log']; ?>" class="text-semibold tip" data-placement="bottom" data-original-title="Все товары пользователя"><?php echo $item['log']; ?></a></li>
<li class="ratbar tip" data-placement="bottom" data-original-title="Голосов: <?php echo $item['vo'];?>"><input id="rating-input" type="number" value="<?php echo $item['va']/$item['vo'];?>" /></li>
</ul>
</div>
<div class="pull-right marnone">
<ul class="footer-icons-group">
<li><a  href="/<?php echo ADMINPATH; ?>/eshop/edit/<?php echo $getid; ?>" class="tip" data-placement="bottom" data-original-title="Редактировать"><i class="icon-pencil4"></i></a></li>
<li><a data-toggle="modal" role="button" href="#okm" class="tip" data-placement="bottom" data-original-title="Одобрить"><i class="icon-checkmark3"></i></a></li>
<li><a data-toggle="modal" role="button" href="#nom" class="tip" data-placement="bottom" data-original-title="Дооформление"><i class="icon-reply"></i></a></li>
<li><a data-toggle="modal" role="button" href="#delm" class="tip" data-placement="bottom" data-original-title="Удалить"><i class="icon-remove"></i></a></li>
</ul>
</div>
</div>
<script>
$(function() {
$('#rating-input').rating({
min: 0,
max: 5,
step: 1,
size: 'xs',
showCaption: false,
showClear: false<?php $rated = explode("|",$item['u']); if(in_array($u_id,$rated)) { echo ', disabled:true'; } ?>
});
$('.ratbar').show('slow');
});
</script>
<h6 class="heading-hr margtb"><i class="icon-bubbles4"></i> Комментарии</h6>
<div class="block">
<?php
class Threaded_comments
{
public $parents  = array();
public $children = array();
function __construct($comments)
{
foreach ($comments as $comment)
{
if ($comment['t'] == 0)
{
$this->parents[$comment['id']][] = $comment;
}
else
{
$this->children[$comment['t']][] = $comment;
}
}
}
private function format_comment($comment, $depth)
{
if (empty($comment['av'])) { $av = 'def.png'; } else { $av = $comment['av']; }
for ($depth; $depth > 0; $depth--)
{
echo '<div class="lcom"></div>';
}
echo '<div class="media" onclick="commdel(\''.$comment['id'].'\',\''.$comment['log'].'\');"><a class="pull-left" name="'.$comment['id'].'">
<img class="media-object" src="/wu-uploads/avatars/thumbs/'.$av.'" alt="'.$comment['log'].'">
</a>
<div class="media-body">
<font class="media-heading">'.$comment['log'].'</font>
<ul class="headline-info">
<li>'.wudate($comment['dt']).'</li>
</ul>
'.nl2br(htmlspecialchars($comment['c'])).'
</div>
</div>
';
}
private function print_parent($comment, $depth = 0)
{
foreach ($comment as $c)
{
$this->format_comment($c, $depth);
if (isset($this->children[$c['id']]))
{
$this->print_parent($this->children[$c['id']], $depth + 1);
}
}
}
public function print_comments()
{
foreach ($this->parents as $c)
{
$this->print_parent($c);
}
}
}
$carr = mysqli_query($connect_db, "SELECT id,t,usr,c,dt,log,av FROM `".DB_PREFIX."_es_c` INNER JOIN ".DB_PREFIX."_users ON ".DB_PREFIX."_es_c.usr = ".DB_PREFIX."_users.uid WHERE m = '$getid' ORDER BY id ASC");
if (mysqli_num_rows($carr) > 0) {
while ($row = mysqli_fetch_array($carr)) {
$comm[] = $row;
}
$ecom = new Threaded_comments($comm);
$ecom->print_comments();
} else { echo '<div class="alert alert-info fade in"><i class="icon-info"></i> Комментариев нет</div>'; }
?>
</div>
<script type='text/javascript'>
var toid;
function commdel(id){
toid = id;
$('#todel').text(id);
$('#commdel').modal('show');
};
</script>
<div id="commdel" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><i class="icon-remove"></i> Удаление комментария #<font id="todel"></font></h4>
</div>
<div class="modal-body with-padding">
<div class="alert alert-danger"><center>Внимание! Комментарий будёт удалён из системы.</center></div>
</div>
<div class="modal-footer">
<button type="button" id="comm_del" class="btn btn-danger" data-loading-text="<i class='icon-spinner7 spin'></i> Удаляем">Удалить</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</div>
<div id="okm" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><i class="icon-checkmark3"></i> Одобрить</h4>
</div>
<div class="modal-body with-padding">
<div class="alert alert-info"><center>Внимание! Товар будет одобрен.</center></div>
</div>
<div class="modal-footer">
<button type="button" id="ok" class="btn btn-success" data-loading-text="<i class='icon-spinner7 spin'></i> Одобряем">Одобрить</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</div>
<div id="nom" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><i class="icon-reply"></i> На дооформление</h4>
</div>
<div class="modal-body with-padding">
<div class="form-group">
<label>Введите причину отклонения:</label>
<textarea class="form-control" placeholder="Причина отклонения" id="noreas"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" id="no" class="btn btn-danger" data-loading-text="<i class='icon-spinner7 spin'></i> Отклоняем">Отклонить</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</div>
<div id="delm" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"><i class="icon-remove"></i> Удалить</h4>
</div>
<div class="modal-body with-padding">
<div class="form-group">
<label>Введите причину удаления:</label>
<textarea class="form-control" placeholder="Причина удаления" id="delreas"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" id="rdel" class="btn btn-danger" data-loading-text="<i class='icon-spinner7 spin'></i> Удаляем">Удалить</button>
<button type="button" class="btn btn-warning" data-dismiss="modal">Отмена</button>
</div>
</div>
</div>
</div>
<link href="/wu-static/css/rating.css" rel="stylesheet">
<script src="/wu-static/js/rating.js"></script>
<link href="/wu-static/js/lightgallery/css/lightgallery.min.css" rel="stylesheet">
<script src="/wu-static/js/lightgallery/js/picturefill.min.js"></script>
<script src="/wu-static/js/lightgallery/js/lightgallery.min.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-fullscreen.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-thumbnail.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-video.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-autoplay.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-zoom.js"></script>
<script src="/wu-static/js/lightgallery/js/lg-pager.js"></script>
<script src="/wu-static/js/lightgallery/js/jquery.mousewheel.min.js"></script>
<script type='text/javascript'>
var btnb = $('#ok');
btnb.click(function(){
btnb.button('loading');
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/adm_eshop_ok.php',
data: {'id': '<?php echo $getid; ?>', 'token': token},
cache: false,
success: function(result){
btnb.button('reset');
if (result == '1') {
$(location).attr('href','/<?php echo ADMINPATH; ?>/eshop/moderation');
}
if (result == '3') {
jerr();
}
},
error: function(){
btnb.button('reset');
serr();
}
});
});
var btnn = $('#no');
btnn.click(function(){
btnn.button('loading');
var reas = $('#noreas').val();
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/adm_eshop_no.php',
data: {'id': '<?php echo $getid; ?>', 'reas': reas, 'token': token},
cache: false,
success: function(result){
btnn.button('reset');
if (result == '0') {
$.jGrowl('Вы не ввели причину отклонения', { theme: 'growl-error' });
}
if (result == '1') {
$(location).attr('href','/<?php echo ADMINPATH; ?>/eshop/moderation');
}
if (result == '3') {
jerr();
}
},
error: function(){
btnn.button('reset');
serr();
}
});
});
var btnd = $('#rdel');
btnd.click(function(){
btnd.button('loading');
var reas = $('#delreas').val();
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/adm_eshop_del.php',
data: {'id': '<?php echo $getid; ?>', 'reas': reas, 'token': token},
cache: false,
success: function(result){
btnd.button('reset');
if (result == '0') {
$.jGrowl('Вы не ввели причину удаления', { theme: 'growl-error' });
}
if (result == '1') {
$(location).attr('href','/<?php echo ADMINPATH; ?>/eshop/moderation');
}
if (result == '3') {
jerr();
}
},
error: function(){
btnd.button('reset');
serr();
}
});
});
$(function() {
$('#rating-input').on('rating.change', function() {
var rval = parseInt($('#rating-input').val());
var rvo = parseInt('<?php echo $item['vo']; ?>');
var rva = parseInt('<?php echo $item['va']; ?>');
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/adm_eshop_rating.php',
data: {'id': '<?php echo $getid; ?>', 'val': rval, 'token': token},
cache: false,
success: function(result){
if (result == '0') {
$('#rating-input').rating('reset');
$('#rating-input').rating('refresh', {disabled: true});
$.jGrowl('Вы уже голосовали', { theme: 'growl-error' });
}
if (result == '1') {
var nrvo = rvo + 1;
var nrva = rva + rval;
var newr = nrva / nrvo;
$('#rating-input').rating('update', newr);
$('#rating-input').rating('refresh', {disabled: true});
$.jGrowl('Оценка засчитана', { theme: 'growl-success' });
}
if (result == '3') {
$('#rating-input').rating('reset');
jerr();
}
},
error: function(){
$('#rating-input').rating('reset');
serr();
}
});
});
$('.lightgallerys').lightGallery();
var btnr = $('#comm_del');
btnr.click(function(){
btnr.button('loading');
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/adm_eshop_comment_del.php',
data: {'id': toid, 'token': token},
cache: false,
success: function(result){
btnr.button('reset');
if (result == '1') {
$('#commdel').modal('hide');
$(location).attr('href','/eshop_view/<?php echo $getid; ?>');
location.reload();
}
if (result == '3') {
jerr();
}
},
error: function(){
btnr.button('reset');
serr();
}
});
});
$('.flexslider').flexslider({
animation: "slide",
controlsContainer: $(".custom-controls-container"),
customDirectionNav: $(".custom-navigation a")
});
});
</script>
<?php } else { echo '<div class="alert alert-danger"><center>Товар не найден</center></div>'; } ?>
<script type="text/javascript" src="/wu-static/js/slider.min.js"></script>

<?php include('../../wu-engine/wu_footer.php'); ?>