Some more moves.
This commit is contained in:
parent
3b2114cd10
commit
f109a86c5b
10 changed files with 237 additions and 92 deletions
|
@ -17,6 +17,7 @@
|
||||||
"jbbcode/jbbcode": "*",
|
"jbbcode/jbbcode": "*",
|
||||||
"corneltek/cliframework": "*",
|
"corneltek/cliframework": "*",
|
||||||
"phroute/phroute": "^2.1",
|
"phroute/phroute": "^2.1",
|
||||||
"illuminate/database": "5.2.*"
|
"illuminate/database": "5.2.*",
|
||||||
|
"doctrine/dbal": "~2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
namespace Sakura\Controllers;
|
namespace Sakura\Controllers;
|
||||||
|
|
||||||
use Sakura\DB;
|
use Sakura\DB;
|
||||||
use Sakura\Forum;
|
use Sakura\Forum\Forum;
|
||||||
|
use Sakura\Forum\Thread;
|
||||||
use Sakura\Perms\Forum as ForumPerms;
|
use Sakura\Perms\Forum as ForumPerms;
|
||||||
|
use Sakura\Router;
|
||||||
use Sakura\Template;
|
use Sakura\Template;
|
||||||
use Sakura\User;
|
use Sakura\User;
|
||||||
use Sakura\Users;
|
use Sakura\Users;
|
||||||
|
@ -31,7 +33,7 @@ class ForumController extends Controller
|
||||||
{
|
{
|
||||||
// Merge index specific stuff with the global render data
|
// Merge index specific stuff with the global render data
|
||||||
Template::vars([
|
Template::vars([
|
||||||
'forum' => (new Forum\Forum()),
|
'forum' => (new Forum()),
|
||||||
'stats' => [
|
'stats' => [
|
||||||
'userCount' => DB::table('users')->where('password_algo', '!=', 'disabled')->whereNotIn('rank_main', [1, 10])->count(),
|
'userCount' => DB::table('users')->where('password_algo', '!=', 'disabled')->whereNotIn('rank_main', [1, 10])->count(),
|
||||||
'newestUser' => User::construct(Users::getNewestUserId()),
|
'newestUser' => User::construct(Users::getNewestUserId()),
|
||||||
|
@ -54,11 +56,11 @@ class ForumController extends Controller
|
||||||
global $currentUser;
|
global $currentUser;
|
||||||
|
|
||||||
// Get the forum
|
// Get the forum
|
||||||
$forum = new Forum\Forum($id);
|
$forum = new Forum($id);
|
||||||
|
|
||||||
// Redirect forum id 0 to the main page
|
// Redirect forum id 0 to the main page
|
||||||
if ($forum->id === 0) {
|
if ($forum->id === 0) {
|
||||||
header('Location: ' . (new \Sakura\Urls)->format('FORUM_INDEX'));
|
header('Location: ' . Router::route('forums.index'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +70,7 @@ class ForumController extends Controller
|
||||||
Template::vars([
|
Template::vars([
|
||||||
'page' => [
|
'page' => [
|
||||||
'message' => 'The forum you tried to access does not exist.',
|
'message' => 'The forum you tried to access does not exist.',
|
||||||
|
'redirect' => Router::route('forums.index'),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -81,6 +84,7 @@ class ForumController extends Controller
|
||||||
Template::vars([
|
Template::vars([
|
||||||
'page' => [
|
'page' => [
|
||||||
'message' => 'You do not have access to this forum.',
|
'message' => 'You do not have access to this forum.',
|
||||||
|
'redirect' => Router::route('forums.index'),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -95,24 +99,7 @@ class ForumController extends Controller
|
||||||
'page' => [
|
'page' => [
|
||||||
'message' => 'The forum you tried to access is a link. You\'re being redirected.',
|
'message' => 'The forum you tried to access is a link. You\'re being redirected.',
|
||||||
'redirect' => $forum->link,
|
'redirect' => $forum->link,
|
||||||
]
|
],
|
||||||
]);
|
|
||||||
|
|
||||||
// Print page contents
|
|
||||||
return Template::render('global/information');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we're marking as read
|
|
||||||
if (isset($_GET['read']) && $_GET['read'] && isset($_GET['session']) && $_GET['session'] == session_id()) {
|
|
||||||
// Run the function
|
|
||||||
$forum->trackUpdateAll($currentUser->id);
|
|
||||||
|
|
||||||
// Set render data
|
|
||||||
Template::vars([
|
|
||||||
'page' => [
|
|
||||||
'message' => 'All threads have been marked as read.',
|
|
||||||
'redirect' => (new \Sakura\Urls)->format('FORUM_SUB', [$forum->id]),
|
|
||||||
]
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
|
@ -127,4 +114,148 @@ class ForumController extends Controller
|
||||||
// Print page contents
|
// Print page contents
|
||||||
return Template::render('forum/viewforum');
|
return Template::render('forum/viewforum');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function markForumRead($id = 0)
|
||||||
|
{
|
||||||
|
global $currentUser;
|
||||||
|
|
||||||
|
// Check if the session id was supplied
|
||||||
|
if (!isset($_GET['s']) || $_GET['s'] != session_id()) {
|
||||||
|
// Set render data
|
||||||
|
Template::vars([
|
||||||
|
'page' => [
|
||||||
|
'message' => 'Your session expired! Go back and try again.',
|
||||||
|
'redirect' => Router::route('forums.index'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
return Template::render('global/information');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the forum
|
||||||
|
$forum = new Forum($id);
|
||||||
|
|
||||||
|
// Check if the forum exists
|
||||||
|
if ($forum->id < 1) {
|
||||||
|
// Set render data
|
||||||
|
Template::vars([
|
||||||
|
'page' => [
|
||||||
|
'message' => 'The forum you tried to access does not exist.',
|
||||||
|
'redirect' => Router::route('forums.index'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
return Template::render('global/information');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the user has access to the forum
|
||||||
|
if (!$forum->permission(ForumPerms::VIEW, $currentUser->id)) {
|
||||||
|
// Set render data
|
||||||
|
Template::vars([
|
||||||
|
'page' => [
|
||||||
|
'message' => 'You do not have access to this forum.',
|
||||||
|
'redirect' => Router::route('forums.index'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
return Template::render('global/information');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the function
|
||||||
|
$forum->trackUpdateAll($currentUser->id);
|
||||||
|
|
||||||
|
// Set render data
|
||||||
|
Template::vars([
|
||||||
|
'page' => [
|
||||||
|
'message' => 'All threads have been marked as read.',
|
||||||
|
'redirect' => Router::route('forums.forum', $forum->id),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
return Template::render('global/information');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function thread($id = 0)
|
||||||
|
{
|
||||||
|
global $currentUser;
|
||||||
|
|
||||||
|
// Attempt to get the thread
|
||||||
|
$thread = new Thread($id);
|
||||||
|
|
||||||
|
// And attempt to get the forum
|
||||||
|
$forum = new Forum($thread->forum);
|
||||||
|
|
||||||
|
// Check if the forum exists
|
||||||
|
if ($thread->id == 0 || !$forum->permission(ForumPerms::VIEW, $currentUser->id)) {
|
||||||
|
// Set render data
|
||||||
|
Template::vars([
|
||||||
|
'page' => [
|
||||||
|
'message' => 'This thread doesn\'t exist or you don\'t have access to it!',
|
||||||
|
'redirect' => Router::route('forums.index'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
return Template::render('global/information');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the tracking status
|
||||||
|
$thread->trackUpdate($currentUser->id);
|
||||||
|
|
||||||
|
// Update views
|
||||||
|
$thread->viewsUpdate();
|
||||||
|
|
||||||
|
// Set parse variables
|
||||||
|
Template::vars([
|
||||||
|
'thread' => $thread,
|
||||||
|
'forum' => $forum,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
return Template::render('forum/viewtopic');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function threadModerate($id = 0)
|
||||||
|
{
|
||||||
|
global $currentUser;
|
||||||
|
|
||||||
|
// Attempt to get the thread
|
||||||
|
$thread = new Thread($id);
|
||||||
|
|
||||||
|
// And attempt to get the forum
|
||||||
|
$forum = new Forum($thread->forum);
|
||||||
|
|
||||||
|
// Check if the forum exists
|
||||||
|
if ($thread->id == 0 || !$forum->permission(ForumPerms::VIEW, $currentUser->id)) {
|
||||||
|
// Set render data
|
||||||
|
Template::vars([
|
||||||
|
'page' => [
|
||||||
|
'message' => 'This thread doesn\'t exist or you don\'t have access to it!',
|
||||||
|
'redirect' => Router::route('forums.index'),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
// Take the action
|
||||||
|
$action = isset($_POST['action']) ? $_POST['action'] : null;
|
||||||
|
|
||||||
|
// Switch
|
||||||
|
switch ($action) {
|
||||||
|
default:
|
||||||
|
Template::vars([
|
||||||
|
'page' => [
|
||||||
|
'message' => 'Unknown moderation action.',
|
||||||
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
return Template::render('global/information');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ class Thread
|
||||||
->update([
|
->update([
|
||||||
'topic_hidden' => $this->hidden,
|
'topic_hidden' => $this->hidden,
|
||||||
'topic_title' => $this->title,
|
'topic_title' => $this->title,
|
||||||
'topic_limit' => $this->timeLimit,
|
'topic_time_limit' => $this->timeLimit,
|
||||||
'topic_status' => $this->status,
|
'topic_status' => $this->status,
|
||||||
'topic_status_change' => $this->statusChange,
|
'topic_status_change' => $this->statusChange,
|
||||||
'topic_type' => $this->type,
|
'topic_type' => $this->type,
|
||||||
|
|
|
@ -26,7 +26,7 @@ if (!$thread) {
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'The topic you tried to access does not exist.',
|
'message' => 'The topic you tried to access does not exist.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Set parse variables
|
// Set parse variables
|
||||||
|
@ -42,7 +42,7 @@ if (!$forum->permission(ForumPerms::VIEW, $currentUser->id)) {
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'You do not have access to this thread.',
|
'message' => 'You do not have access to this thread.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Set parse variables
|
// Set parse variables
|
||||||
|
@ -68,7 +68,7 @@ if (isset($_GET['sticky']) && $_GET['sticky'] == session_id() && $forum->permiss
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'Changed the thread type.',
|
'message' => 'Changed the thread type.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Set parse variables
|
// Set parse variables
|
||||||
|
@ -93,7 +93,7 @@ if (isset($_GET['announce']) && $_GET['announce'] == session_id() && $forum->per
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'Changed the thread type.',
|
'message' => 'Changed the thread type.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Set parse variables
|
// Set parse variables
|
||||||
|
@ -118,7 +118,7 @@ if (isset($_GET['lock']) && $_GET['lock'] == session_id() && $forum->permission(
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'Changed the thread status.',
|
'message' => 'Changed the thread status.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Set parse variables
|
// Set parse variables
|
||||||
|
@ -138,13 +138,13 @@ if (isset($_GET['trash']) && $_GET['trash'] == session_id() && $forum->permissio
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'Moved thread to the trash.',
|
'message' => 'Moved thread to the trash.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'This thread is already trashed.',
|
'message' => 'This thread is already trashed.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,13 +166,13 @@ if (isset($_GET['restore']) && $_GET['restore'] == session_id() && $forum->permi
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'Restored the thread to its previous location.',
|
'message' => 'Restored the thread to its previous location.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'This thread has never been moved.',
|
'message' => 'This thread has never been moved.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,13 +193,13 @@ if (isset($_GET['prune']) && $_GET['prune'] == session_id() && $forum->permissio
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'The thread has been pruned.',
|
'message' => 'The thread has been pruned.',
|
||||||
'redirect' => $urls->format('FORUM_SUB', [$thread->forum]),
|
'redirect' => Router::route('forums.forum', $thread->forum),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
// Set render data
|
// Set render data
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'message' => 'You can only prune trashed threads.',
|
'message' => 'You can only prune trashed threads.',
|
||||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
'redirect' => Router::route('forums.thread', $thread->id),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,20 +211,4 @@ if (isset($_GET['prune']) && $_GET['prune'] == session_id() && $forum->permissio
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the tracking status
|
header('Location: ' . Router::route('forums.thread', $thread->id));
|
||||||
$thread->trackUpdate($currentUser->id);
|
|
||||||
|
|
||||||
// Update views
|
|
||||||
$thread->viewsUpdate();
|
|
||||||
|
|
||||||
// Set additional render data
|
|
||||||
$renderData = array_merge($renderData, [
|
|
||||||
'thread' => $thread,
|
|
||||||
'forum' => $forum,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Set parse variables
|
|
||||||
Template::vars($renderData);
|
|
||||||
|
|
||||||
// Print page contents
|
|
||||||
echo Template::render('forum/viewtopic');
|
|
||||||
|
|
|
@ -33,8 +33,16 @@ Router::group(['prefix' => 'news'], function () {
|
||||||
|
|
||||||
// Forum
|
// Forum
|
||||||
Router::group(['prefix' => 'forum'], function () {
|
Router::group(['prefix' => 'forum'], function () {
|
||||||
|
// Thread
|
||||||
|
Router::group(['prefix' => 'thread'], function () {
|
||||||
|
Router::get('/{id}', 'ForumController@thread', 'forums.thread');
|
||||||
|
Router::post('/{id}/mod', 'ForumController@threadModerate', 'forums.mod');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Forum
|
||||||
Router::get('/', 'ForumController@index', 'forums.index');
|
Router::get('/', 'ForumController@index', 'forums.index');
|
||||||
Router::get('/{id}', 'ForumController@forum', 'forums.forum');
|
Router::get('/{id}', 'ForumController@forum', 'forums.forum');
|
||||||
|
Router::get('/{id}/mark', 'ForumController@markForumRead', 'forums.mark');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', '20160228');
|
define('SAKURA_VERSION', '20160310');
|
||||||
|
|
||||||
// Define Sakura Path
|
// Define Sakura Path
|
||||||
define('ROOT', __DIR__ . '/');
|
define('ROOT', __DIR__ . '/');
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
<div class="fa fa-2x fa-{% if thread.type == 1 %}thumb-tack{% elseif thread.type == 2 %}bullhorn{% elseif thread.status == 1 %}lock{% else %}navicon{% endif %}"></div>
|
<div class="fa fa-2x fa-{% if thread.type == 1 %}thumb-tack{% elseif thread.type == 2 %}bullhorn{% elseif thread.status == 1 %}lock{% else %}navicon{% endif %}"></div>
|
||||||
</td>
|
</td>
|
||||||
<td class="topicTitle{% if thread.type == 2 %} topicAnnouncement{% endif %}">
|
<td class="topicTitle{% if thread.type == 2 %} topicAnnouncement{% endif %}">
|
||||||
<a href="{{ urls.format('FORUM_THREAD', [thread.id]) }}" class="default">{{ thread.title }}</a>
|
<a href="{{ route('forums.thread', thread.id) }}" class="default">{{ thread.title }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="topicAuthor{% if thread.type == 2 %} topicAnnouncement{% endif %}">
|
<td class="topicAuthor{% if thread.type == 2 %} topicAnnouncement{% endif %}">
|
||||||
{% if thread.firstPost.poster.id %}
|
{% if thread.firstPost.poster.id %}
|
||||||
<a href="{{ urls.format('USER_PROFILE', [thread.firstPost.poster.id]) }}" class="default" style="color: {{ thread.firstPost.poster.colour }}; text-shadow: 0 0 5px {% if thread.firstPost.poster.colour != 'inherit' %}{{ thread.firstPost.poster.colour }}{% else %}#222{% endif %};">{{ thread.firstPost.poster.username }}</a>
|
<a href="{{ route('user.profile', thread.firstPost.poster.id) }}" class="default" style="color: {{ thread.firstPost.poster.colour }}; text-shadow: 0 0 5px {% if thread.firstPost.poster.colour != 'inherit' %}{{ thread.firstPost.poster.colour }}{% else %}#222{% endif %};">{{ thread.firstPost.poster.username }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
[deleted user]
|
[deleted user]
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="topicLast{% if thread.type == 2 %} topicAnnouncement{% endif %}">
|
<td class="topicLast{% if thread.type == 2 %} topicAnnouncement{% endif %}">
|
||||||
{% if thread.lastPost.poster.id %}
|
{% if thread.lastPost.poster.id %}
|
||||||
<a href="{{ urls.format('USER_PROFILE', [thread.lastPost.poster.id]) }}" class="default" style="color: {{ thread.lastPost.poster.colour }}; text-shadow: 0 0 5px {% if thread.lastPost.poster.colour != 'inherit' %}{{ thread.lastPost.poster.colour }}{% else %}#222{% endif %};">{{ thread.lastPost.poster.username }}</a>
|
<a href="{{ route('user.profile', thread.lastPost.poster.id) }}" class="default" style="color: {{ thread.lastPost.poster.colour }}; text-shadow: 0 0 5px {% if thread.lastPost.poster.colour != 'inherit' %}{{ thread.lastPost.poster.colour }}{% else %}#222{% endif %};">{{ thread.lastPost.poster.username }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
[deleted user]
|
[deleted user]
|
||||||
{% endif %} <a href="{{ urls.format('FORUM_POST', [thread.lastPost.id]) }}#p{{ thread.lastPost.id }}" class="default fa fa-tag"></a><br />
|
{% endif %} <a href="{{ urls.format('FORUM_POST', [thread.lastPost.id]) }}#p{{ thread.lastPost.id }}" class="default fa fa-tag"></a><br />
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
{% set title %}Forums / {{ forum.name }}{% endset %}
|
{% set title %}Forums / {{ forum.name }}{% endset %}
|
||||||
|
|
||||||
{% set forumBackLink %}{{ urls.format('FORUM_INDEX') }}{% endset %}
|
{% set forumBackLink %}{{ route('forums.index') }}{% endset %}
|
||||||
{% set forumNewLink %}{{ urls.format('FORUM_NEW_THREAD', [forum.id]) }}{% endset %}
|
{% set forumNewLink %}{{ urls.format('FORUM_NEW_THREAD', [forum.id]) }}{% endset %}
|
||||||
{% set forumMarkRead %}{{ urls.format('FORUM_MARK_READ', [forum.id, php.sessionid]) }}{% endset %}
|
{% set forumMarkRead %}{{ route('forums.mark', forum.id) }}?s={{ php.sessionid }}{% endset %}
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
{% block title %}{{ title }}{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@
|
||||||
{% for post in posts[get.page|default(1) - 1] %}
|
{% for post in posts[get.page|default(1) - 1] %}
|
||||||
<tr class="post" id="p{{ post.id }}">
|
<tr class="post" id="p{{ post.id }}">
|
||||||
<td class="userpanel">
|
<td class="userpanel">
|
||||||
{% if not post.poster.permission(constant('Sakura\\Perms\\Site::DEACTIVATED')) or post.poster.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %}<a href="{{ urls.format('USER_PROFILE', [post.poster.id]) }}" class="default username" style="color: {{ post.poster.colour }}; text-shadow: 0 0 5px {% if post.poster.colour != 'inherit' %}{{ post.poster.colour }}{% else %}#222{% endif %};" title="Go to {{ post.poster.username }}'s profile">{{ post.poster.username }}</a>
|
{% if not post.poster.permission(constant('Sakura\\Perms\\Site::DEACTIVATED')) or post.poster.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %}<a href="{{ route('user.profile', post.poster.id) }}" class="default username" style="color: {{ post.poster.colour }}; text-shadow: 0 0 5px {% if post.poster.colour != 'inherit' %}{{ post.poster.colour }}{% else %}#222{% endif %};" title="Go to {{ post.poster.username }}'s profile">{{ post.poster.username }}</a>
|
||||||
<img src="{{ urls.format('IMAGE_AVATAR', [post.poster.id]) }}" alt="{{ post.poster.username }}" class="avatar" style="box-shadow: 0 3px 7px #{% if post.poster.isOnline %}484{% else %}844{% endif %};" />
|
<img src="{{ route('file.avatar', post.poster.id) }}" alt="{{ post.poster.username }}" class="avatar" style="box-shadow: 0 3px 7px #{% if post.poster.isOnline %}484{% else %}844{% endif %};" />
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="username">[deleted user]</a>
|
<a class="username">[deleted user]</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -213,8 +213,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{% if sakura.dev.showChangelog and php.self == '/index.php' and stats %}
|
{% if sakura.dev.showChangelog and stats %}
|
||||||
<script type="text/javascript" src="https://sakura.flash.moe/?get={{ sakura.versionInfo.version|slice(0, 4) }}-{{ sakura.versionInfo.version|slice(4, 2) }}-{{ sakura.versionInfo.version|slice(6, 2) }}&variable=true"></script>
|
<script type="text/javascript" src="https://sakura.flash.moe/?get=all&limit=5&variable=true"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// Column colours for actions
|
// Column colours for actions
|
||||||
var changelogColours = [
|
var changelogColours = [
|
||||||
|
@ -227,55 +227,76 @@
|
||||||
'#C44' // Revert
|
'#C44' // Revert
|
||||||
];
|
];
|
||||||
|
|
||||||
window.addEventListener("load", function() {
|
window.addEventListener("load", function () {
|
||||||
// Check if the changelog variable is an object
|
// Check if the changelog variable is an object
|
||||||
if(typeof changelog === 'object') {
|
if(typeof changelog === 'object') {
|
||||||
// Grab the index panel
|
// Grab the index panel
|
||||||
var indexPanel = document.getElementById('indexPanel');
|
var _panel = document.getElementById('indexPanel');
|
||||||
|
|
||||||
// Create the head container
|
// Create the head container
|
||||||
var changelogTitle = document.createElement('div');
|
var _cltitle = document.createElement('div');
|
||||||
changelogTitle.className = 'head';
|
_cltitle.className = 'head';
|
||||||
changelogTitle.style.marginBottom = '1px';
|
_cltitle.style.marginBottom = '1px';
|
||||||
|
|
||||||
// Create a link
|
// Create a link
|
||||||
var changelogLink = document.createElement('a');
|
var _cllink = document.createElement('a');
|
||||||
changelogLink.className = 'underline';
|
_cllink.className = 'underline';
|
||||||
changelogLink.target = '_blank';
|
_cllink.target = '_blank';
|
||||||
changelogLink.href = 'https://sakura.flash.moe/#r{{ sakura.versionInfo.version }}';
|
_cllink.href = 'https://sakura.flash.moe/#r{{ sakura.versionInfo.version }}';
|
||||||
|
|
||||||
// Create the text container
|
|
||||||
var changelogTitleText = document.createTextNode('Changelog ({{ sakura.versionInfo.version|slice(0, 4) }}-{{ sakura.versionInfo.version|slice(4, 2) }}-{{ sakura.versionInfo.version|slice(6, 2) }})');
|
|
||||||
|
|
||||||
// Append everything
|
// Append everything
|
||||||
changelogLink.appendChild(changelogTitleText);
|
_cllink.appendChild(document.createTextNode('Changelog'));
|
||||||
changelogTitle.appendChild(changelogLink);
|
_cltitle.appendChild(_cllink);
|
||||||
indexPanel.appendChild(changelogTitle);
|
_panel.appendChild(_cltitle);
|
||||||
|
|
||||||
// Create changelog table
|
// Create changelog table
|
||||||
var changelogTable = document.createElement('table');
|
var _cltable = document.createElement('table');
|
||||||
changelogTable.className = 'panelTable';
|
_cltable.className = 'panelTable';
|
||||||
|
_cltable.style.borderSpacing = '0 1px';
|
||||||
|
|
||||||
// Create and append all changelog entries
|
// Create and append all changelog entries
|
||||||
for (var i in changelog) {
|
for (var _s in changelog) {
|
||||||
// Create elements
|
// Create header
|
||||||
var changelogRow = document.createElement('tr');
|
var _hr = document.createElement('tr');
|
||||||
var changelogColumnAction = document.createElement('td');
|
var _hri = document.createElement('td');
|
||||||
var changelogColumnMessage = document.createElement('td');
|
|
||||||
|
|
||||||
// Set data
|
// Set data
|
||||||
changelogColumnAction.appendChild(document.createTextNode(changelog[i]['change_action']['action_name']));
|
_hri.appendChild(document.createTextNode(_s));
|
||||||
changelogColumnAction.style.background = changelogColours[changelog[i]['change_action']['action_id']];
|
_hri.style.background = '#9475b2';
|
||||||
changelogColumnMessage.appendChild(document.createTextNode(changelog[i]['change_message']));
|
_hri.style.color = '#306';
|
||||||
|
_hri.style.fontWeight = '700';
|
||||||
|
_hri.style.fontSize = '1.2em';
|
||||||
|
_hri.setAttribute('colspan', '2');
|
||||||
|
|
||||||
// Append
|
// Append
|
||||||
changelogRow.appendChild(changelogColumnAction);
|
_hr.appendChild(_hri);
|
||||||
changelogRow.appendChild(changelogColumnMessage);
|
_cltable.appendChild(_hr);
|
||||||
changelogTable.appendChild(changelogRow);
|
|
||||||
|
for (var _e in changelog[_s]) {
|
||||||
|
// Reassign _e
|
||||||
|
_e = changelog[_s][_e];
|
||||||
|
|
||||||
|
// Create elements
|
||||||
|
var _clr = document.createElement('tr');
|
||||||
|
var _clca = document.createElement('td');
|
||||||
|
var _clcm = document.createElement('td');
|
||||||
|
|
||||||
|
// Set data
|
||||||
|
_clca.appendChild(document.createTextNode(_e['change_action']['action_name']));
|
||||||
|
_clca.style.background = changelogColours[_e['change_action']['action_id']];
|
||||||
|
_clca.style.borderBottom = '1px solid ' + changelogColours[_e['change_action']['action_id']];
|
||||||
|
_clcm.style.borderBottom = '1px solid ' + changelogColours[_e['change_action']['action_id']];
|
||||||
|
_clcm.appendChild(document.createTextNode(_e['change_message']));
|
||||||
|
|
||||||
|
// Append
|
||||||
|
_clr.appendChild(_clca);
|
||||||
|
_clr.appendChild(_clcm);
|
||||||
|
_cltable.appendChild(_clr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append it to indexPanel
|
// Append it to indexPanel
|
||||||
indexPanel.appendChild(changelogTable);
|
indexPanel.appendChild(_cltable);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Reference in a new issue