本文整理汇总了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'));
}
}
}
}
示例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'];
}
}
示例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();
}
}
}