diff --git a/public/manage/forum.php b/public/manage/forum.php deleted file mode 100644 index 17e1c3f0..00000000 --- a/public/manage/forum.php +++ /dev/null @@ -1,35 +0,0 @@ -bindValue('forum_id', (int)($_GET['f'] ?? 0)); - $forum = db_fetch($getForum); - - if (!$forum) { - echo render_error(404); - break; - } - - echo tpl_render('manage.forum.forum', compact('forum')); - break; -} diff --git a/public/manage/forum/category.php b/public/manage/forum/category.php new file mode 100644 index 00000000..5f13f194 --- /dev/null +++ b/public/manage/forum/category.php @@ -0,0 +1,22 @@ +bindValue('forum_id', (int)($_GET['f'] ?? 0)); +$forum = db_fetch($getForum); + +if(!$forum) { + echo render_error(404); + return; +} + +echo tpl_render('manage.forum.forum', compact('forum')); diff --git a/public/manage/forum/index.php b/public/manage/forum/index.php new file mode 100644 index 00000000..aae9b61d --- /dev/null +++ b/public/manage/forum/index.php @@ -0,0 +1,19 @@ + $notices, + 'blacklist' => ip_blacklist_list(), +]); diff --git a/public/manage/general/emoticons.php b/public/manage/general/emoticons.php new file mode 100644 index 00000000..32bae19b --- /dev/null +++ b/public/manage/general/emoticons.php @@ -0,0 +1,9 @@ + 0 + ) AS `stat_comment_likes`, + ( + SELECT COUNT(`user_id`) + FROM `msz_comments_votes` + WHERE `comment_vote` < 0 + ) AS `stat_comment_dislikes`, + ( + SELECT COUNT(`post_id`) + FROM `msz_forum_posts` + ) AS `stat_forum_posts_total`, + ( + SELECT COUNT(`post_id`) + FROM `msz_forum_posts` + WHERE `post_deleted` IS NOT NULL + ) AS `stat_forum_posts_deleted`, + ( + SELECT COUNT(`post_id`) + FROM `msz_forum_posts` + WHERE `post_edited` IS NOT NULL + ) AS `stat_forum_posts_edited`, + ( + SELECT COUNT(`post_id`) + FROM `msz_forum_posts` + WHERE `post_parse` = 0 + ) AS `stat_forum_posts_plain`, + ( + SELECT COUNT(`post_id`) + FROM `msz_forum_posts` + WHERE `post_parse` = 1 + ) AS `stat_forum_posts_bbcode`, + ( + SELECT COUNT(`post_id`) + FROM `msz_forum_posts` + WHERE `post_parse` = 2 + ) AS `stat_forum_posts_markdown`, + ( + SELECT COUNT(`post_id`) + FROM `msz_forum_posts` + WHERE `post_display_signature` != 0 + ) AS `stat_forum_posts_signature`, + ( + SELECT COUNT(`topic_id`) + FROM `msz_forum_topics` + ) AS `stat_forum_topics_total`, + ( + SELECT COUNT(`topic_id`) + FROM `msz_forum_topics` + WHERE `topic_type` = 0 + ) AS `stat_forum_topics_normal`, + ( + SELECT COUNT(`topic_id`) + FROM `msz_forum_topics` + WHERE `topic_type` = 1 + ) AS `stat_forum_topics_pinned`, + ( + SELECT COUNT(`topic_id`) + FROM `msz_forum_topics` + WHERE `topic_type` = 2 + ) AS `stat_forum_topics_announce`, + ( + SELECT COUNT(`topic_id`) + FROM `msz_forum_topics` + WHERE `topic_type` = 3 + ) AS `stat_forum_topics_global_announce`, + ( + SELECT COUNT(`topic_id`) + FROM `msz_forum_topics` + WHERE `topic_deleted` IS NOT NULL + ) AS `stat_forum_topics_deleted`, + ( + SELECT COUNT(`topic_id`) + FROM `msz_forum_topics` + WHERE `topic_locked` IS NOT NULL + ) AS `stat_forum_topics_locked`, + ( + SELECT COUNT(*) + FROM `msz_ip_blacklist` + ) AS `stat_blacklist`, + ( + SELECT COUNT(`attempt_id`) + FROM `msz_login_attempts` + ) AS `stat_login_attempts_total`, + ( + SELECT COUNT(`attempt_id`) + FROM `msz_login_attempts` + WHERE `attempt_success` = 0 + ) AS `stat_login_attempts_failed`, + ( + SELECT COUNT(`session_id`) + FROM `msz_sessions` + ) AS `stat_user_sessions`, + ( + SELECT COUNT(`user_id`) + FROM `msz_users_password_resets` + ) AS `stat_user_password_resets`, + ( + SELECT COUNT(`user_id`) + FROM `msz_user_relations` + ) AS `stat_user_relations`, + ( + SELECT COUNT(`warning_id`) + FROM `msz_user_warnings` + WHERE `warning_type` != 0 + ) AS `stat_user_warnings` +')); + +if(!empty($_GET['poll'])) { + header('Content-Type: application/json; charset=utf-8'); + echo json_encode($statistics); + return; +} + +echo tpl_render('manage.general.overview', [ + 'statistics' => $statistics, +]); diff --git a/public/manage/general/logs.php b/public/manage/general/logs.php new file mode 100644 index 00000000..8c1c7015 --- /dev/null +++ b/public/manage/general/logs.php @@ -0,0 +1,23 @@ + $logs, + 'global_logs_pagination' => $logsPagination, + 'global_logs_strings' => MSZ_AUDIT_LOG_STRINGS, +]); diff --git a/public/manage/general/settings.php b/public/manage/general/settings.php new file mode 100644 index 00000000..062c9b3f --- /dev/null +++ b/public/manage/general/settings.php @@ -0,0 +1,9 @@ + 0 - ) AS `stat_comment_likes`, - ( - SELECT COUNT(`user_id`) - FROM `msz_comments_votes` - WHERE `comment_vote` < 0 - ) AS `stat_comment_dislikes`, - ( - SELECT COUNT(`post_id`) - FROM `msz_forum_posts` - ) AS `stat_forum_posts_total`, - ( - SELECT COUNT(`post_id`) - FROM `msz_forum_posts` - WHERE `post_deleted` IS NOT NULL - ) AS `stat_forum_posts_deleted`, - ( - SELECT COUNT(`post_id`) - FROM `msz_forum_posts` - WHERE `post_edited` IS NOT NULL - ) AS `stat_forum_posts_edited`, - ( - SELECT COUNT(`post_id`) - FROM `msz_forum_posts` - WHERE `post_parse` = 0 - ) AS `stat_forum_posts_plain`, - ( - SELECT COUNT(`post_id`) - FROM `msz_forum_posts` - WHERE `post_parse` = 1 - ) AS `stat_forum_posts_bbcode`, - ( - SELECT COUNT(`post_id`) - FROM `msz_forum_posts` - WHERE `post_parse` = 2 - ) AS `stat_forum_posts_markdown`, - ( - SELECT COUNT(`post_id`) - FROM `msz_forum_posts` - WHERE `post_display_signature` != 0 - ) AS `stat_forum_posts_signature`, - ( - SELECT COUNT(`topic_id`) - FROM `msz_forum_topics` - ) AS `stat_forum_topics_total`, - ( - SELECT COUNT(`topic_id`) - FROM `msz_forum_topics` - WHERE `topic_type` = 0 - ) AS `stat_forum_topics_normal`, - ( - SELECT COUNT(`topic_id`) - FROM `msz_forum_topics` - WHERE `topic_type` = 1 - ) AS `stat_forum_topics_pinned`, - ( - SELECT COUNT(`topic_id`) - FROM `msz_forum_topics` - WHERE `topic_type` = 2 - ) AS `stat_forum_topics_announce`, - ( - SELECT COUNT(`topic_id`) - FROM `msz_forum_topics` - WHERE `topic_type` = 3 - ) AS `stat_forum_topics_global_announce`, - ( - SELECT COUNT(`topic_id`) - FROM `msz_forum_topics` - WHERE `topic_deleted` IS NOT NULL - ) AS `stat_forum_topics_deleted`, - ( - SELECT COUNT(`topic_id`) - FROM `msz_forum_topics` - WHERE `topic_locked` IS NOT NULL - ) AS `stat_forum_topics_locked`, - ( - SELECT COUNT(*) - FROM `msz_ip_blacklist` - ) AS `stat_blacklist`, - ( - SELECT COUNT(`attempt_id`) - FROM `msz_login_attempts` - ) AS `stat_login_attempts_total`, - ( - SELECT COUNT(`attempt_id`) - FROM `msz_login_attempts` - WHERE `attempt_success` = 0 - ) AS `stat_login_attempts_failed`, - ( - SELECT COUNT(`session_id`) - FROM `msz_sessions` - ) AS `stat_user_sessions`, - ( - SELECT COUNT(`user_id`) - FROM `msz_users_password_resets` - ) AS `stat_user_password_resets`, - ( - SELECT COUNT(`user_id`) - FROM `msz_user_relations` - ) AS `stat_user_relations`, - ( - SELECT COUNT(`warning_id`) - FROM `msz_user_warnings` - WHERE `warning_type` != 0 - ) AS `stat_user_warnings` - ')); - - if (!empty($_GET['poll'])) { - header('Content-Type: application/json; charset=utf-8'); - echo json_encode($statistics); - return; - } - - echo tpl_render('manage.general.overview', [ - 'statistics' => $statistics, - ]); - break; - - case 'logs': - if (!perms_check($generalPerms, MSZ_PERM_GENERAL_VIEW_LOGS)) { - echo render_error(403); - break; - } - - $logsPagination = pagination_create(audit_log_count(), 50); - $logsOffset = pagination_offset($logsPagination, pagination_param()); - - if (!pagination_is_valid_offset($logsOffset)) { - echo render_error(404); - break; - } - - $logs = audit_log_list($logsOffset, $logsPagination['range']); - - echo tpl_render('manage.general.logs', [ - 'global_logs' => $logs, - 'global_logs_pagination' => $logsPagination, - 'global_logs_strings' => MSZ_AUDIT_LOG_STRINGS, - ]); - break; - - case 'emoticons': - if (!perms_check($generalPerms, MSZ_PERM_GENERAL_MANAGE_EMOTICONS)) { - echo render_error(403); - break; - } - - echo tpl_render('manage.general.emoticons'); - break; - - case 'settings': - if (!perms_check($generalPerms, MSZ_PERM_GENERAL_MANAGE_SETTINGS)) { - echo render_error(403); - break; - } - - echo tpl_render('manage.general.settings'); - break; - - case 'blacklist': - if (!perms_check($generalPerms, MSZ_PERM_GENERAL_MANAGE_BLACKLIST)) { - echo render_error(403); - break; - } - - $notices = []; - - if (!empty($_POST)) { - if (!csrf_verify('ip_blacklist', $_POST['csrf'] ?? '')) { - $notices[] = 'Verification failed.'; - } else { - header(csrf_http_header('ip_blacklist')); - - if (!empty($_POST['blacklist']['remove']) && is_array($_POST['blacklist']['remove'])) { - foreach ($_POST['blacklist']['remove'] as $cidr) { - if (!ip_blacklist_remove($cidr)) { - $notices[] = sprintf('Failed to remove "%s" from the blacklist.', $cidr); - } - } - } - - if (!empty($_POST['blacklist']['add']) && is_string($_POST['blacklist']['add'])) { - $cidrs = explode("\n", $_POST['blacklist']['add']); - - foreach ($cidrs as $cidr) { - $cidr = trim($cidr); - - if (empty($cidr)) { - continue; - } - - if (!ip_blacklist_add($cidr)) { - $notices[] = sprintf('Failed to add "%s" to the blacklist.', $cidr); - } - } - } - } - } - - echo tpl_render('manage.general.blacklist', [ - 'notices' => $notices, - 'blacklist' => ip_blacklist_list(), - ]); - break; -} +header('Location: ' . url('manage-general-overview')); diff --git a/src/manage.php b/src/manage.php index 8425d6a8..5d49781e 100644 --- a/src/manage.php +++ b/src/manage.php @@ -3,66 +3,66 @@ function manage_get_menu(int $userId): array { $perms = perms_get_user($userId); - if (!perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_CAN_MANAGE)) { + if(!perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_CAN_MANAGE)) { return []; } $menu = []; - $menu['General']['Overview'] = '/manage/index.php?v=overview'; + $menu['General']['Overview'] = url('manage-general-overview'); - if (perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_VIEW_LOGS)) { - $menu['General']['Logs'] = '/manage/index.php?v=logs'; + if(perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_VIEW_LOGS)) { + $menu['General']['Logs'] = url('manage-general-logs'); } - if (perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_MANAGE_EMOTICONS)) { - $menu['General']['Emoticons'] = '/manage/index.php?v=emoticons'; + if(perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_MANAGE_EMOTICONS)) { + $menu['General']['Emoticons'] = url('manage-general-emoticons'); } - if (perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_MANAGE_SETTINGS)) { - $menu['General']['Settings'] = '/manage/index.php?v=settings'; + if(perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_MANAGE_SETTINGS)) { + $menu['General']['Settings'] = url('manage-general-settings'); } - if (perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_MANAGE_BLACKLIST)) { - $menu['General']['IP Blacklist'] = '/manage/index.php?v=blacklist'; + if(perms_check($perms[MSZ_PERMS_GENERAL], MSZ_PERM_GENERAL_MANAGE_BLACKLIST)) { + $menu['General']['IP Blacklist'] = url('manage-general-blacklist'); } - if (perms_check($perms[MSZ_PERMS_USER], MSZ_PERM_USER_MANAGE_USERS | MSZ_PERM_USER_MANAGE_PERMS)) { + if(perms_check($perms[MSZ_PERMS_USER], MSZ_PERM_USER_MANAGE_USERS | MSZ_PERM_USER_MANAGE_PERMS)) { $menu['Users']['Listing'] = '/manage/users.php?v=listing'; } - if (perms_check($perms[MSZ_PERMS_USER], MSZ_PERM_USER_MANAGE_ROLES | MSZ_PERM_USER_MANAGE_PERMS)) { + if(perms_check($perms[MSZ_PERMS_USER], MSZ_PERM_USER_MANAGE_ROLES | MSZ_PERM_USER_MANAGE_PERMS)) { $menu['Users']['Roles'] = '/manage/users.php?v=roles'; } - if (perms_check($perms[MSZ_PERMS_USER], MSZ_PERM_USER_MANAGE_REPORTS)) { + if(perms_check($perms[MSZ_PERMS_USER], MSZ_PERM_USER_MANAGE_REPORTS)) { $menu['Users']['Reports'] = '/manage/users.php?v=reports'; } - if (perms_check($perms[MSZ_PERMS_USER], MSZ_PERM_USER_MANAGE_WARNINGS)) { + if(perms_check($perms[MSZ_PERMS_USER], MSZ_PERM_USER_MANAGE_WARNINGS)) { $menu['Users']['Warnings'] = '/manage/users.php?v=warnings'; } - if (perms_check($perms[MSZ_PERMS_NEWS], MSZ_PERM_NEWS_MANAGE_POSTS)) { + if(perms_check($perms[MSZ_PERMS_NEWS], MSZ_PERM_NEWS_MANAGE_POSTS)) { $menu['News']['Posts'] = '/manage/news.php?v=posts'; } - if (perms_check($perms[MSZ_PERMS_NEWS], MSZ_PERM_NEWS_MANAGE_CATEGORIES)) { + if(perms_check($perms[MSZ_PERMS_NEWS], MSZ_PERM_NEWS_MANAGE_CATEGORIES)) { $menu['News']['Categories'] = '/manage/news.php?v=categories'; } - if (perms_check($perms[MSZ_PERMS_FORUM], MSZ_PERM_FORUM_MANAGE_FORUMS)) { - $menu['Forum']['Listing'] = '/manage/forum.php?v=listing'; + if(perms_check($perms[MSZ_PERMS_FORUM], MSZ_PERM_FORUM_MANAGE_FORUMS)) { + $menu['Forum']['Categories'] = url('manage-forum-categories'); } - if (perms_check($perms[MSZ_PERMS_FORUM], 0)) { + if(perms_check($perms[MSZ_PERMS_FORUM], 0)) { $menu['Forum']['Settings'] = '/manage/forum.php?v=settings'; } - if (perms_check($perms[MSZ_PERMS_CHANGELOG], MSZ_PERM_CHANGELOG_MANAGE_CHANGES)) { + if(perms_check($perms[MSZ_PERMS_CHANGELOG], MSZ_PERM_CHANGELOG_MANAGE_CHANGES)) { $menu['Changelog']['Changes'] = '/manage/changelog.php?v=changes'; } - if (perms_check($perms[MSZ_PERMS_CHANGELOG], MSZ_PERM_CHANGELOG_MANAGE_TAGS)) { + if(perms_check($perms[MSZ_PERMS_CHANGELOG], MSZ_PERM_CHANGELOG_MANAGE_TAGS)) { $menu['Changelog']['Tags'] = '/manage/changelog.php?v=tags'; } @@ -75,11 +75,11 @@ define('MSZ_MANAGE_PERM_NEVER', 'never'); function manage_perms_value(int $perm, int $allow, int $deny): string { - if (perms_check($deny, $perm)) { + if(perms_check($deny, $perm)) { return MSZ_MANAGE_PERM_NEVER; } - if (perms_check($allow, $perm)) { + if(perms_check($allow, $perm)) { return MSZ_MANAGE_PERM_YES; } @@ -90,8 +90,8 @@ function manage_perms_apply(array $list, array $post, ?array $raw = null): ?arra { $perms = $raw !== null ? $raw : perms_create(); - foreach ($list as $section) { - if (empty($post[$section['section']]) + foreach($list as $section) { + if(empty($post[$section['section']]) || !is_array($post[$section['section']])) { continue; } @@ -99,12 +99,12 @@ function manage_perms_apply(array $list, array $post, ?array $raw = null): ?arra $allowKey = perms_get_key($section['section'], MSZ_PERMS_ALLOW); $denyKey = perms_get_key($section['section'], MSZ_PERMS_DENY); - foreach ($section['perms'] as $perm) { - if (empty($post[$section['section']][$perm['section']]['value'])) { + foreach($section['perms'] as $perm) { + if(empty($post[$section['section']][$perm['section']]['value'])) { continue; } - switch ($post[$section['section']][$perm['section']]['value']) { + switch($post[$section['section']][$perm['section']]['value']) { case MSZ_MANAGE_PERM_YES: $perms[$allowKey] |= $perm['perm']; $perms[$denyKey] &= ~$perm['perm']; @@ -126,11 +126,11 @@ function manage_perms_apply(array $list, array $post, ?array $raw = null): ?arra $returnNothing = 0; - foreach ($perms as $perm) { + foreach($perms as $perm) { $returnNothing |= $perm; } - if ($returnNothing === 0) { + if($returnNothing === 0) { return null; } @@ -139,12 +139,12 @@ function manage_perms_apply(array $list, array $post, ?array $raw = null): ?arra function manage_perms_calculate(array $rawPerms, array $perms): array { - for ($i = 0; $i < count($perms); $i++) { + for($i = 0; $i < count($perms); $i++) { $section = $perms[$i]['section']; $allowKey = perms_get_key($section, MSZ_PERMS_ALLOW); $denyKey = perms_get_key($section, MSZ_PERMS_DENY); - for ($j = 0; $j < count($perms[$i]['perms']); $j++) { + for($j = 0; $j < count($perms[$i]['perms']); $j++) { $permission = $perms[$i]['perms'][$j]['perm']; $perms[$i]['perms'][$j]['value'] = manage_perms_value($permission, $rawPerms[$allowKey], $rawPerms[$denyKey]); } diff --git a/src/url.php b/src/url.php index da097ec5..b262eed8 100644 --- a/src/url.php +++ b/src/url.php @@ -13,107 +13,113 @@ define('MSZ_URLS', [ 'media-proxy' => ['/proxy.php//'], 'search-index' => ['/search.php'], - 'search-query' => ['/search.php', ['q' => '']], + 'search-query' => ['/search.php', ['q' => '']], - 'auth-login' => ['/auth/login.php', ['username' => '', 'redirect' => '']], - 'auth-login-welcome' => ['/auth/login.php', ['welcome' => '1', 'username' => '']], + 'auth-login' => ['/auth/login.php', ['username' => '', 'redirect' => '']], + 'auth-login-welcome' => ['/auth/login.php', ['welcome' => '1', 'username' => '']], 'auth-register' => ['/auth/register.php'], 'auth-forgot' => ['/auth/password.php'], - 'auth-reset' => ['/auth/password.php', ['user' => '']], - 'auth-logout' => ['/auth/logout.php', ['token' => '{logout}']], - 'auth-resolve-user' => ['/auth/login.php', ['resolve_user' => '']], - 'auth-two-factor' => ['/auth/twofactor.php', ['token' => '']], + 'auth-reset' => ['/auth/password.php', ['user' => '']], + 'auth-logout' => ['/auth/logout.php', ['token' => '{logout}']], + 'auth-resolve-user' => ['/auth/login.php', ['resolve_user' => '']], + 'auth-two-factor' => ['/auth/twofactor.php', ['token' => '']], 'changelog-index' => ['/changelog.php'], - 'changelog-change' => ['/changelog.php', ['c' => '']], - 'changelog-date' => ['/changelog.php', ['d' => '']], - 'changelog-tag' => ['/changelog.php', ['t' => '']], + 'changelog-change' => ['/changelog.php', ['c' => '']], + 'changelog-date' => ['/changelog.php', ['d' => '']], + 'changelog-tag' => ['/changelog.php', ['t' => '']], - 'news-index' => ['/news', ['page' => '']], - 'news-post' => ['/news/post.php', ['p' => '']], - 'news-post-comments' => ['/news/post.php', ['p' => ''], 'comments'], - 'news-category' => ['/news/category.php', ['c' => '', 'p' => '']], + 'news-index' => ['/news', ['page' => '']], + 'news-post' => ['/news/post.php', ['p' => '']], + 'news-post-comments' => ['/news/post.php', ['p' => ''], 'comments'], + 'news-category' => ['/news/category.php', ['c' => '', 'p' => '']], 'news-feed-rss' => ['/news/feed.php/rss'], - 'news-category-feed-rss' => ['/news/feed.php/rss', ['c' => '']], + 'news-category-feed-rss' => ['/news/feed.php/rss', ['c' => '']], 'news-feed-atom' => ['/news/feed.php/atom'], - 'news-category-feed-atom' => ['/news/feed.php/atom', ['c' => '']], + 'news-category-feed-atom' => ['/news/feed.php/atom', ['c' => '']], 'forum-index' => ['/forum'], - 'forum-leaderboard' => ['/forum/leaderboard.php', ['id' => '', 'mode' => '']], - 'forum-mark-global' => ['/forum/index.php', ['m' => 'mark', 'c' => '{forum_mark}']], - 'forum-mark-single' => ['/forum/index.php', ['m' => 'mark', 'c' => '{forum_mark}', 'f' => '']], - 'forum-topic-new' => ['/forum/posting.php', ['f' => '']], - 'forum-reply-new' => ['/forum/posting.php', ['t' => '']], - 'forum-category' => ['/forum/forum.php', ['f' => '', 'p' => '']], - 'forum-topic' => ['/forum/topic.php', ['t' => '', 'page' => '']], - 'forum-topic-create' => ['/forum/posting.php', ['f' => '']], - 'forum-topic-bump' => ['/forum/topic.php', ['t' => '', 'm' => 'bump', 'csrf[forum_post]' => '{forum_post}']], - 'forum-topic-lock' => ['/forum/topic.php', ['t' => '', 'm' => 'lock', 'csrf[forum_post]' => '{forum_post}']], - 'forum-topic-unlock' => ['/forum/topic.php', ['t' => '', 'm' => 'unlock', 'csrf[forum_post]' => '{forum_post}']], - 'forum-topic-delete' => ['/forum/topic.php', ['t' => '', 'm' => 'delete', 'csrf[forum_post]' => '{forum_post}']], - 'forum-topic-restore' => ['/forum/topic.php', ['t' => '', 'm' => 'restore', 'csrf[forum_post]' => '{forum_post}']], - 'forum-topic-nuke' => ['/forum/topic.php', ['t' => '', 'm' => 'nuke', 'csrf[forum_post]' => '{forum_post}']], - 'forum-topic-priority' => ['/forum/topic-priority.php', ['t' => '', 'b' => '']], - 'forum-post' => ['/forum/topic.php', ['p' => ''], ''], - 'forum-post-create' => ['/forum/posting.php', ['t' => '']], - 'forum-post-delete' => ['/forum/post.php', ['p' => '', 'm' => 'delete']], - 'forum-post-restore' => ['/forum/post.php', ['p' => '', 'm' => 'restore']], - 'forum-post-nuke' => ['/forum/post.php', ['p' => '', 'm' => 'nuke']], - 'forum-post-quote' => ['/forum/posting.php', ['q' => '']], - 'forum-post-edit' => ['/forum/posting.php', ['p' => '', 'm' => 'edit']], + 'forum-leaderboard' => ['/forum/leaderboard.php', ['id' => '', 'mode' => '']], + 'forum-mark-global' => ['/forum/index.php', ['m' => 'mark', 'c' => '{forum_mark}']], + 'forum-mark-single' => ['/forum/index.php', ['m' => 'mark', 'c' => '{forum_mark}', 'f' => '']], + 'forum-topic-new' => ['/forum/posting.php', ['f' => '']], + 'forum-reply-new' => ['/forum/posting.php', ['t' => '']], + 'forum-category' => ['/forum/forum.php', ['f' => '', 'p' => '']], + 'forum-topic' => ['/forum/topic.php', ['t' => '', 'page' => '']], + 'forum-topic-create' => ['/forum/posting.php', ['f' => '']], + 'forum-topic-bump' => ['/forum/topic.php', ['t' => '', 'm' => 'bump', 'csrf[forum_post]' => '{forum_post}']], + 'forum-topic-lock' => ['/forum/topic.php', ['t' => '', 'm' => 'lock', 'csrf[forum_post]' => '{forum_post}']], + 'forum-topic-unlock' => ['/forum/topic.php', ['t' => '', 'm' => 'unlock', 'csrf[forum_post]' => '{forum_post}']], + 'forum-topic-delete' => ['/forum/topic.php', ['t' => '', 'm' => 'delete', 'csrf[forum_post]' => '{forum_post}']], + 'forum-topic-restore' => ['/forum/topic.php', ['t' => '', 'm' => 'restore', 'csrf[forum_post]' => '{forum_post}']], + 'forum-topic-nuke' => ['/forum/topic.php', ['t' => '', 'm' => 'nuke', 'csrf[forum_post]' => '{forum_post}']], + 'forum-topic-priority' => ['/forum/topic-priority.php', ['t' => '', 'b' => '']], + 'forum-post' => ['/forum/topic.php', ['p' => ''], ''], + 'forum-post-create' => ['/forum/posting.php', ['t' => '']], + 'forum-post-delete' => ['/forum/post.php', ['p' => '', 'm' => 'delete']], + 'forum-post-restore' => ['/forum/post.php', ['p' => '', 'm' => 'restore']], + 'forum-post-nuke' => ['/forum/post.php', ['p' => '', 'm' => 'nuke']], + 'forum-post-quote' => ['/forum/posting.php', ['q' => '']], + 'forum-post-edit' => ['/forum/posting.php', ['p' => '', 'm' => 'edit']], 'forum-poll-vote' => ['/forum/poll.php'], - 'user-list' => ['/members.php', ['r' => '', 'ss' => '', 'sd' => '', 'p' => '']], + 'user-list' => ['/members.php', ['r' => '', 'ss' => '', 'sd' => '', 'p' => '']], - 'user-profile' => ['/profile.php', ['u' => '']], - 'user-profile-following' => ['/profile.php', ['u' => '', 'm' => 'following']], - 'user-profile-followers' => ['/profile.php', ['u' => '', 'm' => 'followers']], - 'user-profile-forum-topics' => ['/profile.php', ['u' => '', 'm' => 'forum-topics']], - 'user-profile-forum-posts' => ['/profile.php', ['u' => '', 'm' => 'forum-posts']], - 'user-profile-edit' => ['/profile.php', ['u' => '', 'edit' => '1']], - 'user-account-standing' => ['/profile.php', ['u' => ''], 'account-standing'], + 'user-profile' => ['/profile.php', ['u' => '']], + 'user-profile-following' => ['/profile.php', ['u' => '', 'm' => 'following']], + 'user-profile-followers' => ['/profile.php', ['u' => '', 'm' => 'followers']], + 'user-profile-forum-topics' => ['/profile.php', ['u' => '', 'm' => 'forum-topics']], + 'user-profile-forum-posts' => ['/profile.php', ['u' => '', 'm' => 'forum-posts']], + 'user-profile-edit' => ['/profile.php', ['u' => '', 'edit' => '1']], + 'user-account-standing' => ['/profile.php', ['u' => ''], 'account-standing'], - 'user-avatar' => ['/user-assets.php', ['u' => '', 'm' => 'avatar', 'r' => '']], - 'user-background' => ['/user-assets.php', ['u' => '', 'm' => 'background']], + 'user-avatar' => ['/user-assets.php', ['u' => '', 'm' => 'avatar', 'r' => '']], + 'user-background' => ['/user-assets.php', ['u' => '', 'm' => 'background']], - 'user-relation-create' => ['/relations.php', ['u' => '', 'm' => '', 'c' => '{user_relation}']], - 'user-relation-none' => ['/relations.php', ['u' => '', 'm' => '[MSZ_USER_RELATION_NONE]', 'c' => '{user_relation}']], - 'user-relation-follow' => ['/relations.php', ['u' => '', 'm' => '[MSZ_USER_RELATION_FOLLOW]', 'c' => '{user_relation}']], + 'user-relation-create' => ['/relations.php', ['u' => '', 'm' => '', 'c' => '{user_relation}']], + 'user-relation-none' => ['/relations.php', ['u' => '', 'm' => '[MSZ_USER_RELATION_NONE]', 'c' => '{user_relation}']], + 'user-relation-follow' => ['/relations.php', ['u' => '', 'm' => '[MSZ_USER_RELATION_FOLLOW]', 'c' => '{user_relation}']], 'settings-index' => ['/settings'], 'settings-account' => ['/settings/account.php'], 'settings-sessions' => ['/settings/sessions.php'], 'settings-logs' => ['/settings/logs.php'], - 'comment-create' => ['/comments.php', ['m' => 'create']], - 'comment-vote' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'vote', 'v' => '']], - 'comment-delete' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'delete']], - 'comment-restore' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'restore']], - 'comment-pin' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'pin']], - 'comment-unpin' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'unpin']], + 'comment-create' => ['/comments.php', ['m' => 'create']], + 'comment-vote' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'vote', 'v' => '']], + 'comment-delete' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'delete']], + 'comment-restore' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'restore']], + 'comment-pin' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'pin']], + 'comment-unpin' => ['/comments.php', ['c' => '', 'csrf' => '{comments}', 'm' => 'unpin']], - 'manage-changelog-tag-create' => ['/manage/changelog.php', ['v' => 'tag']], - 'manage-changelog-tag-edit' => ['/manage/changelog.php', ['v' => 'tag', 't' => '']], - 'manage-changelog-action-create' => ['/manage/changelog.php', ['v' => 'action']], - 'manage-changelog-action-edit' => ['/manage/changelog.php', ['v' => 'action', 'a' => '']], - 'manage-changelog-change-create' => ['/manage/changelog.php', ['v' => 'change']], - 'manage-changelog-change-edit' => ['/manage/changelog.php', ['v' => 'change', 'c' => '']], + 'manage-index' => ['/manage'], + 'manage-general-overview' => ['/manage/general/index.php'], + 'manage-general-logs' => ['/manage/general/logs.php'], + 'manage-general-emoticons' => ['/manage/general/emoticons.php'], + 'manage-general-settings' => ['/manage/general/settings.php'], + 'manage-general-blacklist' => ['/manage/general/blacklist.php'], - 'manage-forum-category-view' => ['/manage/forum.php', ['v' => 'forum', 'f' => '']], + 'manage-forum-categories' => ['/manage/forum/index.php'], + 'manage-forum-category' => ['/manage/forum/category.php', ['f' => '']], - 'manage-news-category-create' => ['/manage/news.php', ['v' => 'category']], - 'manage-news-category-edit' => ['/manage/news.php', ['v' => 'category', 'c' => '']], - 'manage-news-post-create' => ['/manage/news.php', ['v' => 'post']], - 'manage-news-post-edit' => ['/manage/news.php', ['v' => 'post', 'p' => '']], + 'manage-changelog-tag-create' => ['/manage/changelog.php', ['v' => 'tag']], + 'manage-changelog-tag-edit' => ['/manage/changelog.php', ['v' => 'tag', 't' => '']], + 'manage-changelog-change-create' => ['/manage/changelog.php', ['v' => 'change']], + 'manage-changelog-change-edit' => ['/manage/changelog.php', ['v' => 'change', 'c' => '']], - 'manage-user-index' => ['/manage/users.php', ['v' => 'listing']], - 'manage-user-edit' => ['/manage/users.php', ['v' => 'view', 'u' => '']], + 'manage-news-category-create' => ['/manage/news.php', ['v' => 'category']], + 'manage-news-category-edit' => ['/manage/news.php', ['v' => 'category', 'c' => '']], + 'manage-news-post-create' => ['/manage/news.php', ['v' => 'post']], + 'manage-news-post-edit' => ['/manage/news.php', ['v' => 'post', 'p' => '']], - 'manage-role-index' => ['/manage/users.php', ['v' => 'roles']], - 'manage-role-create' => ['/manage/users.php', ['v' => 'role']], - 'manage-role-edit' => ['/manage/users.php', ['v' => 'role', 'r' => '']], + 'manage-user-index' => ['/manage/users.php', ['v' => 'listing']], + 'manage-user-edit' => ['/manage/users.php', ['v' => 'view', 'u' => '']], - 'manage-warning-delete' => ['/manage/users.php', ['v' => 'warnings', 'u' => '', 'w' => '', 'm' => 'delete', 'c' => '']], + 'manage-role-index' => ['/manage/users.php', ['v' => 'roles']], + 'manage-role-create' => ['/manage/users.php', ['v' => 'role']], + 'manage-role-edit' => ['/manage/users.php', ['v' => 'role', 'r' => '']], + + 'manage-warning-delete' => ['/manage/users.php', ['v' => 'warnings', 'u' => '', 'w' => '', 'm' => 'delete', 'c' => '']], ]); function url(string $name, array $variables = []): string diff --git a/templates/_layout/header.twig b/templates/_layout/header.twig index f838701e..3ceffb7f 100644 --- a/templates/_layout/header.twig +++ b/templates/_layout/header.twig @@ -74,7 +74,7 @@ }, { 'title': 'Manage', - 'url': manage_link|default('/manage/index.php'), + 'url': manage_link|default(url('manage-index')), 'icon': 'fas fa-door-closed fa-fw', 'display': has_manage_access and manage_menu is not defined }, diff --git a/templates/manage/forum/listing.twig b/templates/manage/forum/listing.twig index 4fe4901a..1c17c6b3 100644 --- a/templates/manage/forum/listing.twig +++ b/templates/manage/forum/listing.twig @@ -8,7 +8,7 @@
{% for forum in forums %} - {{ forum.forum_name }}
+ {{ forum.forum_name }}
{% endfor %}
diff --git a/templates/manage/general/blacklist.twig b/templates/manage/general/blacklist.twig index 812e6c8a..6444df64 100644 --- a/templates/manage/general/blacklist.twig +++ b/templates/manage/general/blacklist.twig @@ -21,13 +21,13 @@ {% endif %}
-
+ {{ input_csrf('ip_blacklist') }}
-
+ {{ input_csrf('ip_blacklist') }} {{ input_select('blacklist[remove][]', blacklist, null, 'ip_cidr', null, true, 'manage__blacklist__select', { 'multiple': true, diff --git a/templates/manage/general/logs.twig b/templates/manage/general/logs.twig index cc986e08..ebd373de 100644 --- a/templates/manage/general/logs.twig +++ b/templates/manage/general/logs.twig @@ -5,7 +5,7 @@ {% block manage_content %}
{{ container_title(' Global Log') }} - {% set glp = pagination(global_logs_pagination, '/manage/index.php', null, {'v': 'logs'}) %} + {% set glp = pagination(global_logs_pagination, url('manage-general-logs'), null, {'v': 'logs'}) %}