r20160110
This commit is contained in:
parent
6eff64007f
commit
9ac118e7d4
16 changed files with 427 additions and 34 deletions
|
@ -51,7 +51,7 @@ class ActionCode
|
|||
public static function invalidate($code)
|
||||
{
|
||||
Database::delete('actioncodes', [
|
||||
'code_action' => [$code, '='],
|
||||
'code_action' => [$code, '='],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,8 @@ class Post
|
|||
}
|
||||
|
||||
// Update a post
|
||||
public function update() {
|
||||
public function update()
|
||||
{
|
||||
// Check if the data meets the requirements
|
||||
if (strlen($this->subject) < Config::get('forum_title_min')
|
||||
|| strlen($this->subject) > Config::get('forum_title_max')
|
||||
|
|
|
@ -25,6 +25,7 @@ class Thread
|
|||
public $status = 0;
|
||||
public $statusChange = 0;
|
||||
public $type = 0;
|
||||
public $oldForum = 0;
|
||||
private $_posts = [];
|
||||
private $_firstPost = null;
|
||||
private $_lastPost = null;
|
||||
|
@ -47,6 +48,7 @@ class Thread
|
|||
$this->status = $threadRow['topic_status'];
|
||||
$this->statusChange = $threadRow['topic_status_change'];
|
||||
$this->type = $threadRow['topic_type'];
|
||||
$this->oldForum = $threadRow['topic_old_forum'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +68,68 @@ class Thread
|
|||
return new Thread(Database::lastInsertID());
|
||||
}
|
||||
|
||||
// Delete the thread
|
||||
public function delete()
|
||||
{
|
||||
// Delete all posts
|
||||
Database::delete('posts', [
|
||||
'topic_id' => [$this->id, '='],
|
||||
]);
|
||||
|
||||
// Delete thread meta
|
||||
Database::delete('topics', [
|
||||
'topic_id' => [$this->id, '='],
|
||||
]);
|
||||
}
|
||||
|
||||
// Move the thread
|
||||
public function move($forum, $setOld = true)
|
||||
{
|
||||
// Update all posts
|
||||
Database::update('posts', [
|
||||
[
|
||||
'forum_id' => $forum,
|
||||
],
|
||||
[
|
||||
'topic_id' => [$this->id, '='],
|
||||
]
|
||||
]);
|
||||
|
||||
// Update thread meta
|
||||
Database::update('topics', [
|
||||
[
|
||||
'forum_id' => $forum,
|
||||
'topic_old_forum' => ($setOld ? $this->forum : 0),
|
||||
],
|
||||
[
|
||||
'topic_id' => [$this->id, '='],
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
// Update the thread
|
||||
public function update()
|
||||
{
|
||||
// Update row
|
||||
Database::update('topics', [
|
||||
[
|
||||
'topic_hidden' => $this->hidden,
|
||||
'topic_title' => $this->title,
|
||||
'topic_time_limit' => $this->timeLimit,
|
||||
'topic_status' => $this->status,
|
||||
'topic_status_change' => $this->statusChange,
|
||||
'topic_type' => $this->type,
|
||||
'topic_old_forum' => $this->oldForum,
|
||||
],
|
||||
[
|
||||
'topic_id' => [$this->id, '='],
|
||||
]
|
||||
]);
|
||||
|
||||
// Return new object
|
||||
return new Thread($this->id);
|
||||
}
|
||||
|
||||
// Posts
|
||||
public function posts()
|
||||
{
|
||||
|
|
|
@ -20,4 +20,6 @@ class Forum
|
|||
const ANNOUNCEMENT = 64; // Can announce threads
|
||||
const EDIT_ANY = 128; // Can edit any post
|
||||
const DELETE_ANY = 256; // Can delete any post
|
||||
const LOCK = 512; // Can (un)lock threads
|
||||
const MOVE = 1024; // Can move threads
|
||||
}
|
||||
|
|
|
@ -12,4 +12,5 @@ namespace Sakura\Perms;
|
|||
class Manage
|
||||
{
|
||||
const USE_MANAGE = 1; // Can use manage
|
||||
const CAN_RESTRICT_USERS = 2; // Can change the status of users to restricted
|
||||
}
|
||||
|
|
|
@ -143,6 +143,30 @@ class Urls
|
|||
'/posting.php?p=%1$u"e=%1$u',
|
||||
'/forum/post/%u/quote',
|
||||
],
|
||||
'FORUM_LOCK' => [
|
||||
'/viewtopic.php?t=%u&lock=%s',
|
||||
'/forum/thread/%u?lock=%s',
|
||||
],
|
||||
'FORUM_STICKY' => [
|
||||
'/viewtopic.php?t=%u&sticky=%s',
|
||||
'/forum/thread/%u?sticky=%s',
|
||||
],
|
||||
'FORUM_ANNOUNCE' => [
|
||||
'/viewtopic.php?t=%u&announce=%s',
|
||||
'/forum/thread/%u?announce=%s',
|
||||
],
|
||||
'FORUM_RESTORE' => [
|
||||
'/viewtopic.php?t=%u&restore=%s',
|
||||
'/forum/thread/%u?restore=%s',
|
||||
],
|
||||
'FORUM_TRASH' => [
|
||||
'/viewtopic.php?t=%u&trash=%s',
|
||||
'/forum/thread/%u?trash=%s',
|
||||
],
|
||||
'FORUM_PRUNE' => [
|
||||
'/viewtopic.php?t=%u&prune=%s',
|
||||
'/forum/thread/%u?prune=%s',
|
||||
],
|
||||
|
||||
// Image serve references
|
||||
'IMAGE_AVATAR' => [
|
||||
|
|
|
@ -119,7 +119,7 @@ class User
|
|||
$this->data['user_data'] = json_decode(!empty($this->data['user_data']) ? $this->data['user_data'] : '[]', true);
|
||||
|
||||
// Get all ranks
|
||||
$ranks = array_map(function($a) {
|
||||
$ranks = array_map(function ($a) {
|
||||
return $a['rank_id'];
|
||||
}, Database::fetch('user_ranks', true, ['user_id' => [$this->data['user_id'], '=']]));
|
||||
|
||||
|
|
|
@ -46,13 +46,13 @@ if (isset($_GET['m'])) {
|
|||
$user = User::construct($_GET['u']);
|
||||
|
||||
// If user is deactivated use deactive avatar
|
||||
if ($user->hasRanks([0, 1])) {
|
||||
if ($user->permission(Perms\Site::DEACTIVATED)) {
|
||||
$serveImage = $deactiveAvatar;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if user is banned
|
||||
if ($user->checkBan()) {
|
||||
if ($user->checkBan() || $user->permission(Perms\Site::RESTRICTED)) {
|
||||
$serveImage = $bannedAvatar;
|
||||
break;
|
||||
}
|
||||
|
@ -81,13 +81,13 @@ if (isset($_GET['m'])) {
|
|||
$user = User::construct($_GET['u']);
|
||||
|
||||
// If user is deactivated use deactive avatar
|
||||
if ($user->hasRanks([0, 1])) {
|
||||
if ($user->permission(Perms\Site::DEACTIVATED)) {
|
||||
$serveImage = $noBackground;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if user is banned
|
||||
if (Bans::checkBan($_GET['u'])) {
|
||||
if (Bans::checkBan($_GET['u']) || $user->permission(Perms\Site::RESTRICTED)) {
|
||||
$serveImage = $noBackground;
|
||||
break;
|
||||
}
|
||||
|
@ -117,13 +117,13 @@ if (isset($_GET['m'])) {
|
|||
$user = User::construct($_GET['u']);
|
||||
|
||||
// If user is deactivated use deactive avatar
|
||||
if ($user->hasRanks([0, 1])) {
|
||||
if ($user->permission(Perms\Site::DEACTIVATED)) {
|
||||
$serveImage = $noHeader;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if user is banned
|
||||
if (Bans::checkBan($_GET['u'])) {
|
||||
if (Bans::checkBan($_GET['u']) || $user->permission(Perms\Site::RESTRICTED)) {
|
||||
$serveImage = $noHeader;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,22 @@ if (!$forum->permission(ForumPerms::VIEW, $currentUser->id()) || !$forum->permis
|
|||
exit;
|
||||
}
|
||||
|
||||
// Check if the user has access to the forum
|
||||
if (!isset($thread) && !$forum->permission(ForumPerms::CREATE_THREADS, $currentUser->id())) {
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'title' => 'Information',
|
||||
'message' => 'You are not allowed to create threads in this forum.',
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
$mode = isset($_GET['f']) ? 'f' : (isset($_GET['t']) ? 't' : (isset($_GET['p']) ? 'p' : null));
|
||||
|
||||
// Include emotes and bbcodes
|
||||
|
@ -83,6 +99,22 @@ if ($mode != 'f') {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Prompt an error if the topic doesn't exist
|
||||
if ($thread->status == 1 && !$forum->permission(ForumPerms::LOCK, $currentUser->id())) {
|
||||
// Add page specific things
|
||||
$renderData['page'] = [
|
||||
'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')),
|
||||
'message' => 'The thread you tried to reply to is locked.',
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check if we're in quote mode
|
||||
if ($mode == 'p' && isset($_GET['quote']) && $_GET['quote'] == $_GET['p'] && array_key_exists($_GET['p'], $thread->posts())) {
|
||||
// Reassign post for ease
|
||||
|
@ -93,8 +125,23 @@ if ($mode != 'f') {
|
|||
|
||||
// Post editing
|
||||
} elseif ($mode == 'p' && isset($_GET['edit']) && $_GET['edit'] == $_GET['p'] && array_key_exists($_GET['p'], $thread->posts())) {
|
||||
// Permissions
|
||||
if (!$currentUser->permission(ForumPerms::EDIT_OWN, Perms::FORUM)) {
|
||||
// Add page specific things
|
||||
$renderData['page'] = [
|
||||
'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')),
|
||||
'message' => 'You are not allowed to edit posts!',
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
// Checks
|
||||
if ($thread->posts()[$_GET['p']]->poster->id() != $currentUser->id()) {
|
||||
if ($thread->posts()[$_GET['p']]->poster->id() != $currentUser->id() && !$forum->permission(ForumPerms::EDIT_ANY, $currentUser->id())) {
|
||||
// Add page specific things
|
||||
$renderData['page'] = [
|
||||
'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')),
|
||||
|
@ -120,12 +167,12 @@ if ($mode != 'f') {
|
|||
]);
|
||||
// Post deletion
|
||||
} elseif ($mode == 'p' && isset($_GET['delete']) && $_GET['delete'] == $_GET['p'] && array_key_exists($_GET['p'], $thread->posts())) {
|
||||
// Checks
|
||||
if ($thread->posts()[$_GET['p']]->poster->id() != $currentUser->id() || !$forum->permission(ForumPerms::DELETE_ANY, $currentUser->id())) {
|
||||
// Permissions
|
||||
if (!$currentUser->permission(ForumPerms::DELETE_OWN, Perms::FORUM)) {
|
||||
// Add page specific things
|
||||
$renderData['page'] = [
|
||||
'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')),
|
||||
'message' => 'You can only delete your own posts!',
|
||||
'message' => 'You are not allowed to delete posts!',
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
|
@ -136,8 +183,8 @@ if ($mode != 'f') {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Permissions
|
||||
if ($currentUser->permission(ForumPerms::DELETE_OWN, Perms::FORUM)) {
|
||||
// Checks
|
||||
if ($thread->posts()[$_GET['p']]->poster->id() != $currentUser->id() && !$forum->permission(ForumPerms::DELETE_ANY, $currentUser->id())) {
|
||||
// Add page specific things
|
||||
$renderData['page'] = [
|
||||
'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')),
|
||||
|
@ -226,7 +273,7 @@ if (isset($_POST['post'])) {
|
|||
$post->editTime = time();
|
||||
$post->editReason = '';
|
||||
$post->editUser = $currentUser;
|
||||
$post->update();
|
||||
$post = $post->update();
|
||||
} else {
|
||||
$post = null;
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ $profile = User::construct(isset($_GET['u']) ? $_GET['u'] : 0);
|
|||
// Views array
|
||||
$views = [
|
||||
'index',
|
||||
'friends',
|
||||
/*'friends',
|
||||
'threads',
|
||||
'posts',
|
||||
'posts',*/
|
||||
'comments',
|
||||
];
|
||||
|
||||
|
@ -39,9 +39,8 @@ if ($profile->id() == 0) {
|
|||
// Redirect if so
|
||||
if ($check) {
|
||||
$renderData['page'] = [
|
||||
'title' => 'Information',
|
||||
'message' => 'The user this profile belongs to changed their username, you are being redirected.',
|
||||
'redirect' => $urls->format('USER_PROFILE', [$check['user_id']]),
|
||||
'redirect' => $urls->format('USER_PROFILE', [$check['user_id']]),
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
|
@ -53,6 +52,31 @@ if ($profile->id() == 0) {
|
|||
}
|
||||
}
|
||||
|
||||
// If the user id is zero check if there was a namechange
|
||||
if (isset($_GET['restrict']) && $_GET['restrict'] == session_id() && $currentUser->permission(Perms\Manage::CAN_RESTRICT_USERS, Perms::MANAGE)) {
|
||||
// Check restricted status
|
||||
$restricted = $profile->permission(Perms\Site::RESTRICTED);
|
||||
|
||||
if ($restricted) {
|
||||
$profile->removeRanks([Config::get('restricted_rank_id')]);
|
||||
} else {
|
||||
$profile->addRanks([Config::get('restricted_rank_id')]);
|
||||
$profile->removeRanks($profile->ranks());
|
||||
}
|
||||
|
||||
$renderData['page'] = [
|
||||
'message' => 'Toggled the restricted status of the user.',
|
||||
'redirect' => $urls->format('USER_PROFILE', [$profile->id()]),
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ if (!$thread) {
|
|||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'The topic you tried to access does not exist.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
|
@ -46,8 +47,8 @@ if (!$thread) {
|
|||
if (!$forum->permission(ForumPerms::VIEW, $currentUser->id())) {
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'title' => 'Information',
|
||||
'message' => 'You do not have access to this thread.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
|
@ -58,6 +59,164 @@ if (!$forum->permission(ForumPerms::VIEW, $currentUser->id())) {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Sticky thread
|
||||
if (isset($_GET['sticky']) && $_GET['sticky'] == session_id() && $forum->permission(ForumPerms::STICKY, $currentUser->id())) {
|
||||
// Check the status
|
||||
if ($thread->type == 1) {
|
||||
$thread->type = 0;
|
||||
} else {
|
||||
$thread->type = 1;
|
||||
}
|
||||
|
||||
// Update the thread
|
||||
$thread->update();
|
||||
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'Changed the thread type.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Announce thread
|
||||
if (isset($_GET['announce']) && $_GET['announce'] == session_id() && $forum->permission(ForumPerms::ANNOUNCEMENT, $currentUser->id())) {
|
||||
// Check the status
|
||||
if ($thread->type == 2) {
|
||||
$thread->type = 0;
|
||||
} else {
|
||||
$thread->type = 2;
|
||||
}
|
||||
|
||||
// Update the thread
|
||||
$thread->update();
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'Changed the thread type.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Lock thread
|
||||
if (isset($_GET['lock']) && $_GET['lock'] == session_id() && $forum->permission(ForumPerms::LOCK, $currentUser->id())) {
|
||||
// Check the status
|
||||
if ($thread->status == 1) {
|
||||
$thread->status = 0;
|
||||
} else {
|
||||
$thread->status = 1;
|
||||
}
|
||||
|
||||
// Update the thread
|
||||
$thread->update();
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'Changed the thread status.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Trash thread
|
||||
if (isset($_GET['trash']) && $_GET['trash'] == session_id() && $forum->permission(ForumPerms::MOVE, $currentUser->id())) {
|
||||
// Check the status
|
||||
if ($thread->forum != Config::get('forum_trash_id')) {
|
||||
$thread->move(Config::get('forum_trash_id'));
|
||||
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'Moved thread to the trash.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
} else {
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'This thread is already trashed.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
}
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Restore thread
|
||||
if (isset($_GET['restore']) && $_GET['restore'] == session_id() && $forum->permission(ForumPerms::MOVE, $currentUser->id())) {
|
||||
// Check the status
|
||||
if ($thread->oldForum) {
|
||||
// Move thread
|
||||
$thread->move($thread->oldForum, false);
|
||||
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'Restored the thread to its previous location.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
} else {
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'This thread has never been moved.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
}
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Prune thread
|
||||
if (isset($_GET['prune']) && $_GET['prune'] == session_id() && $forum->permission(ForumPerms::DELETE_ANY, $currentUser->id())) {
|
||||
// Check the status
|
||||
if ($thread->forum == Config::get('forum_trash_id')) {
|
||||
$thread->delete();
|
||||
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'The thread has been pruned.',
|
||||
'redirect' => $urls->format('FORUM_SUB', [$thread->forum]),
|
||||
];
|
||||
} else {
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'message' => 'You can only prune trashed threads.',
|
||||
'redirect' => $urls->format('FORUM_THREAD', [$thread->id]),
|
||||
];
|
||||
}
|
||||
|
||||
// Set parse variables
|
||||
$template->setVariables($renderData);
|
||||
|
||||
// Print page contents
|
||||
echo $template->render('global/information');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Update the tracking status
|
||||
$thread->trackUpdate($currentUser->id());
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Sakura;
|
||||
|
||||
// Define Sakura version
|
||||
define('SAKURA_VERSION', '20160109');
|
||||
define('SAKURA_VERSION', '20160110');
|
||||
define('SAKURA_VLABEL', 'Eminence');
|
||||
define('SAKURA_COLOUR', '#6C3082');
|
||||
|
||||
|
@ -153,6 +153,7 @@ if (!defined('SAKURA_NO_TPL')) {
|
|||
'onlineTimeout' => Config::get('max_online_time'),
|
||||
'announcementImage' => Config::get('header_announcement_image'),
|
||||
'announcementLink' => Config::get('header_announcement_link'),
|
||||
'trashForumId' => Config::get('forum_trash_id'),
|
||||
|
||||
'recaptchaPublic' => Config::get('recaptcha_public'),
|
||||
'recaptchaEnabled' => Config::get('recaptcha'),
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
{% endif %}
|
||||
{% if forumReplyLink %}
|
||||
<a href="{{ forumReplyLink }}" class="forumbtn"><span class="fa fa-reply-all"></span> Reply</a>
|
||||
<a href="{{ sakura.currentPage }}" class="forumbtn" onclick="ajaxBusyView(true);"><span class="fa fa-refresh"></span> Refresh</a>
|
||||
{% endif %}
|
||||
{% if forumNewLink %}
|
||||
<a href="{{ forumNewLink }}" class="forumbtn"><span class="fa fa-pencil-square-o"></span> New Thread</a>
|
||||
|
@ -15,6 +14,29 @@
|
|||
{% if forumMarkRead %}
|
||||
<a href="{{ forumMarkRead }}" class="forumbtn"><span class="fa fa-check-square-o"></span> Mark as Read</a>
|
||||
{% endif %}
|
||||
{% if forumSticky %}
|
||||
<a href="{{ forumSticky }}" class="forumbtn"><span class="fa fa-thumb-tack"></span> Stick</a>
|
||||
{% elseif forumUnsticky %}
|
||||
<a href="{{ forumUnsticky }}" class="forumbtn"><span class="fa fa-remove"></span> Unstick</a>
|
||||
{% endif %}
|
||||
{% if forumAnnounce %}
|
||||
<a href="{{ forumAnnounce }}" class="forumbtn"><span class="fa fa-bullhorn"></span> Announce</a>
|
||||
{% elseif forumUnannounce %}
|
||||
<a href="{{ forumUnannounce }}" class="forumbtn"><span class="fa fa-remove"></span> Unannounce</a>
|
||||
{% endif %}
|
||||
{% if forumLock %}
|
||||
<a href="{{ forumLock }}" class="forumbtn"><span class="fa fa-lock"></span> Lock</a>
|
||||
{% elseif forumUnlock %}
|
||||
<a href="{{ forumUnlock }}" class="forumbtn"><span class="fa fa-unlock"></span> Unlock</a>
|
||||
{% endif %}
|
||||
{% if forumRestore %}
|
||||
<a href="{{ forumRestore }}" class="forumbtn"><span class="fa fa-history"></span> Restore</a>
|
||||
{% endif %}
|
||||
{% if forumTrash %}
|
||||
<a href="{{ forumTrash }}" class="forumbtn"><span class="fa fa-trash"></span> Trash</a>
|
||||
{% elseif forumPrune %}
|
||||
<a href="{{ forumPrune }}" class="forumbtn"><span class="fa fa-bomb"></span> Prune</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% include 'elements/pagination.twig' %}
|
||||
<div class="clear"></div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<tr>
|
||||
<td class="topicIcon{% if thread.unread(user.id) %} unread{% endif %}{% if thread.type == 2 %} topicAnnouncement{% endif %}">
|
||||
<div class="fa fa-2x fa-{% if thread.type == 1 %}thumb-tack{% elseif thread.type == 2 %}exclamation{% 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 class="topicTitle{% if thread.type == 2 %} topicAnnouncement{% endif %}">
|
||||
<a href="{{ urls.format('FORUM_THREAD', [thread.id]) }}" class="default">{{ thread.title }}</a>
|
||||
|
|
|
@ -1,7 +1,49 @@
|
|||
{% extends 'global/master.twig' %}
|
||||
|
||||
{% set forumBackLink %}{{ urls.format('FORUM_SUB', [forum.id]) }}{% endset %}
|
||||
{% set forumReplyLink %}{{ urls.format('FORUM_REPLY', [thread.id]) }}{% endset %}
|
||||
|
||||
{% if thread.status != 1 or forum.permission(constant('Sakura\\Perms\\Forum::LOCK'), user.id) %}
|
||||
{% set forumReplyLink %}{{ urls.format('FORUM_REPLY', [thread.id]) }}{% endset %}
|
||||
{% endif %}
|
||||
|
||||
{% if forum.permission(constant('Sakura\\Perms\\Forum::STICKY'), user.id) %}
|
||||
{% if thread.type == 1 %}
|
||||
{% set forumUnsticky %}{{ urls.format('FORUM_STICKY', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% else %}
|
||||
{% set forumSticky %}{{ urls.format('FORUM_STICKY', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if forum.permission(constant('Sakura\\Perms\\Forum::ANNOUNCEMENT'), user.id) %}
|
||||
{% if thread.type == 2 %}
|
||||
{% set forumUnannounce %}{{ urls.format('FORUM_ANNOUNCE', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% else %}
|
||||
{% set forumAnnounce %}{{ urls.format('FORUM_ANNOUNCE', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if forum.permission(constant('Sakura\\Perms\\Forum::LOCK'), user.id) %}
|
||||
{% if thread.status == 1 %}
|
||||
{% set forumUnlock %}{{ urls.format('FORUM_LOCK', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% else %}
|
||||
{% set forumLock %}{{ urls.format('FORUM_LOCK', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if forum.permission(constant('Sakura\\Perms\\Forum::MOVE'), user.id) %}
|
||||
{% if thread.oldForum %}
|
||||
{% set forumRestore %}{{ urls.format('FORUM_RESTORE', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% endif %}
|
||||
{% if thread.forum != sakura.trashForumId %}
|
||||
{% set forumTrash %}{{ urls.format('FORUM_TRASH', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if forum.permission(constant('Sakura\\Perms\\Forum::DELETE_ANY'), user.id) %}
|
||||
{% if thread.forum == sakura.trashForumId %}
|
||||
{% set forumPrune %}{{ urls.format('FORUM_PRUNE', [thread.id, php.sessionid]) }}{% endset %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% set posts = thread.posts|batch(10) %}
|
||||
|
||||
|
@ -52,15 +94,18 @@
|
|||
<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi"{% if not post.poster.isPremium[0] %} style="opacity: 0;"{% endif %} /> <img src="{{ sakura.contentPath }}/images/flags/{{ post.poster.country.short|lower }}.png" alt="{{ post.poster.country.long }}" />{% if post.poster.id == (thread.posts|first).poster.id %} <img src="{{ sakura.contentPath }}/images/op.png" alt="OP" title="Original Poster" />{% endif %}
|
||||
{% if session.checkLogin %}
|
||||
<div class="actions">
|
||||
{% if user.id == post.poster.id %}
|
||||
{% if (user.id == post.poster.id and forum.permission(constant('Sakura\\Perms\\Forum::EDIT_OWN'), user.id)) or forum.permission(constant('Sakura\\Perms\\Forum::EDIT_ANY'), user.id) %}
|
||||
<a class="fa fa-pencil-square-o" title="Edit this post" href="{{ urls.format('FORUM_EDIT_POST', [post.id]) }}"></a>
|
||||
<a class="fa fa-trash" title="Delete this post" href="{{ urls.format('FORUM_DELETE_POST', [post.id]) }}"></a>
|
||||
{% elseif not post.poster.checkPermission('SITE', 'DEACTIVATED') or post.poster.checkPermission('SITE', 'RESTRICTED') %}
|
||||
{% if user.isFriends(post.poster.id) != 0 %}
|
||||
<a class="fa fa-{% if user.isFriends(post.poster.id) == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>
|
||||
{% endif %}
|
||||
<a class="fa fa-user-{% if user.isFriends(post.poster.id) == 0 %}plus{% else %}times{% endif %} forum-friend-toggle" title="{% if user.isFriends(post.poster.id) == 0 %}Add {{ post.poster.username }} as a friend{% else %}Remove friend{% endif %}" href="{% if user.isFriends(post.poster.id) == 0 %}{{ urls.format('FRIEND_ADD', [post.poster.id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [post.poster.id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}"></a>
|
||||
<a class="fa fa-flag" title="Report {{ post.poster.username }}" href="{{ urls.format('USER_REPORT', [post.poster.id]) }}"></a>
|
||||
{% if (user.id == post.poster.id and forum.permission(constant('Sakura\\Perms\\Forum::DELETE_OWN'), user.id)) or forum.permission(constant('Sakura\\Perms\\Forum::DELETE_ANY'), user.id) %}
|
||||
<a class="fa fa-trash" title="Delete this post" href="{{ urls.format('FORUM_DELETE_POST', [post.id]) }}"></a>
|
||||
{% endif %}
|
||||
{% if not (post.poster.permission(constant('Sakura\\Perms\\Site::DEACTIVATED')) or post.poster.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) or user.id == post.poster.id) %}
|
||||
{% if user.isFriends(post.poster.id) != 0 %}
|
||||
<a class="fa fa-{% if user.isFriends(post.poster.id) == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>
|
||||
{% endif %}
|
||||
<a class="fa fa-user-{% if user.isFriends(post.poster.id) == 0 %}plus{% else %}times{% endif %} forum-friend-toggle" title="{% if user.isFriends(post.poster.id) == 0 %}Add {{ post.poster.username }} as a friend{% else %}Remove friend{% endif %}" href="{% if user.isFriends(post.poster.id) == 0 %}{{ urls.format('FRIEND_ADD', [post.poster.id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [post.poster.id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}"></a>
|
||||
<a class="fa fa-flag" title="Report {{ post.poster.username }}" href="{{ urls.format('USER_REPORT', [post.poster.id]) }}"></a>
|
||||
{% endif %}
|
||||
<a class="fa fa-reply" title="Quote this post" href="{{ urls.format('FORUM_QUOTE_POST', [post.id]) }}"></a>
|
||||
</div>
|
||||
|
|
|
@ -40,11 +40,14 @@
|
|||
<a class="fa fa-user-{% if user.isFriends(profile.id) == 0 %}plus{% else %}times{% endif %}" title="{% if user.isFriends(profile.id) == 0 %}Add {{ profile.username }} as a friend{% else %}Remove friend{% endif %}" href="{% if user.isFriends(profile.id) == 0 %}{{ urls.format('FRIEND_ADD', [profile.id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [profile.id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}" id="profileFriendToggle"></a>
|
||||
<a class="fa fa-exclamation-circle" title="Report {{ profile.username }}" href="{{ urls.format('USER_REPORT', [profile.id]) }}"></a>
|
||||
{% endif %}
|
||||
{% if user.permission(constant('Sakura\\Perms\\Manage::CAN_RESTRICT_USERS'), constant('Sakura\\Perms::MANAGE')) %}
|
||||
<a class="fa fa-trash" title="Restrict {{ profile.username }}" href="?restrict={{ php.sessionid }}"></a>
|
||||
{% endif %}
|
||||
<hr class="default" />
|
||||
<a class="fa fa-file-text-o" title="View {{ profile.username }}'s user page" href="{{ urls.format('USER_PROFILE', [profile.id]) }}"></a>
|
||||
<a class="fa fa-list" title="View {{ profile.username }}'s threads" href="{{ urls.format('USER_THREADS', [profile.id]) }}"></a>
|
||||
{#<a class="fa fa-list" title="View {{ profile.username }}'s threads" href="{{ urls.format('USER_THREADS', [profile.id]) }}"></a>
|
||||
<a class="fa fa-reply" title="View {{ profile.username }}'s posts" href="{{ urls.format('USER_POSTS', [profile.id]) }}"></a>
|
||||
<a class="fa fa-star" title="View {{ profile.username }}'s friends" href="{{ urls.format('USER_FRIENDS', [profile.id]) }}"></a>
|
||||
<a class="fa fa-star" title="View {{ profile.username }}'s friends" href="{{ urls.format('USER_FRIENDS', [profile.id]) }}"></a> shh #}
|
||||
{#<a class="fa fa-users" title="View {{ profile.username }}'s groups" href="{{ urls.format('USER_GROUPS', [profile.id]) }}"></a>#}
|
||||
{% if not noUserpage %}
|
||||
<a class="fa fa-comments-o" title="View {{ profile.username }}'s profile comments" href="{{ urls.format('USER_COMMENTS', [profile.id]) }}"></a>
|
||||
|
|
Reference in a new issue