• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XenForo_Permission类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getFloodingLimitForAction

 public function getFloodingLimitForAction($action, &$viewingUser = null)
 {
     $this->standardizeViewingUserReference($viewingUser);
     if (!$viewingUser['user_id']) {
         return null;
     }
     switch ($action) {
         case 'conversation':
             $floodingLimit = XenForo_Permission::hasPermission($viewingUser['permissions'], 'conversation', 'floodCheckLength');
             break;
         case 'post':
             $floodingLimit = XenForo_Permission::hasPermission($viewingUser['permissions'], 'general', 'floodCheckPostLength');
             break;
         case 'contact':
             $floodingLimit = XenForo_Permission::hasPermission($viewingUser['permissions'], 'general', 'floodCheckContactLength');
             break;
         case 'report':
             $floodingLimit = XenForo_Permission::hasPermission($viewingUser['permissions'], 'general', 'floodCheckReportLength');
             break;
         default:
             $floodingLimit = null;
             break;
     }
     if ($floodingLimit === false) {
         return null;
     }
     return $floodingLimit;
 }
开发者ID:ThemeHouse-XF,项目名称:FloodControl,代码行数:28,代码来源:FloodCheck.php


示例2: actionContent

 public function actionContent()
 {
     $noWrapper = $this->_input->filterSingle('no_wrapper', XenForo_Input::STRING);
     $defaultOrder = 'media_date';
     $order = $this->_input->filterSingle('order', XenForo_Input::STRING, array('default' => $defaultOrder));
     $container = $this->_input->filterSingle('container', XenForo_Input::STRING);
     $type = $this->_input->filterSingle('type', XenForo_Input::STRING);
     $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
     $userFetchOptions = array('join' => XenForo_Model_User::FETCH_LAST_ACTIVITY);
     $user = $this->getHelper('UserProfile')->assertUserProfileValidAndViewable($userId, $userFetchOptions);
     $this->canonicalizeRequestUrl(XenForo_Link::buildPublicLink('xengallery/users', $user));
     $mediaModel = $this->_getMediaModel();
     $page = $this->_input->filterSingle('page', XenForo_Input::UINT);
     $perPage = XenForo_Application::getOptions()->xengalleryMediaMaxPerPage;
     $visitor = XenForo_Visitor::getInstance();
     $conditions = array('user_id' => $user['user_id'], 'container' => $container, 'type' => $type, 'deleted' => XenForo_Permission::hasPermission(XenForo_Visitor::getInstance()->permissions, 'xengallery', 'viewDeleted'), 'privacyUserId' => $visitor->user_id, 'viewAlbums' => XenForo_Permission::hasPermission($visitor->permissions, 'xengallery', 'viewAlbums'), 'viewCategoryIds' => $mediaModel->getViewableCategoriesForVisitor($visitor->toArray()));
     $fetchOptions = $this->_getMediaFetchOptions() + array('order' => $order ? $order : $defaultOrder, 'orderDirection' => 'desc', 'page' => $page, 'perPage' => $perPage);
     $fetchOptions['join'] |= XenGallery_Model_Media::FETCH_ALBUM | XenGallery_Model_Media::FETCH_PRIVACY;
     $totalCount = $mediaModel->countMedia($conditions, $fetchOptions);
     $media = $mediaModel->getMedia($conditions, $fetchOptions);
     $media = $mediaModel->prepareMediaItems($media);
     $userPage = false;
     if ($userId == $visitor->user_id) {
         $userPage = true;
     }
     $inlineModOptions = $mediaModel->prepareInlineModOptions($media, $userPage);
     $pageNavParams = array('order' => $order != $defaultOrder ? $order : false, 'container' => $container ? $container : false, 'type' => $type ? $type : false);
     $viewParams = array('canViewComments' => $this->_getCommentModel()->canViewComments(), 'media' => $media, 'user' => $user, 'page' => $page <= 1 ? '' : $page, 'perPage' => $perPage, 'pageNavParams' => $pageNavParams, 'order' => $order, 'defaultOrder' => $defaultOrder, 'container' => $container, 'containerFilter' => $container, 'type' => $type, 'typeFilter' => $type, 'mediaCount' => count($media), 'totalCount' => $totalCount, 'noWrapper' => $noWrapper, 'showFilterTabs' => true, 'inlineModOptions' => $inlineModOptions);
     $view = $this->responseView('XenGallery_ViewPublic_User_Media', 'xengallery_media_user', $viewParams);
     if ($noWrapper) {
         return $view;
     } else {
         return $this->_getSiteMediaWrapper('', $view);
     }
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:35,代码来源:User.php


示例3: findNewMedia

 public function findNewMedia()
 {
     $mediaModel = $this->_getMediaModel();
     /** @var $searchModel XenForo_Model_Search */
     $searchModel = $this->_getSearchModel();
     $visitor = XenForo_Visitor::getInstance();
     $limitOptions = array('limit' => XenForo_Application::getOptions()->maximumSearchResults, 'viewCategoryIds' => $mediaModel->getViewableCategoriesForVisitor($visitor->toArray()), 'viewAlbums' => XenForo_Permission::hasPermission($visitor->permissions, 'xengallery', 'viewAlbums'), 'privacyUserId' => $visitor->user_id);
     if ($visitor->user_id) {
         $mediaIds = $mediaModel->getUnviewedMediaIds($visitor->user_id, $limitOptions);
     } else {
         $conditions = $limitOptions + array('media_date' => array('>', XenForo_Application::$time - 86400 * 7), 'deleted' => false, 'moderated' => false);
         $fetchOptions = $limitOptions + array('order' => 'media_date', 'orderDirection' => 'desc', 'join' => XenGallery_Model_Media::FETCH_USER | XenGallery_Model_Media::FETCH_ATTACHMENT | XenGallery_Model_Media::FETCH_CATEGORY | XenGallery_Model_Media::FETCH_ALBUM | XenGallery_Model_Media::FETCH_PRIVACY);
         $mediaIds = array_keys($mediaModel->getMedia($conditions, $fetchOptions));
     }
     if ($mediaIds) {
         $media = $mediaModel->getMedia(array('media_id' => $mediaIds, 'view_user_id' => $visitor->getUserId()), array('join' => XenGallery_Model_Media::FETCH_USER | XenGallery_Model_Media::FETCH_ATTACHMENT | XenGallery_Model_Media::FETCH_CATEGORY | XenGallery_Model_Media::FETCH_ALBUM | XenGallery_Model_Media::FETCH_LAST_VIEW));
         $media = $mediaModel->prepareMedia($media);
     }
     $results = array();
     foreach ($mediaIds as $mediaId) {
         if (isset($media[$mediaId])) {
             $results[] = array(XenForo_Model_Search::CONTENT_TYPE => 'xengallery_media', XenForo_Model_Search::CONTENT_ID => $mediaId);
         }
     }
     $search = $searchModel->insertSearch($results, 'xengallery_media', '', array('findNew'), 'date', false);
     return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('find-new/media', $search));
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:27,代码来源:FindNew.php


示例4: getImage

 public static function getImage($content, $params, XenForo_Template_Abstract $template)
 {
     $posts = $template->getParam('posts');
     if (!count($posts)) {
         return $content;
     }
     $visitor = XenForo_Visitor::getInstance();
     $matches = array();
     foreach ($posts as $post) {
         if (XenForo_Permission::hasPermission($visitor['permissions'], 'forum', 'viewAttachment')) {
             preg_match('#\\[attach(=[^\\]]*)?\\](?P<id>\\d+)(\\D.*)?\\[/attach\\]#iU', $post['message'], $matches);
             if (!empty($matches[2])) {
                 $link = XenForo_Link::buildPublicLink('full:attachments', array('attachment_id' => $matches[2]));
                 if (!empty($link)) {
                     return $link;
                 }
             }
         }
         preg_match('/\\[(img|IMG)\\]\\s*(https?:\\/\\/([^*\\r\\n]+|[a-z0-9\\/\\\\._\\- !]+))\\[\\/(img|IMG)\\]/', $post['message'], $matches);
         if (!empty($matches[2])) {
             return $matches[2];
         }
     }
     return $content;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:25,代码来源:Callback.php


示例5: getPushableDataForNode

 /**
  * Gets the effective data that can be pushed up to a parent node.
  *
  * @param array $node Current node info
  * @param array $childPushable List of pushable data from all child nodes: [node id] => pushable data
  * @param array $permissions Permissions for this node
  *
  * @return array List of pushable data (key-value pairs)
  */
 public function getPushableDataForNode(array $node, array $childPushable, array $permissions)
 {
     if (!XenForo_Permission::hasContentPermission($permissions, 'viewOthers')) {
         return $this->_compileForumLikePushableData(array('privateInfo' => true), $childPushable);
     }
     return $this->_getForumLikePushableData($node, $childPushable);
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:16,代码来源:Forum.php


示例6: getVisibleModerationQueueEntriesForUser

 /**
  * Gets visible moderation queue entries for specified user.
  *
  * @see XenForo_ModerationQueueHandler_Abstract::getVisibleModerationQueueEntriesForUser()
  */
 public function getVisibleModerationQueueEntriesForUser(array $contentIds, array $viewingUser)
 {
     /* @var $resourceModel XenResource_Model_Resource */
     $resourceModel = XenForo_Model::create('XenResource_Model_Resource');
     $resources = $resourceModel->getResourcesByIds($contentIds, array('join' => XenResource_Model_Resource::FETCH_DESCRIPTION));
     $categories = XenForo_Model::create('XenResource_Model_Category')->getAllCategories(array('permissionCombinationId' => $viewingUser['permission_combination_id']));
     $output = array();
     foreach ($resources as $resource) {
         if (!isset($categories[$resource['resource_category_id']])) {
             continue;
         }
         $category = $categories[$resource['resource_category_id']];
         $categoryPermissions = XenForo_Permission::unserializePermissions($category['category_permission_cache']);
         $canManage = true;
         if (!$resourceModel->canViewResourceAndContainer($resource, $category, $null, $viewingUser, $categoryPermissions)) {
             $canManage = false;
         } else {
             if (!XenForo_Permission::hasContentPermission($categoryPermissions, 'editAny') || !XenForo_Permission::hasContentPermission($categoryPermissions, 'deleteAny') || !XenForo_Permission::hasContentPermission($categoryPermissions, 'approveUnapprove')) {
                 $canManage = false;
             }
         }
         if ($canManage) {
             $output[$resource['resource_id']] = array('message' => $resource['description'], 'user' => array('user_id' => $resource['user_id'], 'username' => $resource['username']), 'title' => $resource['title'], 'link' => XenForo_Link::buildPublicLink('resources', $resource), 'contentTypeTitle' => new XenForo_Phrase('resource'), 'titleEdit' => true);
         }
     }
     return $output;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:32,代码来源:Resource.php


示例7: publishPendingDrafts

 public function publishPendingDrafts()
 {
     $GLOBALS[bdSocialShare_Listener::XI_BLOG_MODEL_DRAFT_PUBLISH_PENDING] = $this;
     $response = parent::publishPendingDrafts();
     /* @var $publisherModel bdSocialShare_Model_Publisher */
     $publisherModel = $this->getModelFromCache('bdSocialShare_Model_Publisher');
     /* @var $userModel XenForo_Model_User */
     $userModel = $this->getModelFromCache('XenForo_Model_User');
     foreach ($this->_bdSocialShare_publishPendingDrafts_drafts as $hash => &$draftDw) {
         $entryDw =& $this->_bdSocialShare_publishPendingDrafts_entries[$hash];
         $scheduled = bdSocialShare_Helper_Common::unserializeOrFalse($draftDw->get('bdsocialshare_scheduled'));
         if (!empty($scheduled) and !empty($scheduled['targets'])) {
             if (empty($users[$entryDw->get('user_id')])) {
                 $users[$entryDw->get('user_id')] = $userModel->getVisitingUserById($entryDw->get('user_id'));
                 $users[$entryDw->get('user_id')] = $userModel->prepareUser($users[$entryDw->get('user_id')]);
                 $users[$entryDw->get('user_id')]['permissions'] = XenForo_Permission::unserializePermissions($users[$entryDw->get('user_id')]['global_permission_cache']);
             }
             if (!empty($users[$entryDw->get('user_id')])) {
                 $shareable = new bdSocialShare_Shareable_XI_Blog_Entry($entryDw);
                 $publisherModel->publishScheduled($scheduled, $shareable, $users[$entryDw->get('user_id')]);
                 $publisherModel->postPublish($shareable, false, $users[$entryDw->get('user_id')]);
             }
         }
     }
     return $response;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:26,代码来源:Draft.php


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


示例9: _canViewAttachment

 /**
  * Determines if the specified attachment can be viewed.
  *
  * @see XenForo_AttachmentHandler_Abstract::_canViewAttachment()
  */
 protected function _canViewAttachment(array $attachment, array $viewingUser)
 {
     $mediaModel = $this->_getMediaModel();
     $fetchOptions = array('join' => XenGallery_Model_Media::FETCH_USER | XenGallery_Model_Media::FETCH_ATTACHMENT | XenGallery_Model_Media::FETCH_CATEGORY | XenGallery_Model_Media::FETCH_ALBUM, 'watchUserId' => $viewingUser['user_id']);
     if (XenForo_Permission::hasPermission($viewingUser['permissions'], 'xengallery', 'viewDeleted')) {
         $fetchOptions['join'] |= XenGallery_Model_Media::FETCH_DELETION_LOG;
     }
     $mediaId = $mediaModel->getMediaIdByAttachmentId($attachment['attachment_id']);
     $media = $mediaModel->getMediaById($mediaId, $fetchOptions);
     if (!$media) {
         return false;
     }
     if (!empty($media['album_id'])) {
         $albumModel = $this->_getAlbumModel();
         $media = $albumModel->prepareAlbumWithPermissions($media);
         if (!$albumModel->canViewAlbum($media, $null, $viewingUser)) {
             return false;
         }
     }
     if (!empty($media['category_id'])) {
         if (!$this->_getCategoryModel()->canViewCategory($media, $null, $viewingUser)) {
             return false;
         }
     }
     if (!$mediaModel->canViewDeletedMedia($error, $viewingUser) && $media['media_state'] == 'deleted') {
         return false;
     }
     if (!$mediaModel->canViewUnapprovedMedia($error, $viewingUser) && $media['media_state'] == 'moderated') {
         return false;
     }
     return true;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:37,代码来源:Media.php


示例10: getVisibleModerationQueueEntriesForUser

 /**
  * Gets visible moderation queue entries for specified user.
  *
  * @see XenForo_ModerationQueueHandler_Abstract::getVisibleModerationQueueEntriesForUser()
  */
 public function getVisibleModerationQueueEntriesForUser(array $contentIds, array $viewingUser)
 {
     /* @var $profilePostModel XenForo_Model_ProfilePost */
     $profilePostModel = XenForo_Model::create('XenForo_Model_ProfilePost');
     $profilePosts = $profilePostModel->getProfilePostsByIds($contentIds);
     $profileUserIds = array();
     foreach ($profilePosts as $profilePost) {
         $profileUserIds[] = $profilePost['profile_user_id'];
     }
     $users = XenForo_Model::create('XenForo_Model_User')->getUsersByIds($profileUserIds, array('join' => XenForo_Model_User::FETCH_USER_PRIVACY, 'followingUserId' => $viewingUser['user_id']));
     $output = array();
     foreach ($profilePosts as $profilePost) {
         if (!isset($users[$profilePost['profile_user_id']])) {
             continue;
         }
         $user = $users[$profilePost['profile_user_id']];
         $canManage = true;
         if (!$profilePostModel->canViewProfilePostAndContainer($profilePost, $user, $null, $viewingUser)) {
             $canManage = false;
         } else {
             if (!XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'editAny') || !XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'deleteAny')) {
                 $canManage = false;
             }
         }
         if ($canManage) {
             $output[$profilePost['profile_post_id']] = array('message' => $profilePost['message'], 'user' => array('user_id' => $profilePost['user_id'], 'username' => $profilePost['username']), 'title' => new XenForo_Phrase('profile_post_for_x', array('username' => $user['username'])), 'link' => XenForo_Link::buildPublicLink('profile-posts', $profilePost), 'contentTypeTitle' => new XenForo_Phrase('profile_post'), 'titleEdit' => false);
         }
     }
     return $output;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:35,代码来源:ProfilePost.php


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


示例12: getVisibleReportsForUser

 /**
  * Gets the visible reports of this content type for the viewing user.
  *
  * @see XenForo_ReportHandler_Abstract:getVisibleReportsForUser()
  */
 public function getVisibleReportsForUser(array $reports, array $viewingUser)
 {
     $reportsByForum = array();
     foreach ($reports as $reportId => $report) {
         $info = unserialize($report['content_info']);
         $reportsByForum[$info['node_id']][] = $reportId;
     }
     /* @var $forumModel XenForo_Model_Forum */
     $forumModel = XenForo_Model::create('XenForo_Model_Forum');
     $forums = $forumModel->getForumsByIds(array_keys($reportsByForum), array('permissionCombinationId' => $viewingUser['permission_combination_id']));
     $forums = $forumModel->unserializePermissionsInList($forums, 'node_permission_cache');
     foreach ($reportsByForum as $forumId => $forumReports) {
         $remove = false;
         if (!isset($forums[$forumId])) {
             $remove = true;
         } else {
             $forum = $forums[$forumId];
             if (!XenForo_Permission::hasContentPermission($forum['permissions'], 'editAnyPost') && !XenForo_Permission::hasContentPermission($forum['permissions'], 'deleteAnyPost')) {
                 $remove = true;
             }
         }
         if ($remove) {
             foreach ($forumReports as $reportId) {
                 unset($reports[$reportId]);
             }
         }
     }
     return $reports;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:34,代码来源:Post.php


示例13: actionAlbums

 public function actionAlbums()
 {
     $this->_routeMatch->setSections('xengallery');
     $albumWatchModel = $this->_getAlbumWatchModel();
     $albumModel = $this->_getAlbumModel();
     if (!$albumModel->canWatchAlbum()) {
         throw $this->getErrorOrNoPermissionResponseException();
     }
     $visitor = XenForo_Visitor::getInstance();
     $defaultOrder = 'album_date';
     $order = $this->_input->filterSingle('order', XenForo_Input::STRING, array('default' => $defaultOrder));
     $page = $this->_input->filterSingle('page', XenForo_Input::UINT);
     $perPage = XenForo_Application::getOptions()->xengalleryMediaMaxPerPage;
     $albums = array();
     $conditions = array();
     $fetchOptions = array();
     $albumIds = $albumWatchModel->getUserAlbumWatchByUser($visitor['user_id']);
     if ($albumIds) {
         $conditions = array('deleted' => XenForo_Permission::hasPermission($visitor->permissions, 'xengallery', 'viewDeleted'), 'privacyUserId' => $visitor->user_id, 'viewCategoryIds' => $this->getModelFromCache('XenGallery_Model_Media')->getViewableCategoriesForVisitor(), 'album_id' => array_keys($albumIds));
         $fetchOptions = array('order' => $order ? $order : $defaultOrder, 'orderDirection' => 'desc', 'page' => $page, 'perPage' => $perPage, 'join' => XenGallery_Model_Album::FETCH_PRIVACY | XenGallery_Model_Album::FETCH_USER);
         $albums = $albumModel->getAlbums($conditions, $fetchOptions);
         $albums = $albumModel->prepareAlbums($albums);
         foreach ($albums as $albumId => &$album) {
             $album = array_merge($albumIds[$albumId], $album);
         }
     }
     $pageNavParams = array('order' => $order != $defaultOrder ? $order : false);
     $viewParams = array('albums' => $albums, 'albumCount' => $albums ? $albumModel->countAlbums($conditions, $fetchOptions) : 0, 'canViewRatings' => $this->_getMediaModel()->canViewRatings(), 'canViewComments' => $this->_getCommentModel()->canViewComments(), 'order' => $order, 'defaultOrder' => $defaultOrder, 'page' => $page, 'perPage' => $perPage, 'pageNavParams' => $pageNavParams, 'watchPage' => true, 'hideFilterMenu' => true);
     return $this->responseView('XenGallery_ViewPublic_Watched_Albums', 'xengallery_watch_albums', $viewParams);
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:30,代码来源:Watched.php


示例14: getVisibleReportsForUser

 /**
  * Gets the visible reports of this content type for the viewing user.
  *
  * @see XenForo_ReportHandler_Abstract:getVisibleReportsForUser()
  */
 public function getVisibleReportsForUser(array $reports, array $viewingUser)
 {
     $reportsByUser = array();
     foreach ($reports as $reportId => $report) {
         $info = unserialize($report['content_info']);
         $reportsByUser[$info['profile_user_id']][] = $reportId;
     }
     $users = XenForo_Model::create('XenForo_Model_User')->getUsersByIds(array_keys($reportsByUser), array('join' => XenForo_Model_User::FETCH_USER_PRIVACY, 'followingUserId' => $viewingUser['user_id']));
     $userProfileModel = XenForo_Model::create('XenForo_Model_UserProfile');
     foreach ($reportsByUser as $userId => $userReports) {
         $remove = false;
         if (isset($users[$userId]) && !$userProfileModel->canViewFullUserProfile($users[$userId], $null, $viewingUser)) {
             $remove = true;
         } else {
             if (!XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'editAny') && !XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'deleteAny')) {
                 $remove = true;
             }
         }
         if ($remove) {
             foreach ($userReports as $reportId) {
                 unset($reports[$reportId]);
             }
         }
     }
     return $reports;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:31,代码来源:ProfilePostComment.php


示例15: getVisibleReportsForUser

 public function getVisibleReportsForUser(array $reports, array $viewingUser)
 {
     $teamIds = array();
     foreach ($reports as $reportId => $report) {
         $info = unserialize($report['content_info']);
         $teamIds[$info['team_id']][] = $reportId;
     }
     $teamModel = XenForo_Model::create('Nobita_Teams_Model_Team');
     $teams = $teamModel->getTeamsByIds(array_keys($teamIds), array('join' => Nobita_Teams_Model_Team::FETCH_CATEGORY | Nobita_Teams_Model_Team::FETCH_PRIVACY | Nobita_Teams_Model_Team::FETCH_PROFILE));
     foreach ($teamIds as $teamId => $teamReports) {
         $remove = false;
         if (!isset($teams[$teamId])) {
             $remove = true;
         } else {
             $team = $teams[$teamId];
             if (!XenForo_Permission::hasPermission($viewingUser['permissions'], 'Teams', 'editPostAny') && !XenForo_Permission::hasPermission($viewingUser['permissions'], 'Teams', 'deletePostAny')) {
                 $remove = true;
             }
         }
         if ($remove) {
             foreach ($teamReports as $reportId) {
                 unset($teamReports[$reportId]);
             }
         }
     }
     return $reports;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:27,代码来源:Post.php


示例16: getPermissions

 public function getPermissions(array $viewingUser = null)
 {
     $this->standardizeViewingUserReference($viewingUser);
     $perms['custom'] = XenForo_Permission::hasPermission($viewingUser['permissions'], 'EWRporta', 'canCustom') ? true : false;
     $perms['promote'] = XenForo_Permission::hasPermission($viewingUser['permissions'], 'EWRporta', 'canPromote') ? true : false;
     return $perms;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:Perms.php


示例17: getVisibleModerationQueueEntriesForUser

 /**
  * Gets visible moderation queue entries for specified user.
  *
  * @see XenForo_ModerationQueueHandler_Abstract::getVisibleModerationQueueEntriesForUser()
  */
 public function getVisibleModerationQueueEntriesForUser(array $contentIds, array $viewingUser)
 {
     /** @var XenForo_Model_ProfilePost $profilePostModel */
     $profilePostModel = XenForo_Model::create('XenForo_Model_ProfilePost');
     $comments = $profilePostModel->getProfilePostCommentsByIds($contentIds);
     $profilePostIds = XenForo_Application::arrayColumn($comments, 'profile_post_id');
     $profilePosts = $profilePostModel->getProfilePostsByIds($profilePostIds, array('join' => XenForo_Model_ProfilePost::FETCH_USER_RECEIVER | XenForo_Model_ProfilePost::FETCH_USER_RECEIVER_PRIVACY | XenForo_Model_ProfilePost::FETCH_USER_POSTER, 'visitingUser' => $viewingUser));
     $output = array();
     foreach ($comments as $key => &$comment) {
         if (isset($profilePosts[$comment['profile_post_id']])) {
             $comment['profilePost'] = $profilePosts[$comment['profile_post_id']];
             $comment['profileUser'] = $profilePostModel->getProfileUserFromProfilePost($comment['profilePost'], $viewingUser);
             if (!$comment['profilePost'] || !$comment['profileUser']) {
                 continue;
             }
             $canManage = true;
             if (!$profilePostModel->canViewProfilePostAndContainer($comment['profilePost'], $comment['profileUser'], $null, $viewingUser)) {
                 $canManage = false;
             } else {
                 if (!$profilePostModel->canViewProfilePostComment($comment, $comment['profilePost'], $comment['profileUser'], $null, $viewingUser)) {
                     $canManage = false;
                 } else {
                     if (!XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'editAny') || !XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'deleteAny')) {
                         $canManage = false;
                     }
                 }
             }
             if ($canManage) {
                 $output[$comment['profile_post_comment_id']] = array('message' => $comment['message'], 'user' => array('user_id' => $comment['user_id'], 'username' => $comment['username']), 'title' => new XenForo_Phrase('profile_post_comment_by_x', array('username' => $comment['username'])), 'link' => XenForo_Link::buildPublicLink('profile-posts/comments', $comment), 'contentTypeTitle' => new XenForo_Phrase('profile_post_comment'), 'titleEdit' => false);
             }
         }
     }
     return $output;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:39,代码来源:ProfilePostComment.php


示例18: _getContent

 protected function _getContent(array $contentIds, array $viewingUser)
 {
     $mediaModel = $this->_getMediaModel();
     $conditions = array('media_id' => $contentIds, 'privacyUserId' => $viewingUser['user_id'], 'deleted' => $mediaModel->canViewDeletedMedia($null, $viewingUser), 'moderated' => $mediaModel->canViewUnapprovedMedia($null, $viewingUser), 'viewAlbums' => XenForo_Permission::hasPermission($viewingUser['permissions'], 'xengallery', 'viewAlbums'), 'viewCategoryIds' => $mediaModel->getViewableCategoriesForVisitor($viewingUser));
     $fetchOptions = array('join' => XenGallery_Model_Media::FETCH_USER | XenGallery_Model_Media::FETCH_ALBUM | XenGallery_Model_Media::FETCH_CATEGORY | XenGallery_Model_Media::FETCH_PRIVACY);
     return $mediaModel->getMedia($conditions, $fetchOptions);
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:7,代码来源:Media.php


示例19: canViewSimilarUsernames

 /**
  * Determines if permissions are sufficient to view similar usernames for
  * the given user.
  *
  * @param array $user User being viewed
  * @param string $errorPhraseKey Returned by ref. Phrase key of more
  * specific error
  * @param array|null $viewingUser Viewing user ref
  *
  * @return boolean
  */
 public function canViewSimilarUsernames(array $user, &$errorPhraseKey = '', array $viewingUser = null)
 {
     if (empty($user['user_id'])) {
         return false;
     }
     $this->standardizeViewingUserReference($viewingUser);
     return XenForo_Permission::hasPermission($viewingUser['permissions'], 'general', 'similarUsernames');
 }
开发者ID:ThemeHouse-XF,项目名称:SimilarUsernam,代码行数:19,代码来源:User.php


示例20: canViewThreadsInWatchedForums

 /**
  * Determines if a user can view the lists of threads in watched forums
  *
  * @param string $errorPhraseKey
  * @param array|null $viewingUser
  *
  * @return boolean
  */
 public function canViewThreadsInWatchedForums(&$errorPhraseKey = '', array $viewingUser = null)
 {
     $this->standardizeViewingUserReference($viewingUser);
     if (!$viewingUser['user_id'] || !XenForo_Permission::hasPermission($viewingUser['permissions'], 'general', 'viewThreadsWatchedForums')) {
         return false;
     }
     return true;
 }
开发者ID:ThemeHouse-XF,项目名称:WatchedForums,代码行数:16,代码来源:ForumWatch.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XenForo_Router类代码示例发布时间:2022-05-23
下一篇:
PHP XenForo_Model类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap