Example #1
0
/**
 * View a single wiki page.  If the passed key is -1, then it will assume that we're pulling up a new page.
 * 
 * @uses CFG
 * @param int $page_ident The page being viewed. -1 If we're trying to load a non-existing page.
 * @param string $page_title The title of the page.  Important for when we're pulling up a page that hasn't been created yet.
 * @param int $created The created date for the page (optional, only used to pull up history pages, def = -1)
 * @param array $page The mysql page record.
 * @returns The html stuff to display a page.
 **/
function folio_page_view($page_ident, $page_title, $created = -1, $page, $username)
{
    global $CFG;
    //global $profile_id;
    //global $page_owner;
    $url = $CFG->wwwroot;
    $userid = $_SESSION['userid'];
    // Declare variables.
    $body = '';
    $title = 'Title';
    $parentpage_ident = -1;
    if (!$page) {
        // No results returned.  Offer to create a new page.
        if ($page_title == 'Home Page') {
            $page_body = "You can use this part of Elgg as a wiki, to collaboratively work on projects, " . "or to create an online portfolio.\n\nYou can create links to new pages by simply " . "enclosing the page title using double bracket characters.  Here's an example " . "of a link to your <a href=\"{$url}{$username}/page/" . folio_page_encodetitle($page_title) . "/edit\">[[Home Page]]</a>.";
        } else {
            $page_body = "This page has not yet been created. <a href=\"{$url}{$username}/page/" . folio_page_encodetitle($page_title) . "/edit\">Click here to start editing it</a>.";
        }
        $page_title = '';
        $creator = '';
        $created = '';
        $security_ident = $page_ident;
    } else {
        // Load values.
        $page_title = stripslashes($page->title);
        $page_body = folio_page_makelinks($username, stripslashes($page->body));
        $created = gmdate("m/d/y h:i", intval($page->created));
        $security_ident = intval($page->security_ident);
        $creator = intval($page->creator_ident);
        if ($creator < 1) {
            $creator = 'Anonymous';
        } else {
            $creator = run("users:id_to_name", $creator);
        }
    }
    // Building the html control.
    $body .= <<<END
        <p>{$page_body}</p><br/><br/>
\t\t<h1></h1>
        <p align=right><i>{$creator}, {$created} (GMT)</i></p>
END;
    return $body;
}
Example #2
0
    $comment_on_username = $username;
    $comment_on_name = $name;
    $comment_on_ident = $page_owner;
    if (!$page) {
        // Page does not exist
        // Build nice titles
        $plain_title = 'Create ' . $page_title;
        // Run the command to actually retrieve the content.
        $page_body = "<p>Page does not exist</p>";
        //                folio_page_view($page_ident,$page_title, -1, $page, $username);
    } else {
        // Viewing an existing page.
        // Build nice titles
        $plain_title = $page->title;
        // Run the command to actually retrieve the content.
        $page_body = folio_page_makelinks($username, stripslashes($page->body)) . folio_control_commentlist('page', $page_ident);
    }
    $created = gmdate("m/d/y h:i", intval($page->created));
    $security_ident = intval($page->security_ident);
    $creator = intval($page->creator_ident);
    if ($creator < 1) {
        $creator = 'Anonymous';
    } else {
        $creator = run("users:id_to_name", $creator);
    }
} else {
    // We don't have permissions, and so need some sort of title.
    $plain_title = 'You do not have permission to view this page';
    $page_body = 'You do not have permission to view this page. Please contact the page\'s' . ' owner and ask for the security to be set to <b>Public</b> or <b>Moderated</b>. ' . '  You will be able to view this page once that has been done.  If this page belongs ' . ' to a community, you may also try to join the community.  Once you are a member, ' . ' you will be able to see and edit the page.';
}
// Transfer into template & write.
Example #3
0
// The security ident needs to be set by page_edit_security_post before this can run.
if (!isset($security_ident)) {
    error('Page_Edit_post.php must be called after page_edit_security_post so that the former knows the security information');
}
$page = new StdClass();
$page->title = folio_clean(required_param('page_title'));
$page->body = required_param('page_body');
$page->page_ident = required_param('page_ident', PARAM_INT);
$page->security_ident = $security_ident;
$page->parentpage_ident = required_param('parentpage_ident', PARAM_INT);
$page->newest = 1;
$page->created = time();
$page->user_ident = required_param('user_ident');
$username = required_param('username');
// If the user isn't logged in, then set to -1 (anonymous)
// Otherwise, set the last updater to their logged in information.
if (isloggedin()) {
    $page->creator_ident = $_SESSION['userid'];
} else {
    $page->creator_ident = -1;
}
// Modify old record by converting all records matching the conditions (folio, page, newest) to newest=false.
set_field('folio_page', 'newest', 0, 'newest', 1, 'page_ident', $page->page_ident);
//var_dump( $page );
// Insert new record into db.
$insert_id = insert_record('folio_page', $page, true, 'page_ident');
// Set redirect
$redirect_url = url . $username . '/page/' . folio_page_encodetitle(required_param('page_title'));
// Create RSS record
rss_additem($page->user_ident, $username, $page->creator_ident, $_SESSION['name'], $_SESSION['username'], 'page', $insert_id, '', $page->title, folio_page_makelinks($username, $page->body), $redirect_url, optional_param('folio_control_page_edit_security_custom', 'PUBLIC'));