Example #1
0
function community_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    $usertype = run("users:type:get", $page_owner);
    if ($usertype == "community") {
        if (defined("context") && context == "profile") {
            if (run("permissions:check", "profile")) {
                $PAGE->menu_sub[] = array('name' => 'profile:edit', 'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $page_owner . '">' . gettext("Edit this profile") . '</a>');
                $PAGE->menu_sub[] = array('name' => 'community:pic', 'html' => a_hrefg("{$CFG->wwwroot}_icons/?context=profile&amp;profile_id={$page_owner}", gettext("Community site picture")));
                $PAGE->menu_sub[] = array('name' => 'community:edit', 'html' => a_hrefg("{$CFG->wwwroot}_userdetails/?context=profile&amp;profile_id={$page_owner}", gettext("Edit community details")));
            }
        }
        if (defined("context") && (context == "profile" || context == "network")) {
            $PAGE->menu_sub[] = array('name' => 'community:requests', 'html' => a_hrefg("{$CFG->wwwroot}_communities/requests.php?profile_id={$page_owner}", gettext("View membership requests")));
        }
        /*$PAGE->menu_sub[] = array( 'name' => 'community:members',
          'html' => a_hrefg("{$CFG->wwwroot}_communities/members.php?owner=$page_owner" ,
                             gettext("Community Members")));*/
    } else {
        if ($usertype == "person") {
            if (defined("context") && context == "network") {
                $PAGE->menu_sub[] = array('name' => 'community', 'html' => a_hrefg("{$CFG->wwwroot}_communities/?owner={$page_owner}", gettext("Communities")));
                $PAGE->menu_sub[] = array('name' => 'community:owned', 'html' => a_hrefg("{$CFG->wwwroot}_communities/owned.php?owner={$page_owner}", gettext("Owned Communities")));
            }
        }
    }
}
Example #2
0
function newsclient_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    if (isloggedin() && $CFG->your_resources_enabled) {
        if (defined("context") && context == "resources" && $page_owner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'resources', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/feeds/\" class=\"selected\" >" . gettext("Your Resources") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'resources', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/feeds/\" >" . gettext("Your Resources") . '</a></li>');
        }
        $rss_username = run("users:id_to_name", $page_owner);
    }
    if (defined("context") && context == "resources" && $CFG->your_resources_enabled) {
        if ($page_owner != -1) {
            if (run("permissions:check", "rss") && logged_on && $page_owner == $_SESSION['userid']) {
                $PAGE->menu_sub[] = array('name' => 'newsfeed:subscription', 'html' => a_hrefg($CFG->wwwroot . $_SESSION['username'] . "/feeds/", gettext("Feeds")));
                $PAGE->menu_sub[] = array('name' => 'newsfeed:subscription:publish:blog', 'html' => a_hrefg($CFG->wwwroot . "_rss/blog.php?page_owner=" . $_SESSION['userid'], gettext("Publish to blog")));
            }
            $PAGE->menu_sub[] = array('name' => 'newsclient', 'html' => a_hrefg($CFG->wwwroot . $rss_username . "/feeds/all/", gettext("View aggregator")));
        }
        $PAGE->menu_sub[] = array('name' => 'feed', 'html' => a_hrefg($CFG->wwwroot . "_rss/popular.php", gettext("Popular Feeds")));
        /*
        $PAGE->menu_sub[] = array( 'name' => 'feed',
                                   'html' => a_hrefg( $CFG->wwwroot."help/feeds_help.php", 
                                                      "Page help"));
        */
    }
}
Example #3
0
function friend_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    if (isloggedin()) {
        if (defined("context") && context == "network" && $page_owner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'network', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" class=\"selected\" >" . gettext("Your Network") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'network', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/friends/\" >" . gettext("Your Network") . '</a></li>');
        }
    }
    if (defined("context") && context == "network") {
        if (run("users:type:get", $page_owner) == "person") {
            $friends_username = run("users:id_to_name", $page_owner);
            $PAGE->menu_sub[] = array('name' => 'friend', 'html' => a_hrefg("{$CFG->wwwroot}{$friends_username}/friends/", gettext("Friends")));
            $PAGE->menu_sub[] = array('name' => 'friend:of', 'html' => a_hrefg("{$CFG->wwwroot}_friends/friendsof.php?owner={$page_owner}", gettext("Friend of")));
            $PAGE->menu_sub[] = array('name' => 'friend:requests', 'html' => a_hrefg("{$CFG->wwwroot}_friends/requests.php?owner={$page_owner}", gettext("Friendship requests")));
            if ($CFG->foaf_enabled) {
                $PAGE->menu_sub[] = array('name' => 'friend:foaf', 'html' => a_hrefg("{$CFG->wwwroot}{$friends_username}/foaf/", gettext("FOAF")));
            }
            if (isloggedin()) {
                $PAGE->menu_sub[] = array('name' => 'friend:accesscontrols', 'html' => a_hrefg("{$CFG->wwwroot}_groups/", gettext("Access controls")));
                if ($CFG->publicinvite == true) {
                    $PAGE->menu_sub[] = array('name' => 'friend:invite', 'html' => a_hrefg("{$CFG->wwwroot}_invite/", gettext("Invite a friend")));
                }
                $PAGE->menu_sub[] = array('name' => 'friend:help', 'html' => a_hrefg("{$CFG->wwwroot}help/network_help.php", gettext("Page help")));
            }
        }
    }
}
Example #4
0
function ownedusers_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    global $USER;
    $page_owner = $profile_id;
    if ($CFG->owned_users) {
        if (defined("context") && context == "network") {
            if (run("users:type:get", $page_owner) == "person") {
                $PAGE->menu_sub[] = array('name' => 'ownedusers:requests', 'html' => '<a href="' . $CFG->wwwroot . '_ownedusers/owned.php?owner=' . $page_owner . '">' . gettext("Owned " . $CFG->owned_users_caption) . '</a>');
            }
        }
        if (defined("context") && context == "weblog") {
            if (run("users:type:get", $page_owner) == "person") {
                if ($result = get_records_select('users', "owner = ? AND user_type = ?", array($page_owner, 'person'))) {
                    $PAGE->menu_sub[] = array('name' => 'ownedusers:requests', 'html' => '<a href="' . $CFG->wwwroot . $USER->username . '/weblog/ownedusers/' . '">' . gettext($CFG->owned_users_caption . "' blogs") . '</a>');
                }
            }
        }
        if (defined("context") && context == "profile" && logged_on && !run("users:flags:get", array("admin", $USER->ident))) {
            if ($result = get_records_select('users', "ident = ? and owner = ? AND user_type = ?", array($page_owner, $USER->ident, 'person'))) {
                $PAGE->menu_sub[] = array('name' => 'profile:edit', 'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $page_owner . '">' . gettext("Edit this profile") . '</a>');
                if (run("permissions:check", "profile")) {
                    $PAGE->menu_sub[] = array('name' => 'owneduser:pic', 'html' => a_hrefg("{$CFG->wwwroot}_icons/?context=profile&amp;profile_id={$page_owner}", gettext("Change site picture")));
                    $PAGE->menu_sub[] = array('name' => 'profile:help', 'html' => '<a href="' . $CFG->wwwroot . 'help/profile_help.php">' . gettext("Page help") . '</a>');
                }
            }
        }
    }
}
Example #5
0
function template_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    if (defined("context") && context == "account") {
        if ($page_owner == $_SESSION['userid'] && $page_owner != -1) {
            $PAGE->menu_sub[] = array('name' => 'template:change', 'html' => a_hrefg("{$CFG->wwwroot}_templates/", gettext("Change theme")));
        }
    }
}
Example #6
0
function ldap_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    global $USER;
    $page_owner = $profile_id;
    if ($CFG->auth == 'ldap') {
        if (isloggedin() && defined("context") && context == "admin" && run("users:flags:get", array("admin", $_SESSION['userid']))) {
            $PAGE->menu_sub[] = array('name' => 'admin:ldap', 'html' => a_hrefg("{$CFG->wwwroot}_admin/ldap.php", "LDAP"));
        }
    }
}
Example #7
0
function file_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    if (isloggedin()) {
        if (defined("context") && context == "files" && $page_owner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'file', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/files/\" class=\"selected\" >" . gettext("Your Files") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'files', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/files/\" >" . gettext("Your Files") . '</a></li>');
        }
    }
    if (defined("context") && context == "files") {
        $files_username = run("users:id_to_name", $page_owner);
        if (run("permissions:check", "files")) {
            $PAGE->menu_sub[] = array('name' => 'file:add', 'html' => a_hrefg("#addFile", gettext("Add a file or a folder")));
            $PAGE->menu_sub[] = array('name' => 'file:rss', 'html' => a_hrefg($CFG->wwwroot . $files_username . "/files/rss/", gettext("RSS feed for files")));
            $PAGE->menu_sub[] = array('name' => 'file:help', 'html' => a_hrefg($CFG->wwwroot . "help/files_help.php", gettext("Page help")));
        }
    }
}
Example #8
0
/**
* Create the menu links used by the folio add-in, as well as setting the commands for the info / navigation menu
* on the side of the page.
*/
function folio_pagesetup()
{
    global $profile_id;
    global $page_owner;
    global $PAGE;
    global $CFG;
    global $FOLIO_CFG;
    global $USER;
    global $metatags;
    global $function;
    // These are defined by view.php, and are needed to properly setup the edit & history links for the submenu.
    global $page_ident;
    global $page_title;
    global $username;
    // this is who we're looking at, not the logged in user.
    $currentusername = $_SESSION['username'];
    if ($CFG->folio) {
        // -----------------------------------------------
        // SETUP MENU
        //
        // Main Menu
        if (isloggedin() && $USER->owner == -1) {
            //no "Your Pages" for owned users
            if (defined('context')) {
                if (substr(context, 0, 5) == "folio" & $username == $currentusername) {
                    // Show selected
                    $PAGE->menu[] = array('name' => 'folio', 'html' => '<li><a href="' . $CFG->wwwroot . $currentusername . '/page/" class="selected">Your Pages</a></li>');
                } else {
                    // Show main menu unselected
                    $PAGE->menu[] = array('name' => 'folio', 'html' => '<li><a href="' . $CFG->wwwroot . $currentusername . '/page/">Your Pages</a></li>');
                }
            } else {
                // Some pages don't have context defined.
                // Show link to folio.
                $PAGE->menu[] = array('name' => 'folio', 'html' => '<li><a href="' . $CFG->wwwroot . $currentusername . '/page/">Your Pages</a></li>');
            }
        }
        if (defined('context')) {
            if (substr(context, 0, 10) == 'folio_page') {
                // Looking at a page.
                // Look to see if we should include 'Recent Changes' as a menu option.
                if ($FOLIO_CFG->wiki_menu_recentchanges == 'Y') {
                    $PAGE->menu_sub[] = array('name' => 'folio:recentchanges', 'html' => a_hrefg("{$CFG->wwwroot}{$username}/subscribe/html/page+page_comment/", "Recent Changes"));
                }
                $PAGE->menu_sub[] = array('name' => 'folio:edit', 'html' => a_hrefg("{$CFG->wwwroot}{$username}/page/" . folio_page_encodetitle($page_title) . "/edit", "Edit Page"));
                $PAGE->menu_sub[] = array('name' => 'folio:history', 'html' => a_hrefg("{$CFG->wwwroot}{$username}/page/" . folio_page_encodetitle($page_title) . "/history", "History"));
                $PAGE->menu_sub[] = array('name' => 'folio:delete', 'html' => a_hrefg("{$CFG->wwwroot}{$username}/page/" . folio_page_encodetitle($page_title) . "/delete", "Delete"));
                $PAGE->menu_sub[] = array('name' => 'folio:print', 'html' => a_hrefg("{$CFG->wwwroot}{$username}/page/" . folio_page_encodetitle($page_title) . "/print\" target=\"_new\"", "Print"));
                // Setup Metatags for RSS Discovery
                $metatags .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"" . url . "{$username}/subscribe/rss/page+page_comment/\" />\n";
            }
        }
        // -------------------------------------------------------------
        //     SETUP SIDE MENU
        //
        //	Modify side menu setup.  Remove the file & blog side menus in favor of a newly rebuilt & more compact
        //	version used in this mod.
        // Remove the weblog & file pane. (for everyone but the current user, as it isn't there)
        if ($page_owner != $USER->ident) {
            $function['display:sidebar'] = folio_delete_element($function['display:sidebar'], $CFG->dirroot . "units/weblogs/weblogs_user_info_menu.php");
            $function['display:sidebar'] = folio_delete_element($function['display:sidebar'], $CFG->dirroot . "units/files/files_user_info_menu.php");
        }
        // Insert
        if (defined('context') && $page_owner != -1) {
            switch (context) {
                case 'folio_page_view':
                    // Viewing a page
                    array_splice($function['display:sidebar'], 1, 0, array($CFG->dirroot . "mod/folio/page_info_menu.php"));
                    if ($page_owner != $USER->ident) {
                        //no need for page owner, menu already at top
                        array_splice($function['display:sidebar'], 2, 0, array($CFG->dirroot . "mod/folio/users_info_menu.php"));
                    }
                    break;
                case 'folio_page_edit':
                    // Editing a page.  Kill all sidebar entries. Hmm - don't get this one, am adding back. JK
                    //					$function['display:sidebar'] =
                    //						array( $CFG->dirroot . "mod/folio/page_edit_menu.php" );
                    //adding back sidebar - JK
                    array_splice($function['display:sidebar'], 1, 0, array($CFG->dirroot . "mod/folio/page_info_menu.php"));
                    if ($page_owner != $USER->ident) {
                        //no need for page owner, menu already at top
                        array_splice($function['display:sidebar'], 2, 0, array($CFG->dirroot . "mod/folio/users_info_menu.php"));
                    }
                    break;
                default:
                    // Viewing normal areas of the website -- aka, not looking at pages.
                    // Display link to the user's content.
                    if ($page_owner != $USER->ident) {
                        array_splice($function['display:sidebar'], 2, 0, array($CFG->dirroot . "mod/folio/users_info_menu.php"));
                    }
                    break;
            }
        } else {
            //removed this as it doesn't seem to do anything but double-up user count block when not logged in. There's always a context except at login
            // Viewing normal areas of the website -- aka, not looking at pages.
            // Display link to the user's content.
            //			if ($page_owner != $USER->ident)
            //			array_splice( $function['display:sidebar'], 2, 0,
            //				array( $CFG->dirroot . "mod/folio/users_info_menu.php" ) );
            //
        }
        // -------------------------------------------
        // SETUP ALTERNATE RSS
        //
        $function['weblogs:rss:publish'][] = path . "units/weblogs/function_rss_publish.php";
        /*	
        	$action = optional_param('action');
        	switch ($action) {
        		// Create a new weblog post
        		case "weblogs:post:add":
        			var_dump( $s
        */
    }
}
Example #9
0
function templates_page_setup()
{
    global $PAGE;
    global $CFG;
    if (!empty($PAGE->setupdone)) {
        return false;
        // don't run twice
    }
    $PAGE->setupdone = true;
    // leave your mark
    //
    // Populate $PAGE with links for non-module core code
    //
    if (isadmin()) {
        $PAGE->menu_top[] = array('name' => 'admin', 'html' => "<li><a href=\"" . $CFG->wwwroot . "_admin/\">" . gettext("Administration") . "</a></li>");
    }
    $PAGE->menu_top[] = array('name' => 'userdetails', 'html' => "<li><a href=\"" . $CFG->wwwroot . "_userdetails/\">" . gettext("Account settings") . "</a></li>");
    $PAGE->menu_top[] = array('name' => 'logoff', 'html' => "<li><a href=\"" . $CFG->wwwroot . "login/logout.php\">" . gettext("Log off") . "</a></li>");
    if (defined("context") && context == "account") {
        $PAGE->menu_sub[] = array('name' => 'user:edit', 'html' => a_hrefg("{$CFG->wwwroot}_userdetails/", "Edit user details"));
        $PAGE->menu_sub[] = array('name' => 'user:icon', 'html' => a_hrefg("{$CFG->wwwroot}_icons/", "Your site picture"));
    }
    if (defined("context") && context == "admin" && logged_on && run("users:flags:get", array("admin", $_SESSION['userid']))) {
        $PAGE->menu_sub[] = array('name' => 'admin', 'html' => a_hrefg("{$CFG->wwwroot}_admin/", "Main"));
        $PAGE->menu_sub[] = array('name' => 'admin:useradd', 'html' => a_hrefg("{$CFG->wwwroot}_admin/users_add.php", "Add users"));
        $PAGE->menu_sub[] = array('name' => 'admin:users', 'html' => a_hrefg("{$CFG->wwwroot}_admin/users.php", "Manage users"));
        $PAGE->menu_sub[] = array('name' => 'admin:flaggedcontent', 'html' => a_hrefg("{$CFG->wwwroot}_admin/flags.php", "Manage flagged content"));
        $PAGE->menu_sub[] = array('name' => 'admin:spam', 'html' => a_hrefg("{$CFG->wwwroot}_admin/antispam.php", "Spam control"));
    }
    //
    // Give a chance to all registered modules
    //
    if ($allmods = get_list_of_plugins('mod')) {
        foreach ($allmods as $mod) {
            $mod_pagesetup = $mod . '_pagesetup';
            if (function_exists($mod_pagesetup)) {
                $mod_pagesetup();
            } else {
                notify("Function {$mod_pagesetup} doesn't exist!");
            }
        }
    }
}