half forum
half bird
This commit is contained in:
parent
e88635441e
commit
9da8a4d84a
14 changed files with 418 additions and 80 deletions
|
@ -1301,6 +1301,26 @@
|
|||
{
|
||||
"type": "UPD",
|
||||
"change": "Put the Forum Listing and Front Page in the same PHP file as they both request nearly identical info (only difference is probably news post/forum posts)."
|
||||
},
|
||||
{
|
||||
"type": "UPD",
|
||||
"change": "Changed the die() in the version checker to a trigger_error()."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed an error in the password reset process."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Made some of the functions in the Configuration class more readable."
|
||||
},
|
||||
{
|
||||
"type": "ADD",
|
||||
"change": "Added support for infinite subforums."
|
||||
},
|
||||
{
|
||||
"type": "ADD",
|
||||
"change": "Added very basic topic list support."
|
||||
}
|
||||
|
||||
]
|
||||
|
|
|
@ -15,18 +15,27 @@ class Configuration {
|
|||
public static function init($local) {
|
||||
|
||||
// Check if the configuration file exists
|
||||
if(!file_exists($local))
|
||||
if(!file_exists($local)) {
|
||||
|
||||
trigger_error('Local configuration file does not exist', E_USER_ERROR);
|
||||
|
||||
}
|
||||
|
||||
// Attempt to load the configuration file
|
||||
$local = parse_ini_file($local, true);
|
||||
|
||||
// Check if $local is an array and then store it in $_LCNF
|
||||
if(is_array($local))
|
||||
if(is_array($local)) {
|
||||
|
||||
self::$_LCNF = $local;
|
||||
else // Otherwise trigger an error
|
||||
|
||||
} else {
|
||||
|
||||
// Otherwise trigger an error
|
||||
trigger_error('Failed to load local configuration file, check the structure of the file to see if you made mistake somewhere', E_USER_ERROR);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -42,9 +51,13 @@ class Configuration {
|
|||
// Create variable to temporarily store values in
|
||||
$_DBCN = array();
|
||||
|
||||
foreach($_DATA as $_CONF) // Properly sort the values
|
||||
// Properly sort the values
|
||||
foreach($_DATA as $_CONF) {
|
||||
|
||||
$_DBCN[$_CONF[0]] = $_CONF[1];
|
||||
|
||||
}
|
||||
|
||||
// Assign the temporary array to the static one
|
||||
self::$_DCNF = $_DBCN;
|
||||
|
||||
|
@ -55,13 +68,25 @@ class Configuration {
|
|||
|
||||
// Check if the key that we're looking for exists
|
||||
if(array_key_exists($key, self::$_LCNF)) {
|
||||
if($subkey) // If we also have a subkey return the proper shit
|
||||
|
||||
if($subkey) {
|
||||
|
||||
// If we also have a subkey return the proper data
|
||||
return self::$_LCNF[$key][$subkey];
|
||||
else // else we just return the default value
|
||||
|
||||
} else {
|
||||
|
||||
// else we just return the default value
|
||||
return self::$_LCNF[$key];
|
||||
} else // If it doesn't exist trigger an error to avoid explosions
|
||||
|
||||
}
|
||||
|
||||
} else {// If it doesn't exist trigger an error to avoid explosions
|
||||
|
||||
trigger_error('Unable to get local configuration value!', E_USER_ERROR);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Dynamically set local configuration values, does not update the configuration file
|
||||
|
@ -71,25 +96,39 @@ class Configuration {
|
|||
if($subkey) {
|
||||
|
||||
// If we do we make sure that the parent key is an array
|
||||
if(!isset(self::$_LCNF[$key]))
|
||||
if(!isset(self::$_LCNF[$key])) {
|
||||
|
||||
self::$_LCNF[$key] = array();
|
||||
|
||||
}
|
||||
|
||||
// And then assign the value
|
||||
self::$_LCNF[$key][$subkey] = $value;
|
||||
|
||||
} else // Otherwise we just straight up assign it
|
||||
} else {
|
||||
|
||||
// Otherwise we just straight up assign it
|
||||
self::$_LCNF[$key] = $value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Get values from the configuration in the database
|
||||
public static function getConfig($key) {
|
||||
|
||||
// Check if the key that we're looking for exists
|
||||
if(array_key_exists($key, self::$_DCNF))
|
||||
return self::$_DCNF[$key]; // Then return the value
|
||||
else // If it doesn't exist trigger an error to avoid explosions
|
||||
trigger_error('Unable to get configuration value!', E_USER_ERROR);
|
||||
if(array_key_exists($key, self::$_DCNF)) {
|
||||
|
||||
// Then return the value
|
||||
return self::$_DCNF[$key];
|
||||
|
||||
} else {
|
||||
|
||||
// Then return the value
|
||||
trigger_error('Unable to get configuration value', E_USER_ERROR);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,22 @@ namespace Sakura;
|
|||
|
||||
class Forum {
|
||||
|
||||
// Getting the board list
|
||||
public static function getBoardList() {
|
||||
// Empty forum template
|
||||
public static $emptyForum = [
|
||||
'forum_id' => 0,
|
||||
'forum_name' => 'Forum',
|
||||
'forum_desc' => '',
|
||||
'forum_link' => '',
|
||||
'forum_category' => 0,
|
||||
'forum_type' => 1,
|
||||
'forum_posts' => 0,
|
||||
'forum_topics' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
'forum_last_poster_id' => 0
|
||||
];
|
||||
|
||||
// Getting the forum list
|
||||
public static function getForumList() {
|
||||
|
||||
// Get the content from the database
|
||||
$forums = Database::fetch('forums');
|
||||
|
@ -16,18 +30,7 @@ class Forum {
|
|||
// Create return array
|
||||
$return = [
|
||||
0 => [
|
||||
'data' => [
|
||||
'forum_id' => 0,
|
||||
'forum_name' => 'Forum',
|
||||
'forum_desc' => '',
|
||||
'forum_link' => '',
|
||||
'forum_category' => 0,
|
||||
'forum_type' => 1,
|
||||
'forum_posts' => 0,
|
||||
'forum_topics' => 0,
|
||||
'forum_last_post_id' => 0,
|
||||
'forum_last_poster_id' => 0
|
||||
],
|
||||
'forum' => self::$emptyForum,
|
||||
'forums' => []
|
||||
]
|
||||
];
|
||||
|
@ -36,16 +39,20 @@ class Forum {
|
|||
foreach($forums as $forum) {
|
||||
|
||||
// If the forum type is a category create a new one
|
||||
if($forum['forum_type'] == 1)
|
||||
$return[$forum['forum_id']]['data'] = $forum;
|
||||
else {
|
||||
if($forum['forum_type'] == 1) {
|
||||
|
||||
$return[$forum['forum_id']]['forum'] = $forum;
|
||||
|
||||
} else {
|
||||
|
||||
// For link and reg. forum add it to the category
|
||||
$return[$forum['forum_category']]['forums'][$forum['forum_id']] = $forum;
|
||||
|
||||
// Add last poster data and the details about the post as well
|
||||
$return[$forum['forum_category']]['forums'][$forum['forum_id']]['last_poster_data'] = ($_LAST_POSTER = Users::getUser($forum['forum_last_poster_id']));
|
||||
$return[$forum['forum_category']]['forums'][$forum['forum_id']]['last_poster_rank'] = Users::getRank($_LAST_POSTER['rank_main']);
|
||||
$return[$forum['forum_category']]['forums'][$forum['forum_id']]['last_poster'] = [
|
||||
'user' => ($_LAST_POSTER = Users::getUser($forum['forum_last_poster_id'])),
|
||||
'rank' => Users::getRank($_LAST_POSTER['rank_main'])
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
@ -56,8 +63,108 @@ class Forum {
|
|||
|
||||
}
|
||||
|
||||
// Get a forum or category
|
||||
public static function getForum($id) {
|
||||
|
||||
// Get the forumlist from the database
|
||||
$forums = Database::fetch('forums');
|
||||
|
||||
// Sneak the template in the array
|
||||
$forums['fb'] = self::$emptyForum;
|
||||
|
||||
// Create an array to store the forum once we found it
|
||||
$forum = [];
|
||||
|
||||
// Try to find the requested forum
|
||||
foreach($forums as $list) {
|
||||
|
||||
// Once found set $forum to $list and break the loop
|
||||
if($list['forum_id'] == $id) {
|
||||
|
||||
$forum['forum'] = $list;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If $forum is still empty after the foreach return false
|
||||
if(empty($forum))
|
||||
return false;
|
||||
|
||||
// Create conditions for fetching the forums
|
||||
$conditions['forum_category'] = [$id, '='];
|
||||
|
||||
// If the current category is 0 (the built in fallback) prevent getting categories
|
||||
if($id == 0)
|
||||
$conditions['forum_type'] = ['1', '!='];
|
||||
|
||||
// Check if this forum/category has any subforums
|
||||
$forum['forums'] = Database::fetch('forums', true, $conditions);
|
||||
|
||||
// Get the userdata related to last posts
|
||||
foreach($forum['forums'] as $key => $sub) {
|
||||
|
||||
$forum['forums'][$key]['last_poster'] = [
|
||||
'user' => ($_LAST_POSTER = Users::getUser($sub['forum_last_poster_id'])),
|
||||
'rank' => Users::getRank($_LAST_POSTER['rank_main'])
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
// Lastly grab the topics for this forum
|
||||
$forum['topics'] = Database::fetch('topics', true, [
|
||||
'forum_id' => [$id, '=']
|
||||
]);
|
||||
|
||||
// Get the userdata related to first and last posts
|
||||
foreach($forum['topics'] as $key => $topic) {
|
||||
|
||||
$forum['topics'][$key]['first_poster'] = [
|
||||
'user' => ($_FIRST_POSTER = Users::getUser($topic['topic_first_poster_id'])),
|
||||
'rank' => Users::getRank($_FIRST_POSTER['rank_main'])
|
||||
];
|
||||
|
||||
$forum['topics'][$key]['last_poster'] = [
|
||||
'user' => ($_LAST_POSTER = Users::getUser($topic['topic_last_poster_id'])),
|
||||
'rank' => Users::getRank($_LAST_POSTER['rank_main'])
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
// Return the forum/category
|
||||
return $forum;
|
||||
|
||||
}
|
||||
|
||||
// Getting all topics from a forum
|
||||
public static function getTopics($id) {
|
||||
|
||||
$topics = Database::fetch('topics', true, [
|
||||
'forum_id' => [$id, '=']
|
||||
]);
|
||||
|
||||
// Get the userdata related to last posts
|
||||
foreach($topics as $key => $topic) {
|
||||
|
||||
$topics[$key]['first_poster'] = [
|
||||
'user' => ($_FIRST_POSTER = Users::getUser($topic['topic_first_poster_id'])),
|
||||
'rank' => Users::getRank($_FIRST_POSTER['rank_main'])
|
||||
];
|
||||
|
||||
$topics[$key]['last_poster'] = [
|
||||
'user' => ($_LAST_POSTER = Users::getUser($topic['topic_last_poster_id'])),
|
||||
'rank' => Users::getRank($_LAST_POSTER['rank_main'])
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
return $topics;
|
||||
|
||||
}
|
||||
|
||||
// Creating a new post
|
||||
public static function createPost($subject, $text, $enableMD, $enableSig, $forum, $topic = 0, $type = 0, $status = 0) {
|
||||
public static function createPost($subject, $text, $enableMD, $enableSig, $forum, $type = 0, $status = 0) {
|
||||
|
||||
// Check if this post is OP
|
||||
if(!$topic) {
|
||||
|
|
|
@ -18,7 +18,7 @@ class Main {
|
|||
|
||||
// Stop the execution if the PHP Version is older than 5.4.0
|
||||
if(version_compare(phpversion(), '5.4.0', '<'))
|
||||
die('<h3>Upgrade your PHP Version to at least PHP 5.4!</h3>');
|
||||
trigger_error('Sakura requires at least PHP 5.4.0, please upgrade to a newer PHP version.');
|
||||
|
||||
// Configuration Management and local configuration
|
||||
Configuration::init($config);
|
||||
|
|
35
_sakura/templates/yuuno/forum/forum.tpl
Normal file
35
_sakura/templates/yuuno/forum/forum.tpl
Normal file
|
@ -0,0 +1,35 @@
|
|||
<div class="head">Forums{% if board.viewforum %} / {{ board.forums[0].forum.forum_name }}{% endif %}</div>
|
||||
<table class="forumList">
|
||||
<tbody>
|
||||
{% for category in board.forums %}
|
||||
{% include 'forum/forumEntry.tpl' %}
|
||||
{% 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>
|
||||
{% endif %}
|
41
_sakura/templates/yuuno/forum/forumEntry.tpl
Normal file
41
_sakura/templates/yuuno/forum/forumEntry.tpl
Normal file
|
@ -0,0 +1,41 @@
|
|||
{% if category.forums|length and category.forum|length %}
|
||||
<tr class="forumCategory">
|
||||
<td class="forumCategoryTitleColumn" colspan="4">{% if category.forum.forum_type != 1 %}Subforums{% else %}<a href="//{{ sakura.urls.main }}/forum/{{ category.forum.forum_id }}/" class="clean">{{ category.forum.forum_name }}</a>{% endif %}</td>
|
||||
</tr>
|
||||
{% for forum in category.forums %}
|
||||
<tr class="forumForum">
|
||||
<td class="forumIconColumn">
|
||||
<div class="forumIcon read fa fa-3x {% if forum.forum_icon %}{{ forum.forum_icon }}{% else %}{% if forum.forum_type == 2 %}fa-chevron-circle-right{% elseif forum.forum_type == 1 %}fa-folder{% else %}fa-comments{% endif %}{% endif %}"></div>
|
||||
</td>
|
||||
<td class="forumTitleColumn"{% if forum.forum_type == 2 %} colspan="3"{% endif %}>
|
||||
<div class="name"><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></div>
|
||||
<div class="desc">
|
||||
{{ forum.forum_desc }}
|
||||
{% if board.forums[forum.forum_id]|length %}
|
||||
<div class="subforums" style="margin-top: 3px; margin-left: -5px;">
|
||||
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>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
{% if forum.forum_type != 2 %}
|
||||
<td class="forumCountColumn">
|
||||
<div class="topics" title="Amount of topics in this forum.">{{ forum.forum_topics }}</div>
|
||||
<div class="posts" title="Amount of posts in this forum.">{{ forum.forum_posts }}</div>
|
||||
</td>
|
||||
<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>
|
||||
{% else %}
|
||||
There are no posts in this forum.<br />
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
|
@ -4,44 +4,7 @@
|
|||
{% include 'elements/indexPanel.tpl' %}
|
||||
</div>
|
||||
<div class="content-left content-column">
|
||||
<div class="head">Forums</div>
|
||||
<table class="forumList">
|
||||
<tbody>
|
||||
{% for category in page.boards %}
|
||||
{% if category.forums|length %}
|
||||
<tr class="forumCategory">
|
||||
<td class="forumCategoryTitleColumn" colspan="4"><a href="//{{ sakura.urls.main }}/forum/{{ category.data.forum_id }}/" class="clean">{{ category.data.forum_name }}</a></td>
|
||||
</tr>
|
||||
{% for forum in category.forums %}
|
||||
<tr class="forumForum">
|
||||
<td class="forumIconColumn">
|
||||
<div class="forumIcon read fa fa-3x {% if forum.forum_icon %}{{ forum.forum_icon }}{% else %}{% if forum.forum_type %}fa-chevron-circle-right{% else %}fa-comments{% endif %}{% endif %}"></div>
|
||||
</td>
|
||||
<td class="forumTitleColumn"{% if forum.forum_type == 2 %} colspan="3"{% endif %}>
|
||||
<div class="name"><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></div>
|
||||
<div class="desc">{{ forum.forum_desc }}</div>
|
||||
</td>
|
||||
{% if forum.forum_type != 2 %}
|
||||
<td class="forumCountColumn">
|
||||
<div class="topics" title="Amount of topics in this forum.">{{ forum.forum_topics }}</div>
|
||||
<div class="posts" title="Amount of posts in this forum.">{{ forum.forum_posts }}</div>
|
||||
</td>
|
||||
<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_data.id }}" class="default" style="color: {% if forum.last_poster_data.name_colour %}{{ forum.last_poster_data.name_colour }}{% else %}{{ forum.last_poster_rank.colour }}{% endif %};">{{ forum.last_poster_data.username }}</a>
|
||||
{% else %}
|
||||
There are no posts in this forum.<br />
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% include 'forum/forum.tpl' %}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
|
19
_sakura/templates/yuuno/forum/topicEntry.tpl
Normal file
19
_sakura/templates/yuuno/forum/topicEntry.tpl
Normal file
|
@ -0,0 +1,19 @@
|
|||
<tr>
|
||||
<td class="topicIcon">
|
||||
<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>
|
||||
</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 />
|
||||
2000 years ago
|
||||
</td>
|
||||
</tr>
|
7
_sakura/templates/yuuno/forum/viewforum.tpl
Normal file
7
_sakura/templates/yuuno/forum/viewforum.tpl
Normal file
|
@ -0,0 +1,7 @@
|
|||
{% include 'global/header.tpl' %}
|
||||
<div class="content homepage forum viewforum">
|
||||
<div class="content-column">
|
||||
{% include 'forum/forum.tpl' %}
|
||||
</div>
|
||||
</div>
|
||||
{% include 'global/footer.tpl' %}
|
|
@ -331,6 +331,8 @@ a.gotop.exit {
|
|||
.content-left .head,
|
||||
.news .head,
|
||||
.donate .head,
|
||||
.viewforum .head,
|
||||
.viewtopic .head,
|
||||
.loginPage > .loginCont .head,
|
||||
.messages .head {
|
||||
margin: -1px -2px;
|
||||
|
@ -1558,3 +1560,50 @@ textarea.inputStyling {
|
|||
.forum .forumList .forumForum .forumTitleColumn div {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.forum .topicList {
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.forum .topicList thead,
|
||||
.forum .topicList tfoot {
|
||||
background: #C2AFFE;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.forum .topicList tbody td {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicIcon {
|
||||
width: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicAuthor {
|
||||
width: 150px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicCounts {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicCounts .replies {
|
||||
font-size: 1.3em;
|
||||
color: #111;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicCounts .views {
|
||||
font-size: .8em;
|
||||
color: #555;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
.forum .topicList tbody .topicLast {
|
||||
width: 250px;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,9 @@ 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=$2 [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]
|
||||
|
||||
# Management
|
||||
RewriteRule ^manage/?$ manage.php [L,QSA]
|
||||
|
|
|
@ -15,15 +15,21 @@ $forumMode = isset($_GET['forums']) ? ($_GET['forums'] == true) : false;
|
|||
|
||||
// Add page specific things
|
||||
$renderData['newsPosts'] = ($forumMode ? null : Main::getNewsPosts(3));
|
||||
|
||||
$renderData['page'] = [
|
||||
'title' => ($forumMode ? 'Forum Listing' : Configuration::getConfig('sitename')),
|
||||
'boards' => ($forumMode ? Forum::getBoardList() : null)
|
||||
'title' => ($forumMode ? 'Forum Listing' : Configuration::getConfig('sitename'))
|
||||
];
|
||||
|
||||
$renderData['board'] = [
|
||||
'forums' => ($forumMode ? Forum::getForumList() : null),
|
||||
'viewforum' => false
|
||||
];
|
||||
|
||||
$renderData['stats'] = [
|
||||
'userCount' => ($_INDEX_USER_COUNT = count($_INDEX_USERS = Users::getAllUsers(false))) .' user'. ($_INDEX_USER_COUNT == 1 ? '' : 's'),
|
||||
'newestUser' => ($_INDEX_NEWEST_USER = max($_INDEX_USERS)),
|
||||
'lastRegDate' => ($_INDEX_LAST_REGDATE = date_diff(date_create(date('Y-m-d', $_INDEX_NEWEST_USER['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($_INDEX_LAST_REGDATE == 1 ? '' : 's'),
|
||||
'chatOnline' => ($_INDEX_CHAT_ONLINE = count(SockChat::getOnlineUsers())) .' user'. ($_INDEX_CHAT_ONLINE == 1 ? '' : 's'),
|
||||
'userCount' => ($_INDEX_USER_COUNT = count($_INDEX_USERS = Users::getAllUsers(false))) .' user'. ($_INDEX_USER_COUNT == 1 ? '' : 's'),
|
||||
'newestUser' => ($_INDEX_NEWEST_USER = max($_INDEX_USERS)),
|
||||
'lastRegDate' => ($_INDEX_LAST_REGDATE = date_diff(date_create(date('Y-m-d', $_INDEX_NEWEST_USER['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($_INDEX_LAST_REGDATE == 1 ? '' : 's'),
|
||||
'chatOnline' => ($_INDEX_CHAT_ONLINE = count(SockChat::getOnlineUsers())) .' user'. ($_INDEX_CHAT_ONLINE == 1 ? '' : 's'),
|
||||
'onlineUsers' => Users::checkAllOnline(),
|
||||
'topicCount' => '0 topics',
|
||||
'postCount' => '0 posts'
|
||||
|
|
|
@ -8,3 +8,55 @@ namespace Sakura;
|
|||
|
||||
// Include components
|
||||
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);
|
||||
|
||||
// Check if the forum exists
|
||||
if(!$forum) {
|
||||
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'title' => 'Information',
|
||||
'message' => 'The subforum you tried to access does not exist.'
|
||||
];
|
||||
|
||||
// Print template
|
||||
print Templates::render('errors/information.tpl', $renderData);
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
// Check if the forum isn't a link
|
||||
if($forum['forum']['forum_type'] === 2) {
|
||||
|
||||
// Set render data
|
||||
$renderData['page'] = [
|
||||
'title' => 'Information',
|
||||
'message' => 'The forum you tried to access is a link. You\'re being redirected.',
|
||||
'redirect' => $forum['forum']['forum_link']
|
||||
];
|
||||
|
||||
// Print template
|
||||
print Templates::render('errors/information.tpl', $renderData);
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
$renderData['page'] = [
|
||||
'title' => 'Forums / '. $forum['forum']['forum_name']
|
||||
];
|
||||
|
||||
$renderData['board'] = [
|
||||
'forums' => [
|
||||
$forum
|
||||
],
|
||||
'topics' => Forum::getTopics($forum['forum']['forum_id']),
|
||||
'viewforum' => true
|
||||
];
|
||||
|
||||
//header('Content-Type: text/plain');
|
||||
//print_r($renderData['board']['topics']);exit;
|
||||
|
||||
// Print page contents
|
||||
print Templates::render('forum/viewforum.tpl', $renderData);
|
||||
|
|
|
@ -8,4 +8,3 @@ namespace Sakura;
|
|||
|
||||
// Include components
|
||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||
print 'THIS IS VIEWTOPIC';
|
Reference in a new issue