doNotCacheCurrentPage(); # display error message indicating no ID ?>

# Error

No page ID was supplied.setPageTitle("Page Not Found"); return; } # if no page found with specified ID $PFactory = new PageFactory(); $Id = (int)$_GET["ID"]; if (!is_numeric($_GET["ID"]) || !$PFactory->itemExists($Id)) { $AF->doNotCacheCurrentPage(); # display error message indicating page not found ?>

# Error

No page found with specified ID. setPageTitle("Page Not Found"); return; } # retrieve page $Page = new Page($Id); # retrieve user currently logged in $User = User::getCurrentUser(); # if user cannot view this page if (!$Page->userCanView($User)) { # display unauthorized access message $AF->setPageTitle("Unauthorized Access"); ?>

# Unauthorized Access

You do not have the permissions required to view this page.

setPageTitle($Page->get("Title")); # display edit and delete buttons if appropriate if ($Page->userCanEdit($User)) { $Editor = new \Metavus\InlineEditingUI( "index.php?P=P_Pages_InlineEdit&ID=".$Id ); $RestingControls = [ ".cw-pages-controls.cw-pages-delete", ".cw-pages-controls.cw-folders-addresource", ]; $EditingControls = [ ".cw-pages-controls.cw-pages-edit", ]; $Editor->onDiscardShowSelectors($RestingControls); $Editor->onCancelShowSelectors($RestingControls); $Editor->onSaveShowSelectors($RestingControls); $Editor->onEditShowSelectors($EditingControls); print ''; $DeleteButton = new HtmlButton("Delete"); $DeleteButton->setIcon("Delete.svg"); $DeleteButton->setSize(HtmlButton::SIZE_SMALL); $DeleteButton->addClass("float-end cw-pages-delete"); $DeleteButton->addSemanticClass("btn-danger"); $DeleteButton->setLink("index.php?P=P_Pages_DeletePage&ID=" . $Id); $FullEditorButton = new HtmlButton("Full Editor"); $FullEditorButton->setIcon("Pencil.svg"); $FullEditorButton->setSize(HtmlButton::SIZE_SMALL); $FullEditorButton->addClass("float-end cw-pages-edit"); $FullEditorButton->setLink("index.php?P=P_Pages_EditPage&ID=" . $Id); print $DeleteButton->getHtml(); print $FullEditorButton->getHtml(); $AF->signalEvent( "EVENT_HTML_INSERTION_POINT", [ $AF->getPageName(), "Resource Display Buttons", ["Resource" => $Page] ] ); ?> getEditingControlsHtml(); } # add meta tag for page description $Plugin = Pages::getInstance(); $Summary = $Page->get("Summary"); if ($Summary !== null) { $Summary = $AF->escapeInsertionKeywords( $Summary, $Plugin->getAllowedInsertionKeywords() ); $AF->addMetaTag([ "name" => "description", "content" => $Summary, ]); } # retrieve page content $PageContent = $Page->get("Content"); if ($PageContent === null) { $PageContent = ""; } # keep a copy of the unmodified version $SourceData = $PageContent; # if page contains tabs if ($Page->containsTabs()) { # make sure JavaScript and CSS files needed for tabs are loaded $AF->requireUIFile('jquery-ui.js'); $AF->requireUIFile('jquery-ui.css', ApplicationFramework::ORDER_FIRST); # add in tab markup $PageContent = Page::processTabMarkup($PageContent); } # make sure only allowed insertion keywords are expanded $PageContent = $AF->escapeInsertionKeywords( $PageContent, $Plugin->getAllowedInsertionKeywords() ); # ensure all tags in the content are closed $PageContent = StdLib::closeOpenTags($PageContent); # signal view of page $AF->signalEvent( "EVENT_FULL_RECORD_VIEW", ["ResourceId" => $Page->id()] ); # display the page $AF->requireUIFile('Pages_Controls.css'); print "{{PAGES-BEFORECONTENT}}"; print "
"; print "
"; if ($Page->userCanEdit($User)) { $Editor->htmlToDisplay($PageContent); $Editor->sourceData($SourceData); $Editor->display(); } else { print $PageContent; } print "
"; print "
"; # add editing information if appropriate if ($Page->userCanEdit($User)) { $MDate = $Page->get("Date Last Modified"); $MUser = $Page->get("Last Modified By Id", true); $MUser = array_shift($MUser); $MUserName = ($MUser instanceof User) ? $MUser->name() : "(unknown)"; $EditInfo = "Last modified by " ."".$MUserName."" ." ".StdLib::getPrettyTimestamp($MDate, true) .""; ?>