<?

# Создаем основной альбом для публикаций
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '$user[id]'"), 0)==0){
mysql_query("INSERT INTO `gallery` (`id_user`, `name`) values('$user[id]', 'Публикации')");
}
# Создали), дальше все остальное)

echo '<table class="block3" cellpadding="0" cellspacing="0">';
echo '<td style="width:110px;">';
# Аватар
echo avatar_profil($ank['id'], true, 640, false);
# Сделать подарок
if (isset($user) && $ank['id']!=$user['id']){
echo '<span style="position: absolute; margin: 60px -20px 0;"><a href="/user/gift/categories.php?id='.$ank[id].'"><img width="20" src="/img/go_gift.png"></a></span>';
}
echo '</td>';
echo '<td>';
if ($ank['verified'] == 1) $verified = ' <img style="margin: -1px 5px;" src="/img/verified.png" title="Подтверждённая страница" alt="Подтверждённая страница"> ';
echo '<b>'.user::nick($ank['id']).'</b> '.$verified.'';
if (isset($user) && $ank['id']==$user['id']){
# Редактирование профиля
echo '<a class="profil_edit" href="/user/edit/">Редактировать профиль</a>';
}
if (isset($user) && $ank['id']!=$user['id']){
echo '<table cellpadding="0" cellspacing="0">';
# Действие
echo '<td><a style="margin: 10px 5px 0 0;" class="profil_edit" href="/modules/mail/mail.php?id='.$ank[id].'">Отправить сообщение</a></td>';
echo '<td style="width:40px;">';
if ($frend_new==0 && $frend==0){
echo '<a class="profil_edit" href="/user/friends/create.php?add='.$ank[id].'"><img src="/img/dr2.png"></a>';
}elseif ($frend_new==1){
echo '<a class="profil_edit" href="/user/friends/create.php?otm='.$ank[id].'"><img src="/img/dr1.png"></a>';
}elseif ($frend==2){
echo '<a class="profil_edit" href="/user/friends/create.php?del='.$ank[id].'"><img src="/img/dr1.png"></a>';
}
echo '</td>';
echo '</table>';
}
echo '</td>';
echo '</table>';

# Информация о аккаунте
echo '<div class="block3">';
# Имя
if ($ank['ank_name']!=NULL){
echo '<b>'.$ank[ank_name].'</b> ';
}else{
# No
}
# Фамилия
if ($ank['ank_fam']!=NULL){
echo '<b>'.$ank[ank_fam].'</b>';
}else{
# No
}
echo '</br>';
# О себе
if ($ank['ank_o_sebe']!=NULL){
echo ''.output_text($ank['ank_o_sebe']).'';
}else{
# No
}
# Сайт
if ($ank['ank_site']!=NULL){
echo '</br>'.output_text($ank['ank_site']).'';
}else{
# No
}
echo '</div>';

# Панель

# Счетчики
$count_friends = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
$count_photo = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_user` = '$ank[id]'"),0);
$count_gifts = mysql_result(mysql_query("SELECT COUNT(id) FROM `gifts_user` WHERE `id_user` = '$ank[id]' AND `status` = '1'"),0);
$count_friends_new = mysql_result(mysql_query("SELECT COUNT(id) FROM `frends_new` WHERE `to` = '$user[id]'"), 0);

echo '<table style="text-align:center;" class="block_profil_panel" cellpadding="0" cellspacing="0">';
echo '<td><a href="/modules/photo/'.$ank[id].'/"><span class="profil_panel_count">'.$count_photo.'</span></br>публикаций</a></td>';
if (isset($user) && $ank['id']==$user['id']){
if ($count_friends_new > 0){
echo '<td><a href="/user/friends/request.php"><span class="profil_panel_count">'.$count_friends.'</span></br>друзей <b><font color="#3897f0">+'.$count_friends_new.'</font></b></a></td>';
}else{
echo '<td><a href="/user/friends/?id=' . $ank['id'] . '"><span class="profil_panel_count">'.$count_friends.'</span></br>друзей</a></td>';
}
}else{
echo '<td><a href="/user/friends/?id=' . $ank['id'] . '"><span class="profil_panel_count">'.$count_friends.'</span></br>друзей</a></td>';
}
echo '<td><a href="/user/gift/index.php?id='.$ank[id].'"><span class="profil_panel_count">'.$count_gifts.'</span></br>подарков</a></td>';
echo '</table>';

echo '<table style="text-align:center;" class="block_profil_panel" cellpadding="0" cellspacing="0">';
echo '<td><a href="/id'.$ank[id].'"><img src="/img/plist.png"></a></td>';
echo '<td><a href="/user/profil/save.php?id='.$ank[id].'"><img src="/img/fav_list.png"></a></td>';
echo '<td><a href="/user/profil/gift.php?id='.$ank[id].'"><img src="/img/glist.png"></a></td>';
echo '</table>';

# Вывод фотографий
$sql = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '$ank[id]' ORDER BY `id` DESC LIMIT 8");
$coll=mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_user` = '$ank[id]' ORDER BY `id` DESC"),0);
if ($coll>0){
echo '<div class="album">';
while ($photo = mysql_fetch_assoc($sql)){
echo '<a class="flowap-album_item" href="/modules/photo/'.$ank[id].'/'.$photo[id_gallery].'/'.$photo[id].'/">';
echo '<div class="flowap-album_thumb_wrap">';
echo '<div class="flowap-album_thumb flowap-album-fill">';
echo '<img class="flowap-album_thumb_img" src="/modules/photo/foto0/'.$photo[id].''.$photo[ras].'">';
echo '</div>';
echo '</div>';
echo '</a>';
}
echo '</div>';
}else{
echo '<div class="block2"><center><img width="70" src="/img/no_public.png"><span class="no_public">Публикаций пока нет</span></center></div>';
}

?>