getId(), MSZ_PERM_FORUM_VIEW_LEADERBOARD)) { echo render_error(403); return; } $leaderboardMode = !empty($_GET['mode']) && is_string($_GET['mode']) && ctype_lower($_GET['mode']) ? $_GET['mode'] : ''; $leaderboardId = !empty($_GET['id']) && is_string($_GET['id']) && ctype_digit($_GET['id']) ? $_GET['id'] : MSZ_FORUM_LEADERBOARD_CATEGORY_ALL; $leaderboardIdLength = strlen($leaderboardId); $leaderboardYear = $leaderboardIdLength === 4 || $leaderboardIdLength === 6 ? substr($leaderboardId, 0, 4) : null; $leaderboardMonth = $leaderboardIdLength === 6 ? substr($leaderboardId, 4, 2) : null; $unrankedForums = !empty($_GET['allow_unranked']) ? [] : $cfg->getValue('forum_leader.unranked.forum', CfgType::T_ARR); $unrankedTopics = !empty($_GET['allow_unranked']) ? [] : $cfg->getValue('forum_leader.unranked.topic', CfgType::T_ARR); $leaderboards = forum_leaderboard_categories(); $leaderboard = forum_leaderboard_listing($leaderboardYear, $leaderboardMonth, $unrankedForums, $unrankedTopics); $leaderboardName = 'All Time'; if($leaderboardYear) { $leaderboardName = "Leaderboard {$leaderboardYear}"; if($leaderboardMonth) { $leaderboardName .= "-{$leaderboardMonth}"; } } if($leaderboardMode === 'markdown') { $markdown = << $user['user_id']]), $user['posts']); } Template::set('leaderboard_markdown', $markdown); } Template::render('forum.leaderboard', [ 'leaderboard_id' => $leaderboardId, 'leaderboard_name' => $leaderboardName, 'leaderboard_categories' => $leaderboards, 'leaderboard_data' => $leaderboard, 'leaderboard_mode' => $leaderboardMode, ]);