View file user.php

File size: 14.52Kb
<?php
require_once('wu-engine/wu_init.php');
$getu = mysqli_real_escape_string($connect_db, trim($_GET['login']));
$nlog = explode("/", $getu);
$getuser = mysqli_real_escape_string($connect_db, $nlog['1']);
$usrid = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT uid FROM `".DB_PREFIX."_users` WHERE log='$getuser' LIMIT 1"));
$howes = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT COUNT(id) AS `c` FROM `".DB_PREFIX."_es` WHERE usr='$usrid[uid]'"));

include ('wu-engine/wu-functions/wu_functions.php');
include('wu-engine/wu-functions/wu_pagination.php');
function cat($id) {
switch ($id) {
case '1': $cat = 'Скрипты порталов'; $caturl = 'port_script'; break;
case '2': $cat = 'Скрипты казино'; $caturl = 'kazino_script'; break;
case '3': $cat = 'Доски объявлений'; $caturl = 'doska_script'; break;
case '4': $cat = 'Интернет магазины'; $caturl = 'shop_script'; break;
case '5': $cat = 'Скрипты буксов,CAP'; $caturl = 'cap_script'; break;
case '6': $cat = 'Скрипты хайпов'; $caturl = 'hayp_script'; break;
case '7': $cat = 'Экономические игры'; $caturl = 'games_script'; break;
case '8': $cat = 'Модули для CMS'; $caturl = 'moduls_cms'; break;
case '9': $cat = 'Остальное'; $caturl = 'other'; break;
default: $cat = 'Ошибка категории'; $caturl = '';
}
return Array($cat, $caturl);
}


if ($howes['c'] == 0) {
$pname = "Продавец не найден";
$pkey = "eshop,ешоп,интернет,магазин,цифровой,виртуальные,товары,продать,купить,скрипты,программы,софт,книги,ключи,продавец";
$pdesc = "Продавец не найден";
if (USER_LOGGED) {
$nusr = $u_id;
} else {
$nusr = '330';
$ip = mysqli_real_escape_string($connect_db, $_SERVER['REMOTE_ADDR']);
if(isset($_COOKIE['wu_i'])) { $c_dop = mysqli_real_escape_string($connect_db,' (Первоначальный '.wu_decode($_COOKIE['wu_i']).')'); } else { $c_dop = ''; }
if(isset($_COOKIE['fs'])) { $c_dop_2 = mysqli_real_escape_string($connect_db,' (Сайт-реферер '.$_COOKIE['fs'].')'); } else { $c_dop_2 = ''; }
}
$erres = 1;
header("HTTP/1.0 404 Not Found");
} else {
$pname = "Товары пользователя $getuser";
$pkey = "eshop,ешоп,интернет,магазин,цифровой,виртуальные,товары,продать,купить,скрипты,программы,софт,книги,ключи,продавец,$getuser";
$pdesc = "Товары пользователя $getuser.";
$erres = 0;
}
$right = '<div class="header-buttons"><div class="collapse" id="header-buttons"><div class="well"><div class="btn-group"><a href="javascript://" id="unewitem" class="btn btn-primary">Добавить товар</a></div></div></div></div>';
include('inc/top.php');
$us = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT uid,regdate,av,rat FROM ".DB_PREFIX."_users WHERE uid='$usrid[uid]' LIMIT 1"));
$how = mysqli_num_rows(mysqli_query($connect_db, "SELECT id FROM ".DB_PREFIX."_es_s WHERE usr='$u_id' AND tou='$usrid[uid]' LIMIT 1"));

$page_name = $pname;
$page_keys = $pkey;
$page_desc = $pdesc;
$online_title = 'На странице товаров пользователя '.$getuser;
$online_url = '/user/'.$getuser;

include('wu-engine/wu_header.php');
?>
<!-- Контент -->
<?php
if ($erres == 0) { ?>
<div class="panel panel-default">
<div class="panel-heading">
<h6 class="panel-title"><i class="icon-user2"></i> Информация о продавце <?php echo $getuser; ?></h6>
</div>
<div class="panel-body">
<div class="media">
<div class="lightgallerys pull-left"><a href="<?php if (empty($us['av'])) { $ava_link_thumb_my = '/wu-static/img/avatar_default.png'; $ava_link_full_my = '/wu-static/img/avatar_default.png'; } else { $ava_link_thumb_my = '/wu-uploads/avatars/thumbs/'.$us['av']; $ava_link_full_my = '/wu-uploads/avatars/full/'.$us['av']; } echo $ava_link_thumb_my; ?>" data-sub-html="Аватар пользователя <?php echo $getuser; ?>"><img class="media-object" src="<?php echo $ava_link_full_my; ?>" border="0" alt="Аватар пользователя <?php echo $row['log']; ?>" title="Аватар пользователя <?php echo $getuser; ?>" /></a></div>
<div class="media-body cpn">
Дата регистрации: <?php echo date("d.m.y H:i",$us['regdate']); ?><br />
Количество товаров: <?php $sumr = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `cnt` FROM ".DB_PREFIX."_es WHERE usr='$us[uid]' AND st = '1'")); echo $sumr['cnt']; ?><br />
Рейтинг пользователя: <?php echo $us['rat']; ?>
</div>
</div>
</div>
<div class="panel-footer">
<div class="pull-left">
</div>
<div class="pull-right" style="margin-right: 0">
<ul class="footer-icons-group">
<li id="hsub"<?php if ($how > 0) { echo ' style="display: none"'; } ?>><a href="javascript://" id="sub" class="tip" data-placement="bottom" data-original-title="Подписаться. Вы будете получать уведомления при поступлении новых товаров." data-loading-text="<i class='icon-spinner7 spin'></i>"><i class="icon-megaphone"></i></a></li>
<li id="hsubb"<?php if (!USER_LOGGED || $how == 0) { echo ' style="display: none"'; } ?>><a href="javascript://" id="subb" class="tip" data-placement="bottom" data-original-title="Отписаться" data-loading-text="<i class='icon-spinner7 spin'></i>"><i class="icon-undo"></i></a></li>
</ul>
</div>
</div>
</div>

<?php
$page = intval($_GET['page']);
$num = 20;
if ($page==0) $page=1;
$qu = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `cnt` FROM ".DB_PREFIX."_es WHERE st = '1' AND usr='$usrid[uid]'"));
$co = $qu['cnt'];
$total = intval(($co - 1) / $num) + 1;
$page = intval($page);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$qr = mysqli_query($connect_db, "SELECT ".DB_PREFIX."_es.id,inf,ty,cat,co,ti,ts,col,dt,v,vo,va,log,rat,img FROM ".DB_PREFIX."_es INNER JOIN ".DB_PREFIX."_es_i ON ".DB_PREFIX."_es.id = ".DB_PREFIX."_es_i.m INNER JOIN ".DB_PREFIX."_users ON ".DB_PREFIX."_es.usr = ".DB_PREFIX."_users.uid WHERE st = '1' AND usr='$usrid[uid]' GROUP BY ".DB_PREFIX."_es.id ORDER BY ".DB_PREFIX."_es.dt DESC LIMIT $start, $num");
if ($co > 0) {
while($row = mysqli_fetch_array($qr)) {
list($cat, $caturl) = cat($row['cat']);
if (USER_LOGGED) {
$fav = mysqli_num_rows(mysqli_query($connect_db, "SELECT id FROM ".DB_PREFIX."_es_f WHERE usr='$u_id' AND f='$row[id]' LIMIT 1"));
}
?>
<div class="panel panel-<?php if ($row['col'] == 1) { echo 'info'; } else { echo 'default'; } ?>">
<div class="panel-heading">
<h6 class="panel-title<?php if ($row['col'] == 1) { echo ' esinf'; } ?>"><a href="/eshop_show/<?php echo $row['id']; ?>"><?php echo $row['ti']; ?></a></h6>
<div class="panel-icons-group<?php if ($row['col'] == 1) { echo ' esinf'; } ?>">
<a href="javascript://" class="btn btn-link ptext tip" data-placement="bottom" data-original-title="Количество просмотров товара">Просмотров: <?php echo $row["v"]; ?></a>
<a href="javascript://" class="btn btn-link ptext tip" data-placement="bottom" data-original-title="Количество комментариев к товару">Комментариев: <?php $sumc = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `cnt` FROM ".DB_PREFIX."_es_c WHERE m='$row[id];'")); echo $sumc['cnt']; ?></a>
<a href="javascript://" class="btn btn-link btn-icon tip" data-placement="bottom" data-original-title="Рейтинг товара: <?php if ($row['vo'] > 0) { $rt = $row['va']/$row['vo']; $rt = number_format($rt,2,'.',''); } else { $rt = "Голосов нет"; } echo $rt; ?>"><i class="icon-star<?php if ($rt >=2.5 && $rt < 4) { echo '2'; } if ($rt >=4) { echo '3'; } ?>"></i></a>
<a href="javascript://" class="btn btn-link btn-icon tip" data-placement="bottom" data-original-title="Размещено <?php echo wudate($row['dt']); ?>"><i class="icon-clock3"></i></a>
<a href="javascript://" onclick="fav('<?php echo $row['id']; ?>');" id="fav_<?php echo $row['id']; ?>"<?php if ($fav > 0) { echo ' style="display: none"'; } ?> class="btn btn-link btn-icon tip" data-placement="bottom" data-original-title="Добавить в избранное" data-loading-text="<i class='icon-spinner7 spin'></i>"><i class="icon-heart2"></i></a>
<a href="javascript://" onclick="favb('<?php echo $row['id']; ?>');" id="favb_<?php echo $row['id']; ?>"<?php if (!USER_LOGGED || $fav == 0) { echo ' style="display: none"'; } ?> class="btn btn-link btn-icon tip" data-placement="bottom" data-original-title="Удалить из избранного" data-loading-text="<i class='icon-spinner7 spin'></i>"><i class="icon-heart"></i></a>
</div>
</div>
<div class="panel-body">
<div class="media">
<div class="lightgallerys pull-left marnone">
<a href="/eshop/images/<?php echo $row['img']; ?>" data-sub-html="<?php echo $row['ti']; ?>"><img class="imgeshop" src="/eshop/images/<?php echo $row['img']; ?>" border="0" alt="<?php echo $row['ti']; ?>" title="<?php echo $row['ti']; ?>" /></a>
</div>
<div class="clearh"></div>
<div class="media-body cpn marnone">
<div class="col-lg-9 col-md-6 col-sm-6 emarg">
<?php echo nl2br(htmlspecialchars($row['ts'])); ?>
</div>
<div class="col-lg-3 col-md-6 col-sm-6 well einf">
<ul>
<li>Стоимость: <font class="flright fbold"><?php echo $row['co']; ?> руб.</font></li>
<li>Категория: <font class="flright"><a href="/category/<?php echo $caturl; ?>"><?php echo $cat; ?></a></font></li>
<li>Тип товара: <font class="flright"><?php if ($row['ty'] == 0) { echo 'Файл'; } if ($row['ty'] == 1) { echo 'Текст'; } ?></font></li>
<li>Количество: <font class="flright"><?php if ($row['inf'] == 0) { echo 'Бесконечно'; } if ($row['inf'] == 1) { $units = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT count(`id`) AS `c` FROM ".DB_PREFIX."_es_u WHERE m = '$row[id]' AND st = '0'")); if ($units['c'] > 0) { echo $units['c'].' шт.'; } else { echo 'Всё продано'; } } ?></font></li>
<li>Рейтинг продавца: <font class="flright"><?php echo $row['rat']; ?></font></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<?php }
$pageNav = new SimPageNav();
$pages = ceil($co/$num);
echo $pageNav->getLinks($pages, 1, $page, 10, 'page');
} else { echo '<div class="alert alert-info fade in"><i class="icon-info"></i> Товаров нет</div>'; }
} else { echo '<div class="alert alert-danger"><center>Продавец не найден</center></div>'; } ?>
<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'>
function fav(id){
<?php if(USER_LOGGED){ ?>
$('#fav_'+id).button('loading');
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/eshop_fav_add.php',
data: {'id': id, 'token': token},
cache: false,
success: function(result){
$('#fav_'+id).button('reset');
if (result == '0') {
$.jGrowl('Товар уже в избранном', { theme: 'growl-error' });
}
if (result == '1') {
$.jGrowl('Добавлено в избранное', { theme: 'growl-success' });
$('#fav_'+id).hide();
$('#favb_'+id).show();
}
if (result == '3') {
jerr();
}
},
error: function(){
$('#fav_'+id).button('reset');
serr();
}
});
<?php } else { ?>
$.jGrowl('Авторизуйтесь для добавления в избранное', { theme: 'growl-error' });
<?php } ?>
};
function favb(id){
<?php if(USER_LOGGED){ ?>
$('#favb_'+id).button('loading');
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/eshop_fav_back.php',
data: {'id': id, 'token': token},
cache: false,
success: function(result){
$('#favb_'+id).button('reset');
if (result == '0') {
$.jGrowl('Товар не в избранном', { theme: 'growl-error' });
}
if (result == '1') {
$.jGrowl('Удалено из избранного', { theme: 'growl-success' });
$('#fav_'+id).show();
$('#favb_'+id).hide();
}
if (result == '3') {
jerr();
}
},
error: function(){
$('#fav_'+id).button('reset');
serr();
}
});
<?php } else { ?>
$.jGrowl('Необходимо авторизоваться', { theme: 'growl-error' });
<?php } ?>
};
$(function() {
$('.lightgallerys').lightGallery();
var btns = $('#sub');
btns.click(function(){
<?php if(USER_LOGGED){ ?>
btns.button('loading');
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/eshop_sub.php',
data: {'id': '<?php echo $usrid['uid']; ?>', 'token': token},
cache: false,
success: function(result){
btns.button('reset');
if (result == '0') {
$.jGrowl('Вы не можете подписаться на себя', { theme: 'growl-error' });
}
if (result == '1') {
$.jGrowl('Вы подписались', { theme: 'growl-success' });
$('#hsub').hide();
$('#hsubb').show();
}
if (result == '3') {
jerr();
}
if (result == '4') {
$.jGrowl('Вы уже подписаны на этого продавца', { theme: 'growl-error' });
}
},
error: function(){
btns.button('reset');
serr();
}
});
<?php } else { ?>
$.jGrowl('Авторизуйтесь для подписки', { theme: 'growl-error' });
<?php } ?>
});
<?php if(USER_LOGGED){ ?>
var btnb = $('#subb');
btnb.click(function(){
btnb.button('loading');
$.ajax({
type: 'POST',
url: '/wu-engine/wu-actions/eshop_sub_back.php',
data: {'id': '<?php echo $usrid['uid']; ?>', 'token': token},
cache: false,
success: function(result){
btnb.button('reset');
if (result == '0') {
$.jGrowl('Вы не подписаны на этого продавца', { theme: 'growl-error' });
}
if (result == '1') {
$.jGrowl('Вы отписались', { theme: 'growl-success' });
$('#hsubb').hide();
$('#hsub').show();
}
if (result == '3') {
jerr();
}
},
error: function(){
btnb.button('reset');
serr();
}
});
});
<?php } ?>
$('#unewitem').click(function(){
<?php if (USER_LOGGED) { echo "$(location).attr('href','/cabinet/new');"; } else { echo "$.jGrowl('Авторизуйтесь для добавления товара', { theme: 'growl-error' });"; } ?>
});
});
</script>

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