viewtopic commit + various bug fixes
This commit is contained in:
parent
9da8a4d84a
commit
926f0e6653
19 changed files with 429 additions and 87 deletions
|
@ -23,7 +23,8 @@
|
|||
"20150619",
|
||||
"20150620",
|
||||
"20150621",
|
||||
"20150627"
|
||||
"20150627",
|
||||
"20150628"
|
||||
|
||||
]
|
||||
|
||||
|
@ -1320,7 +1321,32 @@
|
|||
},
|
||||
{
|
||||
"type": "ADD",
|
||||
"change": "Added very basic topic list support."
|
||||
"change": "Added basic topic list support."
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
"20150628": [
|
||||
|
||||
{
|
||||
"type": "REM",
|
||||
"change": "Removed getUserProfileData() which decodes the json in the userData column and do it in the getUser() function."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed all (found) bugs related to the previously listed change."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed bug in the friends system where getFriends() only returns one friend."
|
||||
},
|
||||
{
|
||||
"type": "ADD",
|
||||
"change": "Added basic topic viewing support."
|
||||
},
|
||||
{
|
||||
"type": "UPD",
|
||||
"change": "Changed Edit icon on profiles."
|
||||
}
|
||||
|
||||
]
|
||||
|
|
|
@ -140,6 +140,7 @@ class Forum {
|
|||
// Getting all topics from a forum
|
||||
public static function getTopics($id) {
|
||||
|
||||
// Get the topics from the database
|
||||
$topics = Database::fetch('topics', true, [
|
||||
'forum_id' => [$id, '=']
|
||||
]);
|
||||
|
@ -163,6 +164,105 @@ class Forum {
|
|||
|
||||
}
|
||||
|
||||
// Get posts of a thread
|
||||
public static function getTopic($id) {
|
||||
|
||||
// Get the topic data from the database
|
||||
$topicInfo = Database::fetch('topics', false, [
|
||||
'topic_id' => [$id, '=']
|
||||
]);
|
||||
|
||||
// Check if there actually is anything
|
||||
if(empty($topicInfo))
|
||||
return false;
|
||||
|
||||
// Get the posts from the database
|
||||
$rawPosts = Database::fetch('posts', true, [
|
||||
'topic_id' => [$id, '=']
|
||||
]);
|
||||
|
||||
// Create storage array
|
||||
$topic = [];
|
||||
|
||||
// Add forum data
|
||||
$topic['forum'] = self::getForum($topicInfo['forum_id']);
|
||||
|
||||
// Store the topic info
|
||||
$topic['topic'] = $topicInfo;
|
||||
|
||||
// Get the data of the first poster
|
||||
$topic['topic']['first_poster'] = [
|
||||
'user' => ($_FIRST_POSTER = Users::getUser($topic['topic']['topic_first_poster_id'])),
|
||||
'rank' => Users::getRank($_FIRST_POSTER['rank_main'])
|
||||
];
|
||||
|
||||
// Get the data of the last poster
|
||||
$topic['topic']['last_poster'] = [
|
||||
'user' => ($_LAST_POSTER = Users::getUser($topic['topic']['topic_last_poster_id'])),
|
||||
'rank' => Users::getRank($_LAST_POSTER['rank_main'])
|
||||
];
|
||||
|
||||
// Create space for posts
|
||||
$topic['posts'] = [];
|
||||
|
||||
// Parse the data of every post
|
||||
foreach($rawPosts as $post) {
|
||||
|
||||
// Add post and metadata to the global storage array
|
||||
$topic['posts'][$post['post_id']] = array_merge($post, [
|
||||
'is_op' => ($post['poster_id'] == $topic['topic']['topic_first_poster_id'] ? '1' : '0'),
|
||||
'user' => ($_POSTER = Users::getUser($post['poster_id'])),
|
||||
'rank' => Users::getRank($_POSTER['rank_main']),
|
||||
'country' => Main::getCountryName($_POSTER['country']),
|
||||
'is_tenshi' => Users::checkUserTenshi($_POSTER['id']),
|
||||
'is_online' => Users::checkUserOnline($_POSTER['id']),
|
||||
'is_friend' => Users::checkFriend($_POSTER['id']),
|
||||
'parsed_post' => self::parseMarkUp($post['post_text'], $post['parse_mode'])
|
||||
]);
|
||||
|
||||
// Just in case
|
||||
unset($_POSTER);
|
||||
|
||||
}
|
||||
|
||||
// Return the compiled topic data
|
||||
return $topic;
|
||||
|
||||
}
|
||||
|
||||
// Get a topic ID from a post ID
|
||||
public static function getTopicIdFromPostId($id) {
|
||||
|
||||
// Get the post
|
||||
$post = Database::fetch('posts', false, [
|
||||
'post_id' => [$id, '=']
|
||||
]);
|
||||
|
||||
// Return false if nothing was returned
|
||||
if(empty($post))
|
||||
return false;
|
||||
|
||||
// Return the topic id
|
||||
return $post['topic_id'];
|
||||
|
||||
}
|
||||
|
||||
// Parse different markup flavours
|
||||
public static function parseMarkUp($text, $mode) {
|
||||
|
||||
// Switch between modes
|
||||
switch($mode) {
|
||||
case 1:
|
||||
return Main::bbParse($text);
|
||||
case 2:
|
||||
return Main::mdParse($text);
|
||||
case 0:
|
||||
default:
|
||||
return $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Creating a new post
|
||||
public static function createPost($subject, $text, $enableMD, $enableSig, $forum, $type = 0, $status = 0) {
|
||||
|
||||
|
|
|
@ -694,20 +694,6 @@ class Users {
|
|||
|
||||
}
|
||||
|
||||
// Getting the profile data array of a user
|
||||
public static function getUserProfileData($id, $inputIsUser = false) {
|
||||
|
||||
// Get user data
|
||||
$user = ($inputIsUser ? $id : self::getUser($id));
|
||||
|
||||
// Decode the userData json
|
||||
$data = json_decode($user['userData'], true);
|
||||
|
||||
// Return the profile data
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
// Get the available profile fields
|
||||
public static function getProfileFields() {
|
||||
|
||||
|
@ -745,7 +731,7 @@ class Users {
|
|||
return null;
|
||||
|
||||
// Assign the profileData variable
|
||||
$profileData = ($inputIsData ? $id : self::getUserProfileData($id));
|
||||
$profileData = ($inputIsData ? $id : self::getUser($id)['userData']);
|
||||
|
||||
// Once again if nothing was returned just return null
|
||||
if(count($profileData) < 1 || $profileData == null || empty($profileData['profileFields']))
|
||||
|
@ -894,7 +880,10 @@ class Users {
|
|||
|
||||
// Return false if no user was found
|
||||
if(empty($user))
|
||||
return self::$emptyUser;
|
||||
$user = self::$emptyUser;
|
||||
|
||||
// Parse the json in the additional section
|
||||
$user['userData'] = json_decode($user['userData'], true);
|
||||
|
||||
// If user was found return user data
|
||||
return $user;
|
||||
|
@ -1135,10 +1124,10 @@ class Users {
|
|||
$friends = [];
|
||||
|
||||
// Iterate over the raw database return
|
||||
foreach($getFriends as $friend) {
|
||||
foreach($getFriends as $key => $friend) {
|
||||
|
||||
// Add friend to array
|
||||
$friends[($timestamps ? $friend['fid'] : false)] = $friend[($timestamps ? 'timestamp' : 'fid')];
|
||||
$friends[($timestamps ? $friend['fid'] : $key)] = $friend[($timestamps ? 'timestamp' : 'fid')];
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Sakura;
|
||||
|
||||
// Define Sakura version
|
||||
define('SAKURA_VERSION', '20150627');
|
||||
define('SAKURA_VERSION', '20150628');
|
||||
define('SAKURA_VLABEL', 'Eminence');
|
||||
define('SAKURA_VTYPE', 'Development');
|
||||
define('SAKURA_COLOUR', '#6C3082');
|
||||
|
|
|
@ -6,30 +6,36 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if board.viewforum %}
|
||||
<table class="topicList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Topic</th>
|
||||
<th>Author</th>
|
||||
<th></th>
|
||||
<th>Last post</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Topic</th>
|
||||
<th>Author</th>
|
||||
<th></th>
|
||||
<th>Last post</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
{% for topic in board.topics %}
|
||||
{% include 'forum/topicEntry.tpl' %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if board.viewforum and not board.forums[0].forum.forum_type %}
|
||||
<a href="/forum/{{ board.forums[0].forum.forum_id }}/new" class="forumbtn"><span class="fa fa-pencil-square-o"></span> New Thread</a>
|
||||
{% if board.topics|length %}
|
||||
<table class="topicList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Topic</th>
|
||||
<th>Author</th>
|
||||
<th></th>
|
||||
<th>Last post</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Topic</th>
|
||||
<th>Author</th>
|
||||
<th></th>
|
||||
<th>Last post</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
{% for topic in board.topics %}
|
||||
{% include 'forum/topicEntry.tpl' %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<h1 class="stylised" style="margin: 2em auto; text-align: center;">There are no posts in this forum!</h1>
|
||||
{% endif %}
|
||||
<a href="/forum/{{ board.forums[0].forum.forum_id }}/new" class="forumbtn"><span class="fa fa-pencil-square-o"></span> New Thread</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<div class="desc">
|
||||
{{ forum.forum_desc }}
|
||||
{% if board.forums[forum.forum_id]|length %}
|
||||
<div class="subforums" style="margin-top: 3px; margin-left: -5px;">
|
||||
<div class="subforums" style="margin-top: 3px; margin-left: -5px; font-weight: bold;">
|
||||
Subforums:
|
||||
{% for forum in board.forums[forum.forum_id].forums %}
|
||||
<a href="{% if forum.forum_type == 2 %}{{ forum.forum_link }}" target="_blank"{% else %}//{{ sakura.urls.main }}/forum/{{ forum.forum_id }}/"{% endif %}" class="default">{{ forum.forum_name }}</a>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<td class="forumLastColumn">
|
||||
<div>
|
||||
{% if forum.forum_last_post_id %}
|
||||
Last post in <a href="//{{ sakura.urls.main }}/forum/thread/{{ forum.forum_last_post_id }}" class="default">Thread with an obnoxiously long fucking title</a><br />12 years ago by <a href="//{{ sakura.urls.main }}/u/{{ forum.last_poster.user.id }}" class="default" style="color: {% if forum.last_poster.user.name_colour %}{{ forum.last_poster.user.name_colour }}{% else %}{{ forum.last_poster.rank.colour }}{% endif %};">{{ forum.last_poster.user.username }}</a> <a href="/forum/post/{{ forum.forum_last_post_id }}" class="default fa fa-tag"></a>
|
||||
Last post in <a href="//{{ sakura.urls.main }}/forum/thread/{{ forum.forum_last_post_id }}" class="default">Thread with an obnoxiously long fucking title</a><br />12 years ago by {% if forum.last_poster.user.id %}<a href="//{{ sakura.urls.main }}/u/{{ forum.last_poster.user.id }}" class="default" style="color: {% if forum.last_poster.user.name_colour %}{{ forum.last_poster.user.name_colour }}{% else %}{{ forum.last_poster.rank.colour }}{% endif %};">{{ forum.last_poster.user.username }}</a>{% else %}[deleted user]{% endif %} <a href="/forum/post/{{ forum.forum_last_post_id }}" class="default fa fa-tag"></a>
|
||||
{% else %}
|
||||
There are no posts in this forum.<br />
|
||||
{% endif %}
|
||||
|
|
|
@ -1,19 +1,27 @@
|
|||
<tr>
|
||||
<td class="topicIcon">
|
||||
<td class="topicIcon read">
|
||||
<div class="fa fa-2x fa-{% if topic.topic_status == 1 %}lock{% elseif topic.topic_type == 2 %}exclamation{% elseif topic.topic_type == 1 %}thumb-tack{% else %}navicon{% endif %}"></div>
|
||||
</td>
|
||||
<td class="topicTitle">
|
||||
<a href="/forum/thread/{{ topic.topic_id }}" class="default">{{ topic.topic_title }}</a>
|
||||
</td>
|
||||
<td class="topicAuthor">
|
||||
<a href="/u/{{ topic.first_poster.user.id }}" class="default" style="color: {% if topic.first_poster.user.name_colour %}{{ topic.first_poster.user.name_colour }}{% else %}{{ topic.first_poster.rank.colour }}{% endif %};">{{ topic.first_poster.user.username }}</a>
|
||||
{% if topic.first_poster.user.id %}
|
||||
<a href="/u/{{ topic.first_poster.user.id }}" class="default" style="color: {% if topic.first_poster.user.name_colour %}{{ topic.first_poster.user.name_colour }}{% else %}{{ topic.first_poster.rank.colour }}{% endif %};">{{ topic.first_poster.user.username }}</a>
|
||||
{% else %}
|
||||
[deleted user]
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="topicCounts">
|
||||
<div class="replies" title="Amount of replies to this topic.">{{ topic.topic_replies }}</div>
|
||||
<div class="views" title="Amount of times this topic has been viewed.">{{ topic.topic_views }}</div>
|
||||
</td>
|
||||
<td class="topicLast">
|
||||
<a href="/u/{{ topic.last_poster.user.id }}" class="default" style="color: {% if topic.last_poster.user.name_colour %}{{ topic.last_poster.user.name_colour }}{% else %}{{ topic.last_poster.rank.colour }}{% endif %};">{{ topic.last_poster.user.username }}</a> <a href="#" class="default fa fa-tag"></a><br />
|
||||
{% if topic.last_poster.user.id %}
|
||||
<a href="/u/{{ topic.last_poster.user.id }}" class="default" style="color: {% if topic.last_poster.user.name_colour %}{{ topic.last_poster.user.name_colour }}{% else %}{{ topic.last_poster.rank.colour }}{% endif %};">{{ topic.last_poster.user.username }}</a>
|
||||
{% else %}
|
||||
[deleted user]
|
||||
{% endif %} <a href="#" class="default fa fa-tag"></a><br />
|
||||
2000 years ago
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
|
|
57
_sakura/templates/yuuno/forum/viewtopic.tpl
Normal file
57
_sakura/templates/yuuno/forum/viewtopic.tpl
Normal file
|
@ -0,0 +1,57 @@
|
|||
{% include 'global/header.tpl' %}
|
||||
<div class="content homepage forum viewtopic">
|
||||
<div class="content-column">
|
||||
<div class="head">{{ forum.forum.forum_name }} / {{ topic.topic_title }}</div>
|
||||
<a href="/forum/thread/{{ topic.topic_id }}/reply" class="forumbtn"><span class="fa fa-reply-all"></span> Reply</a>
|
||||
<table class="posts">
|
||||
{% for post in posts %}
|
||||
<tr class="post" id="p{{ post.post_id }}">
|
||||
<td class="userpanel">
|
||||
{% if post.user.rank_main > 1 %}<a href="/u/{{ post.user.id }}" class="default username" style="color: {% if post.user.name_colour %}{{ post.user.name_colour }}{% else %}{{ post.rank.colour }}{% endif %};" title="Go to {{ post.user.username }}'s profile">{{ post.user.username }}</a>
|
||||
<img src="/a/{{ post.user.id }}" alt="{{ post.user.username }}" class="avatar" style="box-shadow: 0 3px 7px #{% if post.is_online %}484{% else %}844{% endif %};" />
|
||||
<div class="userdata">
|
||||
<div class="usertitle">{% if not post.user.usertitle %}{{ post.rank.title }}{% else %}{{ post.user.usertitle }}{% endif %}</div>
|
||||
<img src="//{{ sakura.urls.content }}/images/tenshi.png" alt="Tenshi"{% if not post.is_tenshi %} style="opacity: 0;"{% endif %} /> <img src="//{{ sakura.urls.content }}/images/flags/{% if post.user.country|lower == 'eu' %}europeanunion{% else %}{{ post.user.country|lower }}{% endif %}.png" alt="{{ post.country }}" />
|
||||
<div class="actions">
|
||||
{% if user.data.id == post.user.id %}
|
||||
<a class="fa fa-pencil-square-o" title="Edit this post" href="#"></a>
|
||||
{% else %}
|
||||
{% if post.is_friend != 0 %}<a class="fa fa-{% if post.is_friend == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>{% endif %}
|
||||
<a class="fa fa-user-{% if post.is_friend == 0 %}plus{% else %}times{% endif %}" title="{% if post.is_friend == 0 %}Add {{ post.user.username }} as a friend{% else %}Remove friend{% endif %}" href="//{{ sakura.urls.main }}/friends?{% if post.is_friend == 0 %}add{% else %}remove{% endif %}={{ post.user.id }}&session={{ php.sessionid }}&time={{ php.time }}&redirect={{ sakura.currentpage }}"></a>
|
||||
<a class="fa fa-flag" title="Report {{ post.user.username }}" href="//{{ sakura.urls.main }}/u/{{ post.user.id }}/report"></a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a class="username">[deleted user]</a>
|
||||
<div class="actions">
|
||||
{% endif %}
|
||||
<a class="fa fa-reply" title="Quote this post" href="/forum/post/{{ post.post_id }}/quote"></a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="post-content">
|
||||
<div class="details">
|
||||
<div class="subject">
|
||||
<a href="#p{{ post.post_id }}" class="clean">{{ post.post_subject }}</a>
|
||||
</div>
|
||||
<div class="date">
|
||||
<a href="/forum/post/{{ post.post_id }}#p{{ post.post_id }}" class="clean">{{ post.post_time|date("r") }}</a>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="post-text markdown">
|
||||
{{ post.parsed_post|raw }}
|
||||
</div>
|
||||
{% if post.enable_sig %}
|
||||
<div class="clear"></div>
|
||||
<div class="signature">
|
||||
<img src="http://i.flash.moe/vip.gif" />
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<a href="/forum/thread/{{ topic.topic_id }}/reply" class="forumbtn"><span class="fa fa-reply-all"></span> Reply</a>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'global/footer.tpl' %}
|
|
@ -23,7 +23,7 @@
|
|||
{% if user.checklogin %}
|
||||
<div class="user-actions">
|
||||
{% if user.data.id == profile.user.id %}
|
||||
<a class="fa fa-pencil-square" title="Edit your profile" href="//{{ sakura.urls.main }}/settings/profile"></a>
|
||||
<a class="fa fa-pencil-square-o" title="Edit your profile" href="//{{ sakura.urls.main }}/settings/profile"></a>
|
||||
{% else %}
|
||||
{% if profile.friend != 0 %}<a class="fa fa-{% if profile.friend == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>{% endif %}
|
||||
<a class="fa fa-user-{% if profile.friend == 0 %}plus{% else %}times{% endif %}" title="{% if profile.friend == 0 %}Add {{ profile.user.username }} as a friend{% else %}Remove friend{% endif %}" href="//{{ sakura.urls.main }}/friends?{% if profile.friend == 0 %}add{% else %}remove{% endif %}={{ profile.user.id }}&session={{ php.sessionid }}&time={{ php.time }}&redirect={{ sakura.currentpage }}" id="profileFriendToggle"></a>
|
||||
|
@ -88,7 +88,7 @@
|
|||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
{% if profile.data.profileBackground %}
|
||||
{% if profile.user.userData.profileBackground %}
|
||||
<script type="text/javascript">
|
||||
initialiseParallax('userBackground');
|
||||
</script>
|
||||
|
|
|
@ -1582,6 +1582,16 @@ textarea.inputStyling {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicIcon.read {
|
||||
color: #444;
|
||||
text-shadow: 0 0 5px #444;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicIcon.unread {
|
||||
color: #6C5D7B;
|
||||
text-shadow: 0 0 5px #9475B2;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicAuthor {
|
||||
width: 150px;
|
||||
text-align: center;
|
||||
|
@ -1607,3 +1617,116 @@ textarea.inputStyling {
|
|||
width: 250px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.forum .forumbtn {
|
||||
background: linear-gradient(0deg, #9475B2 10%, #C2AFFE 90%);
|
||||
color: #306;
|
||||
padding: 4px 8px;
|
||||
text-decoration: none;
|
||||
border-radius: 2px;
|
||||
margin: 4px 2px;
|
||||
display: inline-block;
|
||||
font-size: 1.3em;
|
||||
border: 1px solid #9475B2;
|
||||
}
|
||||
|
||||
.forum .forumbtn:hover {
|
||||
background: linear-gradient(0deg, #9475B2 30%, #C2AFFE 70%);
|
||||
}
|
||||
|
||||
.forum .forumbtn:active {
|
||||
background: linear-gradient(180deg, #9475B2 30%, #C2AFFE 70%);
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts {
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts tr:not(:last-child) td {
|
||||
border-bottom: 1px solid #9475B2;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .userpanel {
|
||||
width: 200px;
|
||||
text-align: center;
|
||||
background: linear-gradient(270deg, transparent, #C2AFFE);
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .userpanel .username {
|
||||
font: 1.5em/1.7em "SegoeUI", "Segoe UI", sans-serif;
|
||||
text-shadow: 0 0 7px #888; padding: 0 0 2px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .userpanel .avatar {
|
||||
max-width: 150px;
|
||||
max-height: 150px;
|
||||
border: 3px solid #EEE;
|
||||
background: #EEE;
|
||||
box-shadow: 0 3px 7px #888;
|
||||
border-radius: 3px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .userpanel .usertitle {
|
||||
font-size: .8em;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .userpanel .actions {
|
||||
font-size: 2em;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .userpanel .actions a {
|
||||
color: #8364A1;
|
||||
text-decoration: none;
|
||||
text-shadow: 0 0 2px #9475B2;
|
||||
transition: all .2s;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .userpanel .actions a:hover {
|
||||
text-shadow: 0 0 6px #9475B2;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .userpanel .actions a:active {
|
||||
color: #725390;
|
||||
text-shadow: 0 0 8px #8364A1;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .post-content {
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .post-content .details {
|
||||
border-bottom: 1px solid #B19EED;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .post-content .details .subject {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .post-content .details .date {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .post-content img {
|
||||
max-width: 850px;
|
||||
}
|
||||
|
||||
.forum.viewtopic .posts .post-content .signature {
|
||||
border-top: 1px solid #B19EED;
|
||||
margin-top: 16px;
|
||||
padding-top: 4px;
|
||||
display: block;
|
||||
min-width: 300px;
|
||||
max-height: 180px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
|
|
@ -24,24 +24,24 @@ RewriteRule ^changelog/?$ changelog.php [L,QSA]
|
|||
RewriteRule ^faq/?$ faq.php [L,QSA]
|
||||
RewriteRule ^search/?$ search.php [L,QSA]
|
||||
|
||||
## Info pages
|
||||
# Info pages
|
||||
RewriteRule ^r/([a-z]+)$ infopage.php?r=$1 [L,QSA]
|
||||
|
||||
## News
|
||||
# News
|
||||
RewriteRule ^news/?$ news.php [L,QSA]
|
||||
RewriteRule ^news/([0-9]+)$ news.php?id=$1 [L,QSA]
|
||||
RewriteRule ^news.xml$ news.php?xml [L,QSA]
|
||||
|
||||
## Settings
|
||||
# Settings
|
||||
RewriteRule ^settings/?$ settings.php [L,QSA]
|
||||
RewriteRule ^settings/([a-z]+)/?$ settings.php?mode=$1 [L,QSA]
|
||||
RewriteRule ^friends/?$ settings.php?friend-action=true [L,QSA]
|
||||
|
||||
## Private Messages
|
||||
# Private Messages
|
||||
RewriteRule ^messages/?$ messages.php [L,QSA]
|
||||
RewriteRule ^messages/([a-z]+)/?$ messages.php?mode=$1 [L,QSA]
|
||||
|
||||
## Members
|
||||
# Members
|
||||
RewriteRule ^members/?$ members.php [L,QSA]
|
||||
RewriteRule ^members/([a-z]+)/?$ members.php?sort=$1 [L,QSA]
|
||||
RewriteRule ^members/([0-9]+)/?$ members.php?rank=$1 [L,QSA]
|
||||
|
@ -51,7 +51,7 @@ RewriteRule ^members/([0-9]+)/p([0-9]+)/?$ members.php?rank=$1&page=$2 [L,QSA]
|
|||
RewriteRule ^members/([a-z]+)/p([0-9]+)/?$ members.php?sort=$1&page=$2 [L,QSA]
|
||||
RewriteRule ^members/([a-z]+)/([0-9]+)/p([0-9]+)/?$ members.php?sort=$1&rank=$2&page=$3 [L,QSA]
|
||||
|
||||
## Profiles
|
||||
# Profiles
|
||||
RewriteRule ^u/?$ profile.php [L,QSA]
|
||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/?$ profile.php?u=$1 [L,QSA]
|
||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/header/?$ imageserve.php?m=header&u=$1 [L,QSA]
|
||||
|
@ -61,7 +61,7 @@ RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/threads/?$ profile.php?u=$1$view=threads [L,
|
|||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/posts/?$ profile.php?u=$1$view=posts [L,QSA]
|
||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/report/?$ report.php?mode=user&id=$1 [L,QSA]
|
||||
|
||||
## Groups
|
||||
# Groups
|
||||
RewriteRule ^g/?$ group.php [L,QSA]
|
||||
RewriteRule ^g/([0-9]+)/?$ group.php?g=$1 [L,QSA]
|
||||
|
||||
|
@ -71,9 +71,12 @@ RewriteRule ^bg/([0-9]+)$|bg/([0-9]+).png$ imageserve.php?m=background&u=$1 [L,Q
|
|||
|
||||
# Forum
|
||||
RewriteRule ^forum/?$ index.php?forums=true [L,QSA]
|
||||
RewriteRule ^forum/([0-9]+)/?$ viewforum.php?id=$1 [L,QSA]
|
||||
RewriteRule ^forum/(thread|topic|[0-9+])/([0-9]+)/?$ viewtopic.php?id=$2 [L,QSA]
|
||||
RewriteRule ^forum/post/([0-9]+)/?$ viewtopic.php?pid=$1 [L,QSA]
|
||||
RewriteRule ^forum/([0-9]+)/?$ viewforum.php?f=$1 [L,QSA]
|
||||
RewriteRule ^forum/([0-9]+)/new/?$ posting.php?f=$1 [L,QSA]
|
||||
RewriteRule ^forum/(thread|topic|[0-9+])/([0-9]+)/?$ viewtopic.php?t=$2 [L,QSA]
|
||||
RewriteRule ^forum/(thread|topic|[0-9+])/([0-9]+)/reply/?$ posting.php?t=$2 [L,QSA]
|
||||
RewriteRule ^forum/post/([0-9]+)/?$ viewtopic.php?p=$1 [L,QSA]
|
||||
RewriteRule ^forum/post/([0-9]+)/(quote|reply)/?$ posting.php?p=$1"e=$1 [L,QSA]
|
||||
|
||||
# Management
|
||||
RewriteRule ^manage/?$ manage.php [L,QSA]
|
||||
|
|
|
@ -18,7 +18,8 @@ $renderData['contributors'] = [
|
|||
'Kurasha244' => ['Writing the base for the old backend.', 'http://saibateku.net'],
|
||||
'nookls' => ['Being nookls.', 'http://nookls.org'],
|
||||
'MallocNull' => ['Sock Chat and debug help.', 'http://aroltd.com'],
|
||||
'kamil' => ['Pointing out mistakes and fixing them.', 'http://krakow.pw']
|
||||
'kamil' => ['Pointing out mistakes and fixing them.', 'http://krakow.pw'],
|
||||
'RandomGuy' => ['Coming up with cool things to add and security stuff.', 'http://flashii.net/u/12']
|
||||
];
|
||||
$renderData['thirdParty'] = [
|
||||
'ReCAPTCHA' => ['Providing the Captcha system we use.', 'http://recaptcha.net'],
|
||||
|
|
|
@ -34,7 +34,6 @@ if(isset($_GET['m'])) {
|
|||
|
||||
// Get user data
|
||||
$user = Users::getUser($_GET['u']);
|
||||
$data = Users::getUserProfileData($user, true);
|
||||
|
||||
// If user is deactivated use deactive avatar
|
||||
if(Users::checkIfUserHasRanks([0, 1], $user, true)) {
|
||||
|
@ -49,13 +48,13 @@ if(isset($_GET['m'])) {
|
|||
}
|
||||
|
||||
// Check if user has an avatar set
|
||||
if(empty($data['userAvatar']) || !file_exists($userDirPath . $data['userAvatar'])) {
|
||||
if(empty($user['userData']['userAvatar']) || !file_exists($userDirPath . $user['userData']['userAvatar'])) {
|
||||
$serveImage = $noAvatar;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if the avatar exist and assign it to a value
|
||||
$serveImage = $userDirPath . $data['userAvatar'];
|
||||
$serveImage = $userDirPath . $user['userData']['userAvatar'];
|
||||
break;
|
||||
|
||||
case 'background':
|
||||
|
@ -70,7 +69,6 @@ if(isset($_GET['m'])) {
|
|||
|
||||
// Get user data
|
||||
$user = Users::getUser($_GET['u']);
|
||||
$data = Users::getUserProfileData($user, true);
|
||||
|
||||
// If user is deactivated use deactive avatar
|
||||
if(Users::checkIfUserHasRanks([0, 1], $user, true)) {
|
||||
|
@ -85,13 +83,13 @@ if(isset($_GET['m'])) {
|
|||
}
|
||||
|
||||
// Check if user has a background set
|
||||
if(empty($data['profileBackground']) || !file_exists($userDirPath . $data['profileBackground'])) {
|
||||
if(empty($user['userData']['profileBackground']) || !file_exists($userDirPath . $user['userData']['profileBackground'])) {
|
||||
$serveImage = $noBackground;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if the avatar exist and assign it to a value
|
||||
$serveImage = $userDirPath . $data['profileBackground'];
|
||||
$serveImage = $userDirPath . $user['userData']['profileBackground'];
|
||||
break;
|
||||
|
||||
case 'header':
|
||||
|
@ -106,7 +104,6 @@ if(isset($_GET['m'])) {
|
|||
|
||||
// Get user data
|
||||
$user = Users::getUser($_GET['u']);
|
||||
$data = Users::getUserProfileData($user, true);
|
||||
|
||||
// If user is deactivated use deactive avatar
|
||||
if(Users::checkIfUserHasRanks([0, 1], $user, true)) {
|
||||
|
@ -121,13 +118,13 @@ if(isset($_GET['m'])) {
|
|||
}
|
||||
|
||||
// Check if user has a background set
|
||||
if(empty($data['profileHeader']) || !file_exists($userDirPath . $data['profileHeader'])) {
|
||||
if(empty($user['userData']['profileHeader']) || !file_exists($userDirPath . $user['userData']['profileHeader'])) {
|
||||
$serveImage = $noHeader;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if the avatar exist and assign it to a value
|
||||
$serveImage = $userDirPath . $data['profileHeader'];
|
||||
$serveImage = $userDirPath . $user['userData']['profileHeader'];
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -22,7 +22,8 @@ $renderData['page'] = [
|
|||
|
||||
$renderData['board'] = [
|
||||
'forums' => ($forumMode ? Forum::getForumList() : null),
|
||||
'viewforum' => false
|
||||
'viewforum' => false,
|
||||
'viewtopic' => false
|
||||
];
|
||||
|
||||
$renderData['stats'] = [
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
namespace Sakura;
|
||||
|
||||
// Include components
|
||||
require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||
print 'posting ui';
|
|
@ -18,19 +18,18 @@ if(isset($_GET['u'])) {
|
|||
'rank' => ($_PROFILE_RANK_DATA = Users::getRank($_PROFILE_USER_DATA['rank_main'])),
|
||||
'colour' => ($_PROFILE_USER_DATA['name_colour'] == null ? $_PROFILE_RANK_DATA['colour'] : $_PROFILE_USER_DATA['name_colour']),
|
||||
'ranktitle' => ($_PROFILE_USER_DATA['usertitle'] == null ? $_PROFILE_RANK_DATA['title'] : $_PROFILE_USER_DATA['usertitle']),
|
||||
'data' => ($_PROFILE_PROFILE_DATA = Users::getUserProfileData($_PROFILE_USER_DATA, true)),
|
||||
'country' => Main::getCountryName($_PROFILE_USER_DATA['country']),
|
||||
'istenshi' => Users::checkUserTenshi($_PROFILE_USER_DATA['id']),
|
||||
'online' => Users::checkUserOnline($_PROFILE_USER_DATA['id']),
|
||||
'profilePage' => Users::getProfilePage($_PROFILE_PROFILE_DATA, true),
|
||||
'fields' => Users::getUserProfileFields($_PROFILE_PROFILE_DATA, true),
|
||||
'profilePage' => Users::getProfilePage($_PROFILE_USER_DATA['userData'], true),
|
||||
'fields' => Users::getUserProfileFields($_PROFILE_USER_DATA['userData'], true),
|
||||
'warnings' => Users::getWarnings($_PROFILE_USER_DATA['id']),
|
||||
'friend' => Users::checkFriend($_PROFILE_USER_DATA['id'])
|
||||
];
|
||||
|
||||
$renderData['page'] = [
|
||||
'title' => ($_PROFILE_USER_DATA['id'] < 1 || $_PROFILE_USER_DATA['password_algo'] == 'nologin' ? 'User not found!' : 'Profile of '. $_PROFILE_USER_DATA['username']),
|
||||
'style' => (!empty($_PROFILE_PROFILE_DATA['profileBackground']) ? [
|
||||
'style' => (!empty($_PROFILE_USER_DATA['userData']['profileBackground']) ? [
|
||||
'#userBackground' => [
|
||||
'background' => 'url("/bg/'. $_PROFILE_USER_DATA['id'] .'") no-repeat center center / cover transparent !important',
|
||||
'position' => 'fixed',
|
||||
|
|
|
@ -226,7 +226,7 @@ if(Users::checkLogin()) {
|
|||
// Profile
|
||||
case 'profile':
|
||||
$renderData['profile'] = [
|
||||
'user' => Users::getUserProfileData(Session::$userId),
|
||||
'user' => Users::getUser(Session::$userId),
|
||||
'fields' => Database::fetch('profilefields')
|
||||
];
|
||||
break;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Sakura;
|
|||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||
|
||||
// Get the forum's data
|
||||
$forum = Forum::getForum(isset($_GET['id']) ? $_GET['id'] : 0);
|
||||
$forum = Forum::getForum(isset($_GET['f']) ? $_GET['f'] : 0);
|
||||
|
||||
// Check if the forum exists
|
||||
if(!$forum) {
|
||||
|
@ -52,11 +52,9 @@ $renderData['board'] = [
|
|||
$forum
|
||||
],
|
||||
'topics' => Forum::getTopics($forum['forum']['forum_id']),
|
||||
'viewforum' => true
|
||||
'viewforum' => true,
|
||||
'viewtopic' => false
|
||||
];
|
||||
|
||||
//header('Content-Type: text/plain');
|
||||
//print_r($renderData['board']['topics']);exit;
|
||||
|
||||
// Print page contents
|
||||
print Templates::render('forum/viewforum.tpl', $renderData);
|
||||
|
|
|
@ -8,3 +8,36 @@ namespace Sakura;
|
|||
|
||||
// Include components
|
||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||
|
||||
// Attempt to get a topic
|
||||
$topic = Forum::getTopic(isset($_GET['p']) ? Forum::getTopicIdFromPostId($_GET['p']) : (isset($_GET['t']) ? $_GET['t'] : 0));
|
||||
|
||||
// Check if the forum exists
|
||||
if(!$topic) {
|
||||
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'title' => 'Information',
|
||||
'message' => 'The topic you tried to access does not exist.'
|
||||
];
|
||||
|
||||
// Print template
|
||||
print Templates::render('errors/information.tpl', $renderData);
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
// Set additional render data
|
||||
$renderData = array_merge($renderData, $topic, [
|
||||
'viewforum' => false,
|
||||
'viewtopic' => true,
|
||||
'page' => [
|
||||
'title' => $topic['topic']['topic_title']
|
||||
]
|
||||
]);
|
||||
|
||||
//header('Content-Type: text/plain');
|
||||
//print_r($renderData);exit;
|
||||
|
||||
// Print page contents
|
||||
print Templates::render('forum/viewtopic.tpl', $renderData);
|
||||
|
|
Reference in a new issue