Файл: user/profile/menu.php
Строк: 247
<?php
/* Мод "Профиль"
* Версия v0.0.1
* Дата последнего редактирования 21.11.2014
* Двиг DCMS Special
* Модифицировал densnet
* Файл menu.php
* Описание: выводит меню пользователя, вывод друзей и тд
*/
$i = 0;
$inc_foto = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_user` = '$ank[id]' ORDER BY `id` DESC"), 0);
$foto_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '$ank[id]'"), 0);
$foto_count_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '$ank[id]' AND `time` > '" . (time() - 86400) . "'", $db), 0);
$foto_photo = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_user` = '$ank[id]'"), 0);
$users = mysql_result(mysql_query("SELECT COUNT(id_user) FROM `bookmark_user` WHERE `id_user` = '" . $ank['id'] . "'"), 0);
$fotos = mysql_result(mysql_query("SELECT COUNT(id_user) FROM `bookmark_foto` WHERE `id_user` = '" . $ank['id'] . "'"), 0);
if (IS_WEB) {
$photo = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '$ank[id]' ORDER BY `id` DESC LIMIT 10");
} else {
$photo = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '$ank[id]' ORDER BY `id` DESC LIMIT 5");
}
$bookmark_count = $users + $fotos;
$diary_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `diary` WHERE `id_user` = '$ank[id]'"), 0);
$diary_count_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `diary` WHERE `id_user` = '$ank[id]' AND `time` > '" . (time() - 86400) . "'", $db), 0);
$file = mysql_result(mysql_query("SELECT COUNT(*) FROM `files` WHERE `id_user` = '$ank[id]' AND `type2` = 'file' AND `cat` = 'files'"), 0);
$mail = mysql_result(mysql_query("SELECT COUNT(DISTINCT `mail`.`id_user`) 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 = 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);
if ($k_new == 0) {
$k_new = "нет";
} else {
$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);
}
$count_gifts = mysql_num_rows(mysql_query("SELECT * FROM `gifts` WHERE `id_user` = '$ank[id]'"));
if ($count_gifts > 0) {
echo "<div class = 'razd'>";
}
$query = mysql_query("SELECT * FROM `gifts` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC LIMIT 6");
while ($post = mysql_fetch_array($query)) {
$gift = mysql_fetch_array(mysql_query("SELECT * FROM `gift` WHERE `id` = '$post[id_gift]'"));
echo "<a href = '/modules/gifts/?id=$ank[id]&gift=$post[id]' style = 'margin-right:4px;'><img src = '/modules/gifts/images/$gift[image]' width = '30' height = '30' /></a>n";
}
if ($count_gifts > 6) {
echo " <a href = '/modules/gifts/?id=$ank[id]' style = 'margin-left: 4px;text-decoration: none;'><span style = 'font-size: large;text-decoration: none;vertical-align: bottom;'>»</span></a>";
}
if ($count_gifts > 0) {
echo "</div>";
}
if ($inc_foto > 0) {
echo "<div class = 'razd'>";
while ($photos = mysql_fetch_assoc($photo)) {
echo "<a href = '/modules/foto/$ank[id]/$photos[id_gallery]/$photos[id]/'><img style = 'margin: 2px;border: 1px solid #C9C9C9;border-radius: 4px;' src='/modules/foto/foto48/$photos[id].$photos[ras]' alt=''/></a>";
}
echo "</div>";
}
#Ваша информация анкетная
if (isset($user)) {
echo "<a href = '/user/anketa/?name=$ank[nick]'>";
if (isset($user) && $user['id'] == $ank['id']) {
echo "<div class = 'razd'>" . img('us.png') . " Моя информация ";
} else {
echo "<div class = 'razd'>" . img('us.png') . " Информация о пользователе ";
}
if (isset($user) && $user['id'] == $ank['id']) {
echo "<span style = 'float:right;' id = 'hides'>";
echo "<a class = 'count' href = '/user/anketa/setting.php'>ред</a>";
echo "</span>";
}
echo "</div></a>";
}
#Сообщения
if (isset($user) && $user['id'] == $ank['id']) {
echo "<a href = '/mails.php'>";
echo "<div class = 'razd'>" . img('mails.png') . " Мои сообщения ";
echo "<span style = 'float:right;'><a class = 'count'>$k_new</a></span></div></a>";
}
#Фотоальбомы
echo "<a href = '/modules/foto/$ank[id]/'>";
echo "<div class = 'razd'>" . img('photo_album.png') . " Фотографии ";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$foto_count <font color = 'red'>+$foto_count_new</font></a> <a class = 'count'>$foto_photo фото</a>";
echo "</span></div></a>";
#Дневники
echo "<a href = '/modules/diary/?id=$ank[id]'>";
echo "<div class = 'razd'>" . img('book.png') . " Дневники ";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$diary_count <font color = 'red'>+$diary_count_new</font></a>";
echo "</span></div></a>";
if (isset($user) && $user['id'] == $ank['id']) {
#Черный список
echo "<a href = '/user/blacklist/'><div class = 'razd'>" . img('black.png') . " Черный список</div></a>";
}
#Файлы
echo "<a href = '/user/files/?user=$ank[id]'>";
echo "<div class = 'razd'>" . img('file.png') . " Файлы ";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$file</a>";
echo "</span></div></a>";
#Закладки
echo "<a href = '/user/bookmark/?id=$ank[id]'>";
echo "<div class = 'razd'>" . img('bookmark.png') . " Закладки ";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$bookmark_count</a>";
echo "</span></div></a>";
#Друзья
$k_fr = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
$k_fr_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$ank[id]' AND `time` > '" . (time() - 86400) . "'", $db), 0);
echo "<a href = '/user/friends/?id=$ank[id]'>";
echo "<div class = 'razd'>" . img('users.png') . " Друзья ";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$k_fr <font color = 'red'>+$k_fr_new</font></a>";
echo "</span></div></a>";
if (isset($user) && $user['id'] == $ank['id']) {
$guest_user = mysql_result(mysql_query("SELECT COUNT(*) FROM `myguests` WHERE `id_ank` = '$ank[id]'"), 0);
$guest_user_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `myguests` WHERE `id_ank` = '$ank[id]' AND `time` > '" . (time() - 86400) . "'", $db), 0);
echo "<a href = '/user/guests.php'>";
echo "<div class = 'razd'>" . img('guest.png') . " Мои гости ";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$guest_user <font color = 'red'>+$guest_user_new</font></a>";
echo "</span></div></a>";
$notification = mysql_result(mysql_query("SELECT COUNT(`read`) FROM `notification` WHERE `id_kont` = '$user[id]'"), 0);
$notification_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id_kont` = '$user[id]' AND `time` > '" . (time() - 86400) . "'", $db), 0);
echo "<a href = '/user/notification.php'>";
echo "<div class = 'razd'>" . img('notification.png') . " Мои уведомления ";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$notification <font color = 'red'>+$notification_new</font></a>";
echo "</span></div></a>";
}
#Видно другому пользователю, вам не видно
if (isset($user) && $user['id'] != $ank['id']) {
if (isset($user) && $user['level'] > $ank['level'] && $user['id'] != $ank['id']) {
echo "<div class = 'razd clear_fix'><div class = 'dropdown'>";
echo "<a href = '#' class = 'button'><span class = 'icon icon96' /><span class = 'label'>Администрирование</span><span class = 'toggle'></span></a>";
echo "<div class = 'dropdown-slider'>";
if (user::access('user_prof_edit')) {
echo "<a href = '/adm_panel/user.php?id=$ank[id]' class = 'ddm'><span class = 'icon icon145' /><span class = 'label'>Редактировать</span></a>";
}
if (user::access('user_ban_set') || user::access('user_ban_set_h') || user::access('user_ban_unset')) {
echo "<a href = '/adm_panel/ban.php?id=$ank[id]' class = 'ddm negative'><span class = 'icon icon168' /><span class = 'label'>Дать бан</span></a>";
}
if (user::access('user_delete')) {
echo "<a href = '/adm_panel/delete_user.php?id=$ank[id]' class = 'ddm'><span class = 'icon icon58' /><span class = 'label'>Удалить</span></a>";
$mass[0] = $ank['id'];
if (user::access('user::collisions') && count(user::collision($mass, 1)) > 1) {
echo "<a href = '/adm_panel/delete_user.php?id=$ank[id]&all' class = 'ddm'><span class = 'icon icon58' /><span class = 'label'>Удалить все уч. записи</span></a>";
}
}
if (user::access('adm_log_read') && $ank['level'] && ($ank['id'] == $user['id'] || $ank['level'] < $user['level'])) {
echo "<a href = '/adm_panel/adm_log.php?id=$ank[id]' class = 'ddm negative'><span class = 'icon icon142' /><span class = 'label'>Отчет действий</span></a>";
}
echo "</div></div></div>";
}
}