164 lines
11 KiB
Twig
164 lines
11 KiB
Twig
{% extends 'global/master.twig' %}
|
|
|
|
{% set forumBackLink %}{{ route('forums.forum', forum.id) }}{% endset %}
|
|
|
|
{% block title %}{% if thread is defined %}{{ thread.title }}{% else %}Creating thread in {{ forum.name }}{% endif %}{% endblock %}
|
|
|
|
{% if thread is defined %}
|
|
{% if thread.status != 1
|
|
or forum.permission(constant('Sakura\\Perms\\Forum::LOCK'), user.id)
|
|
or forum.permission(constant('Sakura\\Perms\\Forum::REPLY')) %}
|
|
{% set forumReplyLink %}#reply{% endset %}
|
|
{% endif %}
|
|
|
|
{% if forum.permission(constant('Sakura\\Perms\\Forum::STICKY'), user.id)
|
|
or forum.permission(constant('Sakura\\Perms\\Forum::ANNOUNCEMENT'), user.id)
|
|
or forum.permission(constant('Sakura\\Perms\\Forum::LOCK'), user.id)
|
|
or forum.permission(constant('Sakura\\Perms\\Forum::MOVE'), user.id)
|
|
or forum.permission(constant('Sakura\\Perms\\Forum::DELETE_ANY'), user.id) %}
|
|
{% set showMod = true %}
|
|
{% endif %}
|
|
|
|
{% if forum.permission(constant('Sakura\\Perms\\Forum::STICKY'), user.id) %}
|
|
{% set forumSticky = thread.type == 1 ? true : false %}
|
|
{% endif %}
|
|
|
|
{% if forum.permission(constant('Sakura\\Perms\\Forum::ANNOUNCEMENT'), user.id) %}
|
|
{% set forumAnnounce = thread.type == 2 ? true : false %}
|
|
{% endif %}
|
|
|
|
{% if forum.permission(constant('Sakura\\Perms\\Forum::LOCK'), user.id) %}
|
|
{% set forumLock = thread.status == 1 ? true : false %}
|
|
{% endif %}
|
|
|
|
{% if forum.permission(constant('Sakura\\Perms\\Forum::MOVE'), user.id) %}
|
|
{% if thread.oldForum %}
|
|
{% set forumRestore = true %}
|
|
{% endif %}
|
|
|
|
{% if thread.forum != sakura.trashForumId %}
|
|
{% set forumTrash = true %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if forum.permission(constant('Sakura\\Perms\\Forum::DELETE_ANY'), user.id) %}
|
|
{% if thread.forum == sakura.trashForumId %}
|
|
{% set forumPrune = true %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% set posts = thread.posts|batch(10) %}
|
|
|
|
{% set paginationPages = posts %}
|
|
{% set paginationUrl %}{{ route('forums.thread', thread.id) }}{% endset %}
|
|
{% endif %}
|
|
|
|
{% block css %}
|
|
<link rel="stylesheet" href="{{ sakura.contentPath }}/libraries/highlight.css" />
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script src="{{ sakura.contentPath }}/libraries/highlight.js"></script>
|
|
<script>hljs.initHighlightingOnLoad();</script>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="content homepage forum viewtopic">
|
|
<div class="content-column">
|
|
<div class="head"><a href="{{ forumBackLink }}" class="clean">{{ forum.name }}</a> / <span id="threadTitle"><a href="{{ paginationUrl }}" class="clean">{{ thread.title }}</a></span></div>
|
|
{% include 'forum/forumBtns.twig' %}
|
|
<table class="posts">
|
|
{% if thread is defined %}
|
|
{% set textCache = session.replyText['t' ~ thread.id] %}
|
|
{% set postingAction = route('forums.thread.reply', thread.id) %}
|
|
|
|
{% for post in posts[get.page|default(1) - 1] %}
|
|
<tr class="post" id="p{{ post.id }}">
|
|
<td class="userpanel">
|
|
{% 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="{{ 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 %}
|
|
<a class="username">[deleted user]</a>
|
|
{% endif %}
|
|
<div class="userdata">
|
|
<div class="usertitle">{{ post.poster.title }}</div>
|
|
<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|lower }}.png" alt="{{ post.poster.country(true) }}" />{% 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 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>
|
|
{% endif %}
|
|
{% 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>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
<td class="post-content">
|
|
<div class="details">
|
|
<div class="subject">
|
|
<a href="#p{{ post.id }}" class="clean">{{ post.subject|slice(0, 50) }}{% if post.subject|length > 50 %}...{% endif %}</a>
|
|
</div>
|
|
<div class="date">
|
|
<a href="{{ route('forums.post', post.id) }}" class="clean">#{{ post.id }} - <time>{{ post.time|date(sakura.dateFormat) }}</time></a>
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
<div class="post-text bbcode">
|
|
{{ post.parsed|raw }}
|
|
</div>
|
|
{% if post.poster.signature and post.poster.permission(constant('Sakura\\Perms\\Site::CHANGE_SIGNATURE')) %}
|
|
<div class="clear"></div>
|
|
<div class="signature bbcode">
|
|
{{ post.poster.signature()|raw|nl2br }}
|
|
</div>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
{% else %}
|
|
{% set titleCache = session.replyText['f' ~ forum.id].title %}
|
|
{% set textCache = session.replyText['f' ~ forum.id].text %}
|
|
{% set postingAction = route('forums.new', forum.id) %}
|
|
{% endif %}
|
|
<tr class="post" id="postingPreview" style="display: none;">
|
|
<td class="userpanel">
|
|
<a class="default username" href="{{ route('user.profile', user.id) }}" style="color: {{ user.colour }}; text-shadow: 0 0 5px {% if user.colour != 'inherit' %}{{ user.colour }}{% else %}#222{% endif %};" title="Go to {{ user.username }}'s profile">{{ user.username }}</a>
|
|
<img src="{{ route('file.avatar', user.id) }}" alt="{{ user.username }}" class="avatar" style="box-shadow: 0 3px 7px #484;" />
|
|
<div class="userdata">
|
|
<div class="usertitle">{{ user.title }}</div>
|
|
<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi"{% if not user.isPremium[0] %} style="opacity: 0;"{% endif %} /> <img src="{{ sakura.contentPath }}/images/flags/{{ user.country|lower }}.png" alt="{{ user.country(true) }}" />{% if user.id == (thread.posts|first).poster.id %} <img src="{{ sakura.contentPath }}/images/op.png" alt="OP" title="Original Poster" />{% endif %}
|
|
</div>
|
|
</td>
|
|
<td class="post-content">
|
|
<div class="details">
|
|
<div class="subject" id="previewTitle">{% if titleCache is not defined %}Re: {{ thread.title }}{% endif %}</div>
|
|
<div class="date">Preview</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
<div class="post-text bbcode" id="previewText"></div>
|
|
{% if user.signature and user.permission(constant('Sakura\\Perms\\Site::CHANGE_SIGNATURE')) %}
|
|
<div class="clear"></div>
|
|
<div class="signature bbcode">
|
|
{{ user.signature()|raw|nl2br }}
|
|
</div>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
{% if forumReplyLink is defined or thread is not defined %}
|
|
{% include 'forum/replyForm.twig' %}
|
|
{% endif %}
|
|
{% include 'forum/forumBtns.twig' %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|