File size: 4.73Kb
<?
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH'])=='xmlhttprequest')
{
define("H", $_SERVER["DOCUMENT_ROOT"].'/');
include_once H.'sys/inc/start.php';
include_once H.'sys/inc/compress.php';
include_once H.'sys/inc/sess.php';
include_once H.'sys/inc/settings.php';
include_once H.'sys/inc/db_connect.php';
include_once H.'sys/inc/ipua.php';
include_once H.'sys/inc/fnc.php';
include_once H.'sys/inc/user.php';
if(isset($user)){
// Новые смс
$k_new = mysql_result(mysql_query("SELECT COUNT(`mail`.`id`) FROM `mail`
LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` IS NULL OR `users_konts`.`type` = 'common' OR `users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0);
$k_new_fav = mysql_result(mysql_query("SELECT COUNT(`mail`.`id`) FROM `mail`
LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0); // Почта
// Лента
$lenta = mysql_result(mysql_query("SELECT COUNT(`read`) FROM `tape` WHERE `id_user` = '$user[id]' AND `read` = '0' "),0);
// Обсуждения
$discuss = mysql_result(mysql_query("SELECT COUNT(`count`) FROM `discussions` WHERE `id_user` = '$user[id]' AND `count` > '0' "),0);
// Уведомления
$k_notif = mysql_result(mysql_query("SELECT COUNT(`read`) FROM `notification` WHERE `id_user` = '$user[id]' AND `read` = '0'"), 0);
// Друзья
$k_frend = mysql_result(mysql_query("SELECT COUNT(id) FROM `frends_new` WHERE `to` = '$user[id]'"), 0);
if ($discuss > 0){
$j2 = 'discussions';
}
elseif ($k_notif > 0){
$j2 = 'notification';
}
else{
$j2 = 'notification';
}
// Cкладываем сумму счетчиков
$k_l = $k_notif + $discuss;
?>
<table class="user_panel_2"><tbody><tr>
<td class="user_panel_3">
<a class="user_panel_4" href="/user/tape/">
<span class="user_panel_5">
<span class="user_panel_9"></span>
<?
if($lenta > 0){
?>
<span class="user_panel_10"><?= $lenta?></span>
<?
}
?>
</span>
</a>
</td>
<td class="user_panel_3">
<a class="user_panel_4" href="/user/<?=$j2?>/">
<span class="user_panel_5">
<span class="user_panel_13"></span>
<?
if($k_l > 0){
?>
<span class="user_panel_10"><?= $k_l?></span>
<?
}
?>
</span>
</a>
</td>
<?
if($k_frend > 0){
?>
<td class="user_panel_3">
<a class="user_panel_4" href="/user/frends/new.php" style="line-height: 20px;">
<span class="user_panel_5">
<span class="user_panel_8_8"></span>
<span class="user_panel_10"><?= $k_frend?></span>
</span>
</a>
</td>
<?
}
?>
<td class="user_panel_3">
<?
if ($k_new != 0 && $k_new_fav == 0){
?>
<a class="user_panel_4" href="/new_mess.php" style="line-height: 20px;">
<span class="user_panel_5">
<span class="user_panel_8"></span>
<span class="user_panel_10 user_panel_16"><?= $k_new?></span>
</span>
</a>
<?
}
else{
?>
<a class="user_panel_4" href="/konts.php" style="line-height: 20px;">
<span class="user_panel_5"><span class="user_panel_8"></span></span>
</a>
<?
}
?>
</td>
<td class="user_panel_3" id="knopka_Tw1nGo">
<a class="user_panel_4 user_panel_6 user_panel_11" href="/info.php?id=<?= $user['id']?>">
<span class="user_panel_5">
<span class="user_panel_7"><?= avatar($user['id'],false)?> </span>
</span>
</a>
</td>
</tr></tbody></table>
<?
}
}
?>