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


PHP XenForo_Visitor类代码示例

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


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

示例1: handleData

 /**
  * Do the data writing.
  *
  * @param XenForo_Visitor $visitor The visitor object.
  * @param StdClass $data Data from MCAssoc service.
  */
 private function handleData(XenForo_Visitor $visitor, $data)
 {
     $associationDw = XenForo_DataWriter::create('AssociationMc_DataWriter_AssociationEntry');
     $associationDw->set('xenforo_id', $visitor->getUserId());
     $associationDw->set('minecraft_uuid', hex2bin($data->uuid));
     $associationDw->set('last_username', $data->username);
     $associationDw->save();
 }
开发者ID:adamjdev,项目名称:XenForo-MCASSOC,代码行数:14,代码来源:Confirm.php

示例2: visitor_setup

 public static function visitor_setup(XenForo_Visitor &$visitor)
 {
     $options = $visitor->get('bdsocialshare_options');
     if (!empty($options)) {
         $visitor['_bdSocialShare_options'] = bdSocialShare_Helper_Common::unserializeOrFalse($options);
     } else {
         $visitor['_bdSocialShare_options'] = array();
     }
     $visitor['_bdSocialShare_canStaffShare'] = $visitor->hasPermission('general', 'bdSocialShare_staffShare');
 }
开发者ID:Sywooch,项目名称:forums,代码行数:10,代码来源:Listener.php

示例3: _getSessionActivityList

 protected function _getSessionActivityList()
 {
     $visitor = XenForo_Visitor::getInstance();
     /** @var $sessionModel XenForo_Model_Session */
     $sessionModel = $this->getModelFromCache('XenForo_Model_Session');
     return $sessionModel->getSessionActivityQuickList($visitor->toArray(), array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())), $visitor['user_id'] ? $visitor->toArray() : null);
 }
开发者ID:NixFifty,项目名称:XenForo-SimplePortal,代码行数:7,代码来源:Abstract.php

示例4: actionBanned

 public function actionBanned()
 {
     $userId = XenForo_Visitor::getUserId();
     $bannedUser = $this->getModelFromCache('XenForo_Model_Banning')->getBannedUserById($userId);
     if (!$bannedUser) {
         return $this->responseNoPermission();
     } else {
         if ($bannedUser['triggered'] && !$bannedUser['end_date']) {
             /** @var XenForo_Model_Warning $warningModel */
             $warningModel = $this->getModelFromCache('XenForo_Model_Warning');
             $minUnbanDate = $warningModel->getMinimumWarningUnbanDate($userId);
             if ($minUnbanDate) {
                 $bannedUser['end_date'] = $minUnbanDate;
             }
         }
         if ($bannedUser['user_reason']) {
             $message = new XenForo_Phrase('you_have_been_banned_for_following_reason_x', array('reason' => $bannedUser['user_reason']));
         } else {
             $message = new XenForo_Phrase('you_have_been_banned');
         }
         if ($bannedUser['end_date'] > XenForo_Application::$time) {
             $message .= ' ' . new XenForo_Phrase('your_ban_will_be_lifted_on_x', array('date' => XenForo_Locale::dateTime($bannedUser['end_date'])));
         }
         return $this->responseError($message, 403);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:26,代码来源:Error.php

示例5: actionIndex

 public function actionIndex()
 {
     // styles
     $styleModel = $this->getModelFromCache('XenForo_Model_Style');
     $styles = $styleModel->getAllStylesAsFlattenedTree();
     $styles = $styleModel->countCustomTemplatesPerStyle($styles);
     if ($styleModel->showMasterStyle()) {
         $masterStyle = $styleModel->getStyleById(0, true);
         $masterTemplates = $styleModel->countMasterTemplates();
     } else {
         $masterStyle = null;
         $masterTemplates = 0;
     }
     // languages
     $languageModel = $this->getModelFromCache('XenForo_Model_Language');
     $languages = $languageModel->getAllLanguagesAsFlattenedTree();
     $languages = $languageModel->countTranslatedPhrasesPerLanguage($languages);
     if ($languageModel->showMasterLanguage()) {
         $masterLanguage = $languageModel->getLanguageById(0, true);
         $masterPhrases = $languageModel->countMasterPhrases();
     } else {
         $masterLanguage = null;
         $masterPhrases = 0;
     }
     $visitor = XenForo_Visitor::getInstance();
     $viewParams = array('canEditStyles' => $visitor->hasAdminPermission('style'), 'canEditLanguages' => $visitor->hasAdminPermission('language'), 'styles' => $styles, 'masterStyle' => $masterStyle, 'masterTemplates' => $masterTemplates, 'languages' => $languages, 'masterLanguage' => $masterLanguage, 'masterPhrases' => $masterPhrases);
     return $this->responseView('XenForo_ViewAdmin_Appearance_Splash', 'appearance_splash', $viewParams);
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:28,代码来源:Appearance.php

示例6: generateHtmlRecurrence

 public function generateHtmlRecurrence($days, $amount, $currency, $comment, array $data, XenForo_View $view)
 {
     $data[] = utf8_strtolower($currency);
     $data[] = $amount;
     $processorModel = $this->_getProcessorModel();
     $itemId = $processorModel->generateItemId('bdshop', XenForo_Visitor::getInstance(), $data);
     $processorNames = $processorModel->getProcessorNames();
     $processors = array();
     foreach ($processorNames as $processorId => $processorClass) {
         $processors[$processorId] = bdPaygate_Processor_Abstract::create($processorClass);
     }
     $recurringInterval = false;
     $recurringUnit = false;
     if ($days > 0) {
         if ($days % 360 == 0) {
             $recurringInterval = $days / 365;
             $recurringUnit = bdPaygate_Processor_Abstract::RECURRING_UNIT_YEAR;
         } elseif ($days % 30 == 0) {
             $recurringInterval = $days / 30;
             $recurringUnit = bdPaygate_Processor_Abstract::RECURRING_UNIT_MONTH;
         } else {
             $recurringInterval = $days;
             $recurringUnit = bdPaygate_Processor_Abstract::RECURRING_UNIT_DAY;
         }
     }
     return implode('', bdPaygate_Processor_Abstract::prepareForms($processors, $amount, $currency, $comment, $itemId, $recurringInterval, $recurringUnit, array(bdPaygate_Processor_Abstract::EXTRA_RETURN_URL => XenForo_Link::buildPublicLink('full:shop/thanks'))));
 }
开发者ID:E2Dev,项目名称:bdPaygates,代码行数:27,代码来源:StockPricing.php

示例7: getUser

 public function getUser()
 {
     $visitor = XenForo_Visitor::getInstance();
     $userModel = XenForo_Model::create('XenForo_Model_User');
     $userInfo = $userModel->getFullUserById($visitor->getUserId());
     return $userInfo;
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:7,代码来源:XfAuthentication.php

示例8: _insertDiscussionThread

 /**
  *
  * @see XenResource_DataWriter_Resource::_insertDiscussionThread()
  */
 protected function _insertDiscussionThread($nodeId, $prefixId = 0)
 {
     /* @var $nodeModel XenForo_Model_Node */
     $nodeModel = $this->getModelFromCache('XenForo_Model_Node');
     $node = $nodeModel->getNodeById($nodeId);
     if (!$node) {
         return false;
     }
     if ($node['node_type_id'] == 'SocialCategory') {
         $socialForumId = 0;
         if (isset($GLOBALS['XenResource_ControllerPublic_Resource'])) {
             /* @var $controller XenResource_ControllerPublic_Resource */
             $controller = $GLOBALS['XenResource_ControllerPublic_Resource'];
             $socialForumId = $controller->getInput()->filterSingle('social_forum_id', XenForo_Input::UINT);
         }
         if ($socialForumId) {
             $socialForumModel = ThemeHouse_SocialGroups_SocialForum::getSocialForumModel();
             $socialForum = $socialForumModel->getSocialForumById($socialForumId);
         }
         if (!empty($socialForum) && $socialForum['node_id'] == $node['node_id']) {
             ThemeHouse_SocialGroups_SocialForum::setup($socialForum);
             // TODO check permissions
         } else {
             $writer = XenForo_DataWriter::create('ThemeHouse_SocialGroups_DataWriter_SocialForum');
             $writer->bulkSet(array('node_id' => $nodeId, 'user_id' => XenForo_Visitor::getUserId(), 'title' => $this->_getThreadTitle(), 'description' => $this->get('tag_line'), 'social_forum_type' => 'resource'));
             $writer->save();
             ThemeHouse_SocialGroups_SocialForum::setup($writer->getMergedData());
             $this->set('social_forum_id', $writer->get('social_forum_id'), '', array('setAfterPreSave' => true));
         }
     }
     return parent::_insertDiscussionThread($nodeId, $prefixId);
 }
开发者ID:AndroidOS,项目名称:SocialGroups,代码行数:36,代码来源:Resource.php

示例9: _getProfilePosts

 protected function _getProfilePosts(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
 {
     if ($positionCode == 'forum_list' and $widget['options']['limit'] == XenForo_Application::getOptions()->get('forumListNewProfilePosts')) {
         if (!empty($params['profilePosts'])) {
             return $params['profilePosts'];
         }
     }
     $core = WidgetFramework_Core::getInstance();
     $visitor = XenForo_Visitor::getInstance();
     /** @var WidgetFramework_XenForo_Model_ProfilePost $profilePostModel */
     $profilePostModel = $core->getModelFromCache('XenForo_Model_ProfilePost');
     $profilePosts = $profilePostModel->WidgetFramework_getLatestProfilePosts(array('deleted' => false, 'moderated' => false), array('limit' => $widget['options']['limit'] * 3, 'join' => XenForo_Model_ProfilePost::FETCH_USER_POSTER | XenForo_Model_ProfilePost::FETCH_USER_RECEIVER | XenForo_Model_ProfilePost::FETCH_USER_RECEIVER_PRIVACY, 'permissionCombinationId' => $visitor->get('permission_combination_id')));
     foreach ($profilePosts as $id => &$profilePost) {
         $receivingUser = $profilePostModel->getProfileUserFromProfilePost($profilePost);
         if (!$profilePostModel->canViewProfilePostAndContainer($profilePost, $receivingUser)) {
             unset($profilePosts[$id]);
         }
         $profilePost = $profilePostModel->prepareProfilePost($profilePost, $receivingUser);
         if (!empty($profilePost['isIgnored'])) {
             unset($profilePosts[$id]);
         }
     }
     $profilePosts = array_slice($profilePosts, 0, $widget['options']['limit'], true);
     return $profilePosts;
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:25,代码来源:ProfilePosts.php

示例10: actionStaff

 public function actionStaff()
 {
     $options = XenForo_Application::get('options');
     if (!XenForo_Visitor::getInstance()->hasPermission('players', 'view') || !$options->displayPlayers && !XenForo_Visitor::getInstance()->isSuperAdmin() || !$options->displayStaffList && !XenForo_Visitor::getInstance()->isSuperAdmin()) {
         return $this->responseNoPermission();
     }
     /* Set the ID of the post to be loaded */
     $postId = $options->applyStaffPostId;
     /* Create a new ControllerHelper that will help us to get the post */
     $ftpHelper = new XenForo_ControllerHelper_ForumThreadPost($this);
     /* Use the ControllerHelper to see if the post we want to get is viewable by the user browsing */
     list($post, $thread) = $ftpHelper->assertPostValidAndViewable($postId);
     /* If the post has attachments */
     if ($post['attach_count'] > 0) {
         /* Let's get all the attachments of this post, if exists  */
         $attachmentModel = XenForo_Model::create('XenForo_Model_Attachment');
         $attachments = $attachmentModel->getAttachmentsByContentId('post', $postId);
         foreach ($attachments as $attachment) {
             /* Insert into the post data the attachments */
             $post['attachments'][$attachment['attachment_id']] = $attachmentModel->prepareAttachment($attachment);
         }
     }
     $mod_raw = file_get_contents($options->restApiUrl . 'player.php?action=getMods&value=name');
     $ss_raw = file_get_contents($options->restApiUrl . 'player.php?action=getSS&value=name');
     $mods = array();
     $ss = array();
     while ($name = json_decode($mod_raw, true)) {
         array_push($mods, $name);
     }
     while ($name = json_decode($ss_raw, true)) {
         array_push($ss, $name);
     }
     $viewParams = array('mods' => $mods, 'ss' => $ss, 'post' => $post);
     return $this->responseView('QCPlayers_ViewPublic_Players_staff', 'player_staff_list', $viewParams);
 }
开发者ID:Quartzcraft,项目名称:Website,代码行数:35,代码来源:Players.php

示例11: actionPromote

 public function actionPromote()
 {
     if (!$this->perms['promote']) {
         return $this->responseNoPermission();
     }
     $input = $this->_input->filter(array('thread_id' => XenForo_Input::UINT, 'promote_date' => XenForo_Input::UINT, 'promote_icon' => XenForo_Input::STRING, 'attach_data' => XenForo_Input::UINT, 'image_data' => XenForo_Input::STRING, 'medio_data' => XenForo_Input::UINT, 'date' => XenForo_Input::STRING, 'hour' => XenForo_Input::UINT, 'mins' => XenForo_Input::UINT, 'ampm' => XenForo_Input::STRING, 'zone' => XenForo_Input::STRING, 'delete' => XenForo_Input::STRING));
     $ftpHelper = $this->getHelper('ForumThreadPost');
     list($thread, $forum) = $ftpHelper->assertThreadValidAndViewable($input['thread_id']);
     if ($this->_request->isPost()) {
         $this->getModelFromCache('EWRporta_Model_Promotes')->updatePromotion($input);
         $this->getModelFromCache('EWRporta_Model_Caches')->emptyBlockCache(array('block_id' => 'RecentFeatures'));
         $this->getModelFromCache('EWRporta_Model_Caches')->emptyBlockCache(array('block_id' => 'RecentNews'));
     } else {
         $threadPromote = $this->getModelFromCache('EWRporta_Model_Promotes')->getPromoteByThreadId($thread['thread_id']);
         $visitor = XenForo_Visitor::getInstance();
         $datetime = $threadPromote ? $threadPromote['promote_date'] : $thread['post_date'];
         $datetime = new DateTime(date('r', $datetime));
         $datetime->setTimezone(new DateTimeZone($visitor['timezone']));
         $datetime = explode('.', $datetime->format('Y-m-d.h.i.A.T'));
         $datetime = array('date' => $datetime[0], 'hour' => $datetime[1], 'mins' => $datetime[2], 'meri' => $datetime[3], 'zone' => $datetime[4]);
         $icons = $this->getModelFromCache('EWRporta_Model_Promotes')->getPromoteIcons($thread);
         $viewParams = array('thread' => $thread, 'icons' => $icons, 'threadPromote' => $threadPromote, 'datetime' => $datetime, 'nodeBreadCrumbs' => $ftpHelper->getNodeBreadCrumbs($forum));
         return $this->responseView('EWRporta_ViewPublic_Promote', 'EWRporta_Promote', $viewParams);
     }
     return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('threads', $thread));
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:26,代码来源:Thread.php

示例12: _thSocialForumDescriptionAboveSocialgroups

 protected function _thSocialForumDescriptionAboveSocialgroups()
 {
     $viewParams = $this->_fetchViewParams();
     if ($viewParams['socialForum']['social_forum_type'] == 'resource') {
         /* @var $resourceModel XenResource_Model_Resource */
         $resourceModel = XenForo_Model::create('XenResource_Model_Resource');
         $fetchOptions = array('join' => XenResource_Model_Resource::FETCH_CATEGORY | XenResource_Model_Resource::FETCH_USER | XenResource_Model_Resource::FETCH_ATTACHMENT | XenResource_Model_Resource::FETCH_VERSION, 'watchUserId' => XenForo_Visitor::getUserId());
         if (XenForo_Visitor::getInstance()->hasPermission('resource', 'viewDeleted')) {
             $fetchOptions['join'] |= XenResource_Model_Resource::FETCH_DELETION_LOG;
         }
         $resource = $resourceModel->getResourceBySocialForumId($viewParams['socialForum']['social_forum_id'], $fetchOptions);
         if ($resource && $resourceModel->canViewResourceAndContainer($resource, $resource)) {
             /* @var $categoryModel XenResource_Model_Category */
             $categoryModel = XenForo_Model::create('XenResource_Model_Category');
             $updateConditions = $categoryModel->getPermissionBasedFetchConditions($resource);
             if ($updateConditions['deleted'] === true || $updateConditions['moderated'] === true || $updateConditions['moderated'] == $resource['user_id']) {
                 /* @var $updateModel XenResource_Model_Update */
                 $updateModel = XenForo_Model::create('XenResource_Model_Update');
                 $resourceUpdateCount = $updateModel->countUpdates($updateConditions + array('resource_id' => $resource['resource_id'], 'resource_update_id_not' => $resource['description_update_id']));
             } else {
                 $resourceUpdateCount = $resource['update_count'];
             }
             $resource = $resourceModel->prepareResource($resource, $resource);
             $this->_appendTemplate('resource_view_tabs', $viewParams + array('resource' => $resource, 'resourceUpdateCount' => $resourceUpdateCount, 'selectedTab' => 'discussion'));
             ThemeHouse_SocialGroups_SocialForum::getInstance()->setResource($resource);
         }
     }
 }
开发者ID:AndroidOS,项目名称:SocialGroups,代码行数:28,代码来源:TemplateHook.php

示例13: getPermissionsFromContext

 public function getPermissionsFromContext(array $context, array $parentContext = null)
 {
     if (isset($context['thread_id'])) {
         $thread = $context;
         $forum = $parentContext;
     } else {
         $thread = null;
         $forum = $context;
     }
     if (!$forum || !isset($forum['node_id'])) {
         throw new Exception("Context must be a thread and a forum or just a forum");
     }
     $visitor = XenForo_Visitor::getInstance();
     // creating a new thread (all tags would be by us)
     $nodePermissions = $visitor->getNodePermissions($forum['node_id']);
     if ($thread) {
         if ($thread['user_id'] == $visitor['user_id'] && XenForo_Permission::hasContentPermission($nodePermissions, 'manageOthersTagsOwnThread')) {
             $removeOthers = true;
         } else {
             $removeOthers = XenForo_Permission::hasContentPermission($nodePermissions, 'manageAnyTag');
         }
     } else {
         $removeOthers = false;
     }
     return array('edit' => $this->_getThreadModel()->canEditTags($thread, $forum), 'removeOthers' => $removeOthers, 'minTotal' => $forum['min_tags']);
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:26,代码来源:Thread.php

示例14: getPermissionsFromContext

 public function getPermissionsFromContext(array $context, array $parentContext = null)
 {
     // Context could be some previously fetched permissions, media, album or category...
     if (isset($context['tagger_permissions'])) {
         return $context['tagger_permissions'];
     } else {
         if (isset($context['media_id'])) {
             $media = $context;
             $container = $parentContext;
         } else {
             $media = null;
             $container = $context;
         }
     }
     if (!$container || empty($container['album_id']) && empty($container['category_id'])) {
         throw new Exception("Context must be a media item and an album/category or just an album/category");
     }
     $visitor = XenForo_Visitor::getInstance();
     if ($media) {
         if ($media['user_id'] == $visitor['user_id'] && XenForo_Permission::hasPermission($visitor['permissions'], 'xengallery', 'manageOthersTagsOwnMedia')) {
             $removeOthers = true;
         } else {
             $removeOthers = XenForo_Permission::hasPermission($visitor['permissions'], 'xengallery', 'manageAnyTag');
         }
     } else {
         $removeOthers = false;
     }
     return array('edit' => $this->_getMediaModel()->canEditTags($media), 'removeOthers' => $removeOthers, 'minTotal' => isset($container['min_tags']) ? $container['min_tags'] : XenForo_Application::getOptions()->xengalleryAlbumMinTags);
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:29,代码来源:Media.php

示例15: getWrapper

 public function getWrapper($selectedGroup, $selectedLink, XenForo_ControllerResponse_View $subView)
 {
     $viewParams = array('selectedGroup' => $selectedGroup, 'selectedLink' => $selectedLink, 'selectedKey' => "{$selectedGroup}/{$selectedLink}", 'canStartConversation' => $this->_controller->getModelFromCache('XenForo_Model_Conversation')->canStartConversations(), 'canEditSignature' => XenForo_Visitor::getInstance()->canEditSignature(), 'canEditProfile' => XenForo_Visitor::getInstance()->canEditProfile());
     $wrapper = $this->_controller->responseView('XenForo_ViewPublic_Account_Wrapper', 'account_wrapper', $viewParams);
     $wrapper->subView = $subView;
     return $wrapper;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:7,代码来源:Account.php


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