2015-04-27 21:07:48 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* Sakura Memberlist
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Declare Namespace
|
|
|
|
namespace Sakura;
|
|
|
|
|
|
|
|
// Include components
|
2015-12-03 19:40:01 +00:00
|
|
|
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) . 'sakura.php';
|
2015-04-27 21:07:48 +00:00
|
|
|
|
2015-11-06 22:30:37 +00:00
|
|
|
// Initialise templating engine
|
|
|
|
$template = new Template();
|
|
|
|
|
|
|
|
// Change templating engine
|
|
|
|
$template->setTemplate($templateName);
|
|
|
|
|
2015-09-07 20:53:47 +00:00
|
|
|
// CHeck if the user is logged in
|
2015-09-14 20:51:23 +00:00
|
|
|
if (Users::checkLogin()) {
|
2015-09-07 20:53:47 +00:00
|
|
|
// Add page specific things
|
|
|
|
$renderData['page'] = [
|
|
|
|
|
2015-09-14 20:51:23 +00:00
|
|
|
'ranks' => ($_MEMBERLIST_RANKS = Users::getAllRanks()),
|
2015-09-14 21:41:43 +00:00
|
|
|
'active' => ($_MEMBERLIST_ACTIVE = (
|
|
|
|
isset($_GET['rank'])
|
|
|
|
&& $_GET['rank']
|
|
|
|
&& array_key_exists($_GET['rank'], $_MEMBERLIST_RANKS) ? $_GET['rank'] : 0
|
|
|
|
)),
|
|
|
|
'notfound' => ($_MEMBERLIST_NFOUND = (
|
|
|
|
isset($_GET['rank'])
|
|
|
|
&& !array_key_exists($_GET['rank'], $_MEMBERLIST_RANKS) && $_GET['rank'] != 0
|
|
|
|
)),
|
2015-09-14 20:51:23 +00:00
|
|
|
'sorts' => ($_MEMBERLIST_SORTS = ['boxes', 'rectangles', 'list']),
|
2015-09-14 21:41:43 +00:00
|
|
|
'sort' => isset($_GET['sort']) && $_GET['sort'] && in_array($_GET['sort'], $_MEMBERLIST_SORTS) ?
|
|
|
|
$_GET['sort'] :
|
|
|
|
$_MEMBERLIST_SORTS[0],
|
2015-09-07 20:53:47 +00:00
|
|
|
|
|
|
|
];
|
|
|
|
|
2015-11-15 21:43:39 +00:00
|
|
|
$renderData['users'] = ($_MEMBERLIST_ACTIVE && !$_MEMBERLIST_NFOUND ? Users::getUsersInRank($_MEMBERLIST_ACTIVE) : Users::getAllUsers());
|
|
|
|
|
2015-12-04 14:19:10 +00:00
|
|
|
$renderData['membersPerPage'] = Config::get('members_per_page');
|
2015-11-15 21:43:39 +00:00
|
|
|
|
2015-11-06 22:30:37 +00:00
|
|
|
// Set parse variables
|
|
|
|
$template->setVariables($renderData);
|
|
|
|
|
2015-09-07 20:53:47 +00:00
|
|
|
// Print page contents
|
2015-11-06 22:30:37 +00:00
|
|
|
echo $template->render('main/memberlist.tpl');
|
2015-09-07 20:53:47 +00:00
|
|
|
} else {
|
2015-11-06 22:30:37 +00:00
|
|
|
// Set parse variables
|
|
|
|
$template->setVariables($renderData);
|
|
|
|
|
|
|
|
// Print page contents
|
|
|
|
echo $template->render('global/restricted.tpl');
|
2015-09-07 20:53:47 +00:00
|
|
|
}
|