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


PHP WCF::getUser方法代码示例

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


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

示例1: readPosts

 /**
  * Gets the posts for the feed.
  */
 protected function readPosts()
 {
     // accessible boards
     $accessibleBoardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
     if (!count($accessibleBoardIDArray)) {
         throw new PermissionDeniedException();
     }
     // get posts
     $attachmentPostIDArray = array();
     $sql = "SELECT\t\tpost.*\n\t\t\tFROM\t\twbb" . WBB_N . "_post post\n\t\t\tWHERE\t\tpost.threadID IN (" . implode(',', $this->threadIDArray) . ")\n\t\t\t\t\tAND post.threadID IN (SELECT threadID FROM wbb" . WBB_N . "_thread WHERE boardID IN (" . implode(',', $accessibleBoardIDArray) . "))\n\t\t\t\t\tAND post.isDeleted = 0\n\t\t\t\t\tAND post.isDisabled = 0\n\t\t\t\t\t" . ($this->hours ? "AND post.time > " . (TIME_NOW - $this->hours * 3600) : '') . "\n\t\t\tORDER BY\tpost.time DESC";
     $result = WCF::getDB()->sendQuery($sql, $this->limit);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $this->posts[] = new FeedPost(null, $row);
         // attachments
         if ($row['attachments'] != 0) {
             $attachmentPostIDArray[] = $row['postID'];
         }
     }
     // read attachments
     if (MODULE_ATTACHMENT == 1 && count($attachmentPostIDArray) > 0 && (WCF::getUser()->getPermission('user.board.canViewAttachmentPreview') || WCF::getUser()->getPermission('user.board.canDownloadAttachment'))) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         $attachmentList = new MessageAttachmentList($attachmentPostIDArray, 'post');
         $attachmentList->readObjects();
         $attachments = $attachmentList->getSortedAttachments();
         // set embedded attachments
         require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php';
         AttachmentBBCode::setAttachments($attachments);
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:32,代码来源:PostsFeedPage.class.php

示例2: 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;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:34,代码来源:UserDeleteAction.class.php

示例3: readFormParameters

 /**
  * @see Form::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     // default settings
     $this->closeThread = $this->thread->isClosed;
     $this->subscription = $this->thread->subscribed;
     if (WCF::getUser()->userID) {
         // options
         $this->parseURL = WCF::getUser()->{$this->permissionType . 'ParseURL'};
         $this->enableSmilies = WCF::getUser()->{$this->permissionType . 'EnableSmilies'};
         $this->enableHtml = WCF::getUser()->{$this->permissionType . 'EnableHtml'};
         $this->enableBBCodes = WCF::getUser()->{$this->permissionType . 'EnableBBCodes'};
         if ($this->showSignatureSetting) {
             $this->showSignature = WCF::getUser()->{$this->permissionType . 'ShowSignature'};
         }
         if (!$this->subscription && WCF::getUser()->enableSubscription) {
             $this->subscription = 1;
         }
     } else {
         // options
         $this->parseURL = MESSAGE_FORM_DEFAULT_PARSE_URL;
         $this->enableSmilies = MESSAGE_FORM_DEFAULT_ENABLE_SMILIES;
         $this->enableHtml = MESSAGE_FORM_DEFAULT_ENABLE_HTML;
         $this->enableBBCodes = MESSAGE_FORM_DEFAULT_ENABLE_BBCODES;
     }
     $this->enableSmilies = intval($this->enableSmilies && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseSmilies'));
     $this->enableHtml = intval($this->enableHtml && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseHtml'));
     $this->enableBBCodes = intval($this->enableBBCodes && WCF::getUser()->getPermission('user.' . $this->permissionType . '.canUseBBCodes'));
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:32,代码来源:PostQuickAddForm.class.php

示例4: show

 /**
  * @see Page::show()
  */
 public function show()
 {
     // check permission
     WCF::getUser()->checkPermission('user.guestbook.canViewList');
     HeaderMenu::setActiveMenuItem('wcf.header.menu.userGuestbook');
     parent::show();
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:10,代码来源:UserGuestbookListPage.class.php

示例5: readData

 public function readData()
 {
     parent::readData();
     $this->entry = new ViewableBashEntry($this->entryID);
     // check for the entry
     if (!$this->entry->entryID) {
         throw new IllegalLinkException();
     }
     // check for permissions
     $throwPermissionDeniedException = false;
     if ($this->entry->isDisabled) {
         // guest
         if (!WCF::getUser()->userID) {
             $throwPermissionDeniedException = true;
         }
         // check for author (the author of the entry can see this entry)
         if (!$throwPermissionDeniedException and WCF::getUser()->userID != $this->entry->authorID) {
             $throwPermissionDeniedException = true;
         }
         // check for a moderator (a moderator can see this entry)
         if (!$throwPermissionDeniedException and WCF::getUser()->userID != $this->entry->authorID and !WCF::getUser()->getPermission('mod.bash.moderatorPermissions')) {
             $throwPermissionDeniedException = true;
         }
     }
     // throw a permission denied exception
     if ($throwPermissionDeniedException) {
         throw new PermissionDeniedException();
     }
     // init sidebars
     $this->sidebarFactory = new MessageSidebarFactory($this);
     $this->sidebarFactory->create($this->entry);
     $this->sidebarFactory->init();
 }
开发者ID:Evil-Co-Legacy,项目名称:Bash-Database,代码行数:33,代码来源:BashEntryPage.class.php

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

示例7: readParameters

 /**
  * @see Action::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (!WCF::getUser()->userID) {
         throw new IllegalLinkException();
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:10,代码来源:BoardSubscribeAction.class.php

示例8: execute

 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (!MODULE_USER_NOTIFICATION) {
         return;
     }
     try {
         $notificationObject = $this->getNotificationObject($eventObj->eventName, $eventObj->placeholders + array('contestID' => $eventObj->contestID));
     } catch (Exception $e) {
         // just fun, errors don't need to be handled
         return;
     }
     switch ($eventName) {
         case 'create':
             foreach ($notificationObject->getRecipients() as $recipientUserID) {
                 // remove current user from recipient list
                 if ($recipientUserID == WCF::getUser()->userID) {
                     continue;
                 }
                 NotificationHandler::fireEvent($eventObj->eventName, self::OBJECT_TYPE, $notificationObject, $recipientUserID);
             }
             break;
         case 'delete':
             NotificationHandler::revokeEvent(array($eventObj->eventName), self::OBJECT_TYPE, array($notificationObject));
             break;
         case 'confirm':
             // anybody affected by current confirmation?
             $objectIDScope = array();
             foreach ($notificationObject->getObjects() as $objectID) {
                 $objectIDScope[] = $objectID;
             }
             $recipientUserID = WCF::getUser()->userID;
             NotificationEditor::markConfirmedByObjectVisit($recipientUserID, array($eventObj->eventName), self::OBJECT_TYPE, $objectIDScope);
             break;
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:38,代码来源:ContestEventNotificationListener.class.php

示例9: execute

 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (MODULE_USERS_ONLINE == 1) {
         if ($eventObj->activeCategory == 'profile') {
             if ($eventName == 'validate') {
                 if (WCF::getUser()->getPermission('user.profile.rank.canSelectOnlineMarking')) {
                     if (isset($_POST['userOnlineGroupID'])) {
                         $this->userOnlineGroupID = intval($_POST['userOnlineGroupID']);
                     }
                     // validate user online group id
                     if ($this->userOnlineGroupID) {
                         try {
                             $sql = "SELECT\t\tgroupID\n\t\t\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_group\n\t\t\t\t\t\t\t\t\tWHERE\t\tgroupID = " . $this->userOnlineGroupID . "\n\t\t\t\t\t\t\t\t\t\t\tAND groupID IN (" . implode(',', WCF::getUser()->getGroupIDs()) . ")";
                             $row = WCF::getDB()->getFirstRow($sql);
                             if (!isset($row['groupID'])) {
                                 throw new UserInputException('userOnlineGroupID');
                             }
                             // save rankid
                             $eventObj->additionalFields['userOnlineGroupID'] = $this->userOnlineGroupID;
                         } catch (UserInputException $e) {
                             $eventObj->errorType[$e->getField()] = $e->getType();
                         }
                     }
                 }
             } else {
                 if ($eventName == 'assignVariables') {
                     if (!count($_POST)) {
                         // get current values
                         $this->userOnlineGroupID = WCF::getUser()->userOnlineGroupID;
                     }
                     $fields = array();
                     // get user online markings
                     if (WCF::getUser()->getPermission('user.profile.rank.canSelectOnlineMarking')) {
                         $markings = array();
                         $sql = "SELECT\t\tgroupID, groupName, userOnlineMarking\n\t\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_group\n\t\t\t\t\t\t\tWHERE\t\tgroupID IN (" . implode(',', WCF::getUser()->getGroupIDs()) . ")\n\t\t\t\t\t\t\tORDER BY\tgroupID ASC";
                         $result = WCF::getDB()->sendQuery($sql);
                         while ($row = WCF::getDB()->fetchArray($result)) {
                             $row['userOnlineMarking'] = sprintf($row['userOnlineMarking'], StringUtil::encodeHTML(WCF::getUser()->username));
                             $markings[] = $row;
                         }
                         if (count($markings) > 1) {
                             WCF::getTPL()->assign(array('markings' => $markings, 'userOnlineGroupID' => $this->userOnlineGroupID));
                             $fields[] = array('optionName' => 'userOnlineGroupID', 'divClass' => 'formRadio', 'beforeLabel' => false, 'isOptionGroup' => true, 'html' => WCF::getTPL()->fetch('userProfileEditOnlineMarkingSelect'));
                         }
                     }
                     // add fields
                     if (count($fields) > 0) {
                         foreach ($eventObj->options as $key => $category) {
                             if ($category['categoryName'] == 'profile.rank') {
                                 $eventObj->options[$key]['options'] = array_merge($category['options'], $fields);
                                 return;
                             }
                         }
                         $eventObj->options[] = array('categoryName' => 'profile.rank', 'categoryIconM' => '', 'options' => $fields);
                     }
                 }
             }
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:63,代码来源:UserProfileEditFormOnlineMarkingListener.class.php

示例10: execute

 public function execute($eventObj, $className, $eventName)
 {
     if (!defined('THREAD_SHOW_CLOSED_MESSAGE_ALL')) {
         define('THREAD_SHOW_CLOSED_MESSAGE_ALL', false);
     }
     if (isset($eventObj->thread) && $eventObj->thread->isDeleted == 1) {
         WCF::getTPL()->append('userMessages', '<p class="error">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.deleted') . '</p>');
     } else {
         if (isset($eventObj->thread) && $eventObj->thread->isDisabled == 1) {
             WCF::getTPL()->append('userMessages', '<p class="warning">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.disabled') . '</p>');
         } else {
             if (isset($eventObj->thread) && $eventObj->thread->isClosed == 1 && (WCF::getUser()->getPermission('mod.board.canReplyClosedThread') || THREAD_SHOW_CLOSED_MESSAGE_ALL)) {
                 WCF::getTPL()->append('userMessages', '<p class="warning">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.closed') . '</p>');
             } else {
                 if (isset($eventObj->post) && $eventObj->post->isDeleted == 1) {
                     WCF::getTPL()->append('userMessages', '<p class="error">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.deleted') . '</p>');
                 } else {
                     if (isset($eventObj->post) && $eventObj->post->isDisabled == 1) {
                         WCF::getTPL()->append('userMessages', '<p class="warning">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.disabled') . '</p>');
                     } else {
                         if (isset($eventObj->post) && $eventObj->post->isClosed == 1 && (WCF::getUser()->getPermission('mod.board.canReplyClosedThread') || THREAD_SHOW_CLOSED_MESSAGE_ALL)) {
                             WCF::getTPL()->append('userMessages', '<p class="warning">' . WCF::getLanguage()->get('wbb.thread.inactiveTopic.closed') . '</p>');
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:29,代码来源:InactiveTopicInfoListener.class.php

示例11: __construct

 public function __construct($data, $boxname = "")
 {
     $this->BoardlistData['templatename'] = "listboards";
     $this->getBoxStatus($data);
     $this->BoardlistData['boxID'] = $data['boxID'];
     // DEFAULTS
     $lbLength = 24;
     $lbLevelCut = 3;
     $lbMaxHeight = 0;
     $lbSBColor = 2;
     $lbFontsize = '1.2em';
     $lbSpacer = 5;
     $lbIndent = '&nbsp;&raquo;&nbsp;';
     $lbIndentNewPosts = '<span style="font-weight:bold; color:Red;">&nbsp;&raquo;&nbsp;</span>';
     $lbShowNewPosts = true;
     // ACP Konstanten...
     if (!defined('LISTBOARDS_LENGTH_ACP')) {
         define('LISTBOARDS_LENGTH_ACP', $lbLength);
     }
     if (!defined('LISTBOARDS_LEVELCUT_ACP')) {
         define('LISTBOARDS_LEVELCUT_ACP', $lbLevelCut);
     }
     if (!defined('LISTBOARDS_MAXHEIGHT_ACP')) {
         define('LISTBOARDS_MAXHEIGHT_ACP', $lbMaxHeight);
     }
     if (!defined('LISTBOARDSBOX_SBCOLOR_ACP')) {
         define('LISTBOARDSBOX_SBCOLOR_ACP', $lbSBColor);
     }
     if (!defined('LISTBOARDS_MAINBOARD_FONTSIZE_ACP')) {
         define('LISTBOARDS_MAINBOARD_FONTSIZE_ACP', $lbFontsize);
     }
     if (!defined('LISTBOARDS_MAINBOARD_SPACER_ACP')) {
         define('LISTBOARDS_MAINBOARD_SPACER_ACP', $lbSpacer);
     }
     if (!defined('LISTBOARDS_SUBBOARD_INDENT_ACP')) {
         define('LISTBOARDS_SUBBOARD_INDENT_ACP', $lbIndent);
     }
     if (!defined('LISTBOARDS_NEWPOST_INDENT_ACP')) {
         define('LISTBOARDS_NEWPOST_INDENT_ACP', $lbIndentNewPosts);
     }
     if (!defined('LISTBOARDS_SHOW_NEWPOSTS_ACP')) {
         define('LISTBOARDS_SHOW_NEWPOSTS_ACP', $lbShowNewPosts);
     }
     // Boxen Hoehe
     if (WCF::getUser()->userID) {
         if (WCF::getUser()->listboards_maxheight >= 100) {
             $lbMaxHeight = intval(WCF::getUser()->listboards_maxheight);
         } else {
             if (WCF::getUser()->listboards_maxheight == 0 && LISTBOARDS_MAXHEIGHT_ACP >= 100) {
                 $lbMaxHeight = LISTBOARDS_MAXHEIGHT_ACP;
             }
         }
     }
     // Template Variablen zuordnen...
     WCF::getTPL()->assign(array('lbFontsize' => LISTBOARDS_MAINBOARD_FONTSIZE_ACP == '' ? $lbFontsize : LISTBOARDS_MAINBOARD_FONTSIZE_ACP, 'lbSpacer' => intval(LISTBOARDS_MAINBOARD_SPACER_ACP), 'lbIndent' => LISTBOARDS_SUBBOARD_INDENT_ACP, 'lbIndentNewPosts' => LISTBOARDS_NEWPOST_INDENT_ACP, 'lbSBColor' => intval(LISTBOARDSBOX_SBCOLOR_ACP), 'lbLength' => intval(LISTBOARDS_LENGTH_ACP), 'lbLevelCut' => intval(LISTBOARDS_LEVELCUT_ACP), 'lbShowNewPosts' => LISTBOARDS_SHOW_NEWPOSTS_ACP, 'lbMaxHeight' => $lbMaxHeight));
     // Forenliste
     require_once WBB_DIR . 'lib/data/board/BoardList.class.php';
     $boardList = new BoardList();
     $boardList->renderBoards();
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:60,代码来源:ListBoardsBox.class.php

示例12: execute

 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     // ip address
     if (WCF::getUser()->getPermission('admin.general.canViewIpAddress') && $eventObj->container instanceof ThreadPage) {
         foreach ($eventObj->messageSidebars as $id => $sidebar) {
             if ($sidebar->getSidebarObject()->ipAddress) {
                 $title = WCF::getLanguage()->getDynamicVariable('wbb.thread.ipAddress', array('username' => $sidebar->getUser()->username, 'ipAddress' => $sidebar->getSidebarObject()->ipAddress));
                 $sidebar->addUserContact('<a href="index.php?page=IpAddress&amp;postID=' . $sidebar->getSidebarObject()->postID . SID_ARG_2ND . '"><img src="' . StyleManager::getStyle()->getIconPath('ipAddressS.png') . '" alt="' . $title . '" title="' . $title . '" /></a>');
             }
         }
     }
     // thread starter icon
     if (MESSAGE_SIDEBAR_ENABLE_THREAD_STARTER_ICON == 1 && $eventObj->container instanceof ThreadPage && $eventObj->container->thread->userID != 0) {
         foreach ($eventObj->messageSidebars as $id => $sidebar) {
             if ($eventObj->container->thread->userID == $sidebar->getUser()->userID) {
                 $title = WCF::getLanguage()->getDynamicVariable('wbb.thread.starter', array('username' => $sidebar->getUser()->username));
                 $sidebar->addUserSymbol('<img src="' . StyleManager::getStyle()->getIconPath('threadStarterS.png') . '" alt="' . $title . '" title="' . $title . '" />');
             }
         }
     }
     // post count
     if (MESSAGE_SIDEBAR_ENABLE_USER_POSTS == 1) {
         foreach ($eventObj->messageSidebars as $id => $sidebar) {
             if ($sidebar->getUser()->userID != 0 && $sidebar->getSidebarObject()->posts !== null) {
                 $sidebar->userCredits = array_merge(array(array('name' => WCF::getLanguage()->get('wcf.user.posts'), 'value' => StringUtil::formatInteger($sidebar->getSidebarObject()->posts), 'url' => 'index.php?form=Search&amp;types[]=post&amp;userID=' . $sidebar->getUser()->userID . SID_ARG_2ND)), $sidebar->userCredits);
             }
         }
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:32,代码来源:MessageSidebarFactoryWBBListener.class.php

示例13: readParameters

 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (!empty($_POST['action']) && $_POST['action'] == 'compare') {
         if (!empty($_POST['version1']) && !empty($_POST['version2'])) {
             require_once WCF_DIR . 'lib/acp/package/Package.class.php';
             $this->verResult = Package::compareVersion($_POST['version1'], $_POST['version2']);
             //		        $this->verResult = version_compare($_POST['version1'], $_POST['version2']);
             $this->verFirst = $_POST['version1'];
             $this->verSecond = $_POST['version2'];
             if ($this->logFile) {
                 $entries = array();
                 $u = WCF::getUser()->username ? WCF::getUser()->username : 'Guest';
                 $t = TIME_NOW;
                 if (is_file(WBB_DIR . '/' . $this->logFile)) {
                     $entries = file(WBB_DIR . '/' . $this->logFile);
                 }
                 array_push($entries, $t . '||' . date('d.m.Y H:i:s', $t) . '||' . $u . '||' . $this->verFirst . '||' . $this->verSecond);
                 rsort($entries);
                 if (!empty($this->logMaxEntries) && $this->logMaxEntries > 0) {
                     $output = array_slice($entries, 0, $this->logMaxEntries);
                 } else {
                     $output = $entries;
                 }
                 if (count($output) && ($fh = @fopen(WBB_DIR . '/' . $this->logFile, 'w'))) {
                     foreach ($output as $k => $line) {
                         fwrite($fh, trim($line) . "\n");
                     }
                     fclose($fh);
                 }
             }
         }
     }
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:37,代码来源:VersionCheckerPage.class.php

示例14: execute

 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->fleet = Fleet::getInstance($this->fleetID);
     if ($this->fleet->ownerID != WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     if (!$this->fleet->getCancelDuration()) {
         require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php';
         throw new IllegalLinkException();
     }
     if ($this->fleet->missionID == 11) {
         $formation = $this->fleet->getNavalFormation();
     }
     $this->fleet->getEditor()->cancel();
     if ($this->fleet->missionID == 11) {
         FleetOvent::update($formation->getLeaderFleet());
     }
     $this->executed();
     header('Location: index.php?page=FleetStartShips');
     exit;
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:FleetCancelAction.class.php

示例15: 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);
     }
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:32,代码来源:SessionAccessLogListener.class.php


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