Файл: lenta.php
Строк: 214
<?
require_once("core/core.php");
$location = 'В ленте';
switch (@$_GET['act']) {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Форум~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    case 'forum':
        $title = $title . ' :: Лента Форум';
        include 'head.php';
        echo '<div class="title"><center><a href = "lenta.php?">Лента</a> :: <b>Форум</b></center></div>';
        echo '<div class="nav">';
        echo '<a href = "lenta.php?">Все</a> | <b>Форум</b> | <a href = "lenta.php?act=blog">Дневники</a>
    | <a href = "lenta.php?act=foto">Фото</a>';
        echo '</div>';
        if ($u['setting_jurnal_list'])
            $count = $u['setting_jurnal_list']; else
            $count = 10;
        $all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `lenta_forum`"), 0);
        if ($all > 0) {
            $total = intval(($all - 1) / $count) + 1;
            $page = num($_GET['page']);
            if (empty($page) or $page < 0)
                $page = 1;
            if ($page > $total)
                $page = $total;
            $start = $page * $count - $count;
            echo '<div class="title">';
            $sort = $_GET['sort'];
            if ($sort == 'time') {
                $sortq = 'ASC';
                echo '<a href = "lenta.php?act=forum&sort=message&page=' . $page . '">Новые</a> | <b>Поcледние</b>';
            }
            if ($sort == 'message' || empty($sortq)) {
                $sort = 'message';
                $sortq = 'DESC';
                echo '<b>Новые</b> | <a href = "lenta.php?act=forum&sort=time&page=' . $page . '">Поcледние</a>';
            }
            echo '</div>';
            $result = mysql_query("SELECT * FROM `lenta_forum` ORDER BY `time` $sortq LIMIT $start, $count");
            while ($lenta = mysql_fetch_assoc($result)) {
                $user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $lenta["user"] . "'"));
                echo '<div class="div">';
                if ($lenta['new'] == 1)
                    echo '<span style="float: right; font-size: small; color: grey"><font color="red">New</font></span>';
                echo '' . ico($user['sex'], $user['admin'], $user['online']) . ' <a href = "page.php?id=' . $user['id'] . '"><b><font color="#79358c">' . $user['login'] . '</font></b></a>';
                echo '' . medal($user['rating']) . '';
                echo ' <small>' . vremya($lenta['time']) . '</small>';
                echo '<br/> ' . $lenta['text'] . '';
                echo '<br/>';
                if ($lenta['new'] == 1)
                    echo '</div>';
                if ($lenta['new'] == 1)
                    mysql_query("UPDATE `lenta_forum` SET `new` = 0 WHERE `id` = '" . $lenta['id'] . "'");
                echo '</div>';
            }
            echo '</div>';
            navigation($page, $total, 'lenta.php?act=forum&sort=' . $sort . '&');
        }else {
            echo '<div class="div">Нет новых событий!</div>';
        }
        echo '</div>';
        include 'foot.php';
        break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Дневники~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    case 'blog':
        $title = $title . ' :: Лента Дневники';
        include 'head.php';
        echo '<div class="title"><center><a href = "lenta.php?">Лента</a> :: <b>Дневники</b></center></div>';
        echo '<div class="nav">';
        echo '<a href = "lenta.php?">Все</a> | <a href = "lenta.php?act=forum">Форум</a> | <b>Дневники</b>
    | <a href = "lenta.php?act=foto">Фото</a>';
        echo '</div>';
        if ($u['setting_jurnal_list'])
            $count = $u['setting_jurnal_list']; else
            $count = 10;
        $all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `lenta_diary`"), 0);
        if ($all > 0) {
            $total = intval(($all - 1) / $count) + 1;
            $page = num($_GET['page']);
            if (empty($page) or $page < 0)
                $page = 1;
            if ($page > $total)
                $page = $total;
            $start = $page * $count - $count;
            echo '<div class="title">';
            $sort = $_GET['sort'];
            if ($sort == 'time') {
                $sortq = 'ASC';
                echo '<a href = "lenta.php?act=blog&sort=message&page=' . $page . '">Новые</a> | <b>Поcледние</b>';
            }
            if ($sort == 'message' || empty($sortq)) {
                $sort = 'message';
                $sortq = 'DESC';
                echo '<b>Новые</b> | <a href = "lenta.php?act=blog&sort=time&page=' . $page . '">Поcледние</a>';
            }
            echo '</div>';
            $result = mysql_query("SELECT * FROM `lenta_diary` ORDER BY `time` $sortq LIMIT $start, $count");
            while ($lenta = mysql_fetch_assoc($result)) {
                $user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $lenta["user"] . "'"));
                echo '<div class="div">';
                if ($lenta['new'] == 1)
                    echo '<span style="float: right; font-size: small; color: grey"><font color="red">New</font></span>';
                echo '' . ico($user['sex'], $user['admin'], $user['online']) . ' <a href = "page.php?id=' . $user['id'] . '"><b><font color="#79358c">' . $user['login'] . '</font></b></a>';
                echo '' . medal($user['rating']) . '';
                echo ' <small>' . vremya($lenta['time']) . '</small>';
                echo '<br/> ' . $lenta['text'] . '';
                echo '<br/>';
                if ($lenta['new'] == 1)
                    echo '</div>';
                if ($lenta['new'] == 1)
                    mysql_query("UPDATE `lenta_diary` SET `new` = 0 WHERE `id` = '" . $lenta['id'] . "'");
                echo '</div>';
            }
            echo '</div>';
            navigation($page, $total, 'lenta.php?act=blog&sort=' . $sort . '&');
        }else {
            echo '<div class="div">Нет новых событий!</div>';
        }
        echo '</div>';
        include 'foot.php';
        break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Фото~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    case 'foto':
        $title = $title . ' :: Лента фото';
        include 'head.php';
        echo '<div class="title"><center><a href = "lenta.php?">Лента</a> :: <b>Фото</b></center></div>';
        echo '<div class="nav">';
        echo '<a href = "lenta.php?">Все</a> | <a href = "lenta.php?act=forum">Форум</a> | 
    <a href = "lenta.php?act=blog">Дневники</a>
    | <b>Фото</b>';
        echo '</div>';
        if ($u['setting_jurnal_list'])
            $count = $u['setting_jurnal_list']; else
            $count = 10;
        $all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `lenta_foto`"), 0);
        if ($all > 0) {
            $total = intval(($all - 1) / $count) + 1;
            @$page = num($_GET['page']);
            if (empty($page) or $page < 0)
                $page = 1;
            if ($page > $total)
                $page = $total;
            @$start = $page * $count - $count;
            echo '<div class="title">';
            @$sort = $_GET['sort'];
            if ($sort == 'time') {
                $sortq = 'ASC';
                echo '<a href = "lenta.php?act=foto&sort=message&page=' . $page . '">Новые</a> | <b>Поcледние</b>';
            }
            if ($sort == 'message' || empty($sortq)) {
                $sort = 'message';
                $sortq = 'DESC';
                echo '<b>Новые</b> | <a href = "lenta.php?act=foto&sort=time&page=' . $page . '">Поcледние</a>';
            }
            echo '</div>';
            $result = mysql_query("SELECT * FROM `lenta_foto` ORDER BY `time` $sortq LIMIT $start, $count");
            while ($lenta = mysql_fetch_assoc($result)) {
                $user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $lenta["user"] . "'"));
                echo '<div class="div">';
                if ($lenta['new'] == 1)
                    echo '<span style="float: right; font-size: small; color: grey"><font color="red">New</font></span>';
                echo '' . ico($user['sex'], $user['admin'], $user['online']) . ' <a href = "page.php?id=' . $user['id'] . '"><b><font color="#79358c">' . $user['login'] . '</font></b></a>';
                echo '' . medal($user['rating']) . '';
                echo ' <small>' . vremya($lenta['time']) . '</small>';
                echo '<br/> ' . $lenta['text'] . '';
                echo '<br/>';
                if ($lenta['new'] == 1)
                    echo '</div>';
                if ($lenta['new'] == 1)
                    mysql_query("UPDATE `lenta_foto` SET `new` = 0 WHERE `id` = '" . $lenta['id'] . "'");
                echo '</div>';
            }
            echo '</div>';
            navigation($page, $total, 'lenta.php?act=blog&sort=' . $sort . '&');
        }else {
            echo '<div class="div">Нет новых событий!</div>';
        }
        echo '</div>';
        include 'foot.php';
        break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Все~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    default:
        $title = $title . ' :: Лента';
        include 'head.php';
        echo '<div class="title"><center> Лента </center></div>';
        echo '<div class="nav">';
        echo '<b>Все</b> | <a href = "lenta.php?act=forum">Форум</a> | <a href = "lenta.php?act=blog">Дневники</a>
    | <a href = "lenta.php?act=foto">Фото</a>';
        echo '</div>';
        if ($u['setting_jurnal_list'])
            $count = $u['setting_jurnal_list']; else
            $count = 10;
        $all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `lenta` "), 0);
        if ($all > 0) {
            $total = intval(($all - 1) / $count) + 1;
            @$page = num($_GET['page']);
            if (empty($page) or $page < 0)
                $page = 1;
            if ($page > $total)
                $page = $total;
            $start = $page * $count - $count;
            echo '<div class="title">';
            @$sort = $_GET['sort'];
            if ($sort == 'time') {
                $sortq = 'ASC';
                echo '<a href = "lenta.php?&sort=message&page=' . $page . '">Новые</a> | <b>Поcледние</b>';
            }
            if ($sort == 'message' || empty($sortq)) {
                $sort = 'message';
                $sortq = 'DESC';
                echo '<b>Новые</b> | <a href = "lenta.php?&sort=time&page=' . $page . '">Поcледние</a>';
            }
            echo '</div>';
            $result = mysql_query("SELECT * FROM `lenta` ORDER BY `time` $sortq LIMIT $start, $count");
            while ($lenta = mysql_fetch_assoc($result)) {
                $user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $lenta["user"] . "'"));
                echo '<div class="div">';
                if ($lenta['new'] == 1)
                    echo '<span style="float: right; font-size: small; color: grey"><font color="red">New</font></span>';
                echo '' . ico($user['sex'], $user['admin'], $user['online']) . ' <a href = "page.php?id=' . $user['id'] . '"><b><font color="#79358c">' . $user['login'] . '</font></b></a>';
                echo '' . medal($user['rating']) . '';
                echo ' <small>' . vremya($lenta['time']) . '</small>';
                echo '<br/> ' . $lenta['text'] . '';
                echo '<br/>';
                if ($lenta['new'] == 1)
                    echo '</div>';
                if ($lenta['new'] == 1)
                    mysql_query("UPDATE `lenta` SET `new` = 0 WHERE `id` = '" . $lenta['id'] . "'");
                echo '</div>';
            }
            echo '</div>';
            navigation($page, $total, 'lenta.php?&sort=' . $sort . '&');
        }else {
            echo '<div class="div">Нет новых событий!</div>';
        }
        echo '</div>';
        include 'foot.php';
        break;
}
?>