function customstyle_page_handler($page) { gatekeeper(); elgg_set_context('customstyle'); elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('customstyle'); $base_dir = elgg_get_plugins_path() . 'customstyle/pages/customstyle'; switch ($page[0]) { case 'colors': $body = elgg_view('customstyle/colors'); break; case 'background': $body = elgg_view('customstyle/background'); break; case 'personalize': $body = elgg_view('customstyle/default'); break; default: $body = elgg_view('customstyle/default'); break; } $params = array('content' => $body, 'title' => $title); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); return true; }
/** * Stripe related pages * * @param array $page * @param string $handler * @return boolean */ function stripe_page_handler($page, $handler) { gatekeeper(); $username = elgg_extract(0, $page, false); if ($username) { $user = get_user_by_username($username); } if (!elgg_instanceof($user) || !$user->canEdit()) { $user = elgg_get_logged_in_user_entity(); forward("{$handler}/{$user->username}"); } elgg_set_context('settings'); elgg_set_page_owner_guid($user->guid); elgg_push_breadcrumb(elgg_echo('stripe:billing'), 'billing'); $context = elgg_extract(1, $page, 'cards'); $action = elgg_extract(2, $page, 'all'); $view = "stripe/pages/{$context}/{$action}"; if (elgg_view_exists($view)) { $params = array('entity' => $user, 'id' => elgg_extract(3, $page, false), 'context' => $page); $title = elgg_echo("stripe:{$context}:{$action}"); $content = elgg_view($view, $params); $sidebar = elgg_view('stripe/sidebar', $params); $filter = elgg_view("stripe/filters/{$context}/{$action}", $params); } if ($content) { if (elgg_is_xhr()) { echo $content; } else { $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter)); echo elgg_view_page($title, $layout); } return true; } return false; }
/** * whoviewedme page handler * * @param array $page url segments * @return bool */ function whoviewedme_page_handler($page) { gatekeeper(); $base = elgg_get_plugins_path() . 'whoviewedme/pages/whoviewedme'; require_once "{$base}/index.php"; return true; }
/** * Serves pages for twitter. * * @param array $page */ function twitter_api_pagehandler($page) { if (!isset($page[0])) { forward(); } switch ($page[0]) { case 'authorize': twitter_api_authorize(); break; case 'revoke': twitter_api_revoke(); break; case 'forward': twitter_api_forward(); break; case 'login': twitter_api_login(); break; case 'interstitial': gatekeeper(); // only let twitter users do this. $guid = elgg_get_logged_in_user_guid(); $twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api'); if (!$twitter_name) { register_error(elgg_echo('twitter_api:invalid_page')); forward(); } $pages = dirname(__FILE__) . '/pages/twitter_api'; include "{$pages}/interstitial.php"; break; default: forward(); break; } }
function set_notifier_page_handler($page, $identifier) { // select page based on first URL segment after /set_notifier/ switch ($page[0]) { case 'set': gatekeeper(); $num_users = 1; $limit = 100; $offset = 0; while ($num_users != 0) { $users = elgg_get_entities(array('types' => 'user', 'limit' => $limit, 'offset' => $offset)); if ($users != 0) { foreach ($users as $user) { $prefix = "notification:method:notifier"; $user->{$prefix} = true; $user->collections_notifications_preferences_notifier = '-1'; $user->save(); } } $num_users = count($users); $offset += $limit; } forward(REFERER); break; default: echo "request for {$identifier} {$page['0']}"; break; } // return true to let Elgg know that a page was sent to browser return true; }
/** * Route page requests * * @param array $page Array of url parameters * @return bool */ function notifications_page_handler($page) { gatekeeper(); $current_user = elgg_get_logged_in_user_entity(); // default to personal notifications if (!isset($page[0])) { $page[0] = 'personal'; } if (!isset($page[1])) { forward("notifications/{$page[0]}/{$current_user->username}"); } $user = get_user_by_username($page[1]); if ($user->guid != $current_user->guid && !$current_user->isAdmin()) { forward(); } $base = elgg_get_plugins_path() . 'notifications'; // note: $user passed in switch ($page[0]) { case 'group': require "{$base}/groups.php"; break; case 'personal': require "{$base}/index.php"; break; default: return false; } return true; }
/** * Serve pages. URLs in the form: * * pg/block_users/blocked_users/<username> - Users blocked by <username>. If not set, defaults to logged in. * pg/block_users/blocked - The page to display when a user is blocked. * * @param array $page * @return bool Depending on success */ function page_handler($page) { gatekeeper(); if (!isset($page[0])) { $page[0] = 'blocked_users'; } switch ($page[0]) { case 'blocked_user_content': $site = elgg_get_site_entity(); elgg_set_page_owner_guid($site->guid); include dirname(__FILE__) . '/pages/block_users/blocked_user_content.php'; break; case 'blocked_content': $site = elgg_get_site_entity(); elgg_set_page_owner_guid($site->guid); include dirname(__FILE__) . '/pages/block_users/blocked_content.php'; break; default: case 'blocked_users': $logged_in_user = elgg_get_logged_in_user_entity(); if (!isset($page[1])) { $page[1] = $logged_in_user->username; } set_input('blocking_username', $page[1]); // only admins can see another user's block list if ($page[1] != $logged_in_user->username) { admin_gatekeeper(); } include dirname(__FILE__) . '/pages/block_users/blocked_users.php'; } return true; }
/** * Page handler for static sites * * This page handler will behave like a REST-ful api endpoint for GET request * Since static sites 'containers' are groups, the resource naming and endpoints * will look like: * * GET - {elgg_url}/staticsites/{group_guid}/page/{id} * GET - {elgg_url}/staticsites/{group_guid}/pages * */ function staticsites_page_handler($params) { // Logged in only gatekeeper(); $is_xhr = elgg_is_xhr(); $is_xhr = 1; // Debug if ($is_xhr && $params[0]) { // Check for container_guid as first param if (is_numeric($params[0])) { $container_guid = $params[0]; unset($params[0]); $params = array_values($params); } switch ($params[0]) { case "page": staticsites_handle_page_request($params, $container_guid); break; case "pages": staticsites_handle_pages_request($params, $container_guid); break; default: return FALSE; break; } } else { return FALSE; } return TRUE; }
function loginrequired_init() { global $CONFIG; // No need to do all the checking below if the user is already logged in... performance is key :) // if (elgg_is_logged_in()) return; elgg_extend_view('css/elgg', 'loginrequired/css'); // elgg_unextend_view('page/elements/header', 'search/header'); elgg_register_plugin_hook_handler('index', 'system', 'loginrequired_index', 1); elgg_register_plugin_hook_handler('login_required', 'login_required', 'login_required_default_allowed_list'); // Get the current page URL without any ? & parameters... this is required for the registration page to work properly $current_url = current_page_url(); $parameters_start = strrpos($current_url, '?'); if ($parameters_start) { $current_url = substr($current_url, 0, $parameters_start); } // Always allow index page if ($current_url == $CONFIG->url) { return; } $allow = array(); // Allow should have pages $allow[] = '_graphics'; $allow[] = 'action/login'; $allow[] = 'register'; $allow[] = 'action/register'; $allow[] = 'forgotpassword'; $allow[] = 'resetpassword'; $allow[] = 'action/user/requestnewpassword'; $allow[] = 'action/user/passwordreset'; $allow[] = 'action/security/refreshtoken'; $allow[] = 'ajax/view/js/languages'; $allow[] = 'upgrade\\.php'; $allow[] = 'xml-rpc\\.php'; $allow[] = 'mt/mt-xmlrpc\\.cgi'; $allow[] = 'css/.*'; $allow[] = 'js/.*'; $allow[] = 'cache/css/.*'; $allow[] = 'cache/js/.*'; // Allow other plugin developers to edit the array values $add_allow = elgg_trigger_plugin_hook('login_required', 'login_required'); // If more URL's are added... merge both with original list if (is_array($add_allow)) { $allow = array_merge($allow, $add_allow); } // Any public_pages defined via Elgg's walled garden plugin hook? $plugins = elgg_trigger_plugin_hook('public_pages', 'walled_garden', NULL, array()); // If more URL's are added... merge both with original list if (is_array($plugins)) { $allow = array_merge($allow, $plugins); } // Check if current page is in allowed list... otherwise redirect to login foreach ($allow as $public) { $pattern = "`^{$CONFIG->url}{$public}/*\$`i"; if (preg_match($pattern, $current_url)) { return; } } gatekeeper(); }
public function logout() { gatekeeper(); // Logout and redirect to frontpage $this->Member_model->logout(); message('Successfully signed out.'); redirect('auth/login'); }
function admin_gatekeeper() { gatekeeper(); $CI =& get_instance(); if (!$CI->Group_model->member_of_group(member_id(), 'admins')) { error('You have to be logged in as an administrator to access this page.'); redirect(); } }
/** * Page handlers for hypeFramework * * * @param type $page * @return type */ function hj_framework_page_handlers($page) { if (!isset($page[0])) { forward(); } $path_pages = elgg_get_root_path() . 'mod/hypeFramework/pages/'; switch ($page[0]) { case 'edit': set_input('guid', $page[1]); include $path_pages . 'edit/object.php'; break; case 'icon': set_input('guid', $page[1]); set_input('size', $page[2]); include $path_pages . "icon/icon.php"; break; case 'download': set_input('guid', $page[1]); include $path_pages . "file/download.php"; break; case 'file': switch ($page[1]) { case 'create': gatekeeper(); $container_guid = elgg_extract(2, $page, false); if (!$container_guid) { $container_guid = elgg_get_logged_in_user_guid(); } elgg_set_page_owner_guid($container_guid); set_input('container_guid', $container_guid); include "{$path_pages}create/file.php"; break; case 'edit': gatekeeper(); set_input('guid', $page[2]); include "{$path_pages}edit/object.php"; break; case 'view': if (!isset($page[2])) { return false; } $entity = get_entity($page[2]); if (!$entity) { return false; } $sidebar = elgg_view('framework/file/dashboard/sidebar', array('entity' => $entity)); echo elgg_view_page($entity->title, elgg_view_layout('framework/entity', array('entity' => $entity, 'sidebar' => $sidebar))); break; } break; default: return false; break; } return true; }
function poll_get_page_edit($page_type, $guid = 0) { gatekeeper(); // Get the current page's owner $page_owner = elgg_get_page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { $page_owner = elgg_get_logged_in_user_entity(); elgg_set_page_owner_guid($page_owner->guid); } $form_vars = array('id' => 'poll-edit-form'); // Get the post, if it exists if ($page_type == 'edit') { $poll = get_entity($guid); if ($poll instanceof Poll) { $container_guid = $poll->container_guid; elgg_set_page_owner_guid($container_guid); $title = elgg_echo('poll:editpost', array($poll->title)); $body_vars = array('fd' => poll_prepare_edit_body_vars($poll), 'entity' => $poll); if ($poll->canEdit()) { $content = elgg_view_form("poll/edit", $form_vars, $body_vars); } else { $content = elgg_echo('poll:permission_error'); } $container = get_entity($container_guid); if (elgg_instanceof($container, 'group')) { elgg_push_breadcrumb($container->name, 'poll/group/' . $container->getGUID()); } else { elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username); } elgg_push_breadcrumb(elgg_echo("poll:edit")); } else { $title = elgg_echo('poll:error_title'); $content = elgg_echo('poll:no_such_poll'); } } else { if ($guid) { elgg_set_page_owner_guid($guid); $container = get_entity($guid); elgg_push_breadcrumb($container->name, 'poll/group/' . $container->getGUID()); } else { $user = elgg_get_logged_in_user_entity(); elgg_set_page_owner_guid($user->getGUID()); elgg_push_breadcrumb($user->name, 'poll/owner/' . $user->username); } elgg_push_breadcrumb(elgg_echo('poll:add')); $title = elgg_echo('poll:addpost'); $body_vars = array('fd' => poll_prepare_edit_body_vars(), 'container_guid' => $guid); $content = elgg_view_form("poll/edit", $form_vars, $body_vars); } $params = array('title' => $title, 'content' => $content, 'filter' => ''); $body = elgg_view_layout('content', $params); // Display page return elgg_view_page($title, $body); }
/** * 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); }
/** * Reported content page handler * * Serves the add report page * * @param array $page Array of page routing elements */ function reportedcontent_page_handler($page) { // only logged in users can report things gatekeeper(); $content .= elgg_view_title(elgg_echo('reportedcontent:this')); $content .= elgg_view_form('reportedcontent/add'); $sidebar = elgg_echo('reportedcontent:instructions'); $params = array('content' => $content, 'sidebar' => $sidebar); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page(elgg_echo('reportedcontent:this'), $body); }
function importer_page_handler($page) { gatekeeper(); elgg_set_context('friends'); elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('import:contacts'); $body = elgg_view('importer/form'); $params = array('content' => $body, 'title' => $title); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); return true; }
function donation_page_handler($page) { gatekeeper(); $title = elgg_echo('donation:title:everyone', array(elgg_get_config('sitename'))); $content = elgg_view('donation/everyone'); if (elgg_get_plugin_setting('sidebar_donation', 'donation') != 'yes') { $sidebar = elgg_view("donation/sidebar"); } $params = array('content' => $content, 'title' => $title, 'sidebar' => $sidebar); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); }
/** * GV isegoria page handler. */ function isegoria_page_handler() { // Ensure that only logged-in users can see this page gatekeeper(); // Set context and title elgg_set_context('dashboard'); elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('dashboard'); $params = array('num_columns' => 3, 'show_access' => false); $widgets = elgg_view_layout('widgets', $params); $body = elgg_view_layout('one_column', array('content' => $widgets)); echo elgg_view_page($title, $body); return true; }
/** * Dispatche chat pages. * * @param array $page * @return bool */ function chat_page_handler($page) { elgg_load_library('chat'); if (!isset($page[0])) { elgg_push_breadcrumb(elgg_echo('chat')); $page[0] = 'all'; } else { elgg_push_breadcrumb(elgg_echo('chat'), 'chat/all'); } switch ($page[0]) { case 'messages': include __DIR__ . '/messages.php'; return true; case 'notifier': include __DIR__ . '/notifier.php'; return true; case 'owner': $user = get_user_by_username($page[1]); $params = chat_all($user->guid); break; case 'friends': $user = get_user_by_username($page[1]); $params = chat_friends($user->guid); break; case 'add': gatekeeper(); $params = chat_edit(); break; case 'edit': gatekeeper(); $params = chat_edit($page[1]); break; case 'view': $params = chat_view($page[1]); break; case 'members': gatekeeper(); $params = chat_add_members($page[1]); break; case 'all': default: $params = chat_all(); break; } $body = elgg_view_layout('content', $params); echo elgg_view_page('test', $body); return true; }
/** * Dispatches notifier pages * * URLs take the form of * All notifications: notifier/all * Subjects of a notification: notifier/subjects/<notification guid> * * @param array $segments Array of URL segments * @return bool Was the page handled successfully */ function notifier_page_handler($segments) { gatekeeper(); $page = array_shift($segments); switch ($page) { default: case 'all': case 'popup': echo elgg_view_resource('notifier/list'); return true; case 'subjects': $guid = array_shift($segments); echo elgg_view_resource('notifier/subjects', array('guid' => $guid)); return true; } return false; }
function file_tools_file_route_hook($hook, $type, $returnvalue, $params) { $result = $returnvalue; if (!empty($returnvalue) && is_array($returnvalue)) { $page = elgg_extract("segments", $returnvalue); switch ($page[0]) { case "view": if (!elgg_is_logged_in() && isset($page[1])) { if (!get_entity($page[1])) { gatekeeper(); } } break; case "owner": if (file_tools_use_folder_structure()) { $result = false; include dirname(dirname(__FILE__)) . "/pages/list.php"; } break; case "group": if (file_tools_use_folder_structure()) { $result = false; include dirname(dirname(__FILE__)) . "/pages/list.php"; } break; case "add": $result = false; include dirname(dirname(__FILE__)) . "/pages/file/new.php"; break; case "zip": if (isset($page[1])) { $result = false; elgg_set_page_owner_guid($page[1]); register_error(elgg_echo("changebookmark")); forward("file/add/" . $page[1] . "?upload_type=zip"); } break; case "bulk_download": $result = false; include dirname(dirname(__FILE__)) . "/pages/file/download.php"; break; } } return $result; }
/** * Dispatches sched_conf pages. * * URLs take the form of * Schedule a conference: sched_conf/add * Schedule a group conference: sched_conf/add/<group_guid> * Edit a conference: sched_conf/edit/<conf_guid> * List site wide conferences: sched_conf/list/all * List a user's conferences: sched_conf/list/owner/<username> * List a group's conferences: sched_conf/list/group/<group_guid> * View a conference: sched_conf/view/<conf_guid>/<title> * * Title is ignored * * @param array $page * @return NULL */ function sched_conf_page_handler($page) { elgg_load_library('elgg:sched_conf'); $page_type = $page[0]; switch ($page_type) { case 'list': echo sched_conf_get_page_content_list($page[1], $page[2]); break; case 'view': echo sched_conf_get_page_content_view($page[1]); break; case 'add': case 'edit': gatekeeper(); echo sched_conf_get_page_content_edit($page_type, $page[1]); break; } }
function poll_get_page_edit($page_type, $guid = 0) { gatekeeper(); $form_vars = array('id' => 'poll-edit-form'); // Get the post, if it exists if ($page_type == 'edit') { $poll = get_entity($guid); if (!$poll instanceof Poll) { register_error(elgg_echo('poll:not_found')); forward(REFERER); } if (!$poll->canEdit()) { register_error(elgg_echo('poll:permission_error')); forward(REFERER); } $container = $poll->getContainerEntity(); elgg_set_page_owner_guid($container->guid); $title = elgg_echo('poll:editpost', array($poll->title)); $body_vars = array('fd' => poll_prepare_edit_body_vars($poll), 'entity' => $poll); if ($container instanceof ElggGroup) { elgg_push_breadcrumb($container->name, 'poll/group/' . $container->guid); } else { elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username); } elgg_push_breadcrumb(elgg_echo("poll:edit")); } else { if ($guid) { $container = get_entity($guid); elgg_push_breadcrumb($container->name, 'poll/group/' . $container->guid); } else { $container = elgg_get_logged_in_user_entity(); elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username); } elgg_set_page_owner_guid($container->guid); elgg_push_breadcrumb(elgg_echo('poll:add')); $title = elgg_echo('poll:addpost'); $body_vars = array('fd' => poll_prepare_edit_body_vars(), 'container_guid' => $guid); } $content = elgg_view_form("poll/edit", $form_vars, $body_vars); $params = array('title' => $title, 'content' => $content, 'filter' => ''); $body = elgg_view_layout('content', $params); // Display page return elgg_view_page($title, $body); }
/** * Serve pages. URLs in the form: * * crushes/owner/<username> - Crushes landing page for <username>. If ?section=mutual shows only mutual * * @param array $page * @return bool Depending on success */ function page_handler($page) { gatekeeper(); if (!isset($page[0])) { $page[0] = 'owner'; } if (!isset($page[1])) { $user = elgg_get_logged_in_user_entity(); $page[1] = $user->username; } $username = elgg_extract(1, $page); $user = get_user_by_username($username); elgg_set_page_owner_guid($user->getGUID()); if (!$user) { forward(REFERER, 404); } include dirname(__FILE__) . '/pages/crushes/owner.php'; return true; }
/** * Edit or add a discussion topic * * @param string $type 'add' or 'edit' * @param int $guid GUID of group or topic */ function discussion_handle_edit_page($type, $guid) { gatekeeper(); if ($type == 'add') { $group = get_entity($guid); if (!$group) { register_error(elgg_echo('group:notfound')); forward(); } // make sure user has permissions to add a topic to container if (!$group->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('groups:permissions:error')); forward($group->getURL()); } $title = elgg_echo('groups:addtopic'); elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}"); elgg_push_breadcrumb($title); $body_vars = discussion_prepare_form_vars(); $content = elgg_view_form('discussion/save', array(), $body_vars); } else { $topic = get_entity($guid); if (!$topic || !$topic->canEdit()) { register_error(elgg_echo('discussion:topic:notfound')); forward(); } $group = $topic->getContainerEntity(); if (!$group) { register_error(elgg_echo('group:notfound')); forward(); } $title = elgg_echo('groups:edittopic'); elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}"); elgg_push_breadcrumb($topic->title, $topic->getURL()); elgg_push_breadcrumb($title); $body_vars = discussion_prepare_form_vars($topic); $content = elgg_view_form('discussion/save', array(), $body_vars); } $params = array('content' => $content, 'title' => $title, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
/** * Messages page handler * /messages/inbox/<username>?message_type=<message_type> * /messages/sent/<username>?message_type=<message_type> * /messages/read/<guid> * /messages/thread/<hash> * /messages/compose?send_to=<guid> * * @param array $segments An array of URL segments * @return boolean Outputs a page or returns false on failure */ function handlePages($segments) { gatekeeper(); $page_owner = $this->getPageOwner($segments); if (!$page_owner || !$page_owner->canEdit()) { forward('', '403'); } elgg_set_page_owner_guid($page_owner->guid); switch ($segments[0]) { default: case 'inbox': case 'incoming': $page = elgg_view('resources/messages/inbox'); break; case 'outbox': case 'outgoing': case 'sent': $page = elgg_view('resources/messages/sent'); break; case 'read': case 'view': case 'reply': set_input('guid', $segments[1]); $page = elgg_view('resources/messages/read'); break; case 'thread': set_input('hash', $segments[1]); $page = elgg_view('resources/messages/thread'); break; case 'compose': case 'add': set_input('guid', $segments[1]); $page = elgg_view('resources/messages/compose'); break; } if (!$page) { return false; } echo $page; return true; }
function blog_tools_route_blog_hook($hook, $type, $returm_value, $params) { $result = $returm_value; if ($page = elgg_extract("segments", $returm_value)) { switch ($page[0]) { case "read": // Elgg 1.7 compatibility // Elgg 1.7 compatibility case "view": if (!elgg_is_logged_in() && elgg_get_plugin_setting("advanced_gatekeeper", "blog_tools") != "no") { if (isset($page[1]) && !get_entity($page[1])) { gatekeeper(); } } break; case "add": case "edit": $result = false; // push all blogs breadcrumb elgg_push_breadcrumb(elgg_echo("blog:blogs"), "blog/all"); set_input("page_type", $page[0]); if (isset($page[1])) { set_input("guid", $page[1]); } if (isset($page[2])) { set_input("revision", $page[2]); } include dirname(dirname(__FILE__)) . "/pages/edit.php"; break; case "transfer": $result = false; if (isset($page[1])) { set_input("guid", $page[1]); } include dirname(dirname(__FILE__)) . "/pages/transfer.php"; break; } } return $result; }
/** * Dispatches notifier pages * * URLs take the form of * All notifications: notifier/all * Subjects of a notification: notifier/subjects/<notification guid> * * @param array $page Array of URL segments * @return bool Was the page handled successfully */ function notifier_page_handler($page) { gatekeeper(); if (empty($page[0])) { $page[0] = 'all'; } $path = elgg_get_plugins_path() . 'notifier/pages/notifier/'; switch ($page[0]) { case 'popup': include_once $path . 'popup.php'; break; case 'subjects': set_input('guid', $page[1]); include_once $path . 'subjects.php'; break; case 'all': default: include_once $path . 'list.php'; break; } return true; }
function bookmark_tools_bookmark_route_hook($hook, $type, $returnvalue, $params) { $result = $returnvalue; if (!empty($returnvalue) && is_array($returnvalue)) { $page = elgg_extract("segments", $returnvalue); switch ($page[0]) { case "view": if (!elgg_is_logged_in() && isset($page[1])) { if (!get_entity($page[1])) { gatekeeper(); } } break; case "owner": if (bookmark_tools_use_folder_structure()) { $result = false; include dirname(dirname(__FILE__)) . "/pages/list.php"; } break; case "group": if (bookmark_tools_use_folder_structure()) { $result = false; include dirname(dirname(__FILE__)) . "/pages/list.php"; } break; case "add": $user = get_user_by_username($page[1]); if ($user) { $search = elgg_get_site_url() . 'bookmarks/add/' . $user->username; $replace = elgg_get_site_url() . 'bookmarks/add/' . $user->guid; $url = str_replace($search, $replace, current_page_url()); forward($url); } break; } } return $result; }
function private_profiles_page_handler($page) { gatekeeper(); $current_user = elgg_get_logged_in_user_entity(); if (!isset($page[0])) { $page[0] = 'usersettings'; } if (!isset($page[1])) { forward("private_profiles/{$page[0]}/{$current_user->username}"); } $user = get_user_by_username($page[1]); if ($user->guid != $current_user->guid && !$current_user->isAdmin()) { forward(); } switch ($page[0]) { case 'usersettings': require elgg_get_plugins_path() . 'private_profiles/index.php'; break; default: return false; } return true; }