Visman 8 năm trước cách đây
mục cha
commit
0a71fc6cb6

+ 6 - 1
app/Controllers/Routing.php

@@ -78,9 +78,14 @@ class Routing
             }
 
             // разделы
+            $r->add('GET', '/forum/{id:[1-9]\d*}/new/topic', 'Post:newTopic', 'NewTopic');
             $r->add('GET', '/forum/{id:[1-9]\d*}[/{name}][/page/{page:[1-9]\d*}]', 'Forum:view', 'Forum');
             // темы
-            $r->add('GET', '/post/{id:[1-9]\d*}#p{id}', 'Topic:viewpost', 'viewPost');
+            $r->add('GET', '/topic/{id:[1-9]\d*}[/{name}][/page/{page:[1-9]\d*}]', 'Topic:view', 'Topic');
+            $r->add('GET', '/topic/{id:[1-9]\d*}/go_to/new', 'Topic:goToNew', 'TopicGoToNew');
+            $r->add('GET', '/topic/{id:[1-9]\d*}/go_to/unread', 'Topic:goToUnread', 'TopicGoToUnread');
+            // сообщения
+            $r->add('GET', '/post/{id:[1-9]\d*}#p{id}', 'Topic:viewPost', 'ViewPost'); //????
 
         }
         // админ и модератор

+ 53 - 0
app/Core/Func.php

@@ -59,4 +59,57 @@ class Func
         }
         return $this->langs;
     }
+
+    /**
+     * @param int $all
+     * @param int $cur
+     * @param string $marker
+     * @param array $args
+     * @return array 
+     */
+    public function paginate($all, $cur, $marker, array $args = []) 
+    {
+        $pages = [];
+        if ($all < 2) {
+            $pages[] = [null, 1, true];
+        } else {
+            if ($cur > 0) {
+                $cur = min(max(1, $cur), $all);
+                if ($cur === 2) {
+                    $pages[] = [$this->c->Router->link($marker, $args), 'prev', null];
+                } elseif ($cur > 2) {
+                    $pages[] = [$this->c->Router->link($marker, ['page' => $cur - 1] + $args), 'prev', null];
+                }
+                $tpl = [1 => 1];
+                $start = $cur < 6 ? 2 : $cur - 2;
+                $end = $all - $cur < 5 ? $all : $cur + 3;
+                for ($i = $start; $i < $end; ++$i) {
+                    $tpl[$i] = $i;
+                }
+                $tpl[$all] = $all;
+            } else {
+                $tpl = $all < 7 
+                    ? array_slice([2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6], 0, $all - 1)
+                    : [2 => 2, 3 => 3, 4 => 4, $all => $all];
+            }
+            $k = 1;
+            foreach ($tpl as $i) {
+                if ($i - $k > 1) {
+                    $pages[] = [null, 'space', null];
+                }
+                if ($i === $cur) {
+                    $pages[] = [null, $i, true];
+                } elseif ($i === 1) {
+                    $pages[] = [$this->c->Router->link($marker, $args), $i, null];
+                } else {
+                    $pages[] = [$this->c->Router->link($marker, ['page' => $i] + $args), $i, null];
+                }
+                $k = $i;
+            }
+            if ($cur > 0 && $cur < $all) {
+                $pages[] = [$this->c->Router->link($marker, ['page' => $cur + 1] + $args), 'next', null];
+            }
+        }
+        return $pages;
+    }
 }

+ 67 - 19
app/Models/Pages/Forum.php

@@ -23,10 +23,11 @@ class Forum extends Page
      */
     public function view(array $args)
     {
-        $this->c->Lang->load('index');
+        $this->c->Lang->load('forum');
         $this->c->Lang->load('subforums');
 
         list($fTree, $fDesc, $fAsc) = $this->c->forums;
+
         // раздел отсутствует в доступных
         if (empty($fDesc[$args['id']])) {
             return $this->c->Message->message('Bad request');
@@ -47,14 +48,14 @@ class Forum extends Page
             ':gid' => $user->groupId,
         ];
         if ($user->isGuest) {
-            $sql = 'SELECT f.forum_name, f.moderators, f.num_topics, f.sort_by, 0 AS is_subscribed FROM ::forums AS f WHERE f.id=?i:fid';
+            $sql = 'SELECT f.moderators, f.num_topics, f.sort_by, 0 AS is_subscribed FROM ::forums AS f WHERE f.id=?i:fid';
         } else {
-            $sql = 'SELECT f.forum_name, f.moderators, f.num_topics, f.sort_by, s.user_id AS is_subscribed, mof.mf_upper, mof.mf_lower FROM ::forums AS f LEFT JOIN ::forum_subscriptions AS s ON (f.id=s.forum_id AND s.user_id=?i:uid) LEFT JOIN ::mark_of_forum AS mof ON (mof.uid=?i:uid AND f.id=mof.fid) WHERE f.id=?i:fid';
+            $sql = 'SELECT f.moderators, f.num_topics, f.sort_by, s.user_id AS is_subscribed, mof.mf_mark_all_read FROM ::forums AS f LEFT JOIN ::forum_subscriptions AS s ON (f.id=s.forum_id AND s.user_id=?i:uid) LEFT JOIN ::mark_of_forum AS mof ON (mof.uid=?i:uid AND f.id=mof.fid) WHERE f.id=?i:fid';
         }
         $curForum = $this->c->DB->query($sql, $vars)->fetch();
 
         // нет данных по данному разделу
-        if (! isset($curForum['forum_name'])) {
+        if (empty($curForum)) {
             return $this->c->Message->message('Bad request'); //???? может в лог ошибок?
         }
 
@@ -64,15 +65,18 @@ class Forum extends Page
             if ($page !== 1) {
                 return $this->c->Message->message('Bad request');
             }
+
             $pages = 1;
             $offset = 0;
             $topics = null;
         } else {
             $pages = ceil($curForum['num_topics'] / $user->dispTopics);
+
             // попытка открыть страницу которой нет
             if ($page < 1 || $page > $pages) {
                 return $this->c->Message->message('Bad request');
             }
+
             $offset = $user->dispTopics * ($page - 1);
 
             switch ($curForum['sort_by']) {
@@ -98,7 +102,6 @@ class Forum extends Page
                 ->fetchAll(\PDO::FETCH_COLUMN);
         }
 
-        $dotTopics = [];
         if (! empty($topics)) {
             $vars = [
                 ':uid' => $user->id,
@@ -106,27 +109,68 @@ class Forum extends Page
             ];
 
             if (! $user->isGuest && $this->config['o_show_dot'] == '1') {
-                $dotTopics = $this->c->DB
-                    ->query('SELECT topic_id FROM ::posts WHERE topic_id IN (?ai:topics) AND poster_id=?i:uid GROUP BY topic_id', $vars)
+                $dots = $this->c->DB
+                    ->query('SELECT topic_id FROM ::posts WHERE poster_id=?i:uid AND topic_id IN (?ai:topics) GROUP BY topic_id', $vars)
                     ->fetchAll(\PDO::FETCH_COLUMN);
+                $dots = array_flip($dots);
+            } else {
+                $dots = [];
             }
 
             if ($user->isGuest) {
                 $sql = "SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to, poll_type FROM ::topics WHERE id IN(?ai:topics) ORDER BY sticky DESC, {$sortBy}, id DESC";
             } else {
-                $sql = "SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.poll_type, mot.mt_upper, mot.mt_lower FROM ::topics AS t LEFT JOIN ::mark_of_topic AS mot ON (mot.uid=?i:uid AND t.id=mot.tid) WHERE t.id IN (?ai:topics) ORDER BY t.sticky DESC, t.{$sortBy}, t.id DESC";
+                $sql = "SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.poll_type, mot.mt_last_visit, mot.mt_last_read FROM ::topics AS t LEFT JOIN ::mark_of_topic AS mot ON (mot.uid=?i:uid AND t.id=mot.tid) WHERE t.id IN (?ai:topics) ORDER BY t.sticky DESC, t.{$sortBy}, t.id DESC";
             }
             $topics = $this->c->DB->query($sql, $vars)->fetchAll();
-        }
-
 
+            if (! $user->isGuest) {
+                $lower = max((int) $user->uMarkAllRead, (int) $curForum['mf_mark_all_read']);
+                $upper = max($lower, (int) $user->lastVisit);
+            }
 
+            foreach ($topics as &$cur) {
+                if ($this->config['o_censoring'] == '1') {
+                    $cur['subject'] = preg_replace($this->c->censoring[0], $this->c->censoring[1], $cur['subject']);
+                }
+                if (empty($cur['moved_to'])) {
+                    $cur['link'] = $this->c->Router->link('Topic', ['id' => $cur['id'], 'name' => $cur['subject']]);
+                    $cur['link_last'] = $this->c->Router->link('viewPost', ['id' => $cur['last_post_id']]);
+                    if ($user->isGuest) {
+                        $cur['link_new'] = null;
+                        $cur['link_unread'] = null;
+                        $cur['dot'] = false;
+                    } else {
+                        if ($cur['last_post'] > max($upper, $cur['mt_last_visit'])) {
+                            $cur['link_new'] = $this->c->Router->link('TopicGoToNew', ['id' => $cur['id']]);
+                        } else {
+                            $cur['link_new'] = null;
+                        }
+                        if ($cur['last_post'] > max($lower, $cur['mt_last_read'])) {
+                            $cur['link_unread'] = $this->c->Router->link('TopicGoToUnread', ['id' => $cur['id']]);
+                        } else {
+                            $cur['link_unread'] = null;
+                        }
+                        $cur['dot'] = isset($dots[$cur['id']]);
+                    }
+                } else {
+                    $cur['link'] = $this->c->Router->link('Topic', ['id' => $cur['moved_to'], 'name' => $cur['subject']]);
+                    $cur['link_last'] = null;
+                    $cur['link_new'] = null;
+                    $cur['link_unread'] = null;
+                    $cur['dot'] = false;
+                }
+            }
+            unset($cur);
+        }
 
         $moders = empty($curForum['moderators']) ? [] : array_flip(unserialize($curForum['moderators']));
+        $newOn = $perm['post_topics'] == 1 
+            || (null === $perm['post_topics'] && $user->gPostTopics == 1)
+            || $user->isAdmin 
+            || ($user->isAdmMod && isset($moders[$user->id]));
 
-        $this->onlinePos = 'forum' . $args['id'];
-
-        // хлебные крошки и титул
+        $this->onlinePos = 'forum-' . $args['id'];
         $this->titles = [];
         $crumbs = [];
         $id = $args['id'];
@@ -154,10 +198,14 @@ class Forum extends Page
         $this->data = [
             'forums' => $this->getForumsData($args['id']),
             'topics' => $topics,
-            'dots' => array_flip($dotTopics),
             'crumbs' => array_reverse($crumbs),
+            'forumName' => $fDesc[$args['id']]['forum_name'],
+            'newTopic' => $newOn ? $this->c->Router->link('NewTopic', ['id' => $args['id']]) : null,
+            'pages' => $this->c->Func->paginate($pages, $page, 'Forum', ['id' => $args['id'], 'name' => $fDesc[$args['id']]['forum_name']]),
         ];
-
+#echo "<pre>\n";
+#var_dump($this->data);
+#echo "</pre>\n";
         return $this;
     }
 
@@ -185,7 +233,7 @@ class Forum extends Page
         if ($user->isGuest) {
             $stmt = $this->c->DB->query('SELECT id, forum_desc, moderators, num_topics, num_posts, last_post, last_post_id, last_poster, last_topic FROM ::forums WHERE id IN (?ai:forums)', $vars);
         } else {
-            $stmt = $this->c->DB->query('SELECT f.id, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.last_topic, mof.mf_upper FROM ::forums AS f LEFT JOIN ::mark_of_forum AS mof ON (mof.uid=?i:id AND f.id=mof.fid) WHERE f.id IN (?ai:forums)', $vars);
+            $stmt = $this->c->DB->query('SELECT f.id, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.last_topic, mof.mf_last_visit FROM ::forums AS f LEFT JOIN ::mark_of_forum AS mof ON (mof.uid=?i:id AND f.id=mof.fid) WHERE f.id IN (?ai:forums)', $vars);
         }
         $forums = [];
         while ($cur = $stmt->fetch()) {
@@ -198,7 +246,7 @@ class Forum extends Page
             // предварительная проверка разделов
             $max = max((int) $user->lastVisit, (int) $user->uMarkAllRead);
             foreach ($forums as $id => $cur) {
-                $t = max($max, (int) $cur['mf_upper']);
+                $t = max($max, (int) $cur['mf_last_visit']);
                 if ($cur['last_post'] > $t) {
                     $new[$id] = $t;
                 }
@@ -210,7 +258,7 @@ class Forum extends Page
                     ':forums' => $new,
                     ':max' => $max,
                 ];
-                $stmt = $this->c->DB->query('SELECT t.forum_id, t.id, t.last_post FROM ::topics AS t LEFT JOIN ::mark_of_topic AS mot ON (mot.uid=?i:id AND mot.tid=t.id) WHERE t.forum_id IN(?ai:forums) AND t.last_post>?i:max AND t.moved_to IS NULL AND (mot.mt_upper IS NULL OR t.last_post>mot.mt_upper)', $vars);
+                $stmt = $this->c->DB->query('SELECT t.forum_id, t.id, t.last_post FROM ::topics AS t LEFT JOIN ::mark_of_topic AS mot ON (mot.uid=?i:id AND mot.tid=t.id) WHERE t.forum_id IN(?ai:forums) AND t.last_post>?i:max AND t.moved_to IS NULL AND (mot.mt_last_visit IS NULL OR t.last_post>mot.mt_last_visit)', $vars);
                 $tmp = [];
                 while ($cur = $stmt->fetch()) {
                     if ($cur['last_post']>$new[$cur['forum_id']]) {
@@ -294,7 +342,7 @@ class Forum extends Page
                 'topics'       => $this->number($numT),
                 'posts'        => $this->number($numP),
                 'last_post'    => $this->time($time),
-                'last_post_id' => $postId > 0 ? $r->link('viewPost', ['id' => $postId]) : null,
+                'last_post_id' => $postId > 0 ? $r->link('ViewPost', ['id' => $postId]) : null,
                 'last_poster'  => $poster,
                 'last_topic'   => $topic,
                 'new'          => $fnew,

+ 4 - 4
app/Models/Pages/Index.php

@@ -132,7 +132,7 @@ class Index extends Page
         if ($user->isGuest) {
             $stmt = $this->c->DB->query('SELECT id, forum_desc, moderators, num_topics, num_posts, last_post, last_post_id, last_poster, last_topic FROM ::forums WHERE id IN (?ai:forums)', $vars);
         } else {
-            $stmt = $this->c->DB->query('SELECT f.id, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.last_topic, mof.mf_upper FROM ::forums AS f LEFT JOIN ::mark_of_forum AS mof ON (mof.uid=?i:id AND f.id=mof.fid) WHERE f.id IN (?ai:forums)', $vars);
+            $stmt = $this->c->DB->query('SELECT f.id, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.last_topic, mof.mf_last_visit FROM ::forums AS f LEFT JOIN ::mark_of_forum AS mof ON (mof.uid=?i:id AND f.id=mof.fid) WHERE f.id IN (?ai:forums)', $vars);
         }
         $forums = [];
         while ($cur = $stmt->fetch()) {
@@ -145,7 +145,7 @@ class Index extends Page
             // предварительная проверка разделов
             $max = max((int) $user->lastVisit, (int) $user->uMarkAllRead);
             foreach ($forums as $id => $cur) {
-                $t = max($max, (int) $cur['mf_upper']);
+                $t = max($max, (int) $cur['mf_last_visit']);
                 if ($cur['last_post'] > $t) {
                     $new[$id] = $t;
                 }
@@ -157,7 +157,7 @@ class Index extends Page
                     ':forums' => $new,
                     ':max' => $max,
                 ];
-                $stmt = $this->c->DB->query('SELECT t.forum_id, t.id, t.last_post FROM ::topics AS t LEFT JOIN ::mark_of_topic AS mot ON (mot.uid=?i:id AND mot.tid=t.id) WHERE t.forum_id IN(?ai:forums) AND t.last_post>?i:max AND t.moved_to IS NULL AND (mot.mt_upper IS NULL OR t.last_post>mot.mt_upper)', $vars);
+                $stmt = $this->c->DB->query('SELECT t.forum_id, t.id, t.last_post FROM ::topics AS t LEFT JOIN ::mark_of_topic AS mot ON (mot.uid=?i:id AND mot.tid=t.id) WHERE t.forum_id IN(?ai:forums) AND t.last_post>?i:max AND t.moved_to IS NULL AND (mot.mt_last_visit IS NULL OR t.last_post>mot.mt_last_visit)', $vars);
                 $tmp = [];
                 while ($cur = $stmt->fetch()) {
                     if ($cur['last_post']>$new[$cur['forum_id']]) {
@@ -241,7 +241,7 @@ class Index extends Page
                 'topics'       => $this->number($numT),
                 'posts'        => $this->number($numP),
                 'last_post'    => $this->time($time),
-                'last_post_id' => $postId > 0 ? $r->link('viewPost', ['id' => $postId]) : null,
+                'last_post_id' => $postId > 0 ? $r->link('ViewPost', ['id' => $postId]) : null,
                 'last_poster'  => $poster,
                 'last_topic'   => $topic,
                 'new'          => $fnew,

+ 13 - 13
app/Models/Pages/Install.php

@@ -811,17 +811,17 @@ class Install extends Page
         // mark_of_forum
         $schema = [
             'FIELDS' => [
-                'uid'      => ['INT(10) UNSIGNED', true],
-                'fid'      => ['INT(10) UNSIGNED', true],
-                'mf_upper' => ['INT(10) UNSIGNED', true],
-                'mf_lower' => ['INT(10) UNSIGNED', true],
+                'uid'              => ['INT(10) UNSIGNED', true],
+                'fid'              => ['INT(10) UNSIGNED', true],
+                'mf_last_visit'    => ['INT(10) UNSIGNED', true],
+                'mf_mark_all_read' => ['INT(10) UNSIGNED', true],
             ],
             'UNIQUE KEYS' => [
                 'uid_fid_idx' => ['uid', 'fid'],
             ],
             'INDEXES' => [
-                'mf_upper_idx' => ['mf_upper'],
-                'mf_lower_idx' => ['mf_lower'],
+                'mf_last_visit_idx'    => ['mf_last_visit'],
+                'mf_mark_all_read_idx' => ['mf_mark_all_read'],
             ],
             'ENGINE' => $this->DBEngine,
         ];
@@ -829,18 +829,18 @@ class Install extends Page
         // mark_of_topic
         $schema = [
             'FIELDS' => [
-                'uid'      => ['INT(10) UNSIGNED', true],
-                'fid'      => ['INT(10) UNSIGNED', true], //????
-                'tid'      => ['INT(10) UNSIGNED', true],
-                'mt_upper' => ['INT(10) UNSIGNED', true],
-                'mt_lower' => ['INT(10) UNSIGNED', true],
+                'uid'           => ['INT(10) UNSIGNED', true],
+                'fid'           => ['INT(10) UNSIGNED', true], //????
+                'tid'           => ['INT(10) UNSIGNED', true],
+                'mt_last_visit' => ['INT(10) UNSIGNED', true],
+                'mt_last_read'  => ['INT(10) UNSIGNED', true],
             ],
             'UNIQUE KEYS' => [
                 'uid_fid_tid_idx' => ['uid', 'fid', 'tid'],
             ],
             'INDEXES' => [
-                'mt_upper_idx' => ['mt_upper'],
-                'mt_lower_idx' => ['mt_lower'],
+                'mt_last_visit_idx' => ['mt_last_visit'],
+                'mt_last_read_idx'  => ['mt_last_read'],
             ],
             'ENGINE' => $this->DBEngine,
         ];

+ 46 - 0
app/lang/English/forum.po

@@ -0,0 +1,46 @@
+#
+msgid ""
+msgstr ""
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Project-Id-Version: ForkBB\n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: \n"
+"Last-Translator: \n"
+"Language-Team: ForkBB <mio.visman@yandex.ru>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: en\n"
+
+msgid "Post topic"
+msgstr "Post new topic"
+
+msgid "Views"
+msgstr "Views"
+
+msgid "Moved"
+msgstr "Moved:"
+
+msgid "Sticky"
+msgstr "&#8657;&#160;"
+
+msgid "Closed"
+msgstr "Closed:"
+
+msgid "Poll"
+msgstr "Poll"
+
+msgid "Empty forum"
+msgstr "Forum is empty."
+
+msgid "Mod controls"
+msgstr "Moderator controls"
+
+msgid "Is subscribed"
+msgstr "You are currently subscribed to this forum"
+
+msgid "Unsubscribe"
+msgstr "Unsubscribe"
+
+msgid "Subscribe"
+msgstr "Subscribe to this forum"

+ 46 - 0
app/lang/Russian/forum.po

@@ -0,0 +1,46 @@
+#
+msgid ""
+msgstr ""
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"Project-Id-Version: ForkBB\n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: \n"
+"Last-Translator: \n"
+"Language-Team: ForkBB <mio.visman@yandex.ru>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+msgid "Post topic"
+msgstr "Создать тему"
+
+msgid "Views"
+msgstr "Просмотров"
+
+msgid "Moved"
+msgstr "Перенесено"
+
+msgid "Sticky"
+msgstr "&#8657;&#160;"
+
+msgid "Closed"
+msgstr "Закрыто:"
+
+msgid "Poll"
+msgstr "Опрос"
+
+msgid "Empty forum"
+msgstr "Раздел пуст."
+
+msgid "Mod controls"
+msgstr "Инструменты модерирования"
+
+msgid "Is subscribed"
+msgstr "Вы подписаны на этот раздел"
+
+msgid "Unsubscribe"
+msgstr "Отказаться от подписки"
+
+msgid "Subscribe"
+msgstr "Подписаться на этот раздел"

+ 53 - 3
app/templates/forum.tpl

@@ -1,6 +1,5 @@
 @section('crumbs')
-    <section class="f-crumbs">
-      <ul>
+      <ul class="f-crumbs">
 @foreach($crumbs as $cur)
 @if($cur[2])
         <li class="f-crumb"><a href="{!! $cur[0] !!}" class="active">{{ $cur[1] }}</a></li>
@@ -9,11 +8,36 @@
 @endif
 @endforeach
       </ul>
-    </section>
+@endsection
+@section('linkpost')
+@if($newTopic)
+        <div class="f-link-post">
+          <a class="f-btn" href="{!! $newTopic !!}">{!! __('Post topic') !!}</a>
+        </div>
+@endif
+@endsection
+@section('pages')
+        <nav class="f-pages">
+@foreach($pages as $cur)
+@if($cur[2])
+          <span class="f-page active">{{ $cur[1] }}</span>
+@elseif($cur[1] === 'space')
+          <span class="f-page f-pspacer">{!! __('Spacer') !!}</span>
+@elseif($cur[1] === 'prev')
+          <a rel="prev" class="f-page f-pprev" href="{!! $cur[0] !!}">{!! __('Previous') !!}</a>
+@elseif($cur[1] === 'next')
+          <a rel="next" class="f-page f-pnext" href="{!! $cur[0] !!}">{!! __('Next') !!}</a>
+@else
+          <a class="f-page" href="{!! $cur[0] !!}">{{ $cur[1] }}</a>
+@endif
+@endforeach
+        </nav>
 @endsection
 @extends('layouts/main')
 @if($forums)
+    <div class="f-nav-links">
 @yield('crumbs')
+    </div>
     <section class="f-subforums">
       <ol class="f-forumlist">
 @foreach($forums as $id => $cat)
@@ -32,4 +56,30 @@
       </ol>
     </section>
 @endif
+    <div class="f-nav-links">
 @yield('crumbs')
+@if($newTopic)
+      <div class="f-links-b clearfix">
+@yield('pages')
+@yield('linkpost')
+      </div>
+@endif
+    </div>
+@if(empty($topics))
+    <section class="f-main f-message">
+      <h2>{!! __('Empty forum') !!}</h2>
+    </section>
+@else
+    <section class="f-main f-forum">
+      <h2>{{ $forumName }}</h2>
+    </section>
+    <div class="f-nav-links">
+@if($newTopic || $pages)
+      <div class="f-links-a clearfix">
+@yield('linkpost')
+@yield('pages')
+      </div>
+@endif
+@yield('crumbs')
+    </div>
+@endif

+ 56 - 3
public/style/ForkBB/style.css

@@ -438,12 +438,11 @@ select {
 /* Хлебные крошки */
 /******************/
 
-.f-links {
-  border-top: 0.0625rem solid #AA7939;
+.f-nav-links {
+  margin: 1rem 0;
 }
 
 .f-crumbs {
-  margin: 1rem 0;
   padding: 0 0.625rem;
   display: block;
   overflow: hidden;
@@ -467,6 +466,56 @@ select {
   border: 0;
 }
 
+.f-links-b {
+  margin-top: 0.625rem;
+  border-top: 0.0625rem dotted #AA7939;
+}
+
+.f-links-a {
+  margin-bottom: 0.625rem;
+  border-bottom: 0.0625rem dotted #AA7939;
+}
+
+.f-link-post {
+  float: right;
+}
+
+.f-pages {
+  float: left;
+}
+
+.f-links-a .f-link-post,
+.f-links-a .f-pages {
+  padding: 0 0.625rem 0.625rem 0.625rem;
+}
+
+.f-links-b .f-link-post,
+.f-links-b .f-pages {
+  padding: 0.625rem 0.625rem 0 0.625rem;
+}
+
+.f-nav-links .f-page {
+/*  float: left; */
+  border: 0.0625rem solid #AA7939;
+  padding: 0.125rem 0.4375rem;
+  font-size: 0.875rem;
+  box-sizing: border-box;
+/*  margin-left: -0.0625rem; */
+  line-height: 1.125rem;
+/*  display: inline-block; */
+}
+
+.f-nav-links .f-pspacer {
+    border: 0;
+    padding: 0;
+}
+
+.f-nav-links .f-page.active {
+  border-color: #814A00;
+  background-color: #814A00;
+  color: #F8F4E3;
+}  
+
 /********/
 /* Тело */
 /********/
@@ -1125,3 +1174,7 @@ li + li .f-btn {
 .f-subforums .f-forumlist .f-thead {
   border-bottom-width: 0.0625rem;
 }
+
+.f-forum > h2 {
+  display: none;
+}