/** * Web service for leaving a group * * @param string $username username of author * @param string $groupid GUID of the group * * @return bool */ function group_leave($username, $groupid) { $user = get_user_by_username($username); if (!$user) { throw new InvalidParameterException('registration:usernamenotvalid'); } $group = get_entity($groupid); $return['success'] = false; set_page_owner($group->guid); if ($user instanceof ElggUser && $group instanceof ElggGroup) { if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) { if ($group->leave($user)) { $return['success'] = true; $return['message'] = elgg_echo("groups:left"); } else { $return['message'] = elgg_echo("groups:cantleave"); } } else { $return['message'] = elgg_echo("groups:cantleave"); } } else { $return['message'] = elgg_echo("groups:cantleave"); } return $return; }
/** * Gets the page owner for the current page. * @uses $CONFIG * @return int|false The current page owner guid (0 if none). */ function page_owner() { global $CONFIG; $setpageowner = set_page_owner(); if ($setpageowner !== false) { return $setpageowner; } if ($username = get_input("username")) { //if (substr_count($username,'group:')) { if (substr_count($username, 'group_')) { //preg_match('/group\:([0-9]+)/i',$username,$matches); preg_match('/group\\_([0-9]+)/i', $username, $matches); $guid = $matches[1]; if ($entity = get_entity($guid)) { return $entity->getGUID(); } } if ($user = get_user_by_username($username)) { return $user->getGUID(); } } if ($owner = get_input("owner_guid")) { if ($user = get_entity($owner)) { return $user->getGUID(); } } if (!empty($CONFIG->page_owner_handlers) && is_array($CONFIG->page_owner_handlers)) { foreach ($CONFIG->page_owner_handlers as $handler) { if ($guid = $handler()) { return $guid; } } } return 0; }
/** * Page handler function * * @param array $page Page URL segments */ function invitefriends_page_handler($page) { gatekeeper(); elgg_set_context('friends'); set_page_owner(elgg_get_logged_in_user_guid()); $title = elgg_echo('friends:invite'); $body = elgg_view('invitefriends/form'); $params = array('content' => $body, 'title' => $title); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); }
/** * Dispatches blog pages. * To maintain URL backward compatibility, expects old-style URLs like: * pg/blog/[username/[read|edit|archive|new/[time_start|guid/[time_end|title]]]] * * Without a username, show all blogs * Without an action (read|edit|archive|new), forward to pg/blog/username/read. * Without a guid, show all post for that user. * Title is ignored * * If archive, uses time_start/end * * @todo There is no way to say "show me archive view for all blog posts" with the * current URL scheme because $param[0] is the username instead of an action. * Could do something hideous like make '*' mean "all users" (since a username can't be *). * Can't change the URL scheme because of URL compatibility. * * @param array $page * @return NULL */ function blog_page_handler($page) { global $CONFIG; elgg_push_breadcrumb(elgg_echo('blog:blogs'), "{$CONFIG->site->url}pg/blog"); // see if we're showing all or just a user's if (isset($page[0]) && !empty($page[0])) { $username = $page[0]; // forward away if invalid user. if (!($user = get_user_by_username($username))) { register_error('blog:error:unknown_username'); forward($_SERVER['HTTP_REFERER']); } set_page_owner($user->getGUID()); $crumbs_title = sprintf(elgg_echo('blog:owned_blogs'), $user->name); $crumbs_url = "{$CONFIG->site->url}pg/blog/{$username}/read"; elgg_push_breadcrumb($crumbs_title, $crumbs_url); $action = isset($page[1]) ? $page[1] : FALSE; // yeah these are crap names, but they're used for different things. $page2 = isset($page[2]) ? $page[2] : FALSE; $page3 = isset($page[3]) ? $page[3] : FALSE; switch ($action) { case 'read': $title = sprintf(elgg_echo('blog:title:user_blogs'), $user->name); $content_info = blog_get_page_content_read($user->getGUID(), $page2); break; case 'new': case 'edit': //$sidebar = elgg_view('blog/sidebar_edit', array('blog_guid' => $page2)); $content_info = blog_get_page_content_edit($page2, $page3); break; case 'archives': $content = elgg_view('page_elements/content_header', array('context' => $content, 'type' => 'blog')); $content .= blog_get_page_content_archive($user->getGUID(), $page2, $page3); break; case 'friends': $content = elgg_view('page_elements/content_header', array('context' => $content, 'type' => 'blog')); $content .= blog_get_page_content_archive($user->getGUID()); break; default: forward("pg/blog/{$username}/read/"); break; } } else { $title = elgg_echo('blog:title:all_blogs'); $content_info = blog_get_page_content_read(); } $sidebar .= elgg_view('blog/sidebar_menu'); if (isset($content_info['sidebar'])) { $sidebar .= $content_info['sidebar']; } $content = elgg_view('navigation/breadcrumbs') . $content_info['content']; $body = elgg_view_layout('one_column_with_sidebar', $content, $sidebar); page_draw($title, $body); }
/** * Gets the page owner for the current page. * @uses $CONFIG * @return int|false The current page owner guid (0 if none). */ function page_owner() { global $CONFIG; $returnval = NULL; $setpageowner = set_page_owner(); if ($setpageowner !== false) { return $setpageowner; } if (!isset($returnval) && ($username = get_input("username"))) { if (substr_count($username, 'group:')) { preg_match('/group\\:([0-9]+)/i', $username, $matches); $guid = $matches[1]; if ($entity = get_entity($guid)) { $returnval = $entity->getGUID(); } } if (!isset($returnval) && ($user = get_user_by_username($username))) { $returnval = $user->getGUID(); } } if (!isset($returnval) && ($owner = get_input("owner_guid"))) { if ($user = get_entity($owner)) { $returnval = $user->getGUID(); } } if (!isset($returnval) && (!empty($CONFIG->page_owner_handlers) && is_array($CONFIG->page_owner_handlers))) { foreach ($CONFIG->page_owner_handlers as $handler) { if (!isset($returnval) && ($guid = $handler())) { $returnval = $guid; } } } if (isset($returnval)) { // Check if this is obtainable, forwarding if not. /* * If the owner entity has been set, but is inaccessible then we forward to the dashboard. This * catches a bunch of WSoDs. It doesn't have much of a performance hit since 99.999% of the time the next thing * a page does after calling this function is to retrieve the owner entity - which is of course cashed. */ $owner_entity = get_entity($returnval); if (!$owner_entity) { // Log an error error_log(sprintf(elgg_echo('pageownerunavailable'), $returnval)); // Forward forward(); } // set the page owner so if we're called again we don't have to think. set_page_owner($returnval); return $returnval; } return 0; }
/** * Page handler for friends collections * * @param array $page_elements Page elements * * @return void */ function collections_page_handler($page_elements) { elgg_set_context('friends'); $base = elgg_get_config('path'); if (isset($page_elements[0])) { if ($page_elements[0] == "add") { set_page_owner(elgg_get_logged_in_user_guid()); collections_submenu_items(); require_once "{$base}pages/friends/collections/add.php"; } else { $user = get_user_by_username($page_elements[0]); if ($user) { set_page_owner($user->getGUID()); if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) { collections_submenu_items(); } require_once "{$base}pages/friends/collections/view.php"; } } } }
* Elgg Pages * * @package ElggPages * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd * @copyright Curverider Ltd 2008-2009 * @link http://elgg.com/ */ require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; gatekeeper(); $page_guid = get_input('page_guid'); $pages = get_entity($page_guid); if ($pages->container_guid) { set_page_owner($pages->container_guid); } else { set_page_owner($pages->owner_guid); } if (is_callable('group_gatekeeper')) { group_gatekeeper(); } $limit = (int) get_input('limit', 20); $offset = (int) get_input('offset'); $page_guid = get_input('page_guid'); $pages = get_entity($page_guid); add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral'); $title = $pages->title . ": " . elgg_echo("pages:history"); $area2 = elgg_view_title($title); $context = get_context(); set_context('search'); $area2 .= list_annotations($page_guid, 'page', $limit, false); set_context($context);
* Elgg messages inbox page * * @package ElggMessages * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd <*****@*****.**> * @copyright Curverider Ltd 2008-2009 * @link http://elgg.com/ */ // Load Elgg engine require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; // You need to be logged in! gatekeeper(); // Get offset $offset = get_input('offset', 0); // Set limit $limit = 10; // Get the logged in user, you can't see other peoples messages so use session id $page_owner = $_SESSION['user']; set_page_owner($page_owner->getGUID()); // Get the user's inbox, this will be all messages where the 'toId' field matches their guid $messages = get_entities_from_metadata("toId", $page_owner->getGUID(), "object", "messages", $page_owner->guid, $limit + 1, $offset); // Set the page title $area2 = elgg_view_title(elgg_echo("messages:inbox")); // Display them. The last variable 'page_view' is to allow the view page to know where this data is coming from, // in this case it is the inbox, this is necessary to ensure the correct display // $area2 .= elgg_view("messages/view",array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset)); $area2 .= elgg_view("messages/forms/view", array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset)); // format $body = elgg_view_layout("two_column_left_sidebar", '', $area2); // Draw page page_draw(sprintf(elgg_echo('messages:user'), $page_owner->name), $body);
/** * Full group profile * * @package ElggGroups * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd * @copyright Curverider Ltd 2008-2010 * @link http://elgg.com/ */ $group_guid = get_input('group_guid'); set_context('groups'); global $autofeed; $autofeed = true; $group = get_entity($group_guid); if ($group) { set_page_owner($group_guid); $title = $group->name; // Hide some items from closed groups when the user is not logged in. $view_all = true; $groupaccess = group_gatekeeper(false); if (!$groupaccess) { $view_all = false; } $area2 = elgg_view_title($title); $area2 .= elgg_view('group/group', array('entity' => $group, 'user' => $_SESSION['user'], 'full' => true)); if ($view_all) { //group profile 'items' - these are not real widgets, just contents to display $area2 .= elgg_view('groups/profileitems', array('entity' => $group)); //group members $area3 = elgg_view('groups/members', array('entity' => $group)); } else {
<?php /** * Elgg flexprofile extended profile * * @package FlexProfile * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Kevin Jardine <*****@*****.**> * @copyright Radagast Solutions 2008 * @link http://radagast.biz/ */ // Load Elgg engine require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; global $CONFIG; // Define context set_context('groups'); set_page_owner(get_input('group_guid', 0)); $group = page_owner_entity(); $title = friendly_title($group->name); add_submenu_item(elgg_echo('form:main_profile_link_text'), $group->getUrl(), '0extendedprofile'); $body = elgg_view('flexgroupprofile/extended', array('entity' => $group)); $title = sprintf(elgg_echo('form:extended_profile_title'), $group->name); page_draw($title, elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));
* Elgg file saver * * @package ElggFile * @author Curverider Ltd * @copyright Curverider Ltd 2008-2010 * @link http://elgg.com/ */ require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; gatekeeper(); // Render the file upload page $file_guid = (int) get_input('file_guid'); $file = get_entity($file_guid); if (!$file) { forward(); } // Set the page owner $page_owner = page_owner_entity(); if (!$page_owner) { $container_guid = $file->container_guid; if ($container_guid) { set_page_owner($container_guid); } } if (!$file->canEdit()) { forward(); } $title = elgg_echo('file:edit'); $area1 = elgg_view_title($title); $area1 .= elgg_view("file/upload", array('entity' => $file)); $body = elgg_view_layout('one_column_with_sidebar', $area1); page_draw($title, $body);
<?php /** * Friends of friends. * * @package friends_of_friends * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Pedro Prez * @copyright 2009 * @link http://www.pedroprez.com.ar/ */ require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; gatekeeper(); set_context('friendsoffriends'); // Get the current page's owner $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { $page_owner = get_loggedin_user(); set_page_owner(get_loggedin_userid()); } $title = elgg_view_title(elgg_echo('friendsoffriends')); // Display main admin menu $body = friends_of_friends_list_entities($page_owner->getGUID(), 10, true); page_draw(elgg_echo('friendsoffriends'), elgg_view_layout("two_column_left_sidebar", '', $title . $body));
<?php /** * Elgg user account settings. * * @package Elgg * @subpackage Core */ // Only logged in users gatekeeper(); // Make sure we don't open a security hole ... if (!elgg_get_page_owner_entity() || !elgg_get_page_owner_entity()->canEdit()) { set_page_owner(elgg_get_logged_in_user_guid()); } $title = elgg_echo('usersettings:user'); $content = elgg_view('core/settings/account'); $params = array('content' => $content, 'title' => $title); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body);
it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with groups-invite-any. If not, see <http://www.gnu.org/licenses/>. */ gatekeeper(); action_gatekeeper(); $group = get_entity(get_input('entity')); set_page_owner($group->getGUID()); set_context('groups'); $name = get_input('name'); if ($name) { $users = search_for_user($name, get_plugin_setting('maxusers', 'groupsfrommembers')); $nusers = search_for_user($name, 0, 0, '', true); } $title = elgg_echo("groups:invite"); $area2 = elgg_view_title($title); $context = get_context(); set_context('groupsfrommembers'); if ($group && $group->canEdit()) { $area2 .= elgg_view('forms/groups/invite', array('entity' => $group, 'users' => $users, 'nusers' => $nusers)); } else { $area2 .= elgg_echo("groups:noaccess"); }
/** * Group page handler * * @param array $page Array of page elements, forwarded by the page handling mechanism */ function groups_page_handler($page) { global $CONFIG; if (isset($page[0])) { // See what context we're using switch ($page[0]) { case "new": include $CONFIG->pluginspath . "groups/new.php"; break; case "world": set_context('groups'); set_page_owner(0); include $CONFIG->pluginspath . "groups/all.php"; break; case "forum": set_input('group_guid', $page[1]); include $CONFIG->pluginspath . "groups/forum.php"; break; case "owned": // Owned by a user if (isset($page[1])) { set_input('username', $page[1]); } include $CONFIG->pluginspath . "groups/index.php"; break; case "member": // User is a member of if (isset($page[1])) { set_input('username', $page[1]); } include $CONFIG->pluginspath . "groups/membership.php"; break; case "mine": // User is a member of set_input('username', $_SESSION['user']->username); include $CONFIG->pluginspath . "groups/membership.php"; break; default: set_input('group_guid', $page[0]); include $CONFIG->pluginspath . "groups/groupprofile.php"; break; } } }
<?php /** * Elgg blog add entry page * * @package ElggBlog * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd <*****@*****.**> * @copyright Curverider Ltd 2008-2009 * @link http://elgg.com/ */ // Load Elgg engine require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; gatekeeper(); // Get the current page's owner $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { $page_owner = get_input("group"); //$page_owner = $_SESSION['user']; set_page_owner($page_owner); } //set the title $area1 = elgg_view_title(elgg_echo('blog:addpost')); // Get the form $post = new ElggObject(); $post->content_owner = get_input("group"); $area1 .= elgg_view("blog/forms/edit", array('assign_to' => $page_owner)); // Display page page_draw(elgg_echo('blog:addpost'), elgg_view_layout("edit_layout", $area1));
/** * iZAP izap_videos * * @package Elgg videotizer, by iZAP Web Solutions. * @license GNU Public License version 3 * @Contact iZAP Team "<*****@*****.**>" * @Founder Tarun Jangra "<*****@*****.**>" * @link http://www.izap.in/ * */ // get the video id as input $video = (int) get_input('guid'); $izap_videos = izapVideoCheck_izap_videos($video); // make the video owner page owner set_page_owner($izap_videos->container_guid); $title = $izap_videos->title; // get page contents $video = elgg_view_entity($izap_videos, TRUE); $area2 .= elgg_view('izap_videos/izapLink'); // get tags and categories if ($izap_videos->converted == 'yes') { $share .= elgg_view('izap_videos/video/elements/share', array('video' => $izap_videos)); } $area3 = elgg_view('izap_videos/video/elements/related', array('video' => $izap_videos)); $layout = izapAdminSettings_izap_videos('izap_display_page'); switch ($layout) { case 'default': $body = elgg_view_layout("izap_videos_main_page", $share, $video . $area2, $area3); break; case 'left':
} // Group membership - should these be treated with same constants as access permissions? switch (get_input('membership')) { case ACCESS_PUBLIC: $group->membership = ACCESS_PUBLIC; break; default: $group->membership = ACCESS_PRIVATE; } if ($new_group_flag) { $group->access_id = ACCESS_PUBLIC; } $group->save(); // group creator needs to be member of new group and river entry created if ($new_group_flag) { set_page_owner($group->guid); $group->join($user); add_to_river('river/group/create', 'create', $user->guid, $group->guid); } // Invisible group support if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { $visibility = (int) get_input('vis', '', false); if ($visibility != ACCESS_PUBLIC && $visibility != ACCESS_LOGGED_IN) { $visibility = $group->group_acl; } if ($group->access_id != $visibility) { $group->access_id = $visibility; $group->save(); } } // Now see if we have a file icon
<?php /** * Elgg friends page * * @package Elgg * @subpackage Core * @author Curverider Ltd * @link http://elgg.org/ */ if (!($owner = page_owner_entity())) { gatekeeper(); set_page_owner($_SESSION['user']->getGUID()); $owner = $_SESSION['user']; } $friends = sprintf(elgg_echo("friends:owned"), $owner->name); $area1 = elgg_view_title($friends); $area2 = list_entities_from_relationship('friend', $owner->getGUID(), false, 'user', '', 0, 10, false); $body = elgg_view_layout('two_column_left_sidebar', '', $area1 . $area2); page_draw($friends, $body);
/** * Group page handler * * @param array $page Array of page elements, forwarded by the page handling mechanism */ function groups_page_handler($page) { global $CONFIG; if (isset($page[0])) { // See what context we're using switch ($page[0]) { case 'invitations': include $CONFIG->pluginspath . "groups/invitations.php"; $user_guid = get_loggedin_userid(); $invitations = elgg_get_entities_from_relationship(array('relationship' => 'membership_request', 'guid' => $user_guid)); break; case "new": include $CONFIG->pluginspath . "groups/new.php"; break; case "world": set_context('groups'); set_page_owner(0); include $CONFIG->pluginspath . "groups/all.php"; break; case "forum": set_input('group_guid', $page[1]); include $CONFIG->pluginspath . "groups/forum.php"; break; case "owned": // Owned by a user if (isset($page[1])) { set_input('username', $page[1]); } include $CONFIG->pluginspath . "groups/index.php"; break; case "member": // User is a member of if (isset($page[1])) { set_input('username', $page[1]); } include $CONFIG->pluginspath . "groups/membership.php"; break; default: set_input('group_guid', $page[0]); include $CONFIG->pluginspath . "groups/groupprofile.php"; break; } } }
/** * Page handler for friends of * */ function collections_page_handler($page_elements) { if (isset($page_elements[0])) { if ($page_elements[0] == "add") { set_page_owner($_SESSION['guid']); collections_submenu_items(); require_once dirname(dirname(dirname(__FILE__))) . "/friends/add.php"; } else { if ($user = get_user_by_username($page_elements[0])) { set_page_owner($user->getGUID()); if ($_SESSION['guid'] == page_owner()) { collections_submenu_items(); } require_once dirname(dirname(dirname(__FILE__))) . "/friends/collections.php"; } } } }
/** * Serve out views for site pages. * * @param unknown_type $page * @return unknown_type */ function sitepages_page_handler($page) { global $CONFIG; // for the owner block. if ($logged_in_guid = get_loggedin_userid()) { set_page_owner($logged_in_guid); } // sanity checking. // on bad params we'll forward so people will bookmark the correct URLs // @todo valid page names need to be pulled out into some sort of config var or admin option. $default_page = 'About'; $action = isset($page[0]) ? $page[0] : FALSE; $page_type = isset($page[1]) ? $page[1] : FALSE; switch ($action) { case 'edit': $title = elgg_echo('sitepages'); $content = sitepages_get_edit_section_content($page_type); break; case 'read': $title = elgg_echo('sitepages:' . strtolower($page_type)); $content = sitepages_get_page_content($page_type); break; default: forward("{$CONFIG->site->url}pg/sitepages/read/{$default_page}"); break; } page_draw($title, $content); }
<?php require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; admin_gatekeeper(); set_context('admin'); set_page_owner($_SESSION['guid']); $body = elgg_view("CKEditor/forms/admin"); $title = elgg_view_title(elgg_echo('ckeditor:admin_title')); $body = elgg_view_layout("two_column_left_sidebar", '', $title . $body); page_draw($title, $body);
function form_pagesetup() { global $CONFIG; // Set up menu and content setting for logged in users if (isloggedin()) { form_set_menu_items(); if (form_get_user_content_status()) { add_menu(elgg_echo('item:object:form_data'), $CONFIG->wwwroot . "pg/form/" . $_SESSION['user']->username); // add a view content option to user settings extend_elgg_settings_page('form/settings/usersettings', 'usersettings/user'); } } $context = get_context(); $form_id = get_input('form_id', get_input('id', 0)); if (!$form_id && ($sid = get_input('sid', 0))) { $form_id = get_entity($sid)->form_id; } if ($form_id) { $form = get_entity($form_id); set_page_owner($form->getOwner()); } $username = page_owner_entity()->username; if (get_context() == 'admin') { $admin_url = $CONFIG->wwwroot . 'mod/form/manage_all_forms.php'; if ($username) { $admin_url .= '?username='******'form:manage_forms_title'), $admin_url); } if ($context == 'form:admin' && isadminloggedin()) { // add_submenu_item(elgg_echo('form:add_new_profile_form_link'),$CONFIG->wwwroot.'mod/form/manage_form.php?username='******'&profile=1', '4formactions'); // add_submenu_item(elgg_echo('form:add_new_group_profile_form_link'),$CONFIG->wwwroot.'mod/form/manage_form.php?username='******'&profile=2', '4formactions'); add_submenu_item(elgg_echo('form:manage_group_profile_categories_title'), $CONFIG->wwwroot . 'mod/form/manage_group_profile_categories.php?username='******'4formactions'); } if (in_array($context, array('form', 'form:content', 'form:admin')) && isadminloggedin()) { // currently only admins get to manage forms if ($form_id) { add_submenu_item(elgg_echo('form:edit_page_link'), $CONFIG->wwwroot . 'mod/form/manage_form.php?id=' . $form_id, '1formactions'); if ($context == 'form:admin') { add_submenu_item(elgg_echo('form:preview_link_text'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id . '&preview=true', '1formactions'); add_submenu_item(elgg_echo('form:public_link_text'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id, '1formactions'); add_submenu_item(elgg_echo('form:list_search_definitions_link'), $CONFIG->wwwroot . 'mod/form/list_search_definitions.php?form_id=' . $form_id, '1formactions'); add_submenu_item(elgg_echo('form:add_new_search_definition_link_text'), $CONFIG->wwwroot . 'mod/form/manage_search_definition.php?form_id=' . $form_id, '1formactions'); add_submenu_item(elgg_echo('form:manage_translations_link'), $CONFIG->wwwroot . 'mod/form/manage_form_translation.php?id=' . $form_id, '1formactions'); } } add_submenu_item(elgg_echo('form:manage_forms_title'), $CONFIG->wwwroot . 'mod/form/manage_all_forms.php?username='******'3formactions'); if ($context == 'form:admin') { add_submenu_item(elgg_echo('form:add_new_link'), $CONFIG->wwwroot . 'mod/form/manage_form.php?username='******'4formactions'); add_submenu_item(elgg_echo('form:list_all_fields_link'), $CONFIG->wwwroot . 'mod/form/list_fields.php?type=all&username='******'3formactions'); add_submenu_item(elgg_echo('form:list_orphan_fields_link'), $CONFIG->wwwroot . 'mod/form/list_fields.php?type=orphan&username='******'3formactions'); } } if (in_array($context, array('form', 'form:content', 'form:admin')) && form_get_user_content_status()) { add_submenu_item(elgg_echo('form:view_all_forms'), $CONFIG->wwwroot . 'pg/form/' . $username, '2formactions'); } if ($context == 'form:content' && $form_id) { if (isloggedin()) { set_page_owner($_SESSION['user']->getGUID()); } if (!$form->profile) { if ($sid = get_input('sid', 0)) { $sid_bit = '&sid=' . $sid; } else { $sid_bit = ''; } if (isloggedin()) { add_submenu_item(elgg_echo('form:add_content'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id, '0formactions'); //add_submenu_item(elgg_echo('form:view_mine'),$CONFIG->wwwroot.'mod/form/my_forms.php?id='.$form_id.'&form_view=mine'.$sid_bit,'4formactions'); //add_submenu_item(elgg_echo('form:view_friends'),$CONFIG->wwwroot.'mod/form/my_forms.php?id='.$form_id.'&form_view=friends'.$sid_bit,'4formactions'); } add_submenu_item(elgg_echo('form:view_all'), $CONFIG->wwwroot . 'mod/form/my_forms.php?id=' . $form_id . '&form_view=all' . $sid_bit, '0formactions'); $sd_list = get_entities_from_metadata('form_id', $form_id, 'object', 'form:search_definition'); if ($sd_list) { foreach ($sd_list as $sd) { $sd_id = $sd->getGUID(); add_submenu_item(form_search_definition_t($form, $sd, 'title'), $CONFIG->wwwroot . 'mod/form/search.php?sid=' . $sd_id, '0formactions'); } } } } }
} } else { $owner_guid = get_input('owner_guid', 0); if (substr_count($owner_guid, ',')) { $owner_guid = explode(",", $owner_guid); } } $page_owner = get_input('page_owner', 0); if ($page_owner) { set_page_owner($page_owner); } else { if ($friends) { set_page_owner($friends); } else { if ($owner_guid > 0 && !is_array($owner_guid)) { set_page_owner($owner_guid); } } } if (is_callable('group_gatekeeper')) { group_gatekeeper(); } if (empty($tag)) { $area2 = elgg_view_title(elgg_echo('file:type:all')); } else { if (is_array($owner_guid)) { $area2 = elgg_view_title(elgg_echo("file:friends:type:" . $tag)); } else { if (page_owner() && page_owner() != $_SESSION['guid']) { $area2 = elgg_view_title(sprintf(elgg_echo("file:user:type:" . $tag), page_owner_entity()->name)); } else {
$shell = get_input('shell'); if ($shell == "no") { $shell = false; } else { $shell = true; } $context = get_input('context'); if ($context) { set_context($context); } // Get the entity, if possible if ($entity = get_entity($guid)) { if ($entity->container_guid) { set_page_owner($entity->container_guid); } else { set_page_owner($entity->owner_guid); } // Set the body to be the full view of the entity, and the title to be its title if ($entity instanceof ElggObject) { $title = $entity->title; } else { if ($entity instanceof ElggEntity) { $title = $entity->name; } } $area2 = elgg_view_entity($entity, true); if ($shell) { $body = elgg_view_layout('two_column_left_sidebar', '', $area2); } else { $body = $area2; }
<?php /** * Elgg Groups edit a forum topic page * * @package ElggGroups * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider <*****@*****.**> * @copyright Curverider Ltd 2008-2009 * @link http://elgg.com/ */ // Load Elgg engine require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; gatekeeper(); get_input('group'); $page_owner = set_page_owner((int) get_input('group')); // check the user is a member of the group //if (!$page_owner->isMember($_SESSION['user'])) forward(); if (!page_owner_entity() instanceof ElggGroup) { forward(); } //get the topic $topic = get_entity((int) get_input('topic')); // sort the display $area2 = elgg_view("forms/forums/edittopic", array('entity' => $topic)); $body = elgg_view_layout('two_column_left_sidebar', '', $area2); // Display page page_draw(elgg_echo('groups:edittopic'), $body);
* @package ElggBlog * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd <*****@*****.**> * @copyright Curverider Ltd 2008-2009 * @link http://elgg.com/ */ // Load Elgg engine require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; // Get the specified blog post $post = (int) get_input('blogpost'); // If we can get out the blog post ... if ($blogpost = get_entity($post)) { // Get any comments $comments = $blogpost->getAnnotations('comments'); // Set the page owner set_page_owner($blogpost->getOwner()); $page_owner = get_entity($blogpost->getOwner()); // Display it $area2 = elgg_view("object/blog", array('entity' => $blogpost, 'entity_owner' => $page_owner, 'comments' => $comments, 'full' => true)); // Set the title appropriately //$title = sprintf(elgg_echo("blog:posttitle"),$page_owner->name,$blogpost->title); // Display through the correct canvas area $body = elgg_view_layout("two_column_left_sidebar", '', $area1 . $area2); // If we're not allowed to see the blog post } else { // Display the 'post not found' page instead $body = elgg_view("blog/notfound"); $title = elgg_echo("blog:notfound"); } // Display page page_draw($title, $body);
<?php /** * View a question */ require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; // Get the specified question $post = (int) get_input('question_id'); // If we can get question ... $question = get_entity($post); if ($question instanceof ElggEntity && $question->getSubtype() == "question") { // Set the page owner if ($question->container_guid) { elgg_set_page_owner_guid($question->container_guid); } else { set_page_owner($question->owner_guid); } // Display it //$area2 = elgg_view_title(elgg_echo("answers")); $area2 .= elgg_view_entity($question, array('full_view' => true)); // Set the title appropriately $title = sprintf(elgg_echo("answers:question:fulltitle"), $question->title); // Display through the correct canvas area //$body = elgg_view_layout("two_column_left_sidebar", '', $area2); $body = elgg_view_layout("content", array('content' => $area2, 'title' => sprintf(elgg_echo("answers:question:fulltitle"), $question->title), 'filter_override' => '')); // If we're not allowed to see the question } else { // Display the 'post not found' page instead $body = elgg_view("answers/notfound"); $title = elgg_echo("answers:notfound"); }
* @author Kevin Jardine <*****@*****.**> * @copyright Radagast Solutions 2008 * @link http://radagast.biz/ */ // Load Elgg engine require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; // Load form model require_once dirname(__FILE__) . "/models/model.php"; // Define context set_context('form:content'); $form_id = get_input('id', 0); $form_data_id = get_input('d', 0); $preview = get_input('preview', 0); $form = get_entity($form_id); if ($form && $form->type == 'object' && get_subtype_from_id($form->subtype) == 'form:form') { set_page_owner($form->owner_guid); if ($form_data_id && ($form_data = form_get_data($form_data_id))) { if (get_entity($form_data_id)->canEdit()) { $tab_data = form_get_data_for_edit_form($form, $form_data); } else { register_error(elgg_echo('form:content_not_found')); forward(); } } else { $tab_data = form_get_data_for_edit_form($form); } $title = form_form_t($form, 'title'); $body = elgg_view('form/forms/display_form', array('form' => $form, 'tab_data' => $tab_data, 'preview' => $preview, 'form_data_id' => $form_data_id)); $pg_owner_entity = page_owner_entity(); $username = $pg_owner_entity->username; page_draw($title, elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));