本文整理汇总了PHP中WCF::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP WCF::getSession方法的具体用法?PHP WCF::getSession怎么用?PHP WCF::getSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WCF
的用法示例。
在下文中一共展示了WCF::getSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if (isset($eventObj->additionalFields['styleID']) && WCF::getSession()->getStyleID() != 0) {
// reset session style
WCF::getSession()->setStyleID(0);
}
}
示例2: isActiveUserSession
/**
* Returns true, if this session is the active user session.
*
* @return boolean
*/
public function isActiveUserSession()
{
if ($this->isActive() && $this->sessionID == WCF::getSession()->sessionID) {
return 1;
}
return 0;
}
示例3: execute
/**
* @see Action::execute()
*/
public function execute()
{
parent::execute();
$this->board->markAsRead();
WCF::getSession()->unregister('lastSubscriptionsStatusUpdateTime');
$this->executed();
}
示例4: createVirtualIDSpace
/**
* @see AbstractLostAndFoundFileSystemItem::createVirtualIDSpace()
*/
public static function createVirtualIDSpace()
{
$attachments = array();
chdir(WCF_DIR . 'attachments');
$dh = opendir(WCF_DIR . 'attachments');
$attachmentIDs = array();
while ($file = readdir($dh)) {
if (preg_match("/^(attachment|thumbnail).*/", $file) && $file != '.' && $file != '..' && $file != '.htaccess' && !preg_match("/^.*\\.php\$/", $file)) {
$attachmentID = (int) preg_replace("/.*\\-(\\d+)\$/", "\$1", $file);
if ($attachmentID > 0) {
$attachmentIDs[] = $attachmentID;
}
}
}
if (count($attachmentIDs)) {
$sql = "SELECT attachmentID FROM wcf" . WCF_N . "_attachment WHERE attachmentID IN (" . implode(',', $attachmentIDs) . ")";
$result = WCF::getDB()->sendQuery($sql);
$physicalAttachments = array_flip($attachmentIDs);
while ($row = WCF::getDB()->fetchArray($result)) {
unset($physicalAttachments[$row['attachmentID']]);
}
$physicalAttachments = array_keys($physicalAttachments);
foreach ($physicalAttachments as $attachmentID) {
$file = WCF_DIR . 'attachments/attachment-' . $attachmentID;
$attachments[] = $file;
}
}
closedir($dh);
self::$virtualFileIDs['attachmentsFilesystem'] = $attachments;
WCF::getSession()->register('virtualLostAndFoundIDs', self::$virtualFileIDs);
}
示例5: 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'));
}
}
}
}
示例6: renderBoards
/**
* Renders the list of boards.
*/
public function renderBoards()
{
// get unread threads
$this->readUnreadThreads();
// get boards
$this->readBoards();
// assign data
WCF::getTPL()->assign('boards', $this->boards);
WCF::getTPL()->assign('unreadThreadsCount', $this->unreadThreadsCount);
// show newest posts
if (BOARD_LIST_ENABLE_LAST_POST) {
$lastPosts = WCF::getCache()->get('boardData', 'lastPosts');
if (is_array($lastPosts)) {
$visibleLanguages = false;
if (count(WCF::getSession()->getVisibleLanguageIDArray())) {
$visibleLanguages = WCF::getSession()->getVisibleLanguageIDArray();
}
foreach ($lastPosts as $boardID => $languages) {
foreach ($languages as $languageID => $row) {
if (!$languageID || !$visibleLanguages || in_array($languageID, $visibleLanguages)) {
$this->lastPosts[$row['boardID']] = new DatabaseObject($row);
continue 2;
}
}
}
}
WCF::getTPL()->assign('lastPosts', $this->lastPosts);
}
// stats
if (BOARD_LIST_ENABLE_STATS) {
WCF::getTPL()->assign('boardStats', WCF::getCache()->get('boardData', 'counts'));
}
}
示例7: __construct
/**
* Creates a new ModerationMarkedThreadsPage object.
*/
public function __construct()
{
if ($markedThreads = WCF::getSession()->getVar('markedThreads')) {
$this->sqlConditions = 'thread.threadID IN (' . implode(',', $markedThreads) . ') AND movedThreadID = 0';
}
parent::__construct();
}
示例8: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if ($eventObj->board->getPermission('canPostAnonymously')) {
if ($eventName === 'readFormParameters') {
if (isset($_POST['postAnonymously'])) {
self::$postAnonymously = intval($_POST['postAnonymously']);
}
} else {
if ($eventName === 'assignVariables') {
WCF::getTPL()->assign('postAnonymously', self::$postAnonymously);
} else {
if ($eventName === 'show') {
WCF::getTPL()->append('additionalSettings', WCF::getTPL()->fetch('messageFormSettingsPostAnonymously'));
} else {
if ($eventName === 'save') {
if (self::$postAnonymously) {
self::$userID = WCF::getUser()->userID;
self::$ipAddress = WCF::getSession()->ipAddress;
$eventObj->username = WCF::getLanguage()->get('wbb.threadAdd.anonymousUsername');
WCF::getUser()->userID = 0;
WCF::getSession()->ipAddress = '';
}
} else {
if ($eventName === 'saved') {
if (self::$postAnonymously) {
WCF::getUser()->userID = self::$userID;
WCF::getSession()->ipAddress = self::$ipAddress;
}
}
}
}
}
}
}
}
开发者ID:0xLeon,项目名称:com.leon.wbb.postAnonymously,代码行数:38,代码来源:ThreadAddFormPostAnonymouslyListener.class.php
示例9: __construct
/**
* Creates a new ModerationMarkedPostsPage object.
*/
public function __construct()
{
if ($markedPosts = WCF::getSession()->getVar('markedPosts')) {
$this->sqlConditions = 'post.postID IN (' . implode(',', $markedPosts) . ')';
}
parent::__construct();
}
示例10: execute
/**
* @see Action::execute()
*/
public function execute()
{
parent::execute();
WCF::getUser()->checkPermission('admin.user.canDeleteUser');
require_once WCF_DIR . 'lib/data/user/UserEditor.class.php';
require_once WCF_DIR . 'lib/data/user/group/Group.class.php';
if ($this->userID !== 0) {
$this->userIDs[] = $this->userID;
}
// active user can't delete himself
$activeUserID = WCF::getSession()->getUser()->userID;
$this->userIDs = array_diff($this->userIDs, array($activeUserID));
// check permission
if (count($this->userIDs) > 0) {
$sql = "SELECT\tDISTINCT groupID\n\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\tWHERE\tuserID IN (" . implode(',', $this->userIDs) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
if (!Group::isAccessibleGroup($row['groupID'])) {
throw new PermissionDeniedException();
}
}
}
$deletedUsers = UserEditor::deleteUsers($this->userIDs);
$this->executed();
if (!empty($this->url) && (strpos($this->url, 'searchID=0') !== false || strpos($this->url, 'searchID=') === false)) {
HeaderUtil::redirect($this->url);
} else {
HeaderUtil::redirect('index.php?form=UserSearch&deletedUsers=' . $deletedUsers . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
}
exit;
}
示例11: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if ($eventName == 'init') {
$eventObj->sqlSelects .= 'wbb_user.posts,';
$eventObj->sqlJoins .= ' LEFT JOIN wbb' . WBB_N . '_user wbb_user
ON (wbb_user.userID = user.userID) ';
} else {
if ($eventName == 'assignVariables') {
$user = $eventObj->frame->getUser();
$eventObj->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('postM.png'), 'title' => WCF::getLanguage()->get('wcf.user.posts'), 'value' => '<a href="index.php?form=Search&types[]=post&userID=' . $user->userID . SID_ARG_2ND . '" title="' . WCF::getLanguage()->get('wcf.user.profile.search', array('$username' => StringUtil::encodeHTML($user->username))) . '">' . StringUtil::formatInteger(intval($user->posts)) . ($user->getProfileAge() > 1 ? ' ' . WCF::getLanguage()->get('wcf.user.postsPerDay', array('$posts' => StringUtil::formatDouble($user->posts / $user->getProfileAge()))) : '') . '</a>');
// show last 5 posts
if (PROFILE_SHOW_LAST_POSTS) {
require_once WBB_DIR . 'lib/data/post/ViewablePost.class.php';
require_once WBB_DIR . 'lib/data/board/Board.class.php';
$boardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
if (count($boardIDArray)) {
$posts = array();
$sql = "SELECT\t\tpost.postID, post.time,\n\t\t\t\t\t\t\t\tCASE WHEN post.subject <> '' THEN post.subject ELSE thread.topic END AS subject\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_user_last_post user_last_post\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\t\t\tON\t\t(post.postID = user_last_post.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\tuser_last_post.userID = " . $user->userID . "\n\t\t\t\t\t\t\t\tAND post.isDeleted = 0\n\t\t\t\t\t\t\t\tAND post.isDisabled = 0\n\t\t\t\t\t\t\t\tAND thread.boardID IN (" . implode(',', $boardIDArray) . ")\n\t\t\t\t\t\t\t\t" . (count(WCF::getSession()->getVisibleLanguageIDArray()) ? "AND thread.languageID IN (" . implode(',', WCF::getSession()->getVisibleLanguageIDArray()) . ")" : "") . "\n\t\t\t\t\t\tORDER BY\tuser_last_post.time DESC";
$result = WCF::getDB()->sendQuery($sql, 5);
while ($row = WCF::getDB()->fetchArray($result)) {
$posts[] = new ViewablePost(null, $row);
}
if (count($posts)) {
WCF::getTPL()->assign(array('posts' => $posts, 'user' => $user));
WCF::getTPL()->append('additionalContent2', WCF::getTPL()->fetch('userProfileLastPosts'));
}
}
}
}
}
}
示例12: getMarkedPosts
/**
* Gets marked posts from session.
*/
public function getMarkedPosts()
{
$sessionVars = WCF::getSession()->getVars();
if (isset($sessionVars['markedPosts'])) {
$this->postIDs = implode(',', $sessionVars['markedPosts']);
}
}
示例13: createVirtualIDSpace
/**
* @see AbstractLostAndFoundFileSystemItem::createVirtualIDSpace()
*/
public static function createVirtualIDSpace()
{
$theAvatars = array();
chdir(WCF_DIR . 'images/avatars');
$dh = opendir(WCF_DIR . 'images/avatars');
$avatarIDs = array();
$avatars = array();
while ($file = readdir($dh)) {
if (preg_match("/^(avatar).*/", $file) && $file != '.' && $file != '..' && $file != '.htaccess' && !preg_match("/^.*\\.php\$/", $file)) {
$avatarID = (int) preg_replace("/.*\\-(\\d+).*/", "\$1", $file);
$avatars[$avatarID] = preg_replace("/.*\\-(\\d+)(.*)/", "\$2", $file);
if ($avatarID > 0) {
$avatarIDs[] = $avatarID;
}
}
}
if (count($avatarIDs)) {
$sql = "SELECT avatarID, avatarExtension FROM wcf" . WCF_N . "_avatar WHERE avatarID IN (" . implode(',', $avatarIDs) . ")";
$result = WCF::getDB()->sendQuery($sql);
$physicalAvatars = array_flip($avatarIDs);
while ($row = WCF::getDB()->fetchArray($result)) {
unset($physicalAvatars[$row['avatarID']]);
}
$physicalAvatars = array_keys($physicalAvatars);
foreach ($physicalAvatars as $avatarID) {
$file = WCF_DIR . 'images/avatars/avatar-' . $avatarID . $avatars[$avatarID];
$theAvatars[] = $file;
}
}
closedir($dh);
self::$virtualFileIDs['avatarsFilesystem'] = $theAvatars;
WCF::getSession()->register('virtualLostAndFoundIDs', self::$virtualFileIDs);
}
示例14: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if (WCF::getUser()->userID && WCF::getUser()->getPermission('admin.general.canUseAcp') && !defined(get_class($eventObj) . '::DO_NOT_LOG')) {
// try to find existing session log
$sql = "SELECT\tsessionLogID\n\t\t\t\tFROM\twcf" . WCF_N . "_acp_session_log\n\t\t\t\tWHERE\tsessionID = '" . WCF::getSession()->sessionID . "'\n\t\t\t\t\tAND lastActivityTime >= " . (TIME_NOW - SESSION_TIMEOUT);
$row = WCF::getDB()->getFirstRow($sql);
if (!empty($row['sessionLogID'])) {
$sessionLogID = $row['sessionLogID'];
// update session log
$sql = "UPDATE\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\tSET\tlastActivityTime = " . TIME_NOW . "\n\t\t\t\t\tWHERE\tsessionLogID = " . $sessionLogID;
WCF::getDB()->registerShutdownUpdate($sql);
} else {
// create new session log
$sql = "INSERT INTO\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\t\t\t(sessionID, userID, ipAddress, hostname, userAgent, time, lastActivityTime)\n\t\t\t\t\tVALUES\t\t('" . WCF::getSession()->sessionID . "', " . WCF::getUser()->userID . ", '" . escapeString(WCF::getSession()->ipAddress) . "', '" . escapeString(@gethostbyaddr(WCF::getSession()->ipAddress)) . "', '" . escapeString(WCF::getSession()->userAgent) . "', " . TIME_NOW . ", " . TIME_NOW . ")";
WCF::getDB()->sendQuery($sql);
$sessionLogID = WCF::getDB()->getInsertID("wcf" . WCF_N . "_acp_session_log", 'sessionLogID');
}
// format request uri
$requestURI = WCF::getSession()->requestURI;
// remove directories
$URIComponents = explode('/', $requestURI);
$requestURI = array_pop($URIComponents);
// remove session url
$requestURI = preg_replace('/(?:\\?|&)s=[a-f0-9]{40}/', '', $requestURI);
// save access
$sql = "INSERT INTO\twcf" . WCF_N . "_acp_session_access_log\n\t\t\t\t\t\t(sessionLogID, packageID, ipAddress, time, requestURI, requestMethod, className)\n\t\t\t\tVALUES\t\t(" . $sessionLogID . ", " . PACKAGE_ID . ", '" . escapeString(WCF::getSession()->ipAddress) . "', " . TIME_NOW . ", '" . escapeString($requestURI) . "', '" . escapeString(WCF::getSession()->requestMethod) . "', '" . escapeString(get_class($eventObj)) . "')";
WCF::getDB()->registerShutdownUpdate($sql);
}
}
示例15: finishUninstallation
/**
* @see PackageUninstallation::finishInstallation()
*/
protected function finishUninstallation()
{
if ($this->packageArchive !== null) {
$this->packageArchive->deleteArchive();
}
// unregister package installation plugins
WCF::getSession()->unregister('queueID' . $this->queueID . 'PIPs');
// mark this package uninstallation as done
$sql = "UPDATE\twcf" . WCF_N . "_package_installation_queue\n\t\t\tSET\tdone = 1\n\t\t\tWHERE\tqueueID = " . $this->queueID;
WCF::getDB()->sendQuery($sql);
// search for open queue children
$sql = "SELECT\t\tqueueID, action\n\t\t\tFROM\t\twcf" . WCF_N . "_package_installation_queue\n\t\t\tWHERE\t\tparentQueueID = " . $this->queueID . "\n\t\t\t\t\tAND processNo = " . $this->processNo . "\n\t\t\t\t\tAND done = 0\n\t\t\tORDER BY\tqueueID";
$row = WCF::getDB()->getFirstRow($sql);
if (isset($row['queueID'])) {
// entry found
WCF::getTPL()->assign(array('action' => $row['action'], 'queueID' => $row['queueID']));
return '';
} else {
// search for other open queue entries in current level
$sql = "SELECT\t\tqueueID, action\n\t\t\t\tFROM\t\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\tWHERE\t\tparentQueueID = " . $this->parentQueueID . "\n\t\t\t\t\t\tAND processNo = " . $this->processNo . "\n\t\t\t\t\t\tAND done = 0\n\t\t\t\tORDER BY\tqueueID";
$row = WCF::getDB()->getFirstRow($sql);
if (isset($row['queueID'])) {
// other entries found
WCF::getTPL()->assign(array('action' => $row['action'], 'queueID' => $row['queueID'], 'processNo' => $this->processNo));
if ($this->parentQueueID == 0) {
// reload installation frame
// and uninstall next package
WCF::getTPL()->display('packageInstallationReloadFrame');
exit;
} else {
// uninstall next package in current window
return '';
}
} else {
if ($this->parentQueueID == 0) {
// nothing to do
// finish uninstallation
// delete all package installation queue entries with the active process number
$sql = "DELETE FROM\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\t\t\tWHERE\t\tprocessNo = " . $this->processNo;
WCF::getDB()->sendQuery($sql);
// var to redirect to package list
WCF::getTPL()->assign('installationType', 'other');
// show finish page
WCF::getTPL()->display('packageInstallationFinish');
exit;
} else {
// jump to parent package uninstallation
// get information about parent queue id
WCF::getTPL()->assign(array('action' => $this->action, 'queueID' => $this->parentQueueID));
if ($this->packageType == 'requirement') {
return 'finish';
}
if ($this->packageType == 'optional') {
return 'optionals';
}
}
}
}
}