Файл: modules/user/profile.php
Строк: 299
<?
if(isset($user)) {
if ($db->query("SELECT * FROM `users` WHERE `id` = '". abs(intval($_GET['user_id'])) ."' LIMIT 1")->rowCount() == 0)
{
header('Location: /');
exit();
}
$nick = $db->query("SELECT * FROM `users` WHERE `id` = '". abs(intval($_GET['user_id'])) ."' LIMIT 1")->fetch();
if(isset($_GET['user_id']))
{
$title = $lang->word('pr_of') . $nick['nick'].'';
} else {
$title = $lang->word('pr_of') . $user['nick'].'';
}
if (isset($_GET['user_id']))
{
if ($db->query("SELECT * FROM `users` WHERE `id` = '". abs(intval($_GET['user_id'])) ."' LIMIT 1")->rowCount() == 1)
{
$usr = $db->query("SELECT * FROM `users` WHERE `id` = '". abs(intval($_GET['user_id'])) ."' LIMIT 1")->fetch();
$susr = $db->query("SELECT * FROM `settings` WHERE `user_id` = '". abs(intval($_GET['user_id'])) ."' LIMIT 1")->fetch();
}
else
{
$usr = $db->query("SELECT * FROM `users` WHERE `id` = '$user[id]' LIMIT 1")->fetch();
$susr = $db->query("SELECT * FROM `settings` WHERE `user_id` = '". abs(intval($user['id'])) ."' LIMIT 1")->fetch();
}
}
else
{
$usr = $db->query("SELECT * FROM `users` WHERE `id` = '$user[id]' LIMIT 1")->fetch();
$susr = $db->query("SELECT * FROM `settings` WHERE `user_id` = '". abs(intval($user['id'])) ."' LIMIT 1")->fetch();
}
switch(@$_GET['act']){
default:
$locate = 'in_profile';
require_once(SYS.'/view/header.php');
if(time()<$usr['ban_time']) {
$tpl->div('title', '<center><b>Пользователь забанен</b></center>');
$tpl->div('menu', $lang->word('ban_text').': '.$usr['ban_text'].'<br/>
'.$lang->word('end_ban').': '.rtime($usr['ban_time']).'');
}
$tpl->div('title', '<b>'. $usr['nick'].'</b> ['.user_level(abs(intval($usr['id']))).']');
echo '<div class="post">
'. $lang->word('reg_data') .': '. rtime($usr['reg_time']).'<br/>
'. $lang->word('last_v') .': '. rtime($usr['time']).'<br/></div>
<div class="menu">';
echo avatar($usr['nick']);
echo '</div>';
if(intval($usr['id']) != $user['id'])
{
$tpl->div('menu', (isset($user) && $user['id'] != abs(intval($usr['id'])) ? img('mail-send.png') .'<a href="/mail/write/?user_id='. abs(intval($usr['id'])).'">'. $lang->word('w_mail') .'</a><br/>':NULL).'');
}
if(isset($user)) {
if(intval($usr['id']) != $user['id'])
{
echo '<div class="menu"><img src="/template/icons/add_friend.png" alt="*" /> <a href="/friends/add/'.abs(intval($usr['id'])) .'">Добавить в друзья</a></div>';
}
}
$user_files = $db->query("SELECT * FROM `share_files` WHERE `user_id` = '". abs(intval($usr['id'])) ."'")->rowCount();
$tpl->div('title', 'Личные данные');
echo '
<div class="menu"><img src="/template/icons/profile.png" alt="profile" /> <a href="/user/'.$usr['id'].'?act=ank">Данные '. $usr['nick'].'</a></div>
<div class="menu"> <img src="/template/icons/box.png" alt="files" /> <a href="/user/'.$usr['id'].'?act=files">'. $lang->word('user_files').'</a> ['. $user_files .']</a></div>';
echo '<div class="menu">'.img('album.png') .'<a href="/work/port?id='.abs(intval($usr['id'])).'">Портфолио</a> ['.$db->query("select * from `portfel_folder` where `user`='".$usr['id']."'")->rowcount().']</a></div>';
echo '<div class="menu"><img src="/template/icons/shop.png" alt="shop" /> <a href="/magaz/tovar/'. $usr['id'] .'"> Товары пользователя</a> ['. $db->query("SELECT * FROM `magaz_tovar` WHERE `user` = '". $usr['id'] ."'")->rowCount() .']</a></div>';
$user_comments = $db->query("SELECT * FROM `share_comms` WHERE `user_id` = '". abs(intval($usr['id'])) ."'")->rowCount() + $db->query("SELECT * FROM `news_comms` WHERE `user_id` = '". abs(intval($usr['id'])) ."'")->rowCount();
$user_posts = $db->query("SELECT * FROM `forum_pt` WHERE `user_id` = '". abs(intval($usr['id'])) ."'")->rowCount();
$user_topics = $db->query("SELECT * FROM `forum_pt` WHERE `cat_id` != '0' AND `user_id` = '". abs(intval($usr['id'])) ."'")->rowCount();
$user_friends = $db->query("SELECT * FROM `friends` WHERE `friend_id` = '". abs(intval($usr['id'])) ."' AND `active` = '1'")->rowCount();
$tpl->div('title', 'Платежные данные');
if ($usr['wmid'] != NULL) {
echo '<div class="menu">WMID: <a href="http://passport.webmoney.ru/asp/certview.asp?wmid='.$usr['wmid'].'" />'.$usr['wmid'].'</a><br />
BL:<img src="http://stats.wmtransfer.com/Levels/pWMIDLevel.aspx?wmid='.$usr['wmid'].'&w=35&h=18&bg=0XFFFFFF" /><br />
Претензии/Отзывы: <img src="http://arbitrage.webmoney.ru/xml/AL.aspx?wmid='.$usr['wmid'].'" /> </div>';
} else {
echo '<div class="menu"><center>Пользователь не заполнил WMID</center></div>
';
}
$tpl->div('title', 'Информация');
echo '<div class="menu">'. img('them_00.png') .''. $lang->word('user_posts') .': ['.$user_posts.']</div>
<div class="menu">'. img('them_00.png') .''. $lang->word('user_topics') .': ['.$user_topics.']</div>
<div class="menu">'. img('them_00.png') .''. $lang->word('user_comments') .': ['. $user_comments .']</div>';
$tpl->div('title', 'Репутация на сайте');
echo '<div class="menu">';
$blag = $db->query("SELECT * FROM `blag` WHERE `user_blag` = '". $usr['id'] ."'")->rowCount(); echo '<img src="/template/icons/blag.png" alt="news" /> <a href="/user/blag.php?user_id='.$usr['id'].'">Благодарности</a> ['.$blag.']</a>';
echo '</div>';
echo '<div class="menu">';
echo '<img src="/template/icons/chart.png" alt="news" /> Рейтинг: '.$usr['reit'].'';
echo '</div>';
echo '<div class="menu">';
echo '<img src="/template/icons/balans.png" alt="news" /> Баланс: '.$usr['rub'].' руб.';
echo '</div>';
$tpl->div('block', (isset($user) && $user['id'] != abs(intval($usr['id'])) && $user['level'] >=5 ? img('user-ban.png') .'<a href="/padmin/ban/'. abs(intval($usr['id'])).'/">'. $lang->word('to_ban') .'</a><br/>' : NULL)
.($user['level'] >=6 ? img('edit_profile.png').' <a href="/padmin/user_edit.php?id='. abs(intval($usr['id'])) .'">'. $lang->word('edit_profile') .'</a><br/>' : NULL)
.(isset($user) && $user['id'] != abs(intval($usr['id'])) && $user['level'] >=6 ? img('1_admin.png') .'<a href="/padmin/change-dest/'. abs(intval($usr['id'])).'/">'. $lang->word('change_dest') .'</a><br/>' : NULL)
.HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
break;
case 'friends';
if($db->query("SELECT * FROM `friends` WHERE `friend_id` = '". abs(intval($usr['id'])) ."' AND `active` = '1'")->rowCount() != 0)
{
$friends_r = $db->query("SELECT * FROM `friends` WHERE `friend_id` = '". abs(intval($usr['id'])) ."' AND `active` = '1'")->rowCount();
}
$title = $lang->word('friends');
require_once(SYS.'/view/header.php');
$tpl->div('title', ' '.$lang->word('friends').' <b>'. $usr['nick'].'</b> ['.$db->query("SELECT * FROM `friends` WHERE `friend_id` = '". abs(intval($usr['id'])) ."' AND `active` = '1'")->rowCount().' '.$lang->word('us_friends').']');
$pages = new Paginator($friends_r, $ames);
if($friends_r == 0)
{
$tpl->div('menu', $lang->word('friends_no'));
}
else
{
if( $db->query("SELECT * FROM `friends` WHERE `friend_id` = '". abs(intval($usr['id'])) ."' AND `active` = '1'")->rowCount() !=0)
{
$friends_q = $db->query("SELECT * FROM `friends` WHERE `friend_id` = '". abs(intval($usr['id'])) ."' AND `active` = '1' ORDER BY friend_id DESC LIMIT $start, $ames");
}
while($friends = $friends_q->fetch())
{
$friend_id = $friends['user_id'];
echo '<div class="menu">
'.nick($friend_id).'
</div>';
}
$pages->view('/friends/?');
}
$tpl->div('block', img('nav.png') .'<a href="/user/'.$usr['id'].'/">'. $lang->word('back') .'</a><br/>'
. HICO. ' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
break;
case ank:
$title = $usr['nick'].' - Данные ';
require_once(SYS.'/view/header.php');
$tpl->div('title', ''. $usr['nick'].' - Данные ');
echo '<div class="menu">';
if (empty($usr['name']) && empty($usr['surname']) && empty($usr['device']) && empty($usr['gender']) && empty($usr['year']) && empty($usr['info']) && empty($usr['interests']) && empty($usr['site']) && empty($usr['city']) && empty($usr['icq']) && empty($usr['country'])) {
echo $lang->word('e_pr');
}
else if ($susr['view_profile'] == 'self' && abs(intval($usr['id'])) != $user['id']) {
echo $lang->word('h_pr');
}
else if (!isset($user) && $susr['view_profile'] == 'regs') {
echo $lang->word('h_pr') .'<a href="/sign_up/"> '.$lang->word('sign_up').'</a> | <a href="/sign_in/">'.$lang->word('sign_in').'</a>';
}
else {
if(!empty($usr['year']) || $usr['year'] !=0)
{
$sec = 0;
$min = 0;
$hour = 0;
$day = $usr['day'];
$month = $usr['month'];
$year = $usr['year'];
$birthdate_unix = mktime($hour, $min, $sec, $month, $day, $year);
$current_unix = time();
$period_unix = $current_unix - $birthdate_unix;
$age = floor($period_unix / (365*24*60*60));
}
echo (!empty($usr['name'])?'<b>'.$lang->word('name').'</b>: '. $usr['name'] .'<br />':NULL) .'
'. (!empty($usr['surname'])?'<b>'.$lang->word('surname').'</b>: '. $usr['surname'] .'<br />':NULL) .'
'. (!empty($usr['device'])? '<b>'.$lang->word('device').'</b>: '. $usr['device'] .'<br />':NULL) .'
'. (!empty($usr['gender'])?'<b>'.$lang->word('gender').'</b>: '. ($usr['gender'] == 1?''.$lang->word('male').'':''.$lang->word('female').'') .'<br />':NULL) .'
'. (!empty($usr['year'])?'<b>'.$lang->word('birth').'</b>: '. output($usr['day']) .'.'. output($usr['month']) .'.'. output($usr['year']) .' (<span style="color: gray;"><b>'.$age.'</b></span>)<br />':NULL) .'';
echo ''. (!empty($usr['city'])?'<b>'.$lang->word('city').'</b>: '.$usr['city'] .'</a><br />':NULL) .'
'. (!empty($usr['country'])?'<b>'.$lang->word('country').'</b>: '. $usr['country'] .'<br />':NULL) .'
'. (!empty($usr['icq'])? '<b>ICQ</b>: '. output($usr['icq']) .'<br />':NULL) .'
'. (!empty($usr['site']) ?'<b>'.$lang->word('site').'</b>: <a target="_blank" href="http://'. $usr['site'] .'">'. $usr['site'] .'</a><br />':NULL).'
'.($susr['show_email'] == 'yes' ?'<b>E-Mail</b>: <a href="mailto:'. $usr['email'] .'">'. $usr['email'] .'</a><br/>' : NULL) .'
'. (!empty($usr['info'])?'<b>'.$lang->word('about_me').'</b>: '. $usr['info'] .'<br />':NULL);
}
echo '</div>';
$tpl->div('block', img('nav.png') .'<a href="/user/'.$usr['id'].'/">К странице '.$usr['nick'].'</a><br/>'
. HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
break;
case files:
$title = 'Файлы '.$usr['nick'];
require_once(SYS.'/view/header.php');
$tpl->div('title', 'Файлы - '. $usr['nick'].'');
$files_r = $db->query("SELECT * FROM `share_files` WHERE `user_id` = '". $usr['id'] ."'")->rowCount();
$pages = new Paginator($files_r, $ames);
if($files_r == 0) {
echo $tpl->div('menu', $lang->word('no_files'));
}
else {
$files_q = $db->query("SELECT * FROM `share_files` WHERE `user_id` = '". $usr['id'] ."' ORDER BY time LIMIT $start, $ames");
while($files = $files_q->fetch()) {
echo '<div class="menu">
'.(preg_match('/jpeg|jpg|gif|png|bmp/i', $files['ext']) ? img('image.png') : NULL).'
'.(preg_match('/jar|sis|sisx|jad|apk/i', $files['ext']) ? img('application.png') : NULL).'
'.(preg_match('/mp4|3gp|avi|flv/i', $files['ext']) ? img('video.png') : NULL).'
'.(preg_match('/mp3|aac|amr|wav|midi|mid/i', $files['ext']) ? img('music.png') : NULL).'
'.(preg_match('/zip|TORRENT|rar|tar.gz|7z/i', $files['ext']) ? img('box.png') : NULL).'
<a href="/share/file/'. $files['id'] .'/">'. $files['name'] .'</a> ('.strtoupper($files['ext']).')<br/>
'.(preg_match('/jpeg|jpg|gif|png|bmp/i', $files['ext']) ? '<img style="border: 1px solid #000;" weight="80" height="60" src="/files/share/'. $files['path_name'] .'" alt="Screen" /><br/>'."n" : (file_exists(ROOT.'/files/preview/'.$files['path_name'].'.png') ? '<img style="border: 1px solid #000;" weight="80" height="60" src="/files/preview/'.$files['path_name'].'.png" alt="Screen" /><br/>'."n" : NULL)) .'
'. mb_substr($files['text'], 0, 60).'...
</div>';
}
$pages->view('/user/'. $usr['id'] .'/?act=files&');
}
$tpl->div('block', HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
break;
}
} else {
$title = 'Профиль';
require_once(SYS.'/view/header.php');
$tpl->div('title', 'Профиль');
$tpl->div('menu', '<center>Профиль доступен только зарегистрированным пользователям!</center>');
$tpl->div('block',HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
}
?>