Файл: modules/forum/view/new_themes.php
Строк: 48
<?php
/* DCMS S (Special)
 * Версия файла 0.0.1
 * Дата последнего редактирования 23.11.2015
 * Модифицировал densnet
 * Автор yadalay
 */
$set['title'] = 'Новые темы';
$k_post = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_themes` WHERE `time` > ' . (time() - 60 * 60 * 24)), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
if ($k_post == 0) {
    echo "<div class='card-block'>";
    echo "<span class='fa fa-info-circle'></span> Нет результатов";
    echo "</div>";
} else {
    $themes = mysql_query('SELECT * FROM `forum_themes` WHERE `time` > ' . (time() - 60 * 60 * 24) . ' ORDER BY `id` DESC LIMIT ' . $start . ', ' . $set['p_str']);
    while ($theme = mysql_fetch_object($themes)) {
        $creater = mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $theme->id_user));
        $razdel = mysql_fetch_object(mysql_query('SELECT `id`, `id_forum` FROM `forum_razdels` WHERE `id` = ' . $theme->id_razdel));
        $forum = mysql_fetch_object(mysql_query('SELECT `id` FROM `forum` WHERE `id` = ' . $razdel->id_forum));
        $count_posts = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id_theme` = ' . $theme->id), 0);
        $hide = (user::access('forum_post_ed')) ? NULL : '`hide` = "0" AND';
        $last_post = mysql_fetch_object(mysql_query('SELECT `id`, `hide`, `id_user`, `time` FROM `forum_posts` WHERE ' . $hide . ' `id_theme` = ' . $theme->id . ' ORDER BY `id` DESC'));
        $who = ($last_post && $last_post->id_user != 0) ? mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $last_post->id_user)) : array();
        $who_id = ($last_post && $last_post->id_user != 0) ? $who->id : 0;
        $who_nick = ($last_post && $last_post->id_user != 0) ? $who->nick : 'Система';
        if ($theme->reason_close != NULL) {
            $type = "<span class='fa fa-file-text'></span> " . text::toOutput($theme->name, 1, 1, 0, 0, 0) . " <span class='fa fa-lock'></span>";
        } elseif ($theme->type == 1) {
            $type = "<span class='fa fa-file-text'></span> " . text::toOutput($theme->name, 1, 1, 0, 0, 0) . " <span class='fa fa-paperclip'></span>";
        } else {
            $type = "<span class='fa fa-file-text'></span> " . text::toOutput($theme->name, 1, 1, 0, 0, 0) . "";
        }
        echo "<div class='card-block' style='border-bottom: 1px solid #dcdee3;'>";
        echo "<span style = 'float:right;'>";
        echo "<span class='fa fa-comment'></span> $count_posts";
        echo "</span>";
        echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html'>$type</a>";
        echo "    <span style = 'color: #9197a3;' title='" . date::time($theme->time) . "'>" . date::timek($theme->time) . "</span><br />";
        if ($last_post) {
            echo "Автор: <a href = '/info.php?id=$theme->id_user'>$creater->nick</a> | Посл.:</b> <a href = '/info.php?id=$who_id'>$who_nick</a> <small style = 'color: #9197a3;'>" . date::timek($last_post->time) . "</small><br />";
        } else {
            $continue = (mb_strlen($theme->description) > 150) ? '.....' : NULL;
            echo text::toOutput(mb_substr($theme->description, 0, 150), 1, 1, 0, 1, 1) . $continue;
        }
        echo "</div>";
    }
    if ($k_page > 1) {
        str('/modules/forum/new_themes/', $k_page, $page);
    }
}
echo "<div class = 'card-block'><a href = '" . DIR_FORUM . "'><span class='fa fa-arrow-left'></span> Вернуться в форум</a></div>";