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


PHP WikiPage::isAutorized方法代码示例

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


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

示例1: getContent

 function getContent()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $content = '';
     $p = new WikiPage($this->wikipage_group_id, $this->wikipage_wiki_page);
     //Todo: prevent wiki initialisation
     //Todo: prevent whole wiki permission bypassing
     //Todo: fix internal link (make them link to /wiki/ instead of current location (eg: /my/widgets )
     //Todo: display a link to go to the page
     //Todo: check that page exists before doing something
     if ($p->isAutorized(UserManager::instance()->getCurrentUser()->getId())) {
         $content .= $p->render($lite = true, $full_screen = true);
     }
     return $content;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:15,代码来源:Widget_WikiPage.class.php

示例2: getPaginatedUserPages

 /** @return PaginatedWikiPages */
 public function getPaginatedUserPages(PFUser $user, $project_id, $limit, $offset, $pagename)
 {
     $pages = array();
     if ($pagename !== '') {
         $row_pages = $this->dao->searchPaginatedUserWikiPagesByPagename($project_id, $limit, $offset, $pagename);
     } else {
         $row_pages = $this->dao->searchPaginatedUserWikiPages($project_id, $limit, $offset);
     }
     $total_size = (int) $this->dao->foundRows();
     foreach ($row_pages as $page) {
         $wiki_page = new WikiPage($project_id, $page['pagename']);
         if ($wiki_page->isAutorized($user->getId())) {
             $pages[] = $wiki_page;
         }
     }
     return new PaginatedWikiPages($pages, $total_size);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:18,代码来源:PaginatedWikiPagesFactory.class.php

示例3: urlencode

 /**
  * _buildPageLink - private
  *
  * @param  WikiPage $wikiPage
  * @param  string   $title
  * @return string   $href
  */
 function _buildPageLink(&$wikiPage, $title = null)
 {
     $href = '';
     // Check permission
     if ($wikiPage->isAutorized(user_getid())) {
         $pagename = $wikiPage->getPagename();
         // Build page link
         if (empty($title)) {
             $title = $pagename;
         }
         $link = '/wiki/index.php?group_id=' . $this->gid . '&pagename=' . urlencode($pagename);
         // Display title as emphasis if corresponding page does't exist.
         if ($wikiPage->isEmpty()) {
             $title = '<em>' . $title . '</em>';
             $link .= '&action=edit';
         }
         // Build Lock image if a permission is set on the corresponding page
         if ($wikiPage->permissionExist()) {
             $permLink = $this->wikiLink . '&view=pagePerms&id=' . $wikiPage->getId();
             $title = $title . '<img src="' . util_get_image_theme("ic/lock.png") . '" border="0" alt="Lock" />';
         }
         $href = '<a href="' . $link . '">' . $title . '</a>';
     }
     return $href;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:32,代码来源:WikiServiceViews.class.php

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

示例5: checkPermissions

 /**
  * Check access permissions for wiki and wiki pages.
  *
  * Check restriction for:
  *  wiki: whole wiki can be restricted.
  *  wikipage: each page of the wiki can be restricted.
  */
 function checkPermissions()
 {
     // Check if user can access to whole wiki
     if (!$this->wiki->isAutorized(user_getid())) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('wiki_wikiservice', 'acces_denied_whole', session_make_url("/project/memberlist.php?group_id=" . $this->gid)), CODENDI_PURIFIER_DISABLED);
         exit_permission_denied();
     }
     // Check if user can access to selected page
     if (!empty($_REQUEST['pagename'])) {
         $wp = new WikiPage($this->gid, $_REQUEST['pagename']);
         if (!$wp->isAutorized(user_getid())) {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('wiki_wikiservice', 'acces_denied_page', session_make_url("/project/memberlist.php?group_id=" . $this->gid)), CODENDI_PURIFIER_DISABLED);
             exit_permission_denied();
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:23,代码来源:WikiService.class.php


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