Файл: sys/fnc/aut.php
Строк: 178
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 18.10.2015
* Модифицировал densnet
*/
function aut() {
global $set;
$rekl = mysql_result(mysql_query("SELECT COUNT(*) FROM `rekl` WHERE `sel` = '1'"), 0);
if ($rekl > 0) {
echo "<div class = 'rekl'>n";
rekl(1);
echo "</div>n";
}
global $user;
if (isset($user)) {
if (@$_GET['del'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `mess` WHERE `id` = '" . intval($_GET['del']) . "'"), 0) == 1) {
$post = mysql_fetch_assoc(mysql_query("SELECT * FROM `mess` WHERE `id` = '" . intval($_GET['del']) . "' LIMIT 1"));
mysql_query("DELETE FROM `mess` WHERE `id` = '$post[id]'");
}
$q = mysql_result(mysql_query("SELECT COUNT(*) FROM `mess` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
if ($q != 0) {
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mess` WHERE `id_kont` = '" . $user['id'] . "'"), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$qis = mysql_query("SELECT * FROM `mess` WHERE `id_kont` = '" . $user['id'] . "' ORDER BY id DESC LIMIT 1");
while ($post = mysql_fetch_array($qis)) {
echo "<div class = 'new'>";
echo "<div style = 'float:right' id = 'hide'>";
echo "<a href = '?del=$post[id]' title = 'Удалить'><img src = '/style/icons/del.png' /></a>";
echo "</div>";
echo "<img src = '/style/icons/mail.png' /> " . text::toOutput($post['msg']) . "<br />";
echo "</div>";
}
}
$mail = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_user` = '$user[id]' AND `type` = 'to' AND `read` = '0'"), 0);
$jn = mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
$jns = mysql_result(mysql_query("SELECT COUNT(*) FROM `notifications` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
$friends = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends_new` WHERE `to` = '$user[id]'"), 0);
$not = $jn + $jns + $mail + $friends;
$not_count = $jn + $jns;
if ($not == 0) {
} else {
echo "<div class = 'comm1 even'>";
echo "<center>Новые события</center>";
echo "</div><div class = 'comm2'>";
#уведомления о сообщениях
if ($mail != 0) {
$q = mysql_query("SELECT * FROM `mail_conts` WHERE `id_user` = '$user[id]' ORDER BY `time_last` DESC, `count` DESC LIMIT 50");
while ($post = mysql_fetch_array($q)) {
$post['count_in'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_cont` = '$post[id]' AND `type` = 'to'"), 0);
$post['count_out'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_cont` = '$post[id]' AND `type` = 'at'"), 0);
$ank = user::get_user($post['id_ank']);
if ($post['count'] != 0) {
echo "<a href = '/user/mail/'><img src = '/style/icons/mail.png' /><font color = '#88C057'> ";
if ($ank['sex'] == 1) {
$sex = "написал";
} else {
$sex = "написала";
}
echo text::gradient("$ank[nick]", "$ank[ncolor]", "$ank[ncolor2]");
echo " $sex Вам ";
echo sklon_text($post['count'], array('сообщение', 'сообщения', 'сообщений')) . "";
echo "</font></a><br />";
}
}
}
if ($jn || $jns > 0) {
#id_img
#1 - Рейтинг
#2 - Комментарии, цитирование
#3 - Рассылка в журнал
#4 - Дневники
$q = mysql_query("SELECT * FROM `notification` WHERE `id_kont` = '$user[id]' AND `read`='0' AND `id_img` = '1' ORDER BY `id` DESC LIMIT 3");
while ($post = mysql_fetch_assoc($q)) {
$ank = user::get_user($post['id_user']);
echo "<a href = '/user/notification.php'><img src = '/style/icons/rat.png' /><font color = '#88C057'> ";
echo text::gradient("$ank[nick]", "$ank[ncolor]", "$ank[ncolor2]");
echo " ";
echo text::toOutput($post['msg']);
echo " <font color = 'grey'><small>(" . date::times($post['time']) . ")</small></font>";
echo "</font></a><br />";
}
$q = mysql_query("SELECT * FROM `notification` WHERE `id_kont` = '$user[id]' AND `read`='0' AND `id_img` = '2' ORDER BY `id` DESC LIMIT 3");
while ($post = mysql_fetch_assoc($q)) {
$ank = user::get_user($post['id_user']);
echo "<a href = '/user/notification.php'><img src = '/style/icons/cit.png' /> ";
echo text::gradient("$ank[nick]", "$ank[ncolor]", "$ank[ncolor2]");
echo " ";
echo text::toOutput($post['msg']);
echo " <font color = 'grey'><small>(" . date::times($post['time']) . ")</small></font>";
echo "</a><br />";
}
$q = mysql_query("SELECT * FROM `notification` WHERE `id_kont` = '$user[id]' AND `read`='0' AND `id_img` = '3' ORDER BY `id` DESC LIMIT 3");
while ($post = mysql_fetch_assoc($q)) {
$ank = user::get_user($post['id_user']);
echo "<a href = '/user/notification.php'><img src = '/style/icons/mess.png' /> ";
echo text::gradient("$ank[nick]", "$ank[ncolor]", "$ank[ncolor2]");
echo " ";
echo text::toOutput($post['msg']);
echo " <font color = 'grey'><small>(" . date::times($post['time']) . ")</small></font>";
echo "</a><br />";
}
$q = mysql_query("SELECT * FROM `notification` WHERE `id_kont` = '$user[id]' AND `read`='0' AND `id_img` = '4' ORDER BY `id` DESC LIMIT 3");
while ($post = mysql_fetch_assoc($q)) {
$ank = user::get_user($post['id_user']);
echo "<a href = '/user/notification.php'><img src = '/style/icons/mail.png' />" . img('book.png', '') . " ";
echo text::gradient("$ank[nick]", "$ank[ncolor]", "$ank[ncolor2]");
echo " ";
echo text::toOutput($post['msg']);
echo " <font color = 'grey'><small>(" . date::times($post['time']) . ")</small></font>";
echo "</a><br />";
}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `friends_new` WHERE `to` = '$user[id]' LIMIT 1"), 0) > 0) {
$q = mysql_query("SELECT * FROM `friends_new` WHERE `to` = '$user[id]' ORDER BY time DESC");
while ($f = mysql_fetch_array($q)) {
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '" . $f['user'] . "' LIMIT 5"));
echo "<a href='/user/friends/new.php'><img src = '/style/icons/plus.png' /><font color = '#88C057'> ";
echo text::gradient("$ank[nick]", "$ank[ncolor]", "$ank[ncolor2]");
echo " хочет добавить Вас в друзья <font color = 'grey'><small>(" . date::times($f['time']) . ")</small></font>";
echo "</font></a><br />";
}
}
echo "</div>";
}
echo "<table class = 'auts'><tr><td class = 'icon14'><a href='/info.php'>";
echo "<img class='Photo' src='/sys/avatar/";
if (is_file(H . "sys/avatar/$user[id].gif")) {
echo "$user[id].gif";
} elseif (is_file(H . "sys/avatar/$user[id].jpg")) {
echo "$user[id].jpg";
} elseif (is_file(H . "sys/avatar/$user[id].png")) {
echo "$user[id].png";
} else {
if ($user['sex'] == 0) {
$sex = 'zh.jpg';
} else {
$sex = 'm.jpg';
}
echo "$sex";
}
echo "' /></a>";
echo "</td><td class = 'null'><a href='/info.php'><span class='Name'>";
echo text::gradient("$user[nick]", "$user[ncolor]", "$user[ncolor2]");
echo "</span></a><br />";
if ($user['welcome'] != NULL) {
echo "<small><i>" . text::toOutput($user['welcome']) . "</i></small><br />";
}
echo "</td><td class = 'null'><a href = '/umenu.php' title = 'Кабинет'><span style = 'float:right;'>";
echo "<img src = '/style/icons/Settings1.png' alt = '' />";
echo "</span></tr></table>";
} else {
echo '<div class="busi_switcher"><table><tr><td style = "width: 50%;">';
echo "<a href = '/aut.php' style = 'color: #6FA1A5;background-color: #dee7ea;border: 1px solid #689599;border-radius: 2px;'><b>Авторизация</b></a>";
echo '</td><td style = "width: 50%;">';
echo "<a style = 'color: #6FA1A5;background-color: #dee7ea;border: 1px solid #689599;border-radius: 2px;' href = '/reg.php'><b>Регистрация</b></a>";
echo '</td></tr></table></div>';
}
}