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


PHP Wiki::isAutorized方法代码示例

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


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

示例1: getPageChangeEmails

 function getPageChangeEmails($notify)
 {
     $emails = array();
     $userids = array();
     foreach ($notify as $page => $users) {
         if (glob_match($page, $this->_pagename)) {
             foreach ($users as $userid => $user) {
                 $um = UserManager::instance();
                 $dbUser = $um->getUserByUserName($userid);
                 $wiki = new Wiki($_REQUEST['group_id']);
                 $wp = new WikiPage($_REQUEST['group_id'], $_REQUEST['pagename']);
                 if ($dbUser && ($dbUser->isActive() || $dbUser->isRestricted()) && $wiki->isAutorized($dbUser->getId()) && $wp->isAutorized($dbUser->getId())) {
                     if (!$user) {
                         // handle the case for ModeratePage: no prefs, just userid's.
                         global $request;
                         $u = $request->getUser();
                         if ($u->UserName() == $userid) {
                             $prefs = $u->getPreferences();
                         } else {
                             // not current user
                             if (ENABLE_USER_NEW) {
                                 $u = WikiUser($userid);
                                 $u->getPreferences();
                                 $prefs =& $u->_prefs;
                             } else {
                                 $u = new WikiUser($GLOBALS['request'], $userid);
                                 $prefs = $u->getPreferences();
                             }
                         }
                         $emails[] = user_getemail_from_unix($userid);
                         $userids[] = $userid;
                     } else {
                         if (!empty($user['verified']) and !empty($user['email'])) {
                             $emails[] = user_getemail_from_unix($userid);
                             $userids[] = $userid;
                         } elseif (!empty($user['email'])) {
                             global $request;
                             // do a dynamic emailVerified check update
                             $u = $request->getUser();
                             if ($u->UserName() == $userid) {
                                 if ($request->_prefs->get('emailVerified')) {
                                     $emails[] = user_getemail_from_unix($userid);
                                     $userids[] = $userid;
                                     $notify[$page][$userid]['verified'] = 1;
                                     $request->_dbi->set('notify', $notify);
                                 }
                             } else {
                                 // not current user
                                 if (ENABLE_USER_NEW) {
                                     $u = WikiUser($userid);
                                     $u->getPreferences();
                                     $prefs =& $u->_prefs;
                                 } else {
                                     $u = new WikiUser($GLOBALS['request'], $userid);
                                     $prefs = $u->getPreferences();
                                 }
                                 if ($prefs->get('emailVerified')) {
                                     $emails[] = user_getemail_from_unix($userid);
                                     $userids[] = $userid;
                                     $notify[$page][$userid]['verified'] = 1;
                                     $request->_dbi->set('notify', $notify);
                                 }
                             }
                             // ignore verification
                             /*
                             if (DEBUG) {
                                 if (!in_array($user['email'],$emails))
                                     $emails[] = $user['email'];
                             }
                             */
                         }
                     }
                 }
             }
         }
     }
     $emails = array_unique($emails);
     $userids = array_unique($userids);
     return array($emails, $userids);
 }
开发者ID:nterray,项目名称:tuleap,代码行数:80,代码来源:WikiDB.php

示例2: getSearchResults

 public function getSearchResults(array $result)
 {
     $results = array();
     $validator = new ElasticSearch_1_2_ResultValidator();
     if (!isset($result['hits']['hits'])) {
         return $results;
     }
     $user = $this->user_manager->getCurrentUser();
     foreach ($result['hits']['hits'] as $hit) {
         $project = $this->project_manager->getProject($this->extractGroupIdFromHit($hit));
         $index = $this->extractIndexFromHit($hit);
         if ($project->isError()) {
             continue;
         }
         try {
             $this->url_verification->userCanAccessProject($user, $project);
         } catch (Project_AccessPrivateException $exception) {
             continue;
         }
         switch ($index) {
             case fulltextsearchPlugin::SEARCH_DOCMAN_TYPE:
                 if (!$validator->isDocmanResultValid($hit)) {
                     continue;
                 }
                 $results[] = new ElasticSearch_SearchResultDocman($hit, $project);
                 break;
             case fulltextsearchPlugin::SEARCH_WIKI_TYPE:
                 if (!$validator->isWikiResultValid($hit)) {
                     continue;
                 }
                 $wiki = new Wiki($project->getID());
                 if ($wiki->isAutorized($user->getId())) {
                     $results[] = new ElasticSearch_SearchResultWiki($hit, $project);
                 }
                 break;
             case fulltextsearchPlugin::SEARCH_TRACKER_TYPE:
                 if (!$validator->isArtifactResultValid($hit)) {
                     continue;
                 }
                 $artifact = Tracker_ArtifactFactory::instance()->getArtifactById($hit['fields']['id'][0]);
                 if ($artifact->userCanView($user)) {
                     $results[] = new ElasticSearch_SearchResultTracker($hit, $project, $artifact);
                 }
                 break;
             default:
         }
     }
     return $results;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:49,代码来源:ResultFactory.class.php


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