/** @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); } foreach ($row_pages as $page) { $wiki_page = new PHPWikiPage($project_id, $page['pagename']); if ($wiki_page->isAutorized($user->getId())) { $pages[] = $wiki_page; } } return new PaginatedPHPWikiPages($pages); }
/** * _buildPageLink - private * * @param PHPWikiPage $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; } $title = $this->purifier->purify($title, CODENDI_PURIFIER_CONVERT_HTML); $link = PHPWIKI_PLUGIN_BASE_URL . '/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; }
/** * 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('plugin_phpwiki_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 PHPWikiPage($this->gid, $_REQUEST['pagename']); if (!$wp->isAutorized(user_getid())) { $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_phpwiki_wikiservice', 'acces_denied_page', session_make_url("/project/memberlist.php?group_id=" . $this->gid)), CODENDI_PURIFIER_DISABLED); exit_permission_denied(); } } }