当前位置: 首页>>代码示例>>PHP>>正文


PHP Board::getBoard方法代码示例

本文整理汇总了PHP中Board::getBoard方法的典型用法代码示例。如果您正苦于以下问题:PHP Board::getBoard方法的具体用法?PHP Board::getBoard怎么用?PHP Board::getBoard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Board的用法示例。


在下文中一共展示了Board::getBoard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getObjectByID

 /**
  * @see WarningObjectType::getObjectByID()
  */
 public function getObjectByID($objectID)
 {
     if (is_array($objectID)) {
         $posts = array();
         $sql = "SELECT\t\tpost.*, thread.topic, thread.boardID\n\t\t\t\tFROM \t\twbb" . WBB_N . "_post post\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\tpostID IN (" . implode(',', $objectID) . ")";
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             $posts[$row['postID']] = new PostWarningObject(null, $row);
         }
         return count($posts) > 0 ? $posts : null;
     } else {
         // get object
         $post = new PostWarningObject($objectID);
         if (!$post->postID) {
             return null;
         }
         // check permissions
         if (!class_exists('WBBACP')) {
             // ignore permission in acp
             $board = Board::getBoard($post->boardID);
             if (!$board->getPermission('canViewBoard') || !$board->getPermission('canEnterBoard')) {
                 return null;
             }
         }
         // return object
         return $post;
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:31,代码来源:PostWarningObjectType.class.php

示例2: readParameters

 /**
  * @see Action::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['threadID'])) {
         $this->threadID = intval($_REQUEST['threadID']);
     }
     // get thread
     $this->thread = new ThreadEditor($this->threadID);
     // get board
     $this->board = Board::getBoard($this->thread->boardID);
     // enter thread
     $this->thread->enter($this->board);
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:16,代码来源:AbstractThreadAction.class.php

示例3: readData

 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // get post, thread and board
     $this->post = new PostEditor($this->postID);
     $this->thread = new Thread($this->post->threadID);
     $this->board = Board::getBoard($this->thread->boardID);
     // get ip addresses of the author
     $this->authorIpAddresses = PostEditor::getIpAddressByAuthor($this->post->userID, $this->post->username, $this->post->ipAddress);
     // get hostnames
     $this->loadHostnames();
     // get other users of this ip address
     if ($this->post->ipAddress) {
         $this->otherUsers = PostEditor::getAuthorByIpAddress($this->post->ipAddress, $this->post->userID, $this->post->username);
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:19,代码来源:IpAddressPage.class.php

示例4: execute

 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     $attachment = $eventObj->attachment;
     if ($attachment['containerID'] && $attachment['containerType'] == 'post') {
         // get thread
         require_once WBB_DIR . 'lib/data/thread/Thread.class.php';
         $thread = new Thread(null, null, $attachment['containerID']);
         // check read permission
         $thread->enter();
         // get board
         require_once WBB_DIR . 'lib/data/board/Board.class.php';
         $board = Board::getBoard($thread->boardID);
         // check download permission
         if (!$board->getPermission('canDownloadAttachment') && (!$eventObj->thumbnail || !$board->getPermission('canViewAttachmentPreview'))) {
             throw new PermissionDeniedException();
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:21,代码来源:AttachmentCheckPostPermissionListener.class.php

示例5: getPages

 /**
  * Gets the number of pages in this thread.
  *
  * @return	integer		number of pages in this thread
  */
 public function getPages($board = null)
 {
     // get board
     if ($board == null || $board->boardID != $this->boardID) {
         if ($this->board !== null) {
             $board = $this->board;
         } else {
             $board = Board::getBoard($this->boardID);
         }
     }
     // get posts per page
     if (WCF::getUser()->postsPerPage) {
         $postsPerPage = WCF::getUser()->postsPerPage;
     } else {
         if ($board->postsPerPage) {
             $postsPerPage = $board->postsPerPage;
         } else {
             $postsPerPage = THREAD_POSTS_PER_PAGE;
         }
     }
     return intval(ceil(($this->replies + 1) / $postsPerPage));
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:27,代码来源:ViewableThread.class.php

示例6: closeCategory

 /**
  * Closes the category with the given board id for this user.
  *
  * @param	integer		$boardID
  * @param	integer		$close		1 closes the category
  *						-1 opens the category
  */
 public function closeCategory($boardID, $close = 1)
 {
     require_once WBB_DIR . 'lib/data/board/Board.class.php';
     $board = Board::getBoard($boardID);
     if (!$board->isCategory()) {
         throw new IllegalLinkException();
     }
     $sql = "REPLACE INTO\twbb" . WBB_N . "_board_closed_category_to_user\n\t\t\t\t\t(userID, boardID, isClosed)\n\t\t\tVALUES\t\t(" . $this->userID . ",\n\t\t\t\t\t" . $boardID . ",\n\t\t\t\t\t" . $close . ")";
     WCF::getDB()->registerShutdownUpdate($sql);
     WCF::getSession()->resetUserData();
     $this->closedCategories[$boardID] = $close;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:19,代码来源:WBBUserSession.class.php

示例7: canReplyThread

 /**
  * Returns true, if the active user can reply this thread.
  */
 public function canReplyThread($board = null)
 {
     if ($board == null || $board->boardID != $this->boardID) {
         if ($this->board !== null) {
             $board = $this->board;
         } else {
             $board = Board::getBoard($this->boardID);
         }
     }
     return !$board->isClosed && ($this->isClosed && $board->getModeratorPermission('canReplyClosedThread') || !$this->isClosed && ($board->getPermission('canReplyThread') || $this->userID && $this->userID == WCF::getUser()->userID && $board->getPermission('canReplyOwnThread')));
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:14,代码来源:Thread.class.php

示例8: execute

 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (TEAM_SHOW_MODERATED_BOARDS) {
         if ($eventName == 'readData') {
             $eventObj->activeFields[] = 'moderatedBoards';
         } else {
             if ($eventName == 'assignVariables') {
                 require_once WBB_DIR . 'lib/data/board/Board.class.php';
                 // get user ids
                 $userIDArray = array_keys($eventObj->members);
                 if (count($userIDArray)) {
                     // get user to groups
                     $userToGroups = array();
                     $groupIDArray = array();
                     $sql = "SELECT\tuserID, groupID\n\t\t\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\t\t\tWHERE\tuserID IN (" . implode(',', $userIDArray) . ")";
                     $result = WCF::getDB()->sendQuery($sql);
                     while ($row = WCF::getDB()->fetchArray($result)) {
                         if (!isset($userToGroups[$row['userID']])) {
                             $userToGroups[$row['userID']] = array();
                         }
                         $userToGroups[$row['userID']][] = $row['groupID'];
                         $groupIDArray[$row['groupID']] = $row['groupID'];
                     }
                     // get user to boards
                     $userToBoards = array();
                     $sql = "SELECT\tuserID, boardID\n\t\t\t\t\t\tFROM\twbb" . WBB_N . "_board_moderator\n\t\t\t\t\t\tWHERE\tuserID IN (" . implode(',', $userIDArray) . ")";
                     $result = WCF::getDB()->sendQuery($sql);
                     while ($row = WCF::getDB()->fetchArray($result)) {
                         if (!isset($userToBoards[$row['userID']])) {
                             $userToBoards[$row['userID']] = array();
                         }
                         $userToBoards[$row['userID']][] = $row['boardID'];
                     }
                     // get group to boards
                     $groupToBoards = array();
                     if (count($groupIDArray)) {
                         $sql = "SELECT\tgroupID, boardID\n\t\t\t\t\t\t\tFROM\twbb" . WBB_N . "_board_moderator\n\t\t\t\t\t\t\tWHERE\tgroupID IN (" . implode(',', $groupIDArray) . ")";
                         $result = WCF::getDB()->sendQuery($sql);
                         while ($row = WCF::getDB()->fetchArray($result)) {
                             if (!isset($groupToBoards[$row['groupID']])) {
                                 $groupToBoards[$row['groupID']] = array();
                             }
                             $groupToBoards[$row['groupID']][] = $row['boardID'];
                         }
                     }
                     foreach ($eventObj->members as $key => $memberData) {
                         // get board ids
                         $boardIDArray = array();
                         if (isset($userToBoards[$key])) {
                             $boardIDArray = $userToBoards[$key];
                         }
                         if (isset($userToGroups[$key])) {
                             foreach ($userToGroups[$key] as $groupID) {
                                 if (isset($groupToBoards[$groupID])) {
                                     $boardIDArray = array_merge($boardIDArray, $groupToBoards[$groupID]);
                                 }
                             }
                         }
                         // get boards and check permissions
                         array_unique($boardIDArray);
                         $boards = array();
                         foreach ($boardIDArray as $boardID) {
                             $board = Board::getBoard($boardID);
                             if ($board->getPermission('canViewBoard')) {
                                 $boards[$board->boardID] = WCF::getLanguage()->get(StringUtil::encodeHTML($board->title));
                             }
                         }
                         if (count($boards)) {
                             // sort boards
                             StringUtil::sort($boards);
                             // generate output
                             $output = '';
                             foreach ($boards as $boardID => $title) {
                                 if (!empty($output)) {
                                     $output .= ', ';
                                 }
                                 $output .= '<a href="index.php?page=Board&amp;boardID=' . $boardID . SID_ARG_2ND . '">' . $title . '</a>';
                             }
                             $eventObj->members[$key]['moderatedBoards'] = $output;
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:89,代码来源:TeamPageModeratedBoardsListener.class.php

示例9: updateUserStats

 /**
  * Updates the user stats (user posts, activity points & user rank).
  * 
  * @param	string		$threadIDs		changed threads
  * @param 	string		$mode			(enable|copy|move|delete)
  * @param 	integer		$destinationBoardID
  */
 public static function updateUserStats($threadIDs, $mode, $destinationBoardID = 0)
 {
     if (empty($threadIDs)) {
         return;
     }
     // get destination board
     $destinationBoard = null;
     if ($destinationBoardID) {
         $destinationBoard = Board::getBoard($destinationBoardID);
     }
     if ($mode == 'copy' && !$destinationBoard->countUserPosts) {
         return;
     }
     // update user posts, activity points
     $userPosts = array();
     $userActivityPoints = array();
     $sql = "SELECT\tboardID, userID\n\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\tWHERE\tthreadID IN (" . $threadIDs . ")\n\t\t\t\t" . ($mode != 'enable' ? "AND everEnabled = 1" : '') . "\n\t\t\t\tAND userID <> 0";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $board = Board::getBoard($row['boardID']);
         switch ($mode) {
             case 'enable':
                 if ($board->countUserPosts) {
                     // posts
                     if (!isset($userPosts[$row['userID']])) {
                         $userPosts[$row['userID']] = 0;
                     }
                     $userPosts[$row['userID']]++;
                     // activity points
                     if (!isset($userActivityPoints[$row['userID']])) {
                         $userActivityPoints[$row['userID']] = 0;
                     }
                     $userActivityPoints[$row['userID']] += ACTIVITY_POINTS_PER_THREAD;
                 }
                 break;
             case 'copy':
                 if ($destinationBoard->countUserPosts) {
                     // posts
                     if (!isset($userPosts[$row['userID']])) {
                         $userPosts[$row['userID']] = 0;
                     }
                     $userPosts[$row['userID']]++;
                     // activity points
                     if (!isset($userActivityPoints[$row['userID']])) {
                         $userActivityPoints[$row['userID']] = 0;
                     }
                     $userActivityPoints[$row['userID']] += ACTIVITY_POINTS_PER_THREAD;
                 }
                 break;
             case 'move':
                 if ($board->countUserPosts != $destinationBoard->countUserPosts) {
                     // posts
                     if (!isset($userPosts[$row['userID']])) {
                         $userPosts[$row['userID']] = 0;
                     }
                     $userPosts[$row['userID']] += $board->countUserPosts ? -1 : 1;
                     // activity points
                     if (!isset($userActivityPoints[$row['userID']])) {
                         $userActivityPoints[$row['userID']] = 0;
                     }
                     $userActivityPoints[$row['userID']] += $board->countUserPosts ? ACTIVITY_POINTS_PER_THREAD * -1 : ACTIVITY_POINTS_PER_THREAD;
                 }
                 break;
             case 'delete':
                 if ($board->countUserPosts) {
                     // posts
                     if (!isset($userPosts[$row['userID']])) {
                         $userPosts[$row['userID']] = 0;
                     }
                     $userPosts[$row['userID']]--;
                     // activity points
                     if (!isset($userActivityPoints[$row['userID']])) {
                         $userActivityPoints[$row['userID']] = 0;
                     }
                     $userActivityPoints[$row['userID']] -= ACTIVITY_POINTS_PER_THREAD;
                 }
                 break;
         }
     }
     // save posts
     if (count($userPosts)) {
         require_once WBB_DIR . 'lib/data/user/WBBUser.class.php';
         foreach ($userPosts as $userID => $posts) {
             WBBUser::updateUserPosts($userID, $posts);
         }
     }
     // save activity points
     if (count($userActivityPoints)) {
         require_once WCF_DIR . 'lib/data/user/rank/UserRank.class.php';
         foreach ($userActivityPoints as $userID => $points) {
             UserRank::updateActivityPoints($points, $userID);
         }
     }
//.........这里部分代码省略.........
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:101,代码来源:ThreadEditor.class.php

示例10: validateParentID

 /**
  * Validates the given parent id.
  */
 protected function validateParentID()
 {
     if ($this->parentID) {
         try {
             Board::getBoard($this->parentID);
         } catch (IllegalLinkException $e) {
             throw new UserInputException('parentID', 'invalid');
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:13,代码来源:BoardAddForm.class.php

示例11: closeCategory

 /**
  * Closes the category with the given board id for this guest.
  *
  * @param	integer		$boardID
  * @param	integer		$close		1 closes the category
  *						-1 opens the category
  */
 public function closeCategory($boardID, $close = 1)
 {
     $this->getClosedCategories();
     require_once WBB_DIR . 'lib/data/board/Board.class.php';
     $board = Board::getBoard($boardID);
     if (!$board->isCategory()) {
         throw new IllegalLinkException();
     }
     $this->closedCategories[$boardID] = $close;
     WCF::getSession()->register('closedCategories', $this->closedCategories);
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:18,代码来源:WBBGuestSession.class.php

示例12: validate

 /**
  * @see Form::validate()
  */
 public function validate()
 {
     parent::validate();
     // action
     if (!in_array($this->action, $this->availableActions)) {
         throw new UserInputException('action');
     }
     // move to
     if ($this->action == 'move') {
         try {
             $board = Board::getBoard($this->moveTo);
         } catch (IllegalLinkException $e) {
             throw new UserInputException('moveTo');
         }
         if (!$board->isBoard()) {
             throw new UserInputException('moveTo');
         }
     }
     // validate new language
     if ($this->action == 'changeLanguage') {
         require_once WCF_DIR . 'lib/system/language/LanguageEditor.class.php';
         $language = new LanguageEditor($this->newLanguageID);
         if (!$language->getLanguageID()) {
             throw new UserInputException('newLanguageID');
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:30,代码来源:ThreadsMassProcessingForm.class.php

示例13: __construct

 public function __construct($data, $boxname = "")
 {
     $this->spnrbData['templatename'] = "simplePieNewsreaderBox";
     $this->getBoxStatus($data);
     $this->spnrbData['boxID'] = $data['boxID'];
     if (SPNRBOX_BOXOPENED == true) {
         $this->spnrbData['Status'] = 1;
     }
     if (WBBCore::getUser()->getPermission('user.board.canViewSimplePieNewsreaderBox')) {
         require_once WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/simplepie.inc';
         require_once WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/idna_convert.class.php';
         // FILTER?
         if (SPNRBOX_FILTER && strlen(SPNRBOX_FILTERWORDS) >= 3) {
             require_once WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/simplepie_filter.php';
             $feed = new SimplePie_Filter();
             if (!defined('SPNRBOX_FILTERCLASS')) {
                 define('SPNRBOX_FILTERCLASS', 'hightlight');
             }
             define('SPNRBOX_FILTERON', 1);
         } else {
             $feed = new SimplePie();
             define('SPNRBOX_FILTERON', 0);
         }
         // CACHE
         if (SPNRBOX_CACHEMAX != 0 && SPNRBOX_CACHEMIN != 0) {
             $feed->set_autodiscovery_cache_duration(SPNRBOX_CACHEMAX);
             $feed->set_cache_duration(SPNRBOX_CACHEMIN);
         } else {
             $feed->set_autodiscovery_cache_duration(9999999999);
             $feed->set_cache_duration(9999999999);
         }
         // CHARSET
         if (!defined('CHARSET')) {
             define('CHARSET', 'UTF-8');
         }
         if (!defined('SPNRBOX_CHARSET')) {
             define('SPNRBOX_CHARSET', 'UTF-8');
         }
         if (SPNRBOX_CHARSET == 'default') {
             $charset = CHARSET;
         } else {
             $charset = SPNRBOX_CHARSET;
         }
         $feed->set_cache_location(WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/cache');
         $feed->set_favicon_handler(RELATIVE_WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/handler_image.php');
         $feed->set_image_handler(RELATIVE_WBB_DIR . 'lib/data/boxes/SimplePieNewsReader/handler_image.php');
         $feed->set_output_encoding($charset);
         // BOOKMARKS
         $bookmarks = array();
         if (SPNRBOX_SHOWSOCIALBOOKMARKS) {
             $socialBookmarks = preg_split("/\r?\n/", SPNRBOX_SOCIALBOOKMARKS);
             $cntBookmark = 0;
             foreach ($socialBookmarks as $row) {
                 $row = trim($row);
                 if (preg_match("/\\|/", $row)) {
                     list($bookmarkTitle, $bookmarkUrl, $bookmarkImg, $bookmarkEncodeTitle, $bookmarkEncodeUrl) = preg_split("/\\|/", $row, 5);
                     $bookmarkTitle = trim($bookmarkTitle);
                     $bookmarkUrl = trim($bookmarkUrl);
                     $bookmarkImg = trim($bookmarkImg);
                     $bookmarkEncodeTitle = trim($bookmarkEncodeTitle);
                     $bookmarkEncodeUrl = trim($bookmarkEncodeUrl);
                     if (!empty($bookmarkTitle) && !empty($bookmarkUrl) && !empty($bookmarkImg) && isset($bookmarkEncodeTitle) && isset($bookmarkEncodeUrl)) {
                         $bookmarks[$cntBookmark]['bookmarkTitle'] = $bookmarkTitle;
                         $bookmarks[$cntBookmark]['bookmarkUrl'] = $bookmarkUrl;
                         $bookmarks[$cntBookmark]['bookmarkImg'] = $bookmarkImg;
                         $bookmarks[$cntBookmark]['bookmarkEncodeTitle'] = $bookmarkEncodeTitle == 1 ? 1 : 0;
                         $bookmarks[$cntBookmark]['bookmarkEncodeUrl'] = $bookmarkEncodeUrl == 1 ? 1 : 0;
                         $cntBookmark++;
                     }
                 }
             }
         }
         // THEMA ZUM FEED
         if (WCF::getUser()->getPermission('user.board.canViewThreadToFeed') && SPNRBOX_FEEDTOTHREAD) {
             require_once WBB_DIR . 'lib/data/board/Board.class.php';
             $accessibleBoards = explode(',', Board::getAccessibleBoards());
             $selectiveBoards = explode(',', SPNRBOX_FEEDTOTHREADBOARDID);
             $boardStructur = WCF::getCache()->get('board', 'boardStructure');
             if (count($selectiveBoards) != 0) {
                 $this->spnrbData['boardsForm'] = count($selectiveBoards) == 1 ? 'button' : 'list';
                 $cntBoards = 0;
                 $prefix = '';
                 foreach ($selectiveBoards as $k => $v) {
                     $tmp = Board::getBoard($v);
                     if ($tmp->boardType < 2 && in_array($v, $accessibleBoards)) {
                         $this->spnrbData['boards'][$cntBoards]['id'] = $tmp->boardID;
                         $this->spnrbData['boards'][$cntBoards]['type'] = $tmp->boardType;
                         $prefix = '';
                         foreach ($boardStructur as $boardDepth => $boardKey) {
                             if (in_array($this->spnrbData['boards'][$cntBoards]['id'], $boardKey)) {
                                 $prefix = str_repeat('--', $boardDepth);
                                 break;
                             }
                         }
                         $this->spnrbData['boards'][$cntBoards]['title'] = ($prefix != '' ? $prefix : '') . ' ' . $tmp->title;
                         $cntBoards++;
                     }
                 }
             } else {
                 $this->spnrbData['boardsForm'] = '';
//.........这里部分代码省略.........
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:101,代码来源:SimplePieNewsreaderBox.class.php

示例14: readParameters

 /**
  * Reads the given parameters.
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['threadID'])) {
         $this->threadID = intval($_REQUEST['threadID']);
     } else {
         if (isset($_REQUEST['threadid'])) {
             $this->threadID = intval($_REQUEST['threadid']);
         }
     }
     // wbb2 style
     if (isset($_REQUEST['messageID'])) {
         $this->postID = intval($_REQUEST['messageID']);
     } else {
         if (isset($_REQUEST['postID'])) {
             $this->postID = intval($_REQUEST['postID']);
         } else {
             if (isset($_REQUEST['postid'])) {
                 $this->postID = intval($_REQUEST['postid']);
             }
         }
     }
     // wbb2 style
     if (isset($_REQUEST['action'])) {
         $this->action = $_REQUEST['action'];
     }
     if (isset($_REQUEST['highlight'])) {
         $this->highlight = $_REQUEST['highlight'];
     }
     // get thread
     $this->thread = new ViewableThread($this->threadID, null, $this->postID);
     $this->threadID = $this->thread->threadID;
     // get board
     $this->board = Board::getBoard($this->thread->boardID);
     if ($this->board->postSortOrder) {
         $this->sortOrder = $this->board->postSortOrder;
     }
     if ($this->board->enableRating != -1) {
         $this->enableRating = $this->board->enableRating;
     }
     // posts per page
     if ($this->board->postsPerPage) {
         $this->itemsPerPage = $this->board->postsPerPage;
     }
     if (WCF::getUser()->postsPerPage) {
         $this->itemsPerPage = WCF::getUser()->postsPerPage;
     }
     // enter thread
     $this->thread->enter($this->board);
     // init post list
     $this->postList = new ThreadPostList($this->thread, $this->board);
     $this->postList->sqlOrderBy = 'post.time ' . $this->sortOrder;
     // handle jump to
     if ($this->action == 'lastPost') {
         $this->goToLastPost();
     }
     if ($this->action == 'firstNew') {
         $this->goToFirstNewPost();
     }
     if ($this->postID) {
         $this->goToPost();
     }
     // handle subscriptions
     if (WCF::getUser()->userID) {
         $this->thread->updateSubscription();
         if ($this->thread->subscribed) {
             WCF::getSession()->unregister('lastSubscriptionsStatusUpdateTime');
         }
     }
     // handle parameters and special actions
     $this->handleRating();
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:75,代码来源:ThreadPage.class.php

示例15: execute

    /**
     * @see EventListener::execute()
     */
    public function execute($eventObj, $className, $eventName)
    {
        if ($eventName == 'readParameters') {
            // handle special search options here
            $action = '';
            if (isset($_REQUEST['action'])) {
                $action = $_REQUEST['action'];
            }
            if (empty($action)) {
                return;
            }
            // get accessible board ids
            require_once WBB_DIR . 'lib/data/board/Board.class.php';
            $boardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
            foreach ($boardIDArray as $key => $boardID) {
                if (WCF::getUser()->isIgnoredBoard($boardID)) {
                    unset($boardIDArray[$key]);
                } else {
                    if (!Board::getBoard($boardID)->searchable) {
                        unset($boardIDArray[$key]);
                    }
                }
            }
            if (!count($boardIDArray)) {
                return;
            }
            switch ($action) {
                case 'unread':
                    $sql = "SELECT\t\tthread.threadID\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_thread thread\n\t\t\t\t\t\tWHERE\t\tthread.boardID IN (" . implode(',', $boardIDArray) . ")\n\t\t\t\t\t\t\t\tAND thread.lastPostTime > " . WCF::getUser()->getLastMarkAllAsReadTime() . "\n\t\t\t\t\t\t\t\t" . (WCF::getUser()->userID ? "\n\t\t\t\t\t\t\t\tAND thread.lastPostTime > IFNULL((\n\t\t\t\t\t\t\t\t\tSELECT\tlastVisitTime\n\t\t\t\t\t\t\t\t\tFROM \twbb" . WBB_N . "_thread_visit\n\t\t\t\t\t\t\t\t\tWHERE \tthreadID = thread.threadID\n\t\t\t\t\t\t\t\t\t\tAND userID = " . WCF::getUser()->userID . "\n\t\t\t\t\t\t\t\t), 0)\n\t\t\t\t\t\t\t\tAND thread.lastPostTime > IFNULL((\n\t\t\t\t\t\t\t\t\tSELECT\tlastVisitTime\n\t\t\t\t\t\t\t\t\tFROM \twbb" . WBB_N . "_board_visit\n\t\t\t\t\t\t\t\t\tWHERE \tboardID = thread.boardID\n\t\t\t\t\t\t\t\t\t\tAND userID = " . WCF::getUser()->userID . "\n\t\t\t\t\t\t\t\t), 0)\n\t\t\t\t\t\t\t\t" : '') . "\n\t\t\t\t\t\t\t\tAND thread.isDeleted = 0\n\t\t\t\t\t\t\t\tAND thread.isDisabled = 0\n\t\t\t\t\t\t\t\t" . (count(WCF::getSession()->getVisibleLanguageIDArray()) ? " AND languageID IN (" . implode(',', WCF::getSession()->getVisibleLanguageIDArray()) . ")" : "") . "\n\t\t\t\t\t\t\t\tAND thread.movedThreadID = 0\n\t\t\t\t\t\tORDER BY\tthread.lastPostTime DESC";
                    break;
                case 'newPostsSince':
                    $since = TIME_NOW;
                    if (isset($_REQUEST['since'])) {
                        $since = intval($_REQUEST['since']);
                    }
                    $sql = "SELECT\t\tthread.threadID\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_thread thread\n\t\t\t\t\t\tWHERE\t\tthread.boardID IN (" . implode(',', $boardIDArray) . ")\n\t\t\t\t\t\t\t\tAND thread.lastPostTime > " . $since . "\n\t\t\t\t\t\t\t\tAND thread.isDeleted = 0\n\t\t\t\t\t\t\t\tAND thread.isDisabled = 0\n\t\t\t\t\t\t\t\t" . (count(WCF::getSession()->getVisibleLanguageIDArray()) ? " AND languageID IN (" . implode(',', WCF::getSession()->getVisibleLanguageIDArray()) . ")" : "") . "\n\t\t\t\t\t\t\t\tAND thread.movedThreadID = 0\n\t\t\t\t\t\tORDER BY\tthread.lastPostTime DESC";
                    break;
                case 'unreplied':
                    $sql = "SELECT\t\tthreadID\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_thread\n\t\t\t\t\t\tWHERE\t\tboardID IN (" . implode(',', $boardIDArray) . ")\n\t\t\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t\t\t\t\tAND movedThreadID = 0\n\t\t\t\t\t\t\t\t" . (count(WCF::getSession()->getVisibleLanguageIDArray()) ? " AND languageID IN (" . implode(',', WCF::getSession()->getVisibleLanguageIDArray()) . ")" : "") . "\n\t\t\t\t\t\t\t\tAND replies = 0\n\t\t\t\t\t\tORDER BY\tlastPostTime DESC";
                    break;
                case '24h':
                    $sql = "SELECT\t\tthreadID\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_thread\n\t\t\t\t\t\tWHERE\t\tboardID IN (" . implode(',', $boardIDArray) . ")\n\t\t\t\t\t\t\t\tAND lastPostTime > " . (TIME_NOW - 86400) . "\n\t\t\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t\t\t\t\t" . (count(WCF::getSession()->getVisibleLanguageIDArray()) ? " AND languageID IN (" . implode(',', WCF::getSession()->getVisibleLanguageIDArray()) . ")" : "") . "\n\t\t\t\t\t\t\t\tAND movedThreadID = 0\n\t\t\t\t\t\tORDER BY\tlastPostTime DESC";
                    break;
                default:
                    return;
            }
            // build search hash
            $searchHash = StringUtil::getHash($sql);
            // execute query
            $matches = array();
            $result = WCF::getDB()->sendQuery($sql, 1000);
            while ($row = WCF::getDB()->fetchArray($result)) {
                $matches[] = array('messageID' => $row['threadID'], 'messageType' => 'post');
            }
            // result is empty
            if (count($matches) == 0) {
                throw new NamedUserException(WCF::getLanguage()->get('wbb.search.error.noMatches'));
            }
            // save result in database
            $searchData = array('packageID' => PACKAGE_ID, 'query' => '', 'result' => $matches, 'additionalData' => array('post' => array('findThreads' => 1)), 'sortOrder' => 'DESC', 'sortField' => 'time', 'types' => array('post'));
            $searchData = serialize($searchData);
            $sql = "INSERT INTO\twcf" . WCF_N . "_search\n\t\t\t\t\t\t(userID, searchData, searchDate, searchType, searchHash)\n\t\t\t\tVALUES\t\t(" . WCF::getUser()->userID . ",\n\t\t\t\t\t\t'" . escapeString($searchData) . "',\n\t\t\t\t\t\t" . TIME_NOW . ",\n\t\t\t\t\t\t'messages',\n\t\t\t\t\t\t'" . $searchHash . "')";
            WCF::getDB()->sendQuery($sql);
            $searchID = WCF::getDB()->getInsertID();
            // forward to result page
            HeaderUtil::redirect('index.php?form=Search&searchID=' . $searchID . SID_ARG_2ND_NOT_ENCODED);
            exit;
        } else {
            if ($eventName == 'readFormParameters') {
                if (isset($_POST['findThreads'])) {
                    $this->findThreads = intval($_POST['findThreads']);
                }
                if (isset($_REQUEST['findUserThreads'])) {
                    $this->findUserThreads = intval($_REQUEST['findUserThreads']);
                }
                if ($this->findUserThreads == 1) {
                    $this->findThreads = 1;
                }
                // handle findThreads option
                if ($this->findThreads == 1 && (!count($eventObj->types) || in_array('post', $eventObj->types))) {
                    // remove all other searchable message types
                    // findThreads only supports post search
                    $eventObj->types = array('post');
                } else {
                    $this->findThreads = 0;
                }
            } else {
                if ($eventName == 'assignVariables') {
                    if ($eventObj instanceof SearchResultPage) {
                        $html = '<div class="floatedElement">
						<label for="findThreads">' . WCF::getLanguage()->get('wbb.search.results.display') . '</label>
						<select name="findThreads" id="findThreads">
							<option value="0">' . WCF::getLanguage()->get('wbb.search.results.display.post') . '</option>
							<option value="1"' . ($eventObj->additionalData['post']['findThreads'] == 1 ? ' selected="selected"' : '') . '>' . WCF::getLanguage()->get('wbb.search.results.display.thread') . '</option>
						</select>
					</div>';
                        WCF::getTPL()->append('additionalDisplayOptions', $html);
//.........这里部分代码省略.........
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:101,代码来源:ExtendedSearchFormListener.class.php


注:本文中的Board::getBoard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。