private function getTransformedContent(WikiPage $wiki_page, WikiPageVersion $version, WikiRequest $request) { $dbi = $request->_dbi; $page_db = $dbi->getPage($wiki_page->getPagename()); $revision = $page_db->getRevision($version->getVersionId()); return $revision->getTransformedContent(); }
/** * _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; }
/** * pagePerms - public View */ function _pagePerms($postUrl = '') { $wp = new WikiPage($_REQUEST['id']); $pagename = $wp->getPagename(); $eM =& EventManager::instance(); $referenced = false; $eM->processEvent('isWikiPageReferenced', array('referenced' => &$referenced, 'wiki_page' => $pagename, 'group_id' => $this->gid)); if ($referenced) { $label = ''; $eM->processEvent('getPermsLabelForWiki', array('label' => &$label)); print '<p align="center"><br><b>' . $label . '</b></p>'; } else { print $GLOBALS['Language']->getText('wiki_views_wikiviews', 'set_perm_title'); if (empty($pagename)) { print $GLOBALS['Language']->getText('wiki_views_wikiviews', 'empty_page'); } else { print $GLOBALS['Language']->getText('wiki_views_wikiviews', 'not_empty_page', array($pagename)); permission_display_selection_form("WIKIPAGE_READ", $wp->getId(), $this->gid, $postUrl); } } }
/** * * @param WikiPage $wiki_page */ public function updatePermissions(WikiPage $wiki_page) { $this->logger->debug('[Wiki] ElasticSearch: update permissions of wiki page ' . $wiki_page->getPagename() . ' #' . $wiki_page->getId()); $update_data = array(); $this->request_data_factory->setUpdatedData($update_data, 'permissions', $this->request_data_factory->getCurrentPermissions($wiki_page)); $this->indexOrUpdate($wiki_page->getGid(), $wiki_page->getId(), $update_data); }
/** * */ function setWikiPagePerms() { global $feedback; $wp = new WikiPage($_POST['object_id']); if ($_POST['reset']) { $ret = $wp->resetPermissions(); } else { $ret = $wp->setPermissions($_POST['ugroups']); } if (!$ret) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('wiki_actions_wikiserviceadmin', 'update_page_perm_err', array($feedback))); } $event_manager = EventManager::instance(); $event_manager->processEvent("wiki_page_permissions_updated", array('group_id' => $wp->getGid(), 'wiki_page' => $wp->getPagename())); }
public function getIndexedWikiPageData(WikiPage $wiki_page) { $wiki_page_metadata = $wiki_page->getMetadata(); return array('id' => $wiki_page->getId(), 'group_id' => $wiki_page->getGid(), 'page_name' => $wiki_page->getPagename(), 'last_modified_date' => date('c', $wiki_page_metadata[self::PHPWIKI_METADATA_LAST_MODIFIED_DATE]), 'last_author' => $wiki_page_metadata[self::PHPWIKI_METADATA_AUTHOR_ID], 'last_summary' => isset($wiki_page_metadata[self::PHPWIKI_METADATA_SUMMARY]) ? $wiki_page_metadata[self::PHPWIKI_METADATA_SUMMARY] : '', 'content' => isset($wiki_page_metadata[self::PHPWIKI_METADATA_CONTENT]) ? $wiki_page_metadata[self::PHPWIKI_METADATA_CONTENT] : '', 'permissions' => $this->getCurrentPermissions($wiki_page)); }