View file modules/user/cabinet.php

File size: 3.53Kb
<?php

// проверка наличия авторизации
if (!isset($user))
{
    # Перенаправляем на главную
    header('Location: /');
}

# Заголовок модуля
$system['page_title'] = 'Личный кабинет';

# Шапка модуля
require_once(HOME .'/incfiles/header.php');

# Библиотека для вывода аватара
require_lib('avatar.php');

error($err);

# Рейтинг
$rating = $user['rating'] + mysql_result(mysql_query("SELECT COUNT(*) FROM `user_rating` WHERE `user_id` = '$user[id]' AND `type` = '1'"),0) - mysql_result(mysql_query("SELECT COUNT(*) FROM `user_rating` WHERE `user_id` = '$user[id]' AND `type` = '2'"),0);

echo '<div class="title">Личный кабинет</div>
<div class="menu">
'. icon($user['id']) .' '. nick($user['id']) .' '. online($user['id']) .'<br />
Статус: '. mysql_result(mysql_query("SELECT `name` FROM `user_level` WHERE `level` = '$user[level]'"), 0) .'
</div>
<div class="menu">
'. avatar($user['id']) .'
<a href="/user/avatar.php">Управление аватаром</a>
</div>
<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/rating/star.png" alt="" /> ') .' Рейтинг: '. $rating .'<br />';
// звание
echo '<a href="/user/user_rating.php?user_id='. $user['id'] .'">Просмотр голосов &raquo;</a>
</div>

<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/cabinet/ank_view.png" alt="" /> ') .'<a href="/user/user.php">Личная страница</a>
</div>

<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/cabinet/ank_edit.png" alt="" /> ') .'<a href="/user/ank_edit.php">Изменение анкеты</a>
</div>

<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/mail.png" alt="" /> ') .'<a href="/mail/">Личная почта</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `to_id` = '$user[id]' AND `read` = '0'"),0) .')
</div>

<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/cabinet/settings.png" alt="" /> ') .'<a href="/user/settings.php">Настройки</a>
</div>

<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/cabinet/secure.png" alt="" /> ') .'<a href="/user/secure.php">Безопасность</a>
</div>


<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/cabinet/friends.png" alt="" /> ') .'<a href="/friends/index.php">Ваши друзья</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user_id` = '$user[id]' AND `active` = '1'"), 0) . (mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user_id` = '$user[id]' AND `active` = '0'"), 0) != 0?'/<span class="green">+'. mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user_id` = '$user[id]' AND `active` = '0'"), 0) .'</span>':NULL) .')
</div>

<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/cabinet/warn.png" alt="" /> ') .'<a href="/user/warn.php">Уведомления</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `warn` WHERE `user_id` = '$user[id]' AND `read` = '0'"),0) .')
</div>
';

echo '<div class="block">
&raquo; <a href="/">На главную</a>
</div>';

# Ноги модуля
require_once(HOME .'/incfiles/footer.php');

?>