Файл: modules/user/profile.php
Строк: 219
<?
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.net *
**********************************/
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');
$tpl->div('title', ''.$lang->word('pr_of').' <b>'. $usr['nick'].'</b> ['.user_level(abs(intval($usr['id']))).']');
echo '<div class="menu">';
echo avatar($usr['nick']);
echo '</div>';
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['skype']) && empty($usr['mmail']) && 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'])? img('u_info.png') .'<u>'.$lang->word('name').':</u> '. $usr['name'] .'<br />':NULL) .'
'. (!empty($usr['surname'])? img('u_info.png') .'<u>'.$lang->word('surname').':</u> '. $usr['surname'] .'<br />':NULL) .'
'. (!empty($usr['device'])? img('u_device.png') .'<u>'.$lang->word('device').':</u> '. $usr['device'] .'<br />':NULL) .'
'. (!empty($usr['gender'])? img('u_gender.png') .'<u>'.$lang->word('gender').':</u> '. ($usr['gender'] == 1?''.$lang->word('male').'':''.$lang->word('female').'') .'<br />':NULL) .'
'. (!empty($usr['year'])? img('u_year.png') .'<u>'.$lang->word('birth').':</u> '. output($usr['day']) .'.'. output($usr['month']) .'.'. output($usr['year']) .' (<span style="color: gray;"><b>'.$age.'</b></span>)<br />':NULL) .'';
echo ''. (!empty($usr['city'])? img('u_life.png') .'<u>'.$lang->word('city').':</u> '.$usr['city'] .'</a><br />':NULL) .'
'. (!empty($usr['country'])? img('u_life.png') .'<u>'.$lang->word('country').':</u> '. $usr['country'] .'<br />':NULL) .'
'. (!empty($usr['icq'])? img('u_icq.png') .'<u>ICQ:</u> '. output($usr['icq']) .'<br />':NULL) .'
'. (!empty($usr['skype'])? img('skype.png') .'<u>Skype:</u> '. output($usr['skype']) .'<br />':NULL) .'
'. (!empty($usr['mmail'])? img('mail.png') .'<u>E-Mail:</u> '. output($usr['mmail']) .'<br />':NULL) .'
'. (!empty($usr['tel'])? img('tel.png') .'<u>Мобильный номер:</u> '. output($usr['tel']) .'</a></br>':NULL) .'
'. (!empty($usr['site']) ? img('u_site.png') .'<u>'.$lang->word('site').':</u> <a target="_blank" href="http://'. $usr['site'] .'">'. $usr['site'] .'</a><br />':NULL).'
'. (!empty($usr['wmid'])? img('keeper.png') .'<u>WMID:</u> <a href="https://passport.webmoney.ru/asp/certview.asp?wmid='. $usr['wmid'] .'">'. $usr['wmid'] .'</a></br>':NULL) .'
'. (!empty($usr['wmid'])? img('wm.png') .'BL:<img src="http://stats.wmtransfer.com/Levels/pWMIDLevel.aspx?wmid='. $usr['wmid'] .'&w=35&h=18&bg=0XDBE2E9" border="0" alt="" target="_blank" ><br />':NULL) .'
'. (!empty($usr['wmid'])? img('pret.gif') .' Претензии / Отзывы / Иски:<img src="https://arbitrage.webmoney.ru/xml/AL2.aspx?wmid='. $usr['wmid'] .'"></br>':NULL) .'
'. (!empty($usr['wmr'])? img('wmr.png') .'<u>WMR:'. $usr['wmr'] .'</u> </br>':NULL) .'
'.($susr['show_email'] == 'yes' ? img('u_e-mail.png') .'<u>E-Mail</u>: <a href="mailto:'. $usr['email'] .'">'. $usr['email'] .'</a><br/>' : NULL) .'
'. (!empty($usr['info'])? img('u_info.png') .'<u>'.$lang->word('about_me').':</u> '. $usr['info'] .'<br />':NULL);
}
echo '</div>';
$user_files = $db->query("SELECT * FROM `share_files` WHERE `user_id` = '". abs(intval($usr['id'])) ."'")->rowCount();
echo '<div class="post">'. img('u_act_r.png') .'<a href="/user/'.abs(intval($usr['id'])).'?'.(!isset($_GET['activity']) ? 'activity' : NULL).'">'.$lang->word('user_activity').'</a><br/>
'.(isset($_GET['activity']) ? '
'. img('u_act.png') .' Доменов: '. $user_files .'<br/>
</div>
<div class="post">
'. img('u_reg.png') .''. $lang->word('reg_data') .': '. rtime($usr['reg_time']).'<br/>
'. img('u_go.png') .''. $lang->word('last_v') .': '. rtime($usr['time']).'<br/>'
: NULL).'
</div>';
if(intval($usr['id']) == $user['id'])
{
} else {
$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)
.(isset($user) && abs(intval($usr['id'])) != $user['id'] && $db->query("SELECT * FROM `friends` WHERE `user_id` = '".$user['id']."' AND `friend_id` = '".abs(intval($usr['id']))."'")->rowCount() == 0 && $db->query("SELECT * FROM `friends` WHERE `friend_id` = '".$user['id']."' AND `user_id` = '".abs(intval($usr['id']))."'")->rowCount() == 0 ? img('add_friend.png') .'<a href="/friends/add/'. abs(intval($usr['id'])) .'">Добавить в контакты</a><br />':NULL)
.'');
}
$tpl->div('block', (isset($user) && $user['id'] != abs(intval($usr['id'])) && $user['level'] >=6 && $usr['level'] < 7 ? 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 && $usr['level'] < 7 ? 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;
}
?>