Файл: user/profile/menu.php
Строк: 207
<?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 `user_files` WHERE `id_user` = '$ank[id]'"),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'>" . img16('ank.png') . " Моя информация ";
} else {
echo "<div class = 'razd'>" . img16('ank.png') . " Информация о пользователе ";
}
if (isset($user) && $user['id'] == $ank['id']) {
echo "<span style = 'float:right;' id = 'hides'>";
echo "<a class = 'add' 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'>" . img16('mail.png') . " Мои сообщения ";
echo "<span style = 'float:right;'><a class = 'add'>$k_new</a></span></div></a>";
}
#Фотоальбомы
echo "<a href = '/modules/foto/$ank[id]/'>";
echo "<div class = 'razd'>" . img16('photo.png') . " Фотографии ";
echo "<span style = 'float:right;'>";
echo "<a class = 'add'>$foto_count <font color = 'Chartreuse'>+$foto_count_new</font></a> <a class = 'add'>$foto_photo фото</a>";
echo "</span></div></a>";
#Дневники
echo "<a href = '/modules/diary/?id=$ank[id]'>";
echo "<div class = 'razd'>" . img16('book.png') . " Дневники ";
echo "<span style = 'float:right;'>";
echo "<a class = 'add'>$diary_count <font color = 'Chartreuse'>+$diary_count_new</font></a>";
echo "</span></div></a>";
if (isset($user) && $user['id'] == $ank['id']) {
#Черный список
echo "<a href = '/user/blacklist/'><div class = 'razd'>" . img16('blacklist.png') . " Черный список</div></a>";
}
#Файлы
echo "<a href = '/user/files/?user=$ank[id]'>";
echo "<div class = 'razd'>" . img16('files.png') . " Файлы ";
echo "<span style = 'float:right;'>";
echo "<a class = 'add'>$file</a>";
echo "</span></div></a>";
#Закладки
echo "<a href = '/user/bookmark/?id=$ank[id]'>";
echo "<div class = 'razd'>" . img16('star.png') . " Закладки ";
echo "<span style = 'float:right;'>";
echo "<a class = 'add'>$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'>" . img16('users.png') . " Друзья ";
echo "<span style = 'float:right;'>";
echo "<a class = 'add'>$k_fr <font color = 'Chartreuse'>+$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'>" . img16('eye.png') . " Мои гости ";
echo "<span style = 'float:right;'>";
echo "<a class = 'add'>$guest_user <font color = 'Chartreuse'>+$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'>" . img16('not.png') . " Мои уведомления ";
echo "<span style = 'float:right;'>";
echo "<a class = 'add'>$notification <font color = 'Chartreuse'>+$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'>";
if (user::access('user_prof_edit')) {
echo "<a href = '/adm_panel/user.php?id=$ank[id]' class = 'add'>" . img16('set.png') . " Редактировать</a>";
}
if (user::access('user_ban_set') || user::access('user_ban_set_h') || user::access('user_ban_unset')) {
echo "<br /><br /><a href = '/adm_panel/ban.php?id=$ank[id]' class = 'add'>" . img16('kodex.png') . " Дать бан</a>";
}
if (user::access('user_delete')) {
echo "<br /><br /><a href = '/adm_panel/delete_user.php?id=$ank[id]' class = 'add'>" . img16('musor.png') . " Удалить</a>";
$mass[0] = $ank['id'];
if (user::access('user::collisions') && count(user::collision($mass, 1)) > 1) {
echo "<br /><br /><a href = '/adm_panel/delete_user.php?id=$ank[id]&all' class = 'add'>" . img16('musor.png') . " Удалить все уч. записи</a>";
}
}
if (user::access('adm_log_read') && $ank['level'] && ($ank['id'] == $user['id'] || $ank['level'] < $user['level'])) {
echo "<br /><br /><a href = '/adm_panel/adm_log.php?id=$ank[id]' class = 'add'>" . img16('not.png') . " Отчет действий</a>";
}
echo "</div>";
}
}