<?

// Статус форма для написания
if (isset($user) && isset($_GET['status'])){
if ($user['id'] == $ank['id']){
echo '<div class="main">Статус [512 символов]</div>';
echo '<form action="/info.php?id=' . $ank['id'] . '" method="post">';
echo "$tPanel<textarea type=\"text\" style='' name=\"status\" value=\"\"/></textarea><br /> ";
echo "<input class=\"submit\" style='' type=\"submit\" value=\"Установить\" />";
echo " <a href='/info.php?id=$ank[id]'>Отмена</a><br />";
echo "</form>";
include_once 'sys/inc/tfoot.php';
exit;
} // конец только себе
} // Конец написания статуса


echo "<div class='nav1'>";

// День рождения
if ($ank['ank_d_r'] . $ank['ank_m_r'] == date("jn")) echo'<div style="margin-left:0px;"><img src="/style/icons/tort.png" /><font color="orange"> Сегодня</font><font color="DarkGray"> День рождения</font></div>';

echo group($ank['id']) . user::nick($ank['id']);
echo medal($ank['id']) . " " . on_status($ank['id']) . " " . online($ank['id']) . " ";
echo "<div style='float:right;'><b>ID:</b>$ank[id]</div>";
if ((user_access('user_ban_set') || user_access('user_ban_set_h') || user_access('user_ban_unset')) && $ank['id'] != $user['id'])echo "<a href='/adm_panel/ban.php?id=$ank[id]'> <font color=red>[Бан]</font></a> ";

echo " <font color='#808080'>".otkuda($ank['url'])."</font>";
echo '<br />';
echo ' '.getbrowser_($ank['us_browser']);
echo "</div>";

// Аватар + Эконом режим
?>
<table cellspacing='0' cellpadding='0' border='0'><tr>
<td class='nav2' width='1%'>
<?
if($user['ekonom']==0){
echo avatar_ank($ank['id'], true, 128, false);
if (isset($user) && $ank['id']==$user['id']){
?><a href="/avatar.php"><center><small>Сменить аватар</small></center></a><?
} // от смены аватара
} // от эконома
else
{
?>
<center>
<img src='/style/icons/mode.png' alt='Lafac'></br>
<font color=green><b>Экономный</br> режим.</b></font></br>
<a href='/user/info/mode.php'> Отключить?</a>
</center>
<?
}
?>
</td>
<td class='nav2'>
<?

// Доп инфо о юзере
$a = "<font color='green'>";
$aa = "</font>";
$ank['ank_age'] = null;
		
if ($ank['ank_d_r'] != NULL && $ank['ank_m_r'] != NULL && $ank['ank_g_r'] != NULL)
{
$ank['ank_age'] = date("Y")-$ank['ank_g_r'];
if (date("n") < $ank['ank_m_r'])
$ank['ank_age'] = $ank['ank_age'] - 1;
elseif (date("n") == $ank['ank_m_r']&& date("j") < $ank['ank_d_r'])
$ank['ank_age'] = $ank['ank_age'] - 1;
}
	
if ($ank['ank_name']!=NULL)
echo "$a Имя: $aa $ank[ank_name]<br />\n";
else
echo "$a Имя: $aa Не заполнено<br />\n";

if ($ank['ank_city']!=NULL)
echo "$a Город: $aa ".output_text($ank['ank_city'])."<br />\n";
else
echo "$a Город: $aa  Не заполнено<br />\n";

if ($ank['ank_age'] != NULL)
echo "$a Возвраст: $aa $ank[ank_age]<br />\n";
else
echo "$a Возвраст: $aa Не заполнено<br />\n";

if ($ank['group_access']>1)echo "<font color='green'>Статус:</font> $ank[group_name]<br/>";

echo ''.$a.' Посещение: '.$aa.' <font color="red"><small>' . v_vk($ank['date_last']) . '</small></font><br />';

// СП
include_once H.'user/info/sp_para/my_sp.php';

// Зверьки
$zoo=mysql_fetch_array(mysql_query("SELECT * FROM `zooshop_pok` WHERE `id_user`='$ank[id]' LIMIT 1"));
if ($zoo['time']>=$time)echo "<span style='float : right;'><img src='/plugins/zooshop/imgs/$zoo[id_zoo].png'></span>\n";

// Авторитет
?>
<div style="color: #4e4e4e;">
<img src="/style/avtoritet/a8.png" alt="*" />Авторитет [<?= $ank['avtoritet']?>] 
<a href="/user/avtoritet.php?id=<?= $ank['id']?>"><img src="/style/avtoritet/icon_13.png" alt="*" /></a> 
<br />
<? if ($ank['avtoritet'] > 0) { ?>
<div><?= star($ank['avtoritet'])?></div>
<? }
?>
</td></tr></table>
<?





// Статусы юзера
if (isset($user) && isset($_GET['like']) && $user['id']!=$ank['id'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `status_like` WHERE `id_status` = '$status[id]' AND `id_user` = '$user[id]' LIMIT 1"),0)==0){
mysql_query("INSERT INTO `status_like` (`id_user`, `id_status`) values('$user[id]', '$status[id]')");
}
if ($status['id'] || $ank['id'] == $user['id']){
echo "<div class='nav1'>";
echo "<div class='st_1'></div><div class='st_2'>\n";
if ($status['id']){
echo output_text($status['msg']) . ' <font style="font-size:11px; color:gray;">' . v_vk($status['time']) . '</font>';
if ($ank['id']==$user['id'])echo " [<a href='?id=$ank[id]&amp;status'><img src='/style/icons/edit.gif' alt='*'> нов</a>]";
echo '<br />';
}else if ($ank['id']==$user['id']){
echo "Ваш статус [<a href='?id=$ank[id]&status'><img src='/style/icons/edit.gif' alt='*'> ред</a>]";
}
echo "</div>";

// Если статус установлен
if ($status['id']){
echo " <a href='/user/status/komm.php?id=$status[id]'><img src='/style/icons/bbl4.png' alt=''/> " . mysql_result(mysql_query("SELECT COUNT(*) FROM `status_komm` WHERE `id_status` = '$status[id]'"),0) . " </a> ";
$l=mysql_result(mysql_query("SELECT COUNT(*) FROM `status_like` WHERE `id_status` = '$status[id]'"),0);
if (isset($user) && $user['id']!=$ank['id'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `status_like` WHERE `id_status` = '$status[id]' AND `id_user` = '$user[id]' LIMIT 1"),0)==0){	
echo " <a href='/info.php?id=$ank[id]&amp;like'><img src='/style/icons/like.gif' alt='*'/> Класс!</a> • ";
$like = $l;
}else if(isset($user) && $user['id']!=$ank['id']){
echo " <img src='/style/icons/like.gif' alt=''/> Вы и ";
$like = $l-1;
}else{
echo " <img src='/style/icons/like.gif' alt=''/> ";
$like = $l;
} 
echo "<a href='/user/status/like.php?id=$status[id]'> $like чел. </a>";
}

// Общее колличество статусов
$st = mysql_result(mysql_query("SELECT COUNT(*) FROM `status` WHERE `id_user` = '$ank[id]'"),0);
if ($st > 0){
echo "<br /> &rarr; <a href='/user/status/index.php?id=$ank[id]'>Все статусы</a> (" . $st . ")";
}

echo "</div>";
}


// Вывод Подарков 
$k_p = mysql_result(mysql_query("SELECT COUNT(id) FROM `gifts_user` WHERE `id_user` = '$ank[id]' AND `status` = '1'"),0);
$width = ($webbrowser == 'web' ? '60' : '45'); // Размер подарков 

if ($k_p > 0){	
$q = mysql_query("SELECT id,id_gift,status FROM `gifts_user` WHERE `id_user` = '$ank[id]' AND `status` = '1' ORDER BY `id` DESC LIMIT 5");
echo '<div class="nav2">';
while ($post = mysql_fetch_assoc($q)){
$gift = mysql_fetch_assoc(mysql_query("SELECT id FROM `gift_list` WHERE `id` = '$post[id_gift]' LIMIT 1"));
echo '<a href="/user/gift/gift.php?id=' . $post['id'] . '"><img src="/sys/gift/' . $gift['id'] . '.png" style="max-width:' . $width . 'px;" alt="Подарок" /></a> ';
}

echo ' <a href="/user/gift/index.php?id=' . $ank['id'] . '">»</a>';
echo '</div>';
}

//ЗАГС
include H.'zags.inc.php';


// Анкета
echo "<div class='nav2'>";
echo "<img src='/style/icons/anketa.gif' alt='*' /> <a href='/user/info/anketa.php?id=$ank[id]'>Анкета</a> ";
if (isset($user) && $user['id']==$ank['id']){
echo "[<img src='/style/icons/edit.gif' alt='*' /> <a href='/user/info/edit.php'>ред</a>]";
}
echo "</div>";

echo "<div class='nav2'>";
$guestq = mysql_result(mysql_query("SELECT COUNT(*) FROM `stena` WHERE `id_stena` = '$ank[id]'"),0);
echo "<img src='/style/icons/guestbook.gif' alt='*' /> <a href='/guestbook.php?id=$ank[id]'>Гостевая</a> ($guestq)";
echo "</div>";


// Дневники
echo "<div class='nav2'>";
$kol_dnev=mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` WHERE `id_user` = '".$ank['id']."'"),0);
echo "<img src='/style/icons/zametki.gif' alt='*' /> ";
echo "<a href='/plugins/notes/user.php?id=$ank[id]'>Дневники</a> ($kol_dnev)<br />"; 
echo "</div>";


// Закладки
echo "<div class='nav2'>";
$forum=mysql_result(mysql_query("SELECT COUNT(id_user) FROM `forum_zakl` WHERE `id_user` = '" . $ank['id'] . "'"),0);
$people=mysql_result(mysql_query("SELECT COUNT(id_user) FROM `mark_people` WHERE `id_user` = '" . $ank['id'] . "'"),0);
$files=mysql_result(mysql_query("SELECT COUNT(id_user) FROM `mark_files` WHERE `id_user` = '" . $ank['id'] . "'"),0);
$foto=mysql_result(mysql_query("SELECT COUNT(id_user) FROM `mark_foto` WHERE `id_user` = '" . $ank['id'] . "'"),0);
$notes=mysql_result(mysql_query("SELECT COUNT(id_user) FROM `mark_notes` WHERE `id_user` = '" . $ank['id'] . "'"),0);
$comm = mysql_result(mysql_query("SELECT COUNT(id_user) FROM `comm_fav` WHERE `id_user` = '" . $ank['id'] . "'"),0);
$zakladki = $people + $files + $foto + $notes + $forum + $comm;

echo "<img src='/style/icons/fav.gif' alt='*' /> ";
echo "<a href='/user/bookmark/index.php?id=$ank[id]'>Закладки</a> ($zakladki)<br />";
echo "</div>";


// Сообщества
$comm = mysql_result(mysql_query("SELECT COUNT(id) FROM `comm_user` WHERE `id_user` = '$ank[id]'"), 0);
echo '<div class="nav2"><img src="/style/icons/comm.png" alt="*" /> ';
echo "<a href='/comm/user/$ank[id]/'>Сообщества</a> ($comm)";
echo "</div>";


// Друзья
$k_f = mysql_result(mysql_query("SELECT COUNT(id) FROM `frends_new` WHERE `to` = '$ank[id]' LIMIT 1"), 0);
$k_fr = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
$res = mysql_query("select `frend` from `frends` WHERE `user` = '$ank[id]' AND `i` = '1'");

echo '<div class="nav2">';
echo '<img src="/style/icons/druzya.png" alt="*" /> ';
echo '<a href="/user/frends/?id=' . $ank['id'] . '">Друзья</a> (' . $k_fr . '/';

$i = 0;
while ($k_fr = mysql_fetch_array($res)){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$k_fr[frend]' && `date_last` > '".(time()-600)."'"),0) != 0) 
$i++;
}

echo "On:<span style='color:green'><a href='/user/frends/online.php?id=".$ank['id']."'>$i</a></span>)";
if ($k_f>0 && $ank['id'] == $user['id'])echo " <a href='/user/frends/new.php'><font color='red'>+$k_f</font></a>";
echo "</div>";


// Фото
echo "<div class='nav1'>";
$fotogr=mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_user` = '$ank[id]'"),0);
echo "<img src='/style/icons/foto.png' alt='*' /> ";
echo "<a href='/foto/$ank[id]/'>Фото</a> ($fotogr)<br />";

$q = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '$ank[id]' ORDER BY `id` DESC LIMIT 4");
while ($post = mysql_fetch_assoc($q)) {
$f=$post['id'];
$foto12 = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = '" . $f . "'  LIMIT 1"));
$gallery = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id`='" . $foto12['id_gallery'] . "'  LIMIT 1"));
$ank_p=get_user($gallery['id_user']);
echo '<a href="/foto/' . $ank_p['id'] . '/' . $gallery['id'] . '/' . $post['id'] . '/" title="Перейти к фото">';
echo '<img style="padding: 1px; margin:2px;" src="/foto/foto50/' . $post['id'] . '.' . $post['ras'] . '" alt="Lafac"/></a>';
}

echo "</div>";


// Музыка
echo '<div class="nav2">';
$k_music=mysql_result(mysql_query("SELECT COUNT(*) FROM `user_music` WHERE `id_user` = '$ank[id]'"),0);
echo "<img src='/style/icons/play.png' alt='*'/> ";
echo "<a href='/user/music/index.php?id=$ank[id]'>Музыка</a> ";
echo "(" . $k_music . ")";
echo "</div>";


// Файлы
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user_files` WHERE `id_user` = '$ank[id]' AND `osn` = '1'"), 0)==0){
mysql_query("INSERT INTO `user_files` (`id_user`, `name`,  `osn`) values('$ank[id]', 'Файлы', '1')");
}
$dir_osn = mysql_fetch_assoc(mysql_query("SELECT * FROM `user_files` WHERE `id_user` = '$ank[id]' AND `osn` = '1' LIMIT 1"));
echo '<div class="nav2">';
echo "<img src='/style/icons/files.gif' alt='*' /> ";
echo "<a href='/user/personalfiles/$ank[id]/$dir_osn[id]/'>Файлы</a> ";
echo "(" . mysql_result(mysql_query("SELECT COUNT(*) FROM `user_files` WHERE `id_user` = '$ank[id]' AND `osn` > '1'"),0) . "/" . mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_user` = '$ank[id]'"),0) . ")<br />";
echo "</div>";


// Действия
$k_tr = mysql_result(query("SELECT COUNT(*) FROM `treats` WHERE `id_send` = '" . $ank['id'] . "' AND `type` = 'info'"), 0);
$k_tr_new = mysql_result(query("SELECT COUNT(*) FROM `treats` WHERE `id_send` = '" . $ank['id'] . "' AND `type` = 'info' AND `time` > '$ftime'"), 0);
?>
<div class="nav2">
<a href="/plugins/treats/<?= $ank['id']?>/info/?func=user"><img src="/plugins/treats/icons/heart.png" /> <?= __('Действия')?></a> (<?= $k_tr?>) 
<?= ($k_tr_new > 0 ? '<span class="off">+' . $k_tr_new . '</span>' : '')?>
</div>
<?


// Отзывы
echo '<div class="nav2">';
echo "<img src='/style/icons/who_rating.png' alt='*' /> <a href='/user/info/who_rating.php?id=$ank[id]'>Отзывы</a>
 (".mysql_result(mysql_query("SELECT COUNT(*) FROM `user_voice2` WHERE `id_kont` = '".$ank['id']."'"),0).")<br />";
 echo "</div>";
 
 
// Загон
echo '<div class="nav2">'; 
$zagon=mysql_result(mysql_query("SELECT COUNT(*) FROM `zagon` WHERE `id_user` = '$ank[id]'"),0); 
echo '<img src="/style/icons/zagon.png" alt="*"> <a href="/plugins/games/zagon/index.php?id=' . $ank['id'] . '">Добыча</a> ('.$zagon.')<br />';
echo "</div>";
 
 
// Подарки
echo '<div class="nav2">';
echo '<img src="/style/icons/present.gif" alt="*"> <a href="/user/gift/index.php?id=' . $ank['id'] . '">Все подарки</a> (' . $k_p . ')';
echo '</div>'; 
 

// Гости и Оценка
if (isset($user) && $user['id'] == $ank['id'])
{
echo '<div class="nav2">';
	
$new_g = mysql_result(mysql_query("SELECT COUNT(*) FROM `my_guests` WHERE `id_ank` = '$user[id]' AND `read`='1'"),0);
echo '<img src="/style/icons/guests.gif" alt="*" /> ';
if($new_g != 0){
echo "<a href='/user/myguest/index.php'><font color='red'>Гости +$new_g</font></a> ";
}else{
echo "<a href='/user/myguest/index.php'>Гости</a> ";
}
echo ' | ';
$ocenky = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_rating` WHERE `avtor` = '$ank[id]'  AND `read`='1'"),0);
if($ocenky != 0){
echo "<a href='/user/info/ocenky.php'><font color='red'>Оценки +$ocenky</font></a> ";
}else{
echo "<a href='/user/info/ocenky.php'>Оценки</a> ";
}

echo "</div>";
} 


// Черный список 
?>
<div class="nav2">
<img src="/style/icons/blacklist.gif" /> 
<a href="/user/blacklist/"><?= __('Черный список')?></a> 
(<?= mysql_result(mysql_query("SELECT COUNT(id_black) FROM `user_black` WHERE `id_user` = '$user[id]'"), 0)?>) 
</div> 
<?


// Играть
if (isset($user) && $user['id']!=$ank['id']){	
echo"<div class='nav2'>\n";
echo"<img src='/style/icons/games.gif' /> <a href='/plugins/game.php?id=$ank[id]'>Предложить играть</a><br />\n";
echo"</div>\n";
}

 

// Меню действий над юзером

if (isset($user) && $ank['id']!=$user['id']){
echo "<div class='nav1'>";

// Смс
echo " <a href=\"/mail.php?id=$ank[id]\"><img src='/style/icons/pochta.gif' alt='*' /> Отправить сообщение</a><br />";

// В друзья
if ($frend_new==0 && $frend==0){
echo "<img src='/style/icons/druzya.png' alt='*'/> <a href='/user/frends/create.php?add=".$ank['id']."'>Предложить дружбу</a><br />";
}elseif ($frend_new==1){
echo "<img src='/style/icons/druzya.png' alt='*'/> <a href='/user/frends/create.php?otm=$ank[id]'>Отклонить заявку</a><br />";
}elseif ($frend==2){
echo "<img src='/style/icons/druzya.png' alt='*'/> <a href='/user/frends/create.php?del=$ank[id]'>Удалить из друзей</a><br />";
}

// В закладки
echo '<img src="/style/icons/fav.gif" alt="*" /> ';
if ( mysql_result(mysql_query("SELECT COUNT(*) FROM `mark_people` WHERE `id_user` = '" . $user['id'] . "' AND `id_people` = '" . $ank['id'] . "' LIMIT 1"),0) == 0)
	echo '<a href="?id=' . $ank['id'] . '&amp;fav=1">Добавить в закладки</a><br />';
else
	echo '<a href="?id=' . $ank['id'] . '&amp;fav=0">Удалить из закладок</a><br />';

echo "<img src='/style/icons/uslugi.gif' alt='*' /> <a href=\"/user/money/translate.php?id=$ank[id]\">Перевести $sMonet[0]</a><br />";

echo "<img src='/style/icons/present.gif' alt='*' /> <a href=\"/user/gift/categories.php?id=$ank[id]\">Сделать подарок</a><br />";

echo '<img src="/style/icons/blacklist.gif" alt="*" />  <a href="/user/blacklist/?func=add&amp;id=' . $ank['id'] . '">В чёрный список</a><br />';
echo "</div>";
}


// Настройки юзера
if (isset($user) && $ank['id']==$user['id']){
?>
<div class='gmenu'>
<img src='/style/icons/pod.gif' alt='*' /><a href='/user/bonus/'> Мои бонусы</a><br/>
<img src='/style/status/gotov_boltat.png' alt='*' /><a href='statusx.php'> Мой онлайн статус</a><br/>
<img src='/style/icons/jobs.png' alt='*' /><a href='/user/job.php'> Ежедневные задания<br/>
<img src='/style/icons/settings.png' alt='*' /> <a href="/user/info/settings.php">Мои настройки</a> / <a href="/umenu.php">Меню</a><br />
<img src='/style/icons/uslugi.gif' alt='*' /> <a href="/user/money/index.php">Дополнительные услуги</a><br/>
<img src='/style/icons/mode.png' alt='*' /> <a href="/user/info/mode.php">Экономия вашего трафика</a>
</div>
<?
}
// mod_by_WiZcaS
// Голосовать за страницу
define('SYS',1);
include_once 'user/info/rating.php';


?>