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


PHP Thread::enter方法代码示例

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


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

示例1: execute

 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if ($eventObj->poll->messageType == 'post') {
         // check permissions
         require_once WBB_DIR . 'lib/data/post/Post.class.php';
         $post = new Post($eventObj->poll->messageID);
         if (!$post->postID) {
             throw new IllegalLinkException();
         }
         require_once WBB_DIR . 'lib/data/thread/Thread.class.php';
         $thread = new Thread($post->threadID);
         $thread->enter();
         require_once WBB_DIR . 'lib/data/board/Board.class.php';
         $board = new Board($thread->boardID);
         $eventObj->canVotePoll = $board->getPermission('canVotePoll');
         // plug in breadcrumbs
         WCF::getTPL()->assign(array('board' => $board, 'thread' => $thread, 'showThread' => true));
         WCF::getTPL()->append('specialBreadCrumbs', WCF::getTPL()->fetch('navigation'));
         // get other polls from this thread
         if ($thread->polls > 1) {
             require_once WCF_DIR . 'lib/data/message/poll/Poll.class.php';
             $polls = array();
             $sql = "SELECT \t\tpoll_vote.pollID AS voted,\n\t\t\t\t\t\t\tpoll_vote.isChangeable,\n\t\t\t\t\t\t\tpoll.*\n\t\t\t\t\tFROM \t\twcf" . WCF_N . "_poll poll\n\t\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_poll_vote poll_vote\n\t\t\t\t\tON \t\t(poll_vote.pollID = poll.pollID\n\t\t\t\t\t\t\t" . (!WCF::getUser()->userID ? "AND poll_vote.ipAddress = '" . escapeString(WCF::getSession()->ipAddress) . "'" : '') . "\n\t\t\t\t\t\t\tAND poll_vote.userID = " . WCF::getUser()->userID . ")\n\t\t\t\t\tWHERE \t\tpoll.pollID IN (\n\t\t\t\t\t\t\t\tSELECT\tpollID\n\t\t\t\t\t\t\t\tFROM\twbb" . WBB_N . "_post\n\t\t\t\t\t\t\t\tWHERE\tthreadID = " . $thread->threadID . "\n\t\t\t\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t\t\t\t\t\tAND pollID <> 0\n\t\t\t\t\t\t\t)\n\t\t\t\t\tORDER BY\tpoll.question";
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 $polls[] = new Poll(null, $row, $eventObj->canVotePoll);
             }
             if (count($polls) > 1) {
                 WCF::getTPL()->assign(array('polls' => $polls, 'pollID' => $eventObj->pollID));
                 WCF::getTPL()->append('additionalSidebarContent', WCF::getTPL()->fetch('pollOverviewSidebar'));
             }
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:37,代码来源:PollOverviewPagePostsListener.class.php

示例2: execute

 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (isset($_REQUEST['threadID']) && intval($_REQUEST['threadID']) != 0) {
         $threadID = intval($_REQUEST['threadID']);
         require_once WBB_DIR . 'lib/data/thread/Thread.class.php';
         $thread = new Thread($threadID);
         if (!$thread->threadID) {
             throw new IllegalLinkException();
         }
         $thread->enter();
         $sql = "SELECT\tpollID\n\t\t\t\tFROM\twbb" . WBB_N . "_post\n\t\t\t\tWHERE\tthreadID = " . $threadID . "\n\t\t\t\t\tAND\tisDeleted = 0\n\t\t\t\t\tAND\tisDisabled = 0\n\t\t\t\t\tAND\tpollID > 0\n\t\t\t\tORDER BY postID ASC";
         $row = WCF::getDB()->getFirstRow($sql);
         $eventObj->pollID = $row['pollID'];
     }
 }
开发者ID:RouL,项目名称:WBB_Pollfinder,代码行数:18,代码来源:PollOverviewPageThreadListener.class.php

示例3: 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


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