public function delete() { $returnVal = false; if ($this->intTableKeyValue != "") { $arrSubForums = $this->getSubForums(); $result[] = $this->MySQL->query("DELETE FROM " . $this->MySQL->get_tablePrefix() . "forum_post WHERE forumboard_id = '" . $this->intTableKeyValue . "'"); $result[] = $this->MySQL->query("DELETE FROM " . $this->MySQL->get_tablePrefix() . "forum_topic WHERE forumboard_id = '" . $this->intTableKeyValue . "'"); $result[] = $this->MySQL->query("DELETE FROM " . $this->MySQL->get_tablePrefix() . "forum_rankaccess WHERE board_id = '" . $this->intTableKeyValue . "'"); $result[] = $this->MySQL->query("DELETE FROM " . $this->MySQL->get_tablePrefix() . "forum_memberaccess WHERE board_id = '" . $this->intTableKeyValue . "'"); $result[] = parent::delete(); if (count($arrSubForums) > 0) { $subForumObj = new ForumBoard($this->MySQL); $arrColumns = array("sortnum", "subforum_id"); foreach ($arrSubForums as $subForumID) { $subForumObj->select($subForumID); $subForumInfo = $subForumObj->get_info(); $newSortNum = $subForumInfo['sortnum'] + ($this->arrObjInfo['sortnum'] - 1); $arrValues = array($newSortNum, $this->arrObjInfo['subforum_id']); $subForumObj->update($arrColumns, $arrValues); } $subForumObj->resortOrder(); } if (!in_array(false, $result)) { $returnVal = true; } } return $returnVal; }
public function getForumActivity($amountToShow = 5) { $forumObj = new ForumBoard($this->MySQL); $arrReturn = array(); $memberInfo = $this->memberObj->get_info(); $result = $this->MySQL->query("SELECT forumpost_id FROM " . $this->MySQL->get_tablePrefix() . "forum_post ORDER BY dateposted DESC"); while (count($arrReturn) < $amountToShow && ($row = $result->fetch_assoc())) { $forumPostID = $row['forumpost_id']; $forumObj->objPost->select($forumPostID); $topicID = $forumObj->objPost->get_info("forumtopic_id"); $forumObj->objTopic->select($topicID); $boardID = $forumObj->objTopic->get_info("forumboard_id"); $forumObj->select($boardID); $boardAccessType = $forumObj->get_info("accesstype"); if (!in_array($forumPostID, $arrReturn) && $boardAccessType == 0) { $arrReturn[] = $forumPostID; } elseif (!in_array($forumPostID, $arrReturn) && $boardAccessType == 1 && $this->blnLoggedIn && $forumObj->memberHasAccess($memberInfo)) { $arrReturn[] = $forumPostID; } } return $arrReturn; }
$consoleObj = new ConsoleOption($mysqli); $cID = $consoleObj->findConsoleIDByName("Add Board"); $consoleObj->select($cID); $consoleInfo = $consoleObj->get_info_filtered(); $member = new Member($mysqli); $member->select($_SESSION['btUsername']); $categoryObj = new BasicOrder($mysqli, "forum_category", "forumcategory_id"); $categoryObj->set_assocTableName("forum_board"); $categoryObj->set_assocTableKey("forumboard_id"); $boardObj = new ForumBoard($mysqli); // Check Login $LOGIN_FAIL = true; $arrSelectBoard = ""; if (isset($_POST['bID']) && $boardObj->select($_POST['bID'])) { $arrSelectBoard = $boardObj->findBeforeAfter(); if ($boardObj->get_info("subforum_id") != 0) { $arrSelectBoard[0] = $boardObj->get_info("subforum_id"); } } else { $_POST['bID'] = ""; } if ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj)) { if ($categoryObj->select($_POST['catID'])) { $arrBoards = $categoryObj->getAssociateIDs("AND subforum_id = '0' ORDER BY sortnum", true); foreach ($arrBoards as $value) { if ($_POST['bID'] != $value) { $boardObj->select($value); $boardInfo = $boardObj->get_info_filtered(); $selectBoard = ""; if ($_POST['bID'] != "" && $arrSelectBoard[0] == $boardInfo['forumboard_id']) { $selectBoard = " selected";
if (!$boardObj->objTopic->select($_GET['topicID'])) { echo "\n\t\t<script type='text/javascript'>\n\t\t\twindow.location = '" . $MAIN_ROOT . "members'\n\t\t</script>\n\t"; exit; } $topicInfo = $boardObj->objTopic->get_info_filtered(); $boardObj->select($boardObj->objTopic->get_info("forumboard_id")); $boardInfo = $boardObj->get_info_filtered(); $forumCatObj = new Basic($mysqli, "forum_category", "forumcategory_id"); $boardObj->objPost->select($topicInfo['forumpost_id']); $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(" ", $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"));