$currentpage = folio_page_select($page_ident, -1); $page_title = $currentpage->title; // Test to see if we have permissions $ok = folio_page_permission($page, $permissions, 'read', $profile_id); $ok_write = folio_page_permission($page, $permissions, 'write', $profile_id); // If we have permissions to view the page, then continue loading controls. // Also has the side effect of not loading other controls if the page hasnt' been // created yet. if ($ok) { // Build nice titles $html_title = "<a href='{$url}{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}_folio/images/xml.gif' /></a> {$name} : " . folio_control_breadcrumb($page, $username); $plain_title = $page->title; // See if we're trying to revert the page. Need to check security. if ($revert == 'T' && $ok_write) { // Revert $body = "<p align='center'><b>Restore this older version of the page.</b></p><br/>" . folio_page_edit($page, $permissions, $page_title, $username, $page->parentpage_ident); } else { // Just viewing. // Build warning if this is an older version of the page. if ($page->newest != 1) { // Create warning link $body = "<p align='center'><b>You are looking at an archived version of this page.</b><br/>" . "<a href='{$url}{$username}/page/" . folio_page_encodetitle($page_title) . "'>return to current version</a>"; if ($ok_write) { $body .= " :: " . "<a href='{$url}{$username}/page/{$page_ident}:{$created}/revert'>restore this version</a></p>\n"; } } else { $body = ''; } // Run the command to actually retrieve the content. $body .= folio_page_view($page_ident, $page_title, $created, $page, $username); }
} else { // No matches. We're creating a new page from someone clicking on a [[new page link]], // or are creating the homepage for the first time. Always make parentpage = homepage. $page = false; $permissions = false; $parentpage_ident = folio_homepage($username); if (!$parentpage_ident) { // Unable to find homepage. Initialize. $parentpage_ident = folio_homepage_initialize($username); } else { // Found homepage. $parentpage_ident = $parentpage_ident->page_ident; } if ($page_title == 'Home Page') { // Creating the homepage for the first time. $page_ident = $parentpage_ident; $page = folio_page_select($parentpage_ident); $permissions = folio_page_security_select($page_ident); } } // Build the html controls for the page. $body = folio_page_edit($page, $permissions, $page_title, $username, $parentpage_ident); // Reset the side menu after defining the comment on variables. $comment_on_type = 'page'; $comment_on_ident = $page_ident; //not sure why he wanted to burn the sidebar, putting it back - JK //$function['display:sidebar'] = array(path . "mod/folio/page_edit_menu.php"); } header("Cache-control: private"); $body = templates_draw(array('context' => 'contentholder', 'title' => $title, 'body' => $body)); echo templates_page_draw(array($title, $body));