예제 #1
0
$postInfo = $boardObj->objPost->get_info_filtered();
$boardIDs = $boardObj->getAllBoards();
$catName = "";
$nonSelectableItems = array();
foreach ($boardIDs as $id) {
    $boardObj->select($id);
    $forumCatID = $boardObj->get_info("forumcategory_id");
    $forumCatObj->select($forumCatID);
    if ($forumCatObj->get_info_filtered("name") != $catName) {
        $catName = $forumCatObj->get_info_filtered("name");
        $catKey = "category_" . $forumCatID;
        $forumBoardOptions[$catKey] = "<b>" . $catName . "</b>";
        $nonSelectableItems[] = $catKey;
    }
    if (($member->hasAccess($consoleObj) || $boardObj->memberIsMod($memberInfo['member_id'])) && $id != $topicInfo['forumboard_id']) {
        $spacing = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $boardObj->calcBoardDepth());
        $forumBoardOptions[$id] = $spacing . $boardObj->get_info_filtered("name");
    }
}
$i = 0;
$arrComponents = array("selecteditem" => array("type" => "custom", "display_name" => "Selected Topic", "sortorder" => $i++, "html" => "<div class='formInput'><b>" . $postInfo['title'] . "</b></div>"), "moveto" => array("type" => "select", "attributes" => array("class" => "formInput textBox"), "display_name" => "Move To", "validate" => array("RESTRICT_TO_OPTIONS"), "options" => $forumBoardOptions, "sortorder" => $i++, "db_name" => "forumboard_id", "non_selectable_items" => $nonSelectableItems), "postredirect" => array("type" => "checkbox", "attributes" => array("id" => "postRedirect", "class" => "formInput", "checked" => "checked"), "value" => 1, "display_name" => "Post a Redirect", "sortorder" => $i++), "postredirect_top" => array("type" => "custom", "sortorder" => $i++, "html" => "<div id='postRedirectSection'>"), "postredirect_desc" => array("type" => "textarea", "sortorder" => $i++, "attributes" => array("class" => "formInput textBox", "rows" => "5", "cols" => "40"), "display_name" => "Redirect Description", "tooltip" => "Let users know why the topic is being moved.", "value" => "This topic has been moved to [BOARD].\n\n[TOPIC_LINK]"), "postredirect_bottom" => array("type" => "custom", "sortorder" => $i++, "html" => "</div>"), "submit" => array("type" => "submit", "value" => "Move Topic", "sortorder" => $i++, "attributes" => array("class" => "submitButton formSubmitButton")));
$setupFormArgs = array("name" => "console-" . $cID, "components" => $arrComponents, "description" => "Use the form below to move the selected topic.", "saveObject" => $boardObj->objTopic, "saveMessage" => "Successfully Moved Topic!", "saveType" => "update", "saveLink" => $MAIN_ROOT . "forum/viewtopic.php?tID=" . $topicInfo['forumtopic_id'], "attributes" => array("action" => $MAIN_ROOT . "members/console.php?cID=" . $cID . "&topicID=" . $topicInfo['forumtopic_id'], "method" => "post"), "afterSave" => array("post_topic_redirect"));
function post_topic_redirect()
{
    global $mysqli, $boardObj, $postInfo, $MAIN_ROOT, $topicInfo, $member;
    if ($_POST['postredirect'] == 1) {
        $boardObj->select($_POST['moveto']);
        $arrColumns = array("forumboard_id", "lockstatus");
        $arrValues = array($topicInfo['forumboard_id'], 1);
        $boardObj->objTopic->addNew($arrColumns, $arrValues);
        $message = str_replace("[BOARD]", "<a href='" . $MAIN_ROOT . "forum/viewboard.php?bID=" . $_POST['moveto'] . "'>" . $boardObj->get_info_filtered("name") . "</a>", $_POST['postredirect_desc']);