Ejemplo n.º 1
0
 /**
  * get attachment objs
  *
  * @param  Mixed  $var
  * @param  Array  $mbqOpt
  * $mbqOpt['case'] = 'byForumPostIds' means get data by forum post ids.$var is the ids.
  * @return  Mixed
  */
 public function getObjsMbqEtAtt($var, $mbqOpt)
 {
     if ($mbqOpt['case'] == 'byForumPostIds') {
         $objsMbqEtAtt = array();
         //ref wbb\page\ThreadPage::readData(),wbb\data\post\ViewablePostList::readObjects(),wcf\data\attachment\GroupedAttachmentList::setPermissions()
         $oViewablePostList = new ViewablePostList();
         $oViewablePostList->setObjectIDs($var);
         $oViewablePostList->readObjects();
         if ($oViewablePostList->getAttachmentList() && ($objsAttachment = $oViewablePostList->getAttachmentList()->getObjects())) {
             foreach ($objsAttachment as $oAttachment) {
                 $objsMbqEtAtt[] = $this->initOMbqEtAtt($oAttachment, array('case' => 'oAttachment'));
             }
         }
         return $objsMbqEtAtt;
     }
     MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_UNKNOWN_CASE);
 }
Ejemplo n.º 2
0
 /**
  * get forum post objs
  *
  * @param  Mixed  $var
  * @param  Array  $mbqOpt
  * $mbqOpt['case'] = 'byTopic' means get data by forum topic obj.$var is the forum topic obj.
  * $mbqOpt['case'] = 'byPostIds' means get data by post ids.$var is the ids.
  * $mbqOpt['case'] = 'byObjsViewablePost' means get data by objsViewablePost.$var is the objsViewablePost.
  * $mbqOpt['case'] = 'byReplyUser' means get data by reply user.$var is the MbqEtUser obj.
  * $mbqOpt['notGetAttachment'] = true means do not get attachment of forum post.
  * @return  Mixed
  */
 public function getObjsMbqEtForumPost($var = null, $mbqOpt = array())
 {
     if ($mbqOpt['case'] == 'byTopic') {
         $oMbqEtForumTopic = $var;
         if ($mbqOpt['oMbqDataPage']) {
             $oMbqDataPage = $mbqOpt['oMbqDataPage'];
             //ref wbb\page\ThreadPage::initObjectList()
             $oThreadPostList = new ThreadPostList($var->mbqBind['oViewableThread']->getDecoratedObject());
             $oThreadPostList->sqlOffset = $oMbqDataPage->startNum;
             $oThreadPostList->sqlLimit = $oMbqDataPage->numPerPage;
             $oThreadPostList->readObjects();
             $oMbqDataPage->totalNum = $oThreadPostList->countObjects();
             /* common begin */
             $mbqOpt['case'] = 'byObjsViewablePost';
             $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
             return $this->getObjsMbqEtForumPost($oThreadPostList->getObjects(), $mbqOpt);
             /* common end */
         }
     } elseif ($mbqOpt['case'] == 'byPostIds') {
         $objsViewablePost = array();
         $oViewablePostList = new ViewablePostList();
         $oViewablePostList->setObjectIDs($var);
         $oViewablePostList->readObjects();
         /* common begin */
         $mbqOpt['case'] = 'byObjsViewablePost';
         return $this->getObjsMbqEtForumPost($oViewablePostList->getObjects(), $mbqOpt);
         /* common end */
     } elseif ($mbqOpt['case'] == 'byReplyUser') {
         if ($mbqOpt['oMbqDataPage']) {
             $oMbqDataPage = $mbqOpt['oMbqDataPage'];
             $oViewablePostList = new ViewablePostList();
             $oViewablePostList->sqlJoins .= 'INNER JOIN wbb' . WCF_N . '_thread thread ON (post.threadID = thread.threadID AND thread.isAnnouncement = 0 AND post.postID != thread.firstPostID)';
             //!!!
             $oViewablePostList->getConditionBuilder()->add('post.userID = ?', array($var->userId->oriValue));
             $oViewablePostList->readObjects();
             $oMbqDataPage->totalNum = $oViewablePostList->countObjects();
             /* common begin */
             $mbqOpt['case'] = 'byObjsViewablePost';
             $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
             return $this->getObjsMbqEtForumPost($oViewablePostList->getObjects(), $mbqOpt);
             /* common end */
         }
     } elseif ($mbqOpt['case'] == 'byObjsViewablePost') {
         $objsViewablePost = $var;
         /* common begin */
         $objsMbqEtForumPost = array();
         $authorUserIds = array();
         $topicIds = array();
         foreach ($objsViewablePost as $oViewablePost) {
             $objsMbqEtForumPost[] = $this->initOMbqEtForumPost($oViewablePost, array('case' => 'oViewablePost'));
         }
         foreach ($objsMbqEtForumPost as $oMbqEtForumPost) {
             $authorUserIds[$oMbqEtForumPost->postAuthorId->oriValue] = $oMbqEtForumPost->postAuthorId->oriValue;
             //$topicIds[$oMbqEtForumPost->topicId->oriValue] = $oMbqEtForumPost->topicId->oriValue;
             //must use empty array key,otherwise can cause wbb systemException error when doing the following call:$oMbqRdEtForumTopic->getObjsMbqEtForumTopic($topicIds, array('case' => 'byTopicIds'));
             $topicIds[] = $oMbqEtForumPost->topicId->oriValue;
         }
         /* load oMbqEtForumTopic property and oMbqEtForum property */
         $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
         $objsMbqEtFroumTopic = $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($topicIds, array('case' => 'byTopicIds'));
         foreach ($objsMbqEtFroumTopic as $oNewMbqEtFroumTopic) {
             foreach ($objsMbqEtForumPost as &$oMbqEtForumPost) {
                 if ($oNewMbqEtFroumTopic->topicId->oriValue == $oMbqEtForumPost->topicId->oriValue) {
                     $oMbqEtForumPost->oMbqEtForumTopic = $oNewMbqEtFroumTopic;
                     if ($oMbqEtForumPost->oMbqEtForumTopic->oMbqEtForum) {
                         $oMbqEtForumPost->oMbqEtForum = $oMbqEtForumPost->oMbqEtForumTopic->oMbqEtForum;
                     }
                 }
             }
         }
         /* load post author */
         $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser');
         $objsAuthorMbqEtUser = $oMbqRdEtUser->getObjsMbqEtUser($authorUserIds, array('case' => 'byUserIds'));
         $postIds = array();
         foreach ($objsMbqEtForumPost as &$oMbqEtForumPost) {
             $postIds[] = $oMbqEtForumPost->postId->oriValue;
             foreach ($objsAuthorMbqEtUser as $oAuthorMbqEtUser) {
                 if ($oMbqEtForumPost->postAuthorId->oriValue == $oAuthorMbqEtUser->userId->oriValue) {
                     $oMbqEtForumPost->oAuthorMbqEtUser = $oAuthorMbqEtUser;
                     if ($oMbqEtForumPost->oAuthorMbqEtUser->isOnline->hasSetOriValue()) {
                         $oMbqEtForumPost->isOnline->setOriValue($oMbqEtForumPost->oAuthorMbqEtUser->isOnline->oriValue ? MbqBaseFdt::getFdt('MbqFdtForum.MbqEtForumPost.isOnline.range.yes') : MbqBaseFdt::getFdt('MbqFdtForum.MbqEtForumPost.isOnline.range.no'));
                     }
                     if ($oMbqEtForumPost->oAuthorMbqEtUser->iconUrl->hasSetOriValue()) {
                         $oMbqEtForumPost->authorIconUrl->setOriValue($oMbqEtForumPost->oAuthorMbqEtUser->iconUrl->oriValue);
                     }
                     break;
                 }
             }
         }
         /* load attachment */
         $oMbqRdEtAtt = MbqMain::$oClk->newObj('MbqRdEtAtt');
         if (!isset($mbqOpt['notGetAttachment'])) {
             $objsMbqEtAtt = $oMbqRdEtAtt->getObjsMbqEtAtt($postIds, array('case' => 'byForumPostIds'));
             foreach ($objsMbqEtAtt as $oMbqEtAtt) {
                 foreach ($objsMbqEtForumPost as &$oMbqEtForumPost) {
                     if ($oMbqEtForumPost->postId->oriValue == $oMbqEtAtt->postId->oriValue) {
                         $oMbqEtForumPost->objsMbqEtAtt[] = $oMbqEtAtt;
                     }
                 }
             }
         }
         /* load objsNotInContentMbqEtAtt */
         if (!isset($mbqOpt['notGetAttachment'])) {
             foreach ($objsMbqEtForumPost as &$oMbqEtForumPost) {
                 $filedataids = MbqMain::$oMbqCm->getAttIdsFromContent($oMbqEtForumPost->postContent->oriValue);
                 foreach ($oMbqEtForumPost->objsMbqEtAtt as $oMbqEtAtt) {
                     if (!in_array($oMbqEtAtt->attId->oriValue, $filedataids)) {
                         $oMbqEtForumPost->objsNotInContentMbqEtAtt[] = $oMbqEtAtt;
                     }
                 }
             }
         }
         /* load objsMbqEtThank property and make related properties/flags */
         //
         /* make other properties */
         $oMbqAclEtForumPost = MbqMain::$oClk->newObj('MbqAclEtForumPost');
         foreach ($objsMbqEtForumPost as &$oMbqEtForumPost) {
             if ($oMbqAclEtForumPost->canAclSaveRawPost($oMbqEtForumPost)) {
                 $oMbqEtForumPost->canEdit->setOriValue(MbqBaseFdt::getFdt('MbqFdtForum.MbqEtForumPost.canEdit.range.yes'));
             } else {
                 $oMbqEtForumPost->canEdit->setOriValue(MbqBaseFdt::getFdt('MbqFdtForum.MbqEtForumPost.canEdit.range.no'));
             }
         }
         /* common end */
         if (isset($mbqOpt['oMbqDataPage'])) {
             $oMbqDataPage = $mbqOpt['oMbqDataPage'];
             $oMbqDataPage->datas = $objsMbqEtForumPost;
             return $oMbqDataPage;
         } else {
             return $objsMbqEtForumPost;
         }
     }
     MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_UNKNOWN_CASE);
 }
Ejemplo n.º 3
0
 /**
  * forum advanced search
  *
  * @param  Array  $filter  search filter
  * @param  Object  $oMbqDataPage
  * @param  Array  $mbqOpt
  * $mbqOpt['case'] = 'advanced' means advanced search
  * @return  Object  $oMbqDataPage
  */
 public function forumAdvancedSearch($filter = array(), $oMbqDataPage = null, $mbqOpt = array())
 {
     if ($mbqOpt['case'] == 'getLatestTopic' || $mbqOpt['case'] == 'getUnreadTopic' || $mbqOpt['case'] == 'getParticipatedTopic') {
         $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
         if ($mbqOpt['case'] == 'getParticipatedTopic') {
             $oViewableThreadList = new ViewableThreadList();
             $oViewableThreadList->sqlOffset = $oMbqDataPage->startNum;
             $oViewableThreadList->sqlLimit = $oMbqDataPage->numPerPage;
             $oViewableThreadList->getConditionBuilder()->add('thread.isAnnouncement = 0');
             //!!!
             $oViewableThreadList->getConditionBuilder()->add('thread.threadID IN (SELECT threadID from wbb' . WCF_N . '_post where userID = ?)', array(MbqMain::$oCurMbqEtUser->userId->oriValue));
             //!!!
             $oViewableThreadList->readObjects();
             $oMbqDataPage->totalNum = $oViewableThreadList->countObjects();
             $oUnreadThreadList = new ViewableThreadList();
             $oUnreadThreadList->sqlConditionJoins = "    LEFT JOIN   wcf" . WCF_N . "_tracked_visit tracked_thread_visit\r\n                            ON      (tracked_thread_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wbb.thread') . " AND tracked_thread_visit.objectID = thread.threadID AND tracked_thread_visit.userID = " . WCF::getUser()->userID . ")\r\n                            LEFT JOIN   wcf" . WCF_N . "_tracked_visit tracked_board_visit\r\n                            ON      (tracked_board_visit.objectTypeID = " . VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wbb.board') . " AND tracked_board_visit.objectID = thread.boardID AND tracked_board_visit.userID = " . WCF::getUser()->userID . ")";
             $oUnreadThreadList->sqlOffset = $oMbqDataPage->startNum;
             $oUnreadThreadList->sqlLimit = $oMbqDataPage->numPerPage;
             $oUnreadThreadList->getConditionBuilder()->add('thread.isAnnouncement = 0');
             //!!!
             $oUnreadThreadList->getConditionBuilder()->add('thread.threadID IN (SELECT threadID from wbb' . WCF_N . '_post where userID = ?)', array(MbqMain::$oCurMbqEtUser->userId->oriValue));
             //!!!
             $oUnreadThreadList->getConditionBuilder()->add('thread.lastPostTime > ?', array(VisitTracker::getInstance()->getVisitTime('com.woltlab.wbb.thread')));
             $oUnreadThreadList->getConditionBuilder()->add("(thread.lastPostTime > tracked_thread_visit.visitTime OR tracked_thread_visit.visitTime IS NULL)");
             $oUnreadThreadList->getConditionBuilder()->add("(thread.lastPostTime > tracked_board_visit.visitTime OR tracked_board_visit.visitTime IS NULL)");
             $oUnreadThreadList->readObjects();
             $oMbqDataPage->totalUnreadNum = $oUnreadThreadList->countObjects();
             /* common begin */
             $mbqOpt['case'] = 'byObjsViewableThread';
             $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
             return $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($oViewableThreadList->getObjects(), $mbqOpt);
         } elseif ($mbqOpt['case'] == 'getLatestTopic') {
             $oViewableThreadList = new ViewableThreadList();
             $oViewableThreadList->sqlOffset = $oMbqDataPage->startNum;
             $oViewableThreadList->sqlLimit = $oMbqDataPage->numPerPage;
             $oViewableThreadList->getConditionBuilder()->add('thread.isAnnouncement = 0');
             //!!!
             $oViewableThreadList->getConditionBuilder()->add('thread.boardID IN (?)', array(MbqMain::$oMbqAppEnv->accessibleBoardIds));
             $oViewableThreadList->readObjects();
             $oMbqDataPage->totalNum = $oViewableThreadList->countObjects();
             /* common begin */
             $mbqOpt['case'] = 'byObjsViewableThread';
             $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
             return $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($oViewableThreadList->getObjects(), $mbqOpt);
             /* common end */
         } elseif ($mbqOpt['case'] == 'getUnreadTopic') {
             require_once MBQ_APPEXTENTION_PATH . 'ExttMbqBoardQuickSearchAction.php';
             $oExttMbqBoardQuickSearchAction = new ExttMbqBoardQuickSearchAction();
             $oExttMbqBoardQuickSearchAction->exttMbqStartNum = $oMbqDataPage->startNum;
             $oExttMbqBoardQuickSearchAction->exttMbqNumPerPage = $oMbqDataPage->numPerPage;
             $ret = $oExttMbqBoardQuickSearchAction->execute();
             $oMbqDataPage->totalNum = $ret['total'];
             $newMbqOpt['case'] = 'byTopicIds';
             $newMbqOpt['oMbqDataPage'] = $oMbqDataPage;
             $oMbqDataPage = $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($ret['topicIds'], $newMbqOpt);
             return $oMbqDataPage;
         }
     } elseif ($mbqOpt['case'] == 'searchTopic') {
         $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
         $oViewableThreadList = new ViewableThreadList();
         $oViewableThreadList->sqlOffset = $oMbqDataPage->startNum;
         $oViewableThreadList->sqlLimit = $oMbqDataPage->numPerPage;
         $oViewableThreadList->getConditionBuilder()->add('thread.isAnnouncement = 0');
         //!!!
         $oViewableThreadList->getConditionBuilder()->add('thread.boardID IN (?)', array(MbqMain::$oMbqAppEnv->accessibleBoardIds));
         $oViewableThreadList->getConditionBuilder()->add('thread.threadID IN (SELECT threadID from wbb' . WCF_N . '_post as mbqPost where mbqPost.subject LIKE ? OR mbqPost.message LIKE ?)', array('%' . addcslashes($filter['keywords'], '_%') . '%', '%' . addcslashes($filter['keywords'], '_%') . '%'));
         //!!!
         $oViewableThreadList->readObjects();
         $oMbqDataPage->totalNum = $oViewableThreadList->countObjects();
         /* common begin */
         $mbqOpt['case'] = 'byObjsViewableThread';
         $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
         return $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($oViewableThreadList->getObjects(), $mbqOpt);
         /* common end */
     } elseif ($mbqOpt['case'] == 'searchPost') {
         $oMbqRdEtForumPost = MbqMain::$oClk->newObj('MbqRdEtForumPost');
         $oViewablePostList = new ViewablePostList();
         $oViewablePostList->sqlConditionJoins .= 'INNER JOIN wbb' . WCF_N . '_thread thread ON (post.threadID = thread.threadID AND thread.isAnnouncement = 0)';
         //!!!
         $oViewablePostList->getConditionBuilder()->add('thread.boardID IN (?)', array(MbqMain::$oMbqAppEnv->accessibleBoardIds));
         $oViewablePostList->getConditionBuilder()->add('(post.subject LIKE ? OR post.message LIKE ?)', array('%' . addcslashes($filter['keywords'], '_%') . '%', '%' . addcslashes($filter['keywords'], '_%') . '%'));
         //!!!
         $oViewablePostList->readObjects();
         $oMbqDataPage->totalNum = $oViewablePostList->countObjects();
         /* common begin */
         $mbqOpt['case'] = 'byObjsViewablePost';
         $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
         return $oMbqRdEtForumPost->getObjsMbqEtForumPost($oViewablePostList->getObjects(), $mbqOpt);
         /* common end */
     } elseif ($mbqOpt['case'] == 'advanced') {
         MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_NOT_ACHIEVE);
     }
     MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_UNKNOWN_CASE);
 }
Ejemplo n.º 4
0
 /**
  * forum advanced search
  *
  * @param  Array  $filter  search filter
  * @param  Object  $oMbqDataPage
  * @param  Array  $mbqOpt
  * $mbqOpt['case'] = 'advanced' means advanced search
  * @return  Object  $oMbqDataPage
  */
 public function forumAdvancedSearch($filter, $oMbqDataPage, $mbqOpt)
 {
     if ($mbqOpt['case'] == 'getLatestTopic' || $mbqOpt['case'] == 'getUnreadTopic' || $mbqOpt['case'] == 'getParticipatedTopic') {
         $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
         if ($mbqOpt['case'] == 'getParticipatedTopic') {
             $oViewableThreadList = new ViewableThreadList();
             $oViewableThreadList->sqlOffset = $oMbqDataPage->startNum;
             $oViewableThreadList->sqlLimit = $oMbqDataPage->numPerPage;
             $oViewableThreadList->getConditionBuilder()->add('thread.isAnnouncement = 0');
             //!!!
             $oViewableThreadList->getConditionBuilder()->add('thread.threadID IN (SELECT threadID from wbb' . WCF_N . '_post where userID = ?)', array(MbqMain::$oCurMbqEtUser->userId->oriValue));
             //!!!
             $oViewableThreadList->readObjects();
             $oMbqDataPage->totalNum = $oViewableThreadList->countObjects();
             /* common begin */
             $mbqOpt['case'] = 'byObjsViewableThread';
             $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
             return $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($oViewableThreadList->getObjects(), $mbqOpt);
         } elseif ($mbqOpt['case'] == 'getLatestTopic') {
             $oViewableThreadList = new ViewableThreadList();
             $oViewableThreadList->sqlOffset = $oMbqDataPage->startNum;
             $oViewableThreadList->sqlLimit = $oMbqDataPage->numPerPage;
             $oViewableThreadList->getConditionBuilder()->add('thread.isAnnouncement = 0');
             //!!!
             $oViewableThreadList->readObjects();
             $oMbqDataPage->totalNum = $oViewableThreadList->countObjects();
             /* common begin */
             $mbqOpt['case'] = 'byObjsViewableThread';
             $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
             return $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($oViewableThreadList->getObjects(), $mbqOpt);
             /* common end */
         } elseif ($mbqOpt['case'] == 'getUnreadTopic') {
             require_once MBQ_APPEXTENTION_PATH . 'ExttMbqBoardQuickSearchAction.php';
             $oExttMbqBoardQuickSearchAction = new ExttMbqBoardQuickSearchAction();
             $oExttMbqBoardQuickSearchAction->exttMbqStartNum = $oMbqDataPage->startNum;
             $oExttMbqBoardQuickSearchAction->exttMbqNumPerPage = $oMbqDataPage->numPerPage;
             $ret = $oExttMbqBoardQuickSearchAction->execute();
             $oMbqDataPage->totalNum = $ret['total'];
             $newMbqOpt['case'] = 'byTopicIds';
             $newMbqOpt['oMbqDataPage'] = $oMbqDataPage;
             $oMbqDataPage = $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($ret['topicIds'], $newMbqOpt);
             return $oMbqDataPage;
         }
     } elseif ($mbqOpt['case'] == 'searchTopic') {
         $oMbqRdEtForumTopic = MbqMain::$oClk->newObj('MbqRdEtForumTopic');
         $oViewableThreadList = new ViewableThreadList();
         $oViewableThreadList->sqlOffset = $oMbqDataPage->startNum;
         $oViewableThreadList->sqlLimit = $oMbqDataPage->numPerPage;
         $oViewableThreadList->getConditionBuilder()->add('thread.isAnnouncement = 0');
         //!!!
         $oViewableThreadList->getConditionBuilder()->add('thread.threadID IN (SELECT threadID from wbb' . WCF_N . '_post as mbqPost where mbqPost.subject LIKE ? OR mbqPost.message LIKE ?)', array('%' . addcslashes($filter['keywords'], '_%') . '%', '%' . addcslashes($filter['keywords'], '_%') . '%'));
         //!!!
         $oViewableThreadList->readObjects();
         $oMbqDataPage->totalNum = $oViewableThreadList->countObjects();
         /* common begin */
         $mbqOpt['case'] = 'byObjsViewableThread';
         $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
         return $oMbqRdEtForumTopic->getObjsMbqEtForumTopic($oViewableThreadList->getObjects(), $mbqOpt);
         /* common end */
     } elseif ($mbqOpt['case'] == 'searchPost') {
         $oMbqRdEtForumPost = MbqMain::$oClk->newObj('MbqRdEtForumPost');
         $oViewablePostList = new ViewablePostList();
         $oViewablePostList->sqlJoins .= 'INNER JOIN wbb' . WCF_N . '_thread thread ON (post.threadID = thread.threadID AND thread.isAnnouncement = 0)';
         //!!!
         $oViewablePostList->getConditionBuilder()->add('(post.subject LIKE ? OR post.message LIKE ?)', array('%' . addcslashes($filter['keywords'], '_%') . '%', '%' . addcslashes($filter['keywords'], '_%') . '%'));
         //!!!
         $oViewablePostList->readObjects();
         $oMbqDataPage->totalNum = $oViewablePostList->countObjects();
         /* common begin */
         $mbqOpt['case'] = 'byObjsViewablePost';
         $mbqOpt['oMbqDataPage'] = $oMbqDataPage;
         return $oMbqRdEtForumPost->getObjsMbqEtForumPost($oViewablePostList->getObjects(), $mbqOpt);
         /* common end */
     } elseif ($mbqOpt['case'] == 'advanced') {
         MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_NOT_ACHIEVE);
     }
     MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_UNKNOWN_CASE);
 }
Ejemplo n.º 5
0
 /**
  * get post by post id
  *
  * @param  Integer  $postId
  * @return Mixed
  */
 protected function getPostByPostId($postId)
 {
     $oViewablePostList = new ViewablePostList();
     $oViewablePostList->setObjectIDs(array($postId));
     $oViewablePostList->readObjects();
     $objsViewablePost = $oViewablePostList->getObjects();
     if ($objsViewablePost && ($oViewablePost = array_shift($objsViewablePost)) && ($oPost = $oViewablePost->getDecoratedObject()) && $oPost->postID) {
         return $oPost;
     } else {
         return false;
     }
 }