$url = url; // Test to see if this is a valid user. if (!$page_owner) { // Nothing returned by the run command, not a valid user. error('Sorry, but "' . $username . '" is not a valid username in this system.'); die; } else { $profile_id = $page_owner; $name = run('users:display:name', $page_owner); } // Look to see if a page param was passed. If not, find out what page // is set as this user's default homepage. If so, translate title into // a page_ident. if ($page_title == '') { // Because the home page can have its name changed, search to pull up the correct record. $page = folio_homepage($username); if ($page) { $page_title = $page->title; $page_ident = $page->page_ident; } else { // Homepage hasn't been created yet. $page_title = 'Home Page'; $page_ident = -1; error('You can not view history for the Homepage when it has not yet been created'); } } else { // Transate the page & user vars into an int $page_ident $page_ident = folio_page_translatetitle($username, $page_title); } // If we found a matching page, retrieve record & permissions. if ($page_ident != -1) {
if ($page_ident == -1) { error('Could not find page ' . $page_title . ' for user ' . $username . ' to add a page under.' . ' Exception thrown by _folio/edit.php'); } $parentpage_ident = $page_ident; $page_title = 'New Page'; $page = false; $permissions = false; } elseif ($page_ident != -1) { // If we found a matching page, retrieve parent ident. $parentpage_ident = $page->parentpage_ident; } 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.