From ef0d4ab9c2b037eb76c4f9af0a9220be1fdd72b4 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sat, 29 Oct 2011 17:47:55 -0700 Subject: Refs #3859. Added elgg_register_simplecache_view() to core plugins' js. --- mod/thewire/start.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod/thewire/start.php') diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 9d3993b6f..d5e995359 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -26,6 +26,7 @@ function thewire_init() { // register the wire's JavaScript $thewire_js = elgg_get_simplecache_url('js', 'thewire'); + elgg_register_simplecache_view('js/thewire'); elgg_register_js('elgg.thewire', $thewire_js, 'footer'); // add a site navigation item -- cgit v1.2.3 From 54773892f88f53231b85d08d86d11557121d9609 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 4 Nov 2011 22:40:06 -0400 Subject: Fixes #4059 page handlers all return nothing --- engine/lib/admin.php | 9 ++-- engine/lib/deprecated-1.8.php | 37 +++++++++++++++ engine/lib/elgglib.php | 14 +++--- engine/lib/pagehandler.php | 64 +++----------------------- engine/lib/river.php | 1 + engine/lib/tags.php | 27 +++++------ engine/lib/user_settings.php | 7 +-- engine/lib/users.php | 4 +- mod/blog/start.php | 12 ++--- mod/bookmarks/start.php | 6 +-- mod/categories/start.php | 5 +-- mod/dashboard/start.php | 4 ++ mod/developers/start.php | 1 + mod/diagnostics/start.php | 3 -- mod/externalpages/start.php | 1 + mod/file/start.php | 11 +++-- mod/groups/start.php | 5 ++- mod/invitefriends/start.php | 1 + mod/members/start.php | 1 + mod/messageboard/start.php | 4 +- mod/messages/start.php | 6 +-- mod/notifications/start.php | 4 +- mod/pages/start.php | 4 +- mod/profile/start.php | 1 + mod/reportedcontent/start.php | 1 + mod/search/start.php | 5 ++- mod/thewire/start.php | 89 ++++++++++++++++++------------------- mod/twitter_api/start.php | 9 ++-- mod/uservalidationbyemail/start.php | 6 ++- 29 files changed, 161 insertions(+), 181 deletions(-) (limited to 'mod/thewire/start.php') diff --git a/engine/lib/admin.php b/engine/lib/admin.php index ae6429baf..c0a5c0995 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -314,7 +314,7 @@ function admin_init() { // automatic adding of widgets for admin elgg_register_event_handler('make_admin', 'user', 'elgg_add_admin_widgets'); - elgg_register_page_handler('admin', 'admin_settings_page_handler'); + elgg_register_page_handler('admin', 'admin_page_handler'); elgg_register_page_handler('admin_plugin_screenshot', 'admin_plugin_screenshot_page_handler'); elgg_register_page_handler('admin_plugin_text_file', 'admin_markdown_page_handler'); } @@ -430,7 +430,7 @@ function admin_pagesetup() { * @return void * @access private */ -function admin_settings_page_handler($page) { +function admin_page_handler($page) { admin_gatekeeper(); elgg_admin_add_plugin_settings_menu(); @@ -485,7 +485,7 @@ function admin_settings_page_handler($page) { * admin_plugin_screenshot///. * * @param array $pages The pages array - * @return true + * @return void * @access private */ function admin_plugin_screenshot_page_handler($pages) { @@ -524,8 +524,6 @@ function admin_plugin_screenshot_page_handler($pages) { echo file_get_contents($file); break; } - - return true; } /** @@ -541,6 +539,7 @@ function admin_plugin_screenshot_page_handler($pages) { * * LICENSE.txt * * @param type $page + * @return void * @access private */ function admin_markdown_page_handler($pages) { diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index beba7d2b7..e1866498b 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -4735,3 +4735,40 @@ function remove_from_river_by_id($id) { return elgg_delete_river(array('id' => $id)); } + +/** + * A default page handler + * Tries to locate a suitable file to include. Only works for core pages, not plugins. + * + * @param array $page The page URL elements + * @param string $handler The base handler + * + * @return true|false Depending on success + * @deprecated 1.8 + */ +function default_page_handler($page, $handler) { + global $CONFIG; + + elgg_deprecated_notice("default_page_handler is deprecated", "1.8"); + + $page = implode('/', $page); + + // protect against including arbitary files + $page = str_replace("..", "", $page); + + $callpath = $CONFIG->path . $handler . "/" . $page; + if (is_dir($callpath)) { + $callpath = sanitise_filepath($callpath); + $callpath .= "index.php"; + if (file_exists($callpath)) { + if (include($callpath)) { + return TRUE; + } + } + } else if (file_exists($callpath)) { + include($callpath); + return TRUE; + } + + return FALSE; +} diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index a6f5fbc6f..03774deb4 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1745,7 +1745,7 @@ function _elgg_shutdown_hook() { * @access private */ function elgg_js_page_handler($page) { - return elgg_cacheable_view_page_handler($page, 'js'); + elgg_cacheable_view_page_handler($page, 'js'); } /** @@ -1777,8 +1777,6 @@ function elgg_ajax_page_handler($page) { echo elgg_view($view, $vars); } - - return true; } /** @@ -1798,7 +1796,7 @@ function elgg_css_page_handler($page) { $page[0] = 'elgg'; } - return elgg_cacheable_view_page_handler($page, 'css'); + elgg_cacheable_view_page_handler($page, 'css'); } /** @@ -1809,7 +1807,7 @@ function elgg_css_page_handler($page) { * @param array $page The page array * @param string $type The type: js or css * - * @return mixed + * @return void * @access private */ function elgg_cacheable_view_page_handler($page, $type) { @@ -1824,7 +1822,7 @@ function elgg_cacheable_view_page_handler($page, $type) { break; default: - return false; + return; break; } @@ -1851,8 +1849,6 @@ function elgg_cacheable_view_page_handler($page, $type) { echo $return; } - - return true; } /** @@ -1886,6 +1882,8 @@ function elgg_sql_reverse_order_by_clause($order_by) { * * Used as a callback for ElggBatch. * + * @todo why aren't these static methods on ElggBatch? + * * @param object $object The object to enable * @return bool * @access private diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index 0d5e5f89b..91e568c1d 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -9,12 +9,10 @@ /** * Turns the current page over to the page handler, allowing registered handlers to take over. * - * If a page handler returns FALSE, the request is handed over to the default_page_handler. - * * @param string $handler The name of the handler type (eg 'blog') * @param array $page The parameters to the page, as an array (exploded by '/' slashes) * - * @return true|false Depending on whether a registered page handler was found + * @return bool * @access private */ function page_handler($handler, $page) { @@ -42,26 +40,12 @@ function page_handler($handler, $page) { $handler = $params['handler']; $page = $params['segments']; - if (!isset($CONFIG->pagehandler) || empty($handler)) { - $result = false; - } else if (isset($CONFIG->pagehandler[$handler]) && is_callable($CONFIG->pagehandler[$handler])) { + if (isset($CONFIG->pagehandler) && !empty($handler) && isset($CONFIG->pagehandler[$handler])) { $function = $CONFIG->pagehandler[$handler]; - $result = call_user_func($function, $page, $handler); - if ($result !== false) { - $result = true; - } - } else { - $result = false; + call_user_func($function, $page, $handler); } - if (!$result) { - $result = default_page_handler($page, $handler); - } - if ($result !== false) { - $result = true; - } - - return $result; + return headers_sent(); } /** @@ -74,14 +58,15 @@ function page_handler($handler, $page) { * For example, the URL http://yoururl/blog/username/friends/ would result in the call: * blog_page_handler(array('username','friends'), blog); * - * Page handler functions should return true or the default page handler will be called. - * * A request to register a page handler with the same identifier as previously registered * handler will replace the previous one. * * The context is set to the page handler identifier before the registered * page handler function is called. For the above example, the context is set to 'blog'. * + * Requests not handled are forwarded to the front page with a reason of 404. + * Plugins can register for the 'forward', '404' plugin hook. @see forward() + * * @param string $handler The page type to handle * @param string $function Your function name * @@ -119,38 +104,3 @@ function elgg_unregister_page_handler($handler) { unset($CONFIG->pagehandler[$handler]); } - -/** - * A default page handler - * Tries to locate a suitable file to include. Only works for core pages, not plugins. - * - * @param array $page The page URL elements - * @param string $handler The base handler - * - * @return true|false Depending on success - * @access private - */ -function default_page_handler($page, $handler) { - global $CONFIG; - - $page = implode('/', $page); - - // protect against including arbitary files - $page = str_replace("..", "", $page); - - $callpath = $CONFIG->path . $handler . "/" . $page; - if (is_dir($callpath)) { - $callpath = sanitise_filepath($callpath); - $callpath .= "index.php"; - if (file_exists($callpath)) { - if (include($callpath)) { - return TRUE; - } - } - } else if (file_exists($callpath)) { - include($callpath); - return TRUE; - } - - return FALSE; -} diff --git a/engine/lib/river.php b/engine/lib/river.php index f430eb224..b2fead824 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -586,6 +586,7 @@ function update_river_access_by_object($object_guid, $access_id) { * Page handler for activiy * * @param array $page + * @return void * @access private */ function elgg_river_page_handler($page) { diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 6275d653c..b2c9a672f 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -325,21 +325,18 @@ function elgg_get_registered_tag_metadata_names() { * @access private */ function elgg_tagcloud_page_handler($page) { - switch ($page[0]) { - default: - $title = elgg_view_title(elgg_echo('tags:site_cloud')); - $options = array( - 'threshold' => 0, - 'limit' => 100, - 'tag_name' => 'tags', - ); - $tags = elgg_view_tagcloud($options); - $content = $title . $tags; - $body = elgg_view_layout('one_sidebar', array('content' => $content)); - - echo elgg_view_page(elgg_echo('tags:site_cloud'), $body); - break; - } + + $title = elgg_view_title(elgg_echo('tags:site_cloud')); + $options = array( + 'threshold' => 0, + 'limit' => 100, + 'tag_name' => 'tags', + ); + $tags = elgg_view_tagcloud($options); + $content = $title . $tags; + $body = elgg_view_layout('one_sidebar', array('content' => $content)); + + echo elgg_view_page(elgg_echo('tags:site_cloud'), $body); } /** diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index bb5d8d6c4..12084662b 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -304,7 +304,7 @@ function usersettings_page_handler($page) { $page[0] = 'user'; } - if ($page[1]) { + if (isset($page[1])) { $user = get_user_by_username($page[1]); elgg_set_page_owner_guid($user->guid); } else { @@ -324,12 +324,13 @@ function usersettings_page_handler($page) { $path = $CONFIG->path . "pages/settings/tools.php"; break; case 'user': - default: $path = $CONFIG->path . "pages/settings/account.php"; break; } - require($path); + if (isset($path)) { + require $path; + } } /** diff --git a/engine/lib/users.php b/engine/lib/users.php index 843b897e9..3001a2ac6 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1072,7 +1072,7 @@ function friends_page_handler($page_elements) { function friends_of_page_handler($page_elements) { elgg_set_context('friends'); if (isset($page_elements[0]) && $user = get_user_by_username($page_elements[0])) { - set_page_owner($user->getGUID()); + elgg_set_page_owner_guid($user->getGUID()); } if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) { collections_submenu_items(); @@ -1404,6 +1404,7 @@ function elgg_profile_fields_setup() { * /avatar/view/// * * @param array $page + * @return void * @access private */ function elgg_avatar_page_handler($page) { @@ -1426,6 +1427,7 @@ function elgg_avatar_page_handler($page) { * Profile page handler * * @param array $page + * @return void * @access private */ function elgg_profile_page_handler($page) { diff --git a/mod/blog/start.php b/mod/blog/start.php index 81837c48e..b2da00bc7 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -93,7 +93,7 @@ function blog_init() { * @todo no archives for all blogs or friends * * @param array $page - * @return NULL + * @return void */ function blog_page_handler($page) { @@ -139,17 +139,17 @@ function blog_page_handler($page) { $params = blog_get_page_content_list($page[1]); break; case 'all': - default: - $title = elgg_echo('blog:title:all_blogs'); $params = blog_get_page_content_list(); break; } - $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); + if (isset($params)) { + $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); - $body = elgg_view_layout('content', $params); + $body = elgg_view_layout('content', $params); - echo elgg_view_page($params['title'], $body); + echo elgg_view_page($params['title'], $body); + } } /** diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 2a7b44e97..6d9dc9b3d 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -83,6 +83,7 @@ function bookmarks_init() { * Title is ignored * * @param array $page + * @return void */ function bookmarks_page_handler($page) { elgg_load_library('elgg:bookmarks'); @@ -145,14 +146,9 @@ function bookmarks_page_handler($page) { set_input('container_guid', $page[1]); include "$pages/bookmarklet.php"; break; - - default: - return false; } elgg_pop_context(); - - return true; } /** diff --git a/mod/categories/start.php b/mod/categories/start.php index b6bc4a55c..3cec516f1 100644 --- a/mod/categories/start.php +++ b/mod/categories/start.php @@ -27,12 +27,11 @@ function categories_init() { /** - * Page handler - * + * Category page handler + * @return void */ function categories_page_handler() { include(dirname(__FILE__) . "/pages/categories/listing.php"); - return TRUE; } /** diff --git a/mod/dashboard/start.php b/mod/dashboard/start.php index 5635ead57..0197ee64f 100644 --- a/mod/dashboard/start.php +++ b/mod/dashboard/start.php @@ -29,6 +29,10 @@ function dashboard_init() { elgg_register_plugin_hook_handler('get_list', 'default_widgets', 'dashboard_default_widgets'); } +/** + * Dashboard page handler + * @return void + */ function dashboard_page_handler() { // Ensure that only logged-in users can see this page gatekeeper(); diff --git a/mod/developers/start.php b/mod/developers/start.php index ab9a174a4..c89e3d36f 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -157,6 +157,7 @@ function developers_log_events($name, $type) { * Serve the theme preview pages * * @param array $page + * @return void */ function developers_theme_preview_controller($page) { if (!isset($page[0])) { diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 735e15042..0bcc08bd9 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -12,9 +12,6 @@ elgg_register_event_handler('init', 'system', 'diagnostics_init'); */ function diagnostics_init() { - // Register a page handler, so we can have nice URLs - elgg_register_page_handler('diagnostics','diagnostics_page_handler'); - // Add admin menu item elgg_register_admin_menu_item('develop', 'diagnostics', 'develop_utilities'); diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php index 3169503be..271051ba9 100644 --- a/mod/externalpages/start.php +++ b/mod/externalpages/start.php @@ -53,6 +53,7 @@ function expages_setup_footer_menu() { * * @param array $page URL segements * @param string $handler Handler identifier + * @return void */ function expages_page_handler($page, $handler) { if ($handler == 'expages') { diff --git a/mod/file/start.php b/mod/file/start.php index 9007fc9ba..bb20fc7ba 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -100,7 +100,7 @@ function file_init() { * Title is ignored * * @param array $page - * @return NULL + * @return void */ function file_page_handler($page) { @@ -136,7 +136,6 @@ function file_page_handler($page) { include "$file_dir/owner.php"; break; case 'all': - default: include "$file_dir/world.php"; break; } @@ -145,10 +144,10 @@ function file_page_handler($page) { /** * Creates the notification message body * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params + * @param string $hook + * @param string $entity_type + * @param string $returnvalue + * @param array $params */ function file_notify_message($hook, $entity_type, $returnvalue, $params) { $entity = $params['entity']; diff --git a/mod/groups/start.php b/mod/groups/start.php index 1b5b03ce7..710ccc0b2 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -192,6 +192,7 @@ function groups_setup_sidebar_menus() { * Group members: groups/members/ * * @param array $page Array of url segments for routing + * @return void */ function groups_page_handler($page) { @@ -244,7 +245,8 @@ function groups_page_handler($page) { /** * Handle group icons. * - * @param unknown_type $page + * @param array $page + * @return void */ function groups_icon_handler($page) { @@ -750,6 +752,7 @@ function discussion_init() { * Edit discussion topic: discussion/edit/ * * @param array $page Array of url segments for routing + * @return void */ function discussion_page_handler($page) { diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index f39d25f4b..61cfed96c 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -27,6 +27,7 @@ function invitefriends_init() { * Page handler function * * @param array $page Page URL segments + * @return void */ function invitefriends_page_handler($page) { gatekeeper(); diff --git a/mod/members/start.php b/mod/members/start.php index 2c1793c17..1d734da17 100644 --- a/mod/members/start.php +++ b/mod/members/start.php @@ -19,6 +19,7 @@ function members_init() { * Members page handler * * @param array $page url segments + * @return void */ function members_page_handler($page) { $base = elgg_get_plugins_path() . 'members/pages/members'; diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php index 0b0155069..9db16cf3b 100644 --- a/mod/messageboard/start.php +++ b/mod/messageboard/start.php @@ -42,7 +42,7 @@ function messageboard_init() { * Group messageboard: messageboard/group//all (not implemented) * * @param array $page Array of page elements - * @return bool + * @return void */ function messageboard_page_handler($page) { $new_section_one = array('owner', 'add', 'group'); @@ -85,8 +85,6 @@ function messageboard_page_handler($page) { include "$pages/owner.php"; break; } - - return true; } /** diff --git a/mod/messages/start.php b/mod/messages/start.php index 4a3b0b250..631a5f731 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -70,7 +70,7 @@ function messages_init() { * Messages page handler * * @param array $page Array of URL components for routing - * @return bool + * @return void */ function messages_page_handler($page) { @@ -112,11 +112,7 @@ function messages_page_handler($page) { case 'add': include("$base_dir/send.php"); break; - default: - return false; } - - return true; } /** diff --git a/mod/notifications/start.php b/mod/notifications/start.php index c6701cc3e..7ec82cfc9 100644 --- a/mod/notifications/start.php +++ b/mod/notifications/start.php @@ -36,6 +36,7 @@ function notifications_plugin_init() { * Route page requests * * @param array $page Array of url parameters + * @return void */ function notifications_page_handler($page) { @@ -51,12 +52,9 @@ function notifications_page_handler($page) { require "$base/groups.php"; break; case 'personal': - default: require "$base/index.php"; break; } - - return TRUE; } /** diff --git a/mod/pages/start.php b/mod/pages/start.php index 744306649..fd1d7df47 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -100,6 +100,7 @@ function pages_init() { * Title is ignored * * @param array $page + * @return void */ function pages_page_handler($page) { @@ -149,12 +150,9 @@ function pages_page_handler($page) { include "$base_dir/revision.php"; break; case 'all': - default: include "$base_dir/world.php"; break; } - - return; } /** diff --git a/mod/profile/start.php b/mod/profile/start.php index 0f13ad844..1c82d55f5 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -48,6 +48,7 @@ function profile_init() { * Profile page handler * * @param array $page Array of URL segments passed by the page handling mechanism + * @return void */ function profile_page_handler($page) { diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 66a1248d9..0638feb52 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -60,6 +60,7 @@ function reportedcontent_init() { * Serves the add report page * * @param array $page Array of page routing elements + * @return void */ function reportedcontent_page_handler($page) { // only logged in users can report things diff --git a/mod/search/start.php b/mod/search/start.php index 9ab14f42f..a88c6ec03 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -14,7 +14,7 @@ function search_init() { require_once 'search_hooks.php'; // page handler for search actions and results - elgg_register_page_handler('search','search_page_handler'); + elgg_register_page_handler('search', 'search_page_handler'); // register some default search hooks elgg_register_plugin_hook_handler('search', 'object', 'search_objects_hook'); @@ -55,7 +55,8 @@ function search_init() { /** * Page handler for search * - * @param array $page Page elements from pain page handler + * @param array $page Page elements from core page handler + * @return void */ function search_page_handler($page) { diff --git a/mod/thewire/start.php b/mod/thewire/start.php index d5e995359..f46d9ec75 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -84,58 +84,57 @@ function thewire_init() { * thewire/tag/ View wire posts tagged with * * @param array $page From the page_handler function - * @return true|false Depending on success + * @return void */ function thewire_page_handler($page) { $base_dir = elgg_get_plugins_path() . 'thewire/pages/thewire'; - // if just /thewire go to global view in the else statement - if (isset($page[0]) && $page[0]) { - - switch ($page[0]) { - case "all": - include "$base_dir/everyone.php"; - break; - - case "friends": - include "$base_dir/friends.php"; - break; - - case "owner": - include "$base_dir/owner.php"; - break; - - case "thread": - if (isset($page[1])) { - set_input('thread_id', $page[1]); - } - include "$base_dir/thread.php"; - break; - case "reply": - if (isset($page[1])) { - set_input('guid', $page[1]); - } - include "$base_dir/reply.php"; - break; - case "tag": - if (isset($page[1])) { - set_input('tag', $page[1]); - } - include "$base_dir/tag.php"; - break; - case "previous": - if (isset($page[1])) { - set_input('guid', $page[1]); - } - include "$base_dir/previous.php"; - break; - } - } else { - include "$base_dir/everyone.php"; + if (!isset($page[0])) { + $page = array('all'); } - return true; + switch ($page[0]) { + case "all": + include "$base_dir/everyone.php"; + break; + + case "friends": + include "$base_dir/friends.php"; + break; + + case "owner": + include "$base_dir/owner.php"; + break; + + case "thread": + if (isset($page[1])) { + set_input('thread_id', $page[1]); + } + include "$base_dir/thread.php"; + break; + + case "reply": + if (isset($page[1])) { + set_input('guid', $page[1]); + } + include "$base_dir/reply.php"; + break; + + case "tag": + if (isset($page[1])) { + set_input('tag', $page[1]); + } + include "$base_dir/tag.php"; + break; + + case "previous": + if (isset($page[1])) { + set_input('guid', $page[1]); + } + include "$base_dir/previous.php"; + break; + } } /** diff --git a/mod/twitter_api/start.php b/mod/twitter_api/start.php index b17643c8c..fd2ff6493 100644 --- a/mod/twitter_api/start.php +++ b/mod/twitter_api/start.php @@ -45,13 +45,14 @@ function twitter_api_init() { * Handles old pg/twitterservice/ handler * * @param array $page + * @return void */ function twitter_api_pagehandler_deprecated($page) { $url = elgg_get_site_url() . 'pg/twitter_api/authorize'; $msg = elgg_echo('twitter_api:deprecated_callback_url', array($url)); register_error($msg); - return twitter_api_pagehandler($page); + twitter_api_pagehandler($page); } @@ -59,10 +60,11 @@ function twitter_api_pagehandler_deprecated($page) { * Serves pages for twitter. * * @param array $page + * @return void */ function twitter_api_pagehandler($page) { if (!isset($page[0])) { - forward(); + return; } switch ($page[0]) { @@ -90,9 +92,6 @@ function twitter_api_pagehandler($page) { $pages = dirname(__FILE__) . '/pages/twitter_api'; include "$pages/interstitial.php"; break; - default: - forward(); - break; } } diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index d3d0c3488..a674511cf 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -149,6 +149,7 @@ function uservalidationbyemail_check_auth_attempt($credentials) { * Checks sent passed validation code and user guids and validates the user. * * @param array $page + * @return void */ function uservalidationbyemail_page_handler($page) { @@ -162,7 +163,7 @@ function uservalidationbyemail_page_handler($page) { $user = get_entity($user_guid); - if (($code) && ($user)) { + if ($code && $user) { if (uservalidationbyemail_validate_email($user_guid, $code)) { elgg_push_context('uservalidationbyemail_validate_user'); @@ -184,7 +185,8 @@ function uservalidationbyemail_page_handler($page) { register_error(elgg_echo('email:confirm:fail')); } - forward(); + // forward to front page + forward(''); } /** -- cgit v1.2.3 From 0759c227bf7b73254cf6eb5e8502463875f2469f Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 4 Nov 2011 23:29:54 -0400 Subject: Fixes #4059 returning true when handling a page --- engine/lib/admin.php | 9 ++++++--- engine/lib/cron.php | 3 ++- engine/lib/elgglib.php | 15 +++++++++------ engine/lib/entities.php | 4 +++- engine/lib/pagehandler.php | 6 ++++-- engine/lib/river.php | 3 ++- engine/lib/tags.php | 3 ++- engine/lib/user_settings.php | 3 ++- engine/lib/users.php | 30 ++++++++++++++++++++++-------- mod/blog/start.php | 13 +++++++------ mod/bookmarks/start.php | 6 +++++- mod/categories/start.php | 3 ++- mod/dashboard/start.php | 3 ++- mod/developers/start.php | 3 ++- mod/externalpages/start.php | 3 ++- mod/file/start.php | 5 ++++- mod/groups/start.php | 10 ++++++++-- mod/invitefriends/start.php | 3 ++- mod/members/start.php | 3 ++- mod/messageboard/start.php | 6 +++++- mod/messages/start.php | 5 ++++- mod/notifications/start.php | 5 ++++- mod/pages/start.php | 5 ++++- mod/profile/start.php | 3 ++- mod/reportedcontent/start.php | 3 ++- mod/search/start.php | 3 ++- mod/thewire/start.php | 6 +++++- mod/twitter_api/start.php | 9 ++++++--- mod/uservalidationbyemail/start.php | 2 +- 29 files changed, 123 insertions(+), 52 deletions(-) (limited to 'mod/thewire/start.php') diff --git a/engine/lib/admin.php b/engine/lib/admin.php index c0a5c0995..3baf2ff61 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -427,7 +427,7 @@ function admin_pagesetup() { * * @param array $page Array of pages * - * @return void + * @return bool * @access private */ function admin_page_handler($page) { @@ -478,6 +478,7 @@ function admin_page_handler($page) { $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title)); echo elgg_view_page($title, $body, 'admin'); + return true; } /** @@ -485,7 +486,7 @@ function admin_page_handler($page) { * admin_plugin_screenshot///. * * @param array $pages The pages array - * @return void + * @return bool * @access private */ function admin_plugin_screenshot_page_handler($pages) { @@ -524,6 +525,7 @@ function admin_plugin_screenshot_page_handler($pages) { echo file_get_contents($file); break; } + return true; } /** @@ -539,7 +541,7 @@ function admin_plugin_screenshot_page_handler($pages) { * * LICENSE.txt * * @param type $page - * @return void + * @return bool * @access private */ function admin_markdown_page_handler($pages) { @@ -595,6 +597,7 @@ function admin_markdown_page_handler($pages) { )); echo elgg_view_page($title, $body, 'admin'); + return true; } /** diff --git a/engine/lib/cron.php b/engine/lib/cron.php index 8c0b62a53..8af640396 100644 --- a/engine/lib/cron.php +++ b/engine/lib/cron.php @@ -25,7 +25,7 @@ function cron_init() { * * @param array $page Pages * - * @return void + * @return bool * @access private */ function cron_page_handler($page) { @@ -63,6 +63,7 @@ function cron_page_handler($page) { $std_out = ob_get_clean(); echo $std_out . $old_stdout; + return true; } /** diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 03774deb4..10804fdca 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1740,12 +1740,12 @@ function _elgg_shutdown_hook() { * * @param array $page The page array * - * @return void + * @return bool * @elgg_pagehandler js * @access private */ function elgg_js_page_handler($page) { - elgg_cacheable_view_page_handler($page, 'js'); + return elgg_cacheable_view_page_handler($page, 'js'); } /** @@ -1755,7 +1755,7 @@ function elgg_js_page_handler($page) { * * @param array $page The page array * - * @return void + * @return bool * @elgg_pagehandler ajax * @access private */ @@ -1776,7 +1776,9 @@ function elgg_ajax_page_handler($page) { } echo elgg_view($view, $vars); + return true; } + return false; } /** @@ -1796,7 +1798,7 @@ function elgg_css_page_handler($page) { $page[0] = 'elgg'; } - elgg_cacheable_view_page_handler($page, 'css'); + return elgg_cacheable_view_page_handler($page, 'css'); } /** @@ -1807,7 +1809,7 @@ function elgg_css_page_handler($page) { * @param array $page The page array * @param string $type The type: js or css * - * @return void + * @return bool * @access private */ function elgg_cacheable_view_page_handler($page, $type) { @@ -1822,7 +1824,7 @@ function elgg_cacheable_view_page_handler($page, $type) { break; default: - return; + return false; break; } @@ -1848,6 +1850,7 @@ function elgg_cacheable_view_page_handler($page, $type) { //header("Content-Length: " . strlen($return)); echo $return; + return true; } } diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 98e48641a..4b8b6694f 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -2071,7 +2071,7 @@ function is_registered_entity_type($type, $subtype = null) { * * @param array $page Page elements from pain page handler * - * @return void + * @return bool * @elgg_page_handler view * @access private */ @@ -2080,7 +2080,9 @@ function entities_page_handler($page) { global $CONFIG; set_input('guid', $page[0]); include($CONFIG->path . "pages/entities/index.php"); + return true; } + return false; } /** diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index 91e568c1d..f331e2aae 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -40,12 +40,13 @@ function page_handler($handler, $page) { $handler = $params['handler']; $page = $params['segments']; + $result = false; if (isset($CONFIG->pagehandler) && !empty($handler) && isset($CONFIG->pagehandler[$handler])) { $function = $CONFIG->pagehandler[$handler]; - call_user_func($function, $page, $handler); + $result = call_user_func($function, $page, $handler); } - return headers_sent(); + return $result || headers_sent(); } /** @@ -64,6 +65,7 @@ function page_handler($handler, $page) { * The context is set to the page handler identifier before the registered * page handler function is called. For the above example, the context is set to 'blog'. * + * Page handlers should return true to indicate that they handled the request. * Requests not handled are forwarded to the front page with a reason of 404. * Plugins can register for the 'forward', '404' plugin hook. @see forward() * diff --git a/engine/lib/river.php b/engine/lib/river.php index b2fead824..466eca253 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -586,7 +586,7 @@ function update_river_access_by_object($object_guid, $access_id) { * Page handler for activiy * * @param array $page - * @return void + * @return bool * @access private */ function elgg_river_page_handler($page) { @@ -607,6 +607,7 @@ function elgg_river_page_handler($page) { $entity_subtype = ''; require_once("{$CONFIG->path}pages/river.php"); + return true; } /** diff --git a/engine/lib/tags.php b/engine/lib/tags.php index b2c9a672f..a0887d0f3 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -321,7 +321,7 @@ function elgg_get_registered_tag_metadata_names() { * * @param array $page Page array * - * @return void + * @return bool * @access private */ function elgg_tagcloud_page_handler($page) { @@ -337,6 +337,7 @@ function elgg_tagcloud_page_handler($page) { $body = elgg_view_layout('one_sidebar', array('content' => $content)); echo elgg_view_page(elgg_echo('tags:site_cloud'), $body); + return true; } /** diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index 12084662b..1e2d6db10 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -294,7 +294,7 @@ function usersettings_pagesetup() { * * @param array $page Pages array * - * @return void + * @return bool * @access private */ function usersettings_page_handler($page) { @@ -330,6 +330,7 @@ function usersettings_page_handler($page) { if (isset($path)) { require $path; + return true; } } diff --git a/engine/lib/users.php b/engine/lib/users.php index 3001a2ac6..3aff2ca9d 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1048,7 +1048,7 @@ function collections_submenu_items() { * * @param array $page_elements Page elements * - * @return void + * @return bool * @access private */ function friends_page_handler($page_elements) { @@ -1059,6 +1059,7 @@ function friends_page_handler($page_elements) { collections_submenu_items(); } require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/index.php"); + return true; } /** @@ -1066,7 +1067,7 @@ function friends_page_handler($page_elements) { * * @param array $page_elements Page elements * - * @return void + * @return bool * @access private */ function friends_of_page_handler($page_elements) { @@ -1078,6 +1079,7 @@ function friends_of_page_handler($page_elements) { collections_submenu_items(); } require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/of.php"); + return true; } /** @@ -1085,7 +1087,7 @@ function friends_of_page_handler($page_elements) { * * @param array $page_elements Page elements * - * @return void + * @return bool * @access private */ function collections_page_handler($page_elements) { @@ -1096,6 +1098,7 @@ function collections_page_handler($page_elements) { set_page_owner(elgg_get_logged_in_user_guid()); collections_submenu_items(); require_once "{$base}pages/friends/collections/add.php"; + return true; } else { $user = get_user_by_username($page_elements[0]); if ($user) { @@ -1104,9 +1107,11 @@ function collections_page_handler($page_elements) { collections_submenu_items(); } require_once "{$base}pages/friends/collections/view.php"; + return true; } } } + return false; } /** @@ -1115,7 +1120,7 @@ function collections_page_handler($page_elements) { * @param array $page_elements Page elements * @param string $handler The handler string * - * @return void + * @return bool * @access private */ function elgg_user_account_page_handler($page_elements, $handler) { @@ -1131,7 +1136,10 @@ function elgg_user_account_page_handler($page_elements, $handler) { case 'register': require_once("$base_dir/register.php"); break; + default: + return false; } + return true; } /** @@ -1140,17 +1148,18 @@ function elgg_user_account_page_handler($page_elements, $handler) { * This is a fallback for non-JS users who click on the * dropdown login link. * - * @return void + * @return bool * @access private */ function elgg_user_login_page_handler() { if (elgg_is_logged_in()) { - forward(); + forward(''); } $login_box = elgg_view('core/account/login_box'); $content = elgg_view_layout('one_column', array('content' => $login_box)); echo elgg_view_page(elgg_echo('login'), $content); + return true; } /** @@ -1404,7 +1413,7 @@ function elgg_profile_fields_setup() { * /avatar/view/// * * @param array $page - * @return void + * @return bool * @access private */ function elgg_avatar_page_handler($page) { @@ -1417,17 +1426,20 @@ function elgg_avatar_page_handler($page) { if ($page[0] == 'edit') { require_once("{$CONFIG->path}pages/avatar/edit.php"); + return true; } else { set_input('size', $page[2]); require_once("{$CONFIG->path}pages/avatar/view.php"); + return true; } + return false; } /** * Profile page handler * * @param array $page - * @return void + * @return bool * @access private */ function elgg_profile_page_handler($page) { @@ -1438,7 +1450,9 @@ function elgg_profile_page_handler($page) { if ($page[1] == 'edit') { require_once("{$CONFIG->path}pages/profile/edit.php"); + return true; } + return false; } /** diff --git a/mod/blog/start.php b/mod/blog/start.php index b2da00bc7..052c63651 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -93,7 +93,7 @@ function blog_init() { * @todo no archives for all blogs or friends * * @param array $page - * @return void + * @return bool */ function blog_page_handler($page) { @@ -141,15 +141,16 @@ function blog_page_handler($page) { case 'all': $params = blog_get_page_content_list(); break; + default: + return false; } - if (isset($params)) { - $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); + $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); - $body = elgg_view_layout('content', $params); + $body = elgg_view_layout('content', $params); - echo elgg_view_page($params['title'], $body); - } + echo elgg_view_page($params['title'], $body); + return true; } /** diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 6d9dc9b3d..21a2d8940 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -83,7 +83,7 @@ function bookmarks_init() { * Title is ignored * * @param array $page - * @return void + * @return bool */ function bookmarks_page_handler($page) { elgg_load_library('elgg:bookmarks'); @@ -146,9 +146,13 @@ function bookmarks_page_handler($page) { set_input('container_guid', $page[1]); include "$pages/bookmarklet.php"; break; + + default: + return false; } elgg_pop_context(); + return true; } /** diff --git a/mod/categories/start.php b/mod/categories/start.php index 3cec516f1..0aacf11e7 100644 --- a/mod/categories/start.php +++ b/mod/categories/start.php @@ -28,10 +28,11 @@ function categories_init() { /** * Category page handler - * @return void + * @return bool */ function categories_page_handler() { include(dirname(__FILE__) . "/pages/categories/listing.php"); + return true; } /** diff --git a/mod/dashboard/start.php b/mod/dashboard/start.php index 0197ee64f..65007d1a8 100644 --- a/mod/dashboard/start.php +++ b/mod/dashboard/start.php @@ -31,7 +31,7 @@ function dashboard_init() { /** * Dashboard page handler - * @return void + * @return bool */ function dashboard_page_handler() { // Ensure that only logged-in users can see this page @@ -55,6 +55,7 @@ function dashboard_page_handler() { $body = elgg_view_layout('one_column', array('content' => $widgets)); echo elgg_view_page($title, $body); + return true; } diff --git a/mod/developers/start.php b/mod/developers/start.php index c89e3d36f..2e3df7663 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -157,7 +157,7 @@ function developers_log_events($name, $type) { * Serve the theme preview pages * * @param array $page - * @return void + * @return bool */ function developers_theme_preview_controller($page) { if (!isset($page[0])) { @@ -192,4 +192,5 @@ function developers_theme_preview_controller($page) { )); echo elgg_view_page($title, $layout, 'theme_preview'); + return true; } diff --git a/mod/externalpages/start.php b/mod/externalpages/start.php index 271051ba9..13235af53 100644 --- a/mod/externalpages/start.php +++ b/mod/externalpages/start.php @@ -53,7 +53,7 @@ function expages_setup_footer_menu() { * * @param array $page URL segements * @param string $handler Handler identifier - * @return void + * @return bool */ function expages_page_handler($page, $handler) { if ($handler == 'expages') { @@ -77,6 +77,7 @@ function expages_page_handler($page, $handler) { $body = elgg_view_layout("one_sidebar", array('content' => $content)); echo elgg_view_page($title, $body); + return true; } /** diff --git a/mod/file/start.php b/mod/file/start.php index bb20fc7ba..f8b7fa423 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -100,7 +100,7 @@ function file_init() { * Title is ignored * * @param array $page - * @return void + * @return bool */ function file_page_handler($page) { @@ -138,7 +138,10 @@ function file_page_handler($page) { case 'all': include "$file_dir/world.php"; break; + default: + return false; } + return true; } /** diff --git a/mod/groups/start.php b/mod/groups/start.php index 710ccc0b2..5469da013 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -192,7 +192,7 @@ function groups_setup_sidebar_menus() { * Group members: groups/members/ * * @param array $page Array of url segments for routing - * @return void + * @return bool */ function groups_page_handler($page) { @@ -239,7 +239,10 @@ function groups_page_handler($page) { case 'requests': groups_handle_requests_page($page[1]); break; + default: + return false; } + return true; } /** @@ -752,7 +755,7 @@ function discussion_init() { * Edit discussion topic: discussion/edit/ * * @param array $page Array of url segments for routing - * @return void + * @return bool */ function discussion_page_handler($page) { @@ -776,7 +779,10 @@ function discussion_page_handler($page) { case 'view': discussion_handle_view_page($page[1]); break; + default: + return false; } + return true; } /** diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index 61cfed96c..be853f2ce 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -27,7 +27,7 @@ function invitefriends_init() { * Page handler function * * @param array $page Page URL segments - * @return void + * @return bool */ function invitefriends_page_handler($page) { gatekeeper(); @@ -46,4 +46,5 @@ function invitefriends_page_handler($page) { $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page($title, $body); + return true; } diff --git a/mod/members/start.php b/mod/members/start.php index 1d734da17..54787cd16 100644 --- a/mod/members/start.php +++ b/mod/members/start.php @@ -19,7 +19,7 @@ function members_init() { * Members page handler * * @param array $page url segments - * @return void + * @return bool */ function members_page_handler($page) { $base = elgg_get_plugins_path() . 'members/pages/members'; @@ -37,4 +37,5 @@ function members_page_handler($page) { } else { require_once "$base/index.php"; } + return true; } diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php index 9db16cf3b..0c65edc4f 100644 --- a/mod/messageboard/start.php +++ b/mod/messageboard/start.php @@ -42,7 +42,7 @@ function messageboard_init() { * Group messageboard: messageboard/group//all (not implemented) * * @param array $page Array of page elements - * @return void + * @return bool */ function messageboard_page_handler($page) { $new_section_one = array('owner', 'add', 'group'); @@ -84,7 +84,11 @@ function messageboard_page_handler($page) { set_input('page_owner_guid', $owner_guid); include "$pages/owner.php"; break; + + default: + return false; } + return true; } /** diff --git a/mod/messages/start.php b/mod/messages/start.php index 631a5f731..e4ef4d43a 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -70,7 +70,7 @@ function messages_init() { * Messages page handler * * @param array $page Array of URL components for routing - * @return void + * @return bool */ function messages_page_handler($page) { @@ -112,7 +112,10 @@ function messages_page_handler($page) { case 'add': include("$base_dir/send.php"); break; + default: + return false; } + return true; } /** diff --git a/mod/notifications/start.php b/mod/notifications/start.php index 7ec82cfc9..761f17e40 100644 --- a/mod/notifications/start.php +++ b/mod/notifications/start.php @@ -36,7 +36,7 @@ function notifications_plugin_init() { * Route page requests * * @param array $page Array of url parameters - * @return void + * @return bool */ function notifications_page_handler($page) { @@ -54,7 +54,10 @@ function notifications_page_handler($page) { case 'personal': require "$base/index.php"; break; + default: + return false; } + return true; } /** diff --git a/mod/pages/start.php b/mod/pages/start.php index fd1d7df47..b2f26c719 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -100,7 +100,7 @@ function pages_init() { * Title is ignored * * @param array $page - * @return void + * @return bool */ function pages_page_handler($page) { @@ -152,7 +152,10 @@ function pages_page_handler($page) { case 'all': include "$base_dir/world.php"; break; + default: + return false; } + return true; } /** diff --git a/mod/profile/start.php b/mod/profile/start.php index 1c82d55f5..0ee2d0152 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -48,7 +48,7 @@ function profile_init() { * Profile page handler * * @param array $page Array of URL segments passed by the page handling mechanism - * @return void + * @return bool */ function profile_page_handler($page) { @@ -85,6 +85,7 @@ function profile_page_handler($page) { $body = elgg_view_layout('one_column', array('content' => $content)); echo elgg_view_page($title, $body); + return true; } /** diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 0638feb52..8b18a4d64 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -60,7 +60,7 @@ function reportedcontent_init() { * Serves the add report page * * @param array $page Array of page routing elements - * @return void + * @return bool */ function reportedcontent_page_handler($page) { // only logged in users can report things @@ -77,6 +77,7 @@ function reportedcontent_page_handler($page) { $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page(elgg_echo('reportedcontent:this'), $body); + return true; } /** diff --git a/mod/search/start.php b/mod/search/start.php index a88c6ec03..73a96dc0a 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -56,7 +56,7 @@ function search_init() { * Page handler for search * * @param array $page Page elements from core page handler - * @return void + * @return bool */ function search_page_handler($page) { @@ -72,6 +72,7 @@ function search_page_handler($page) { $base_dir = elgg_get_plugins_path() . 'search/pages/search'; include_once("$base_dir/index.php"); + return true; } /** diff --git a/mod/thewire/start.php b/mod/thewire/start.php index f46d9ec75..2ed0f0b4d 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -84,7 +84,7 @@ function thewire_init() { * thewire/tag/ View wire posts tagged with * * @param array $page From the page_handler function - * @return void + * @return bool */ function thewire_page_handler($page) { @@ -134,7 +134,11 @@ function thewire_page_handler($page) { } include "$base_dir/previous.php"; break; + + default: + return false; } + return true; } /** diff --git a/mod/twitter_api/start.php b/mod/twitter_api/start.php index fd2ff6493..08bce5479 100644 --- a/mod/twitter_api/start.php +++ b/mod/twitter_api/start.php @@ -45,14 +45,14 @@ function twitter_api_init() { * Handles old pg/twitterservice/ handler * * @param array $page - * @return void + * @return bool */ function twitter_api_pagehandler_deprecated($page) { $url = elgg_get_site_url() . 'pg/twitter_api/authorize'; $msg = elgg_echo('twitter_api:deprecated_callback_url', array($url)); register_error($msg); - twitter_api_pagehandler($page); + return twitter_api_pagehandler($page); } @@ -64,7 +64,7 @@ function twitter_api_pagehandler_deprecated($page) { */ function twitter_api_pagehandler($page) { if (!isset($page[0])) { - return; + return false; } switch ($page[0]) { @@ -92,7 +92,10 @@ function twitter_api_pagehandler($page) { $pages = dirname(__FILE__) . '/pages/twitter_api'; include "$pages/interstitial.php"; break; + default: + return false; } + return true; } /** diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index a674511cf..6904ce9e2 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -149,7 +149,7 @@ function uservalidationbyemail_check_auth_attempt($credentials) { * Checks sent passed validation code and user guids and validates the user. * * @param array $page - * @return void + * @return bool */ function uservalidationbyemail_page_handler($page) { -- cgit v1.2.3 From 2615252b460c01dd54170fed510516a1c50e3a42 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 6 Nov 2011 07:55:11 -0500 Subject: Fixes #4067 adds activate/deactivate scripts --- mod/blog/activate.php | 6 ++++++ mod/blog/deactivate.php | 6 ++++++ mod/search/README.txt | 5 ----- mod/thewire/activate.php | 6 ++++++ mod/thewire/deactivate.php | 6 ++++++ mod/thewire/start.php | 1 + 6 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 mod/blog/activate.php create mode 100644 mod/blog/deactivate.php create mode 100644 mod/thewire/activate.php create mode 100644 mod/thewire/deactivate.php (limited to 'mod/thewire/start.php') diff --git a/mod/blog/activate.php b/mod/blog/activate.php new file mode 100644 index 000000000..5f67ffbed --- /dev/null +++ b/mod/blog/activate.php @@ -0,0 +1,6 @@ +