From 6f270a81ce33018bab9a3d5de79d7df67815a89a Mon Sep 17 00:00:00 2001 From: RedDragonWebDesign Date: Tue, 6 Feb 2024 22:24:09 -0800 Subject: [PATCH] search: move functions up --- src/forum/search.php | 64 +++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/forum/search.php b/src/forum/search.php index 38c4cdbb..b1d3d6ef 100644 --- a/src/forum/search.php +++ b/src/forum/search.php @@ -12,6 +12,39 @@ * */ +function recurseSubForums($spacing) { + global $filterBoardOptions, $boardObj, $memberInfo; + + $arrSubforums = $boardObj->getSubForums(); + foreach ($arrSubforums as $boardID) { + $boardObj->select($boardID); + if ($boardObj->memberHasAccess($memberInfo)) { + $filterBoardOptions[$boardObj->get_info("forumboard_id")] = $spacing.$boardObj->get_info_filtered("name"); + if (count($boardObj->getSubForums()) > 0) { + recurseSubForums("    ".$spacing); + } + } + } +} + +/** + * Validation function used by the form processor + */ +function check_filter_boards() { + global $boardObj, $formObj; + + $countErrors = 0; + foreach ($_POST['filterboards'] as $value) { + if (!$boardObj->select($value) && $value != 0) { + $countErrors++; + } + } + + if ($countErrors > 0) { + $formObj->errors[] = "You selected an invalid board filter."; + } +} + // Config File $prevFolder = "../"; @@ -103,37 +136,6 @@ } } -function recurseSubForums($spacing) { - global $filterBoardOptions, $boardObj, $memberInfo; - - $arrSubforums = $boardObj->getSubForums(); - foreach ($arrSubforums as $boardID) { - $boardObj->select($boardID); - if ($boardObj->memberHasAccess($memberInfo)) { - $filterBoardOptions[$boardObj->get_info("forumboard_id")] = $spacing.$boardObj->get_info_filtered("name"); - if (count($boardObj->getSubForums()) > 0) { - recurseSubForums("    ".$spacing); - } - } - } -} - -function check_filter_boards() { - global $boardObj, $formObj; - - $countErrors = 0; - foreach ($_POST['filterboards'] as $value) { - if (!$boardObj->select($value) && $value != 0) { - $countErrors++; - } - } - - if ($countErrors > 0) { - $formObj->errors[] = "You selected an invalid board filter."; - } -} - - $filterBoardSize = floor(count($filterBoardOptions)*.85); $i=1;