Файл: info.php
Строк: 419
<?php
/* DCMS Special
* Дата последнего редактирования 11.12.2015
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
require_once "sys/inc/{$inc}.php";
}
if (isset($user)) {
$ank['id'] = $user['id'];
}
if (isset($_GET['id'])) {
$ank['id'] = intval($_GET['id']);
}
only_reg('index.php');
if ($ank['id'] == 0) {
$ank = get_user($ank['id']);
$set['title'] = $ank['nick'] . ' - анкета ';
require_once 'sys/inc/thead.php';
aut();
echo "<div class='list-group-item'>";
echo "$ank[group_name]<br />n";
if ($ank['ank_about_me'] != NULL) {
echo "О себе: $ank[ank_about_me]<br />";
}
echo "</div>";
require_once 'sys/inc/tfoot.php';
exit;
}
$ank = get_user($ank['id']);
if (!$ank) {
header("Location: /index.php?" . SID);
exit;
}
$ank['rating'] = intval(@mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$ank[id]'"), 0));
$set['title'] = $ank['nick'] . ' - анкета '; // заголовок страницы
require_once 'sys/inc/thead.php';
if (isset($_GET['fav']) && isset($user)) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmark_user` WHERE `id_user` = '" . $user['id'] . "' AND `id_people` = '" . $ank['id'] . "' LIMIT 1"), 0) == 0 && $_GET['fav'] == 1) {
mysql_query("INSERT INTO `bookmark_user` (`id_people`, `id_user`, `time`) VALUES ('$ank[id]', '$user[id]', '$time')");
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmark_user` WHERE `id_user` = '" . $user['id'] . "' AND `id_people` = '" . $ank['id'] . "' LIMIT 1"), 0) == 1 && $_GET['fav'] == 0) {
mysql_query("DELETE FROM `bookmark_user` WHERE `id_user` = '$user[id]' AND `id_people` = '$ank[id]'");
}
header("Location: /info.php?id=$ank[id]");
exit;
}
aut();
#Добавляем рейтинг
if (isset($_POST['rating']) && isset($user) && $user['id'] != $ank['id'] && $user['money'] >= 50 && mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$user[id]'"), 0) >= 0) {
$new_r = min(max(@intval($_POST['rating']), -5), 5);
mysql_query("DELETE FROM `user_voice2` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]' LIMIT 1");
if ($new_r) {
mysql_query("INSERT INTO `user_voice2` (`rating`, `id_user`, `id_kont`) VALUES ('$new_r','$user[id]','$ank[id]')");
}
$ank['rating'] = intval(mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$ank[id]'"), 0));
mysql_query("UPDATE `user` SET `rating` = '$ank[rating]' WHERE `id` = '$ank[id]' LIMIT 1");
if ($new_r > 0) {
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `id_img`, `msg`, `time`) values('$user[id]', '$ank[id]', '1', '" . ($user['sex'] ? 'добавил' : 'добавила') . " Вам рейтинг', '$time')");
}
if ($new_r < 0) {
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `id_img`, `msg`, `time`) values('$user[id]', '$ank[id]', '1', '" . ($user['sex'] ? 'убавил' : 'убавила') . " Вам рейтинг', '$time')");
}
if ($new_r == 0) {
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `id_img`, `msg`, `time`) values('$user[id]', '$ank[id]', '1', '" . ($user['sex'] ? 'оставил' : 'оставила') . " нейтральный рейтинг', '$time')");
}
msg('Успешно выполнено');
}
$sql = mysql_query("SELECT * FROM `user_blacklist` WHERE `id_user` = '" . mysql_real_escape_string($ank['id']) . "' AND `id_ank` = '" . mysql_real_escape_string($user['id']) . "';");
if (mysql_num_rows($sql) != 0 AND $user['level'] < 3) {
echo "<div class='alert alert-danger'>Пользователь ограничил круг лиц, которые могут просматривать его страницу.</div>";
require_once 'sys/inc/tfoot.php';
exit;
}
if (isset($_POST['password'])) {
$set_cook = $_POST['password'];
setcookie("passprofile$ank[id]", $set_cook);
if (isset($_POST['password']) && $_POST['password'] == $ank['profile_password']) {
header("Location: ?id=$ank[id]");
}
}
if ($ank['profile_access'] == 'only_me') {
if ($ank['id'] == $user['id'] && isset($user) || $user['level'] >= 3) {
} else {
echo "<div class = 'alert alert-warning'><tr><td class = 'icon14'>";
avatar($ank['id'], '48');
echo "</td><td class = 'null'>";
echo "Доступ к профилю <b>$ank[nick]</b> закрыт.<br /><br />";
echo "<a href = '/user/mail/messageList.php?contact=$ank[id]' class = 'btn btn-default'><span class='fa fa-envelope fa-fw'></span> Сообщение</a> ";
if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$user[id]' AND `friends` = '$ank[id]'"), 0) == 0) {
echo "<a href='/user/friends/add.php?id=$ank[id]' class = 'btn btn-default'><span class='fa fa-user-plus fa-fw'></span> Добавить в друзья</a>";
} else {
echo "<a href='/user/friends/new.php?del=$ank[id]' class = 'btn btn-default'><span class='fa fa-user-times fa-fw'></span> Удалить из друзей</a>";
}
echo "</td></tr></div>";
require_once 'sys/inc/tfoot.php';
exit();
}
} elseif ($ank['profile_access'] == 'friends') {
if ($ank['id'] == $user['id'] && isset($user) || $user['level'] >= 3 || $ank['id'] == $user['id'] && isset($user) || isset($umodd) || mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE (`user` = '$user[id]' AND `friends` = '$ank[id]') OR (`user` = '$ank[id]' AND `friends` = '$user[id]')"), 0) != 0) {
} else {
echo "<div class = 'alert alert-warning'><tr><td class = 'icon14'>";
avatar($ank['id'], '48');
echo "</td><td class = 'null'>";
echo "Доступ к профилю <b>$ank[nick]</b> открыт только для друзей пользователя.<br /><br />";
echo "<a href = '/user/mail/messageList.php?contact=$ank[id]' class = 'btn btn-default'><span class='fa fa-envelope fa-fw'></span> Сообщение</a> ";
if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$user[id]' AND `friends` = '$ank[id]'"), 0) == 0) {
echo "<a href = '/user/friends/add.php?id=$ank[id]' class = 'btn btn-default'><span class='fa fa-user-plus fa-fw'></span> Добавить в друзья</a>";
} else {
echo "<a href = '/user/friends/new.php?del=$ank[id]' class = 'btn btn-default'><span class='fa fa-user-times fa-fw'></span> Удалить из друзей</a>";
}
echo "</td></tr></div>";
require_once 'sys/inc/tfoot.php';
exit();
}
} elseif ($ank['profile_access'] == 'pass') {
if (isset($_COOKIE["passprofile$ank[id]"]) && $_COOKIE["passprofile$ank[id]"] == $ank['profile_password'] || $ank['id'] == $user['id'] && isset($user) || $user['level'] >= 3) {
} else {
if (isset($_POST['password']) && $_POST['password'] != $ank['profile_password']) {
$err[] = "Пароль неправильный.";
}
err();
echo "<div class = 'alert alert-warning'><tr><td class = 'icon14'>";
avatar($ank['id'], '48');
echo "</td><td class = 'null'>";
echo "<form action='' method='post'>";
echo "Доступ к профилю <b>$ank[nick]</b> доступен только по паролю:<br/>";
echo "<div class='col-xs-5'><input name='password' class='form-control' type = 'password' value=''/></div>";
echo "<button class = 'btn btn-default' name = 'submited'>Войти</button>";
echo "</form><br />";
echo "<a href = '/user/mail/messageList.php?contact=$ank[id]' class = 'btn btn-default'><span class='fa fa-envelope fa-fw'></span> Сообщение</a> ";
if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$user[id]' AND `friends` = '$ank[id]'"), 0) == 0) {
echo "<a href = '/user/friends/add.php?id=$ank[id]' class = 'btn btn-default'><span class='fa fa-user-plus fa-fw'></span> Добавить в друзья</a>";
} else {
echo "<a href = '/user/friends/new.php?del=$ank[id]' class = 'btn btn-default'><span class='fa fa-user-times fa-fw'></span> Удалить из друзей</a>";
}
echo "</td></tr></div>";
require_once 'sys/inc/tfoot.php';
exit();
}
}
echo "<div class='card'>";
echo "<div class='card-header'>";
echo user($ank['id']);
echo "</div><div class='card-block'><center>";
avatar_p($ank['id'], '220');
if ($ank['welcome'] != NULL) {
echo "<div class = 'hello' style = 'padding-top: 0px!important;'>";
if (isset($user) && $user['id'] == $ank['id']) {
echo "<a href = '/user/anketa/?mod=information&ank'>";
}
echo "<div class = 'hell'><div class = 'hell-img'></div>";
echo "<small><i>" . toOutput($ank['welcome']) . "</i></small>";
echo "</div>";
if (isset($user) && $user['id'] == $ank['id']) {
echo "</a>";
}
echo "</div>";
}
if (is_file(H . "/user/avatar/$ank[id].gif") || is_file(H . "/user/avatar/$ank[id].jpg") || is_file(H . "/user/avatar/$ank[id].png")) {
$like = mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_like` WHERE `id_komm` = '$ank[id]' AND `like` = '1' "), 0);
$k_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_comments` WHERE `avatar_id` = $ank[id] ", $db), 0);
if ($like == 0) {
$l = null;
} else {
$l = mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_like` WHERE `id_komm` = '$ank[id]'"), 0);
}
if (isset($user) && $user['id'] != $ank['id']) {
$av = mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_like` WHERE `id_komm` = '$ank[id]' AND `id_user` = '$user[id]' AND `like` = '1' LIMIT 1"), 0);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_like` WHERE `id_komm` = '$ank[id]' AND `id_user` = '$user[id]' LIMIT 1"), 0) == 0) {
//echo 'Вам нравится "'.$ank['nick'].'"?<br />';
echo "<br /><span style='font-size: 16px;color: #7f7f7f;'>Вам нравится фото?</span><br />";
echo "<a href = '/user/avatar_like.php?id=$ank[id]&likes' class = 'btn btn-success' style = 'color: white;'><b>Да</b></a> ";
echo "<a href = '/user/avatar_like.php?id=$ank[id]&likess' class = 'btn btn-danger' style = 'color: white;'><b>Нет</b></a> ";
} else {
if ($av == 1) {
echo "<br /><font color='#6A9ACC'>Вам понравилась фотография</font>";
} else {
echo "<br /><font color='#6A9ACC'>Вам не понравилась фотография</font>";
}
echo "<br /><small style='color: grey;'>Оставьте свое <a href='/user/avatar_comm.php?id=$ank[id]'>мнение</a></small>";
}
}
if ($k_p == 0) {
$komms = null;
} else {
$komms = mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_comments` WHERE `avatar_id` = $ank[id] ", $db), 0);
}
//echo "<a href = '/user/avatar_comm.php?id=$ank[id]'><img src = '/style/icons/comment.png' /> <font color = '#7f7f7f'><b>Комментарии $komms</b></font></a> ";
$kum = @mysql_result(mysql_query("SELECT `id_user` FROM `avatar_like` WHERE `id_komm` = '$ank[id]'"), 0);
$kom = @mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='$kum' LIMIT 1"), 0);
$kem = $like - 1;
#Выводит тех, кому понравилась новость
if ($user['id'] == $kum) {
if ($like == 1) {
$vam = "Вам понравилось это фото";
} elseif ($like >= 2) {
$vam = "Вам и ещё <a href='/user/avatar_comm.php?id=$ank[id]&like_all'>" . sklon_text($kem, array('пользователю', 'пользователям', 'пользователям')) . "</a> понравилось это фото";
}
} else {
$vam = "<a href='/user/avatar_comm.php?id=$ank[id]&like_all'>" . sklon_text($like, array('пользователю', 'пользователям', 'пользователям')) . "</a> понравилось это фото";
}
if ($like == 1) {
echo "<div class = 'hr'></div>";
echo "<font color = '#B2B2B2'><i class='fa fa-heart fa-fw'></i> $vam</font>";
} elseif ($like >= 2) {
echo "<div class = 'hr'></div>";
echo "<font color = '#B2B2B2'><i class='fa fa-heart fa-fw'></i> $vam</font>";
}
} else {
if (isset($user) && $user['id'] == $ank['id']) {
echo "<div class = 'hr'></div>";
echo "<center><a href='/user/avatar.php' style='color:#B2B2B2;'><i class='fa fa-camera fa-fw'></i> Загрузить фото</a></center>";
}
}
echo "</center></div>";
if (isset($user) && $user['id'] != $ank['id']) {
echo "<ul class='list-group list-group-flush'>";
echo "<a href='/user/mail/messageList.php?contact=$ank[id]' class = 'list-group-item'><i class='fa fa-envelope fa-fw'></i> Сообщение</a>";
if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$user[id]' AND `friends` = '$ank[id]'"), 0) == 0) {
echo "<a href='/user/friends/add.php?id=$ank[id]' class = 'list-group-item'><i class='fa fa-user-plus fa-fw'></i> Добавить в друзья</a>";
} else {
echo "<a href='/user/friends/new.php?del=$ank[id]' class = 'list-group-item'><i class='fa fa-user-times fa-fw'></i> Убрать из друзей</a>";
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmark_user` WHERE `id_user` = '" . $user['id'] . "' AND `id_people` = '" . $ank['id'] . "' LIMIT 1"), 0) == 0) {
echo "<a href='?id=$ank[id]&fav=1' class = 'list-group-item'><i class='fa fa-bookmark-o fa-fw'></i> В закладки</a>";
} else {
echo "<a href='?id=$ank[id]&fav=0' class = 'list-group-item'><i class='fa fa-bookmark fa-fw'></i> Убрать из закладок</a>";
}
if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user_blacklist` WHERE `id_user` = '$user[id]' AND `id_ank` = '$ank[id]'"), 0) == 0) {
echo "<a href='/user/blacklist/?add=$ank[id]' class = 'list-group-item'><i class='fa fa-ban fa-fw'></i> Заблокировать</a>";
}
echo "</ul>";
}
$razdel = (isset($_GET['act'])) ? htmlspecialchars($_GET['act']) : null;
switch ($razdel) {
case 'wall':
echo "<div class='card-block'>";
echo "<ul class='nav nav-tabs'>";
echo "<li class='nav-item'><a class='nav-link' href='/info.php?id=$ank[id]'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link active'>Стена</a></li>";
echo "</ul>";
echo "</div>";
require_once 'user/wall/index.php';
break;
default:
echo "<div class='card-block'>";
echo "<ul class='nav nav-tabs'>";
echo "<li class='nav-item'><a class='nav-link active'>Профиль</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='/info.php?id=$ank[id]&act=wall'>Стена</a></li>";
echo "</ul>";
echo "</div>";
require_once 'user/menu.php';
break;
}
if (isset($user) && $user['id'] != $ank['id'] && $user['money'] >= 50 && mysql_result(mysql_query("SELECT SUM(`rating`) FROM `user_voice2` WHERE `id_kont` = '$user[id]'"), 0) >= 0) {
$my_r = intval(@mysql_result(mysql_query("SELECT `rating` FROM `user_voice2` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]'"), 0));
echo "<form method='post' class='card-block' style='margin-top: -5px;' action='?id=$ank[id]&$passgen'>n";
echo '<div class="col-xs-6">';
echo '<div class="input-group"><span class="input-group-addon"><span class="fa fa-bar-chart fa-fw"></span></span>';
echo "<select class='form-control' name='rating'>n";
echo "<option value='5' " . ($my_r == 5 ? 'selected="selected"' : null) . "> +5 </option>n";
echo "<option value='4' " . ($my_r == 4 ? 'selected="selected"' : null) . "> +4 </option>n";
echo "<option value='3' " . ($my_r == 3 ? 'selected="selected"' : null) . "> +3 </option>n";
echo "<option value='2' " . ($my_r == 2 ? 'selected="selected"' : null) . "> +2 </option>n";
echo "<option value='1' " . ($my_r == 1 ? 'selected="selected"' : null) . "> +1 </option>n";
echo "<option value='0' " . ($my_r == 0 ? 'selected="selected"' : null) . "> 0 </option>n";
echo "<option value='-1' " . ($my_r == -1 ? 'selected="selected"' : null) . "> -1 </option>n";
echo "<option value='-2' " . ($my_r == -2 ? 'selected="selected"' : null) . "> -2 </option>n";
echo "<option value='-3' " . ($my_r == -3 ? 'selected="selected"' : null) . "> -3 </option>n";
echo "<option value='-4' " . ($my_r == -4 ? 'selected="selected"' : null) . "> -4 </option>n";
echo "<option value='-5' " . ($my_r == -5 ? 'selected="selected"' : null) . "> -5 </option>n";
echo "</select></div></div>n";
echo "<button class='btn btn-default'><span class='fa fa-check fa-fw'></span></button>";
echo "</form>n";
}
echo "</div>";
require_once 'sys/inc/tfoot.php';