This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/main/viewforum.php

71 lines
1.4 KiB
PHP
Raw Normal View History

2015-05-06 13:42:02 +00:00
<?php
/*
* Sakura Forum List Viewer
*/
// Declare Namespace
namespace Sakura;
// Include components
2015-06-27 11:03:11 +00:00
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
2015-06-27 19:29:37 +00:00
// Get the forum's data
2015-06-28 14:43:46 +00:00
$forum = Forum::getForum(isset($_GET['f']) ? $_GET['f'] : 0);
2015-06-27 19:29:37 +00:00
// Check if the forum exists
if(!$forum) {
// Set render data
$renderData['page'] = [
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
'title' => 'Information',
'message' => 'The subforum you tried to access does not exist.'
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
];
// 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'] = [
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
'title' => 'Information',
'message' => 'The forum you tried to access is a link. You\'re being redirected.',
'redirect' => $forum['forum']['forum_link']
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
];
// Print template
print Templates::render('errors/information.tpl', $renderData);
exit;
}
$renderData['page'] = [
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
'title' => 'Forums / '. $forum['forum']['forum_name']
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
];
$renderData['board'] = [
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
'forums' => [
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
$forum
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
],
'topics' => Forum::getTopics($forum['forum']['forum_id']),
2015-06-28 14:43:46 +00:00
'viewforum' => true,
'viewtopic' => false
2015-08-21 22:07:45 +00:00
2015-06-27 19:29:37 +00:00
];
// Print page contents
print Templates::render('forum/viewforum.tpl', $renderData);