/** * @see PostList::readPostIDs() */ protected function readPostIDs() { $boardIDs = Board::getModeratedBoards('canEditPost'); $boardIDs2 = Board::getModeratedBoards('canReadDeletedPost'); if (!empty($boardIDs)) { $sql = "SELECT\t\treport.postID\n\t\t\t\tFROM\t\twbb" . WBB_N . "_post_report report\n\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\tON\t\t(post.postID = report.postID)\n\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\tWHERE\t\tthread.boardID IN (" . $boardIDs . ")\n\t\t\t\t\t\tAND (post.isDeleted = 0" . (!empty($boardIDs2) ? " OR thread.boardID IN (" . $boardIDs2 . ")" : '') . ")\n\t\t\t\tORDER BY\treport.reportTime DESC"; $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->offset); while ($row = WCF::getDB()->fetchArray($result)) { if (!empty($this->postIDs)) { $this->postIDs .= ','; } $this->postIDs .= $row['postID']; } } }
/** * @see Action::execute() */ public function execute() { parent::execute(); // check permissions $boardIDs = Board::getModeratedBoards('canDeleteThreadCompletely'); if (empty($boardIDs)) { throw new PermissionDeniedException(); } // delete threads $threadIDArray = array(); $sql = "SELECT\tthreadID\n\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\tWHERE\tisDeleted = 1\n\t\t\t\tAND boardID IN (" . $boardIDs . ")"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { $threadIDArray[] = $row['threadID']; } if (count($threadIDArray)) { ThreadEditor::deleteAllCompletely(implode(',', $threadIDArray)); } $this->executed(); // forward HeaderUtil::redirect('index.php?page=ModerationDeletedThreads' . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * Returns the number of outstanding thread / post moderations. * * @return integer */ public function getOutstandingModerations() { if ($this->outstandingModerations === null) { $this->outstandingModerations = WCF::getSession()->getVar('outstandingModerations'); if ($this->outstandingModerations === null) { $this->outstandingModerations = 0; require_once WBB_DIR . 'lib/data/board/Board.class.php'; // disabled threads $boardIDs = Board::getModeratedBoards('canEnableThread'); if (!empty($boardIDs)) { $sql = "SELECT\tCOUNT(*) AS count\n\t\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\t\tWHERE\tisDisabled = 1\n\t\t\t\t\t\t\tAND boardID IN (" . $boardIDs . ")\n\t\t\t\t\t\t\tAND movedThreadID = 0"; $row = WCF::getDB()->getFirstRow($sql); $this->outstandingModerations += $row['count']; } // disabled posts $boardIDs = Board::getModeratedBoards('canEnablePost'); if (!empty($boardIDs)) { $sql = "SELECT\t\tCOUNT(*) AS count\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_post post\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\t\t\tWHERE\t\tpost.isDisabled = 1\n\t\t\t\t\t\t\t\tAND thread.boardID IN (" . $boardIDs . ")"; $row = WCF::getDB()->getFirstRow($sql); $this->outstandingModerations += $row['count']; } // reported posts $boardIDs = Board::getModeratedBoards('canEditPost'); $boardIDs2 = Board::getModeratedBoards('canReadDeletedPost'); if (!empty($boardIDs)) { $sql = "SELECT\t\tCOUNT(*) AS count\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_post_report report\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\t\t\tON\t\t(post.postID = report.postID)\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\t\t\tWHERE\t\tthread.boardID IN (" . $boardIDs . ")\n\t\t\t\t\t\t\t\tAND (post.isDeleted = 0" . (!empty($boardIDs2) ? " OR thread.boardID IN (" . $boardIDs2 . ")" : '') . ")"; $row = WCF::getDB()->getFirstRow($sql); $this->outstandingModerations += $row['count']; } WCF::getSession()->register('outstandingModerations', $this->outstandingModerations); } } return $this->outstandingModerations; }
/** * Creates a new ModerationDeletedThreadsPage object. */ public function __construct() { $boardIDs = Board::getModeratedBoards('canReadDeletedThread'); $this->sqlConditions .= ' AND thread.boardID IN (' . (!empty($boardIDs) ? $boardIDs : 0) . ')'; parent::__construct(); }
/** * Counts the reported posts. */ protected function countReports() { $boardIDs = Board::getModeratedBoards('canEditPost'); $boardIDs2 = Board::getModeratedBoards('canReadDeletedPost'); if (!empty($boardIDs)) { $sql = "SELECT\t\tCOUNT(*) AS count\n\t\t\t\tFROM\t\twbb" . WBB_N . "_post_report report\n\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\tON\t\t(post.postID = report.postID)\n\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\tWHERE\t\tthread.boardID IN (" . $boardIDs . ")\n\t\t\t\t\t\tAND (post.isDeleted = 0" . (!empty($boardIDs2) ? " OR thread.boardID IN (" . $boardIDs2 . ")" : '') . ")"; $row = WCF::getDB()->getFirstRow($sql); $this->reports = $row['count']; } }