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) { $page = folio_page_select($page_ident); $permissions = folio_page_security_select($page_ident); } else { $page = false; $permissions = false; } // Test to see if we have permissions $ok = folio_page_permission($page, $permissions, 'read', $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 hasn't been // created yet. if ($ok && $page) { // Run the command to actually retrieve the content. $body = folio_control_historypagelist($username, $page, $page_owner); // Reset the side menu after defining the comment on variables. $comment_on_type = 'page'; $comment_on_ident = $page_ident; $comment_on_username = $username; $comment_on_name = $name; $comment_on_ident = $page_owner; // Build nice titles $html_title = "<a href='{$url}{$username}/subscribe/rss/page+page_comment/'><img border=0 src='{$url}_templates/icons/rss.png' /></a> {$name} : " . folio_control_breadcrumb($page, $username); $plain_title = $page->title;
$name = run('users:display:name', $page_owner); } // Initialize page & permissions records to false. $page = false; $permissions = false; // A page ident was passed. Pull up records & set page_title variable. $page = folio_page_select($page_ident, $created); $permissions = folio_page_security_select($page_ident); // Pull up the title of the current version of the page. // Note that we use title instead of the one of the older version of page, as all of the // various pagelists, comments, etc.. all pull off of the $page_title variable. $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) {
* @package folio * @uses includes.php * @uses $CFG * @param int $page_ident The identity key for the page. **/ // Note, this is ../ insead of ../../../ because we're called by files in /_folio, and not from the folder that this // page is actually residing inside of. require_once '../includes.php'; $url = url; // Load variables $page_ident = required_param('page_ident', PARAM_INT); // Get the record security and page information. $page = folio_page_select($page_ident); $permissions = folio_page_security_select($page_ident); if (!$page) { error("Invalid page {$page_ident} passed to page_delete_post"); } if (isloggedin() & folio_page_permission($page, $permissions, 'delete')) { // Permission to delete granted. // Turn all records with the same page_ident and newest=1 to newest = 0, effectively deleting the page. set_field('folio_page', 'newest', 0, 'page_ident', $page_ident, 'newest', 1); } else { var_dump($page); var_dump($permissions); error('You do not have permission to delete this page'); } global $redirect_url; $username = run('users:id_to_name', $page->user_ident); $redirect_url = url . $username . '/page/'; // Create 'delete' rss record. rss_additem($page->user_ident, $username, $_SESSION['userid'], $_SESSION['name'], $_SESSION['username'], 'page', $page->page_ident, '', 'Deleted ' . $page->title, $_SESSION['username'] . ' deleted the page "' . $page->title . '"', $url . $username . '/page/', 'PUBLIC');
// Run includes require_once "../includes.php"; require_once "../mod/folio/control/page_delete.php"; $title = " Wiki :: Delete Page"; // Retrieve page name & user name. // REQUIRED BY THE MENU SYSTEM (mod/folio/lib.php) $page_title = folio_page_decodetitle(required_param('page')); $username = required_param('user'); $page_owner = run('users:name_to_id', $username); $profile_id = $page_owner; // Get the $page_ident where page & user matches. $page_ident = folio_page_translatetitle($username, $page_title); $page = folio_page_select($page_ident); // Validate permissions. This also verifies to see if we have access to create a page. $permissions = folio_page_security_select($page_ident); if (!folio_page_permission($page, $permissions, 'delete')) { // User doesn't have permission to delete the page. $body = 'You do not have permission to delete this page. ' . 'You must be logged in, be deleting your own wiki page, or be a member of the community owning this page.'; $function['display:sidebar'] = array(); } elseif (folio_page_is_homepage($page)) { // Can't delete homepage $body = 'Sorry, but you can not delete a homepage.'; } else { // User does have permission to delete the page. // Build the html controls for the page. $body = folio_page_delete($page, $page_title, $username); // Reset the side menu after defining the comment on variables. $function['display:sidebar'] = array(''); } header("Cache-control: private"); $body = templates_draw(array('context' => 'contentholder', 'title' => $title, 'body' => $body));
//run("friends:init"); //run("folio:init"); $title = " Wiki :: Edit Page"; // Retrieve page name & user name. // REQUIRED BY THE MENU SYSTEM (mod/folio/lib.php) $page_title = folio_page_decodetitle(required_param('page')); $username = required_param('user'); $new = optional_param('new', 'F'); $page_owner = run('users:name_to_id', $username); $profile_id = $page_owner; // Get the $page_ident where page & user matches. $page_ident = folio_page_translatetitle($username, $page_title); $page = folio_page_select($page_ident); // Validate permissions. This also verifies to see if we have access to create a page. $permissions = folio_page_security_select($page_ident); if (!folio_page_permission($page, $permissions, 'write', $profile_id)) { // User doesn't have permission to write the page. $body = 'You do not have permission to edit this page.'; //not sure why he wanted to burn the sidebar, putting it back - JK //$function['display:sidebar'] = array(); } else { // User does have permission to edit the page. if ($new == 'T') { // Adding a new page as a child of the page title passed. // Default parentpage to the passed page title. 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;