Файл: modules/diary/dnev_list.php
Строк: 107
<?php
/* Мод "Дневники"
* Версия v0.0.1
* Дата последнего редактирования 13.01.2015
* Двиг DCMS Special
* Модифицировал densnet
* Файл dnev_list.php
* Описание: дневник
*/
require_once '../../sys/inc/start.php';
require_once H . 'sys/inc/compress.php';
require_once H . 'sys/inc/sess.php';
require_once H . 'sys/inc/settings.php';
require_once H . 'sys/inc/db_connect.php';
require_once H . 'sys/inc/ipua.php';
require_once H . 'sys/inc/fnc.php';
require_once H . 'sys/inc/user.php';
if (isset($user)) {
$ank['id'] = $user['id'];
}
if (isset($_GET['id'])) {
$ank['id'] = intval($_GET['id']);
}
$ank = user::get_user($ank['id']);
$set['title'] = 'Дневники';
require_once H . 'sys/inc/thead.php';
title();
aut();
err();
echo "<div class = 'blok_text'>";
if ($ank['id'] == $user['id']) {
echo "<span style = 'float: right;' id = 'hide'>";
echo "<a href = 'add.php' title = 'Создать дневник'>" . img16('plus.png') . "</a>";
echo "</span>";
}
echo "Все записи <b>$ank[nick]</b>";
echo "</div>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `diary` WHERE `id_user` = '$ank[id]'"), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$lim = " LIMIT $start, $set[p_str]";
$q = mysql_query("SELECT * FROM `diary` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC $lim");
$diary = mysql_fetch_assoc(mysql_query("SELECT * FROM `diary` WHERE `id` = '$_GET[id]'"));
$dnev_avt = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$diary[id_user]'"));
if (mysql_num_rows($q) == 0) {
echo "<div class = 'errs'>";
echo img16('error.png') . " Нет результатов";
echo "</div>";
}
while ($dnev = mysql_fetch_assoc($q)) {
echo "<div class = 'razd'>";
if ($dnev['read'] == 0) {
echo "<span style = 'float: right;' id = 'hide'>";
echo date::time($dnev['time']);
echo "</span>";
echo img16('diary.png') . " <a href = 'dnev.php?id=$dnev[id]'>$dnev[name]</a> <a class = 'add'>" . img16('komm.png') . " " . mysql_result(mysql_query("SELECT COUNT(*) FROM `diary_komm` WHERE `id_dnev` = '$dnev[id]'"), 0) . "</a><br />";
}
if ($dnev['read'] == 1) {
$friends = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$user[id]' AND `friends` = '$dnev_avt[id]'"), 0);
if ($ank['id'] == $user['id'] || $friends != 0 || $user['level'] == 10) {
echo "<span style = 'float: right;' id = 'hide'>";
echo date::time($dnev['time']);
echo "</span>";
echo img16('diary.png') . " <a href = 'dnev.php?id=$dnev[id]'>$dnev[name]</a> <a class = 'add'>" . mysql_result(mysql_query("SELECT COUNT(*) FROM `diary_komm` WHERE `id_dnev` = '$dnev[id]'"), 0) . "</a><br />";
}
echo img16('lock.png') . " <font color = 'yellow'><b>Только друзьям</b></font>";
}
if ($dnev['read'] == 2) {
if ($user['id'] == $ank['id'] || $user['level'] == 10) {
echo "<span style = 'float: right;' id = 'hide'>";
echo date::time($dnev['time']);
echo "</span>";
echo "<a href = 'dnev.php?id=$dnev[id]'>$dnev[name]</a> <a class = 'add'>" . mysql_result(mysql_query("SELECT COUNT(*) FROM `dnev_kom` WHERE `id_dnev` = '$dnev[id]'"), 0) . "</a><br />";
}
echo img16('lock.png') . " <font color = 'yellow'><b>Личный</b></font>";
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `diary_komm` WHERE `id_dnev` = '$dnev[id]'"), 0) != 0) {
$post = mysql_fetch_assoc(mysql_query("SELECT * FROM `diary_komm` WHERE `id_dnev` = '$dnev[id]' ORDER BY `time` DESC LIMIT 1"));
$ank2 = user::get_user($post['id_user']);
echo "<br />" . img16('komm.png') . " Посл.: <a href='/info.php?id=$ank2[id]' title='Анкета "$ank2[nick]"'>$ank2[nick]</a> (" . date::time($post['time']) . ")<br />n";
}
echo "</div>n";
}
if ($k_page > 1) {
str('?id=' . $ank['id'] . '&', $k_page, $page);
}
require_once H . 'sys/inc/tfoot.php';