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 --- 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 ++- 21 files changed, 87 insertions(+), 92 deletions(-) (limited to 'mod') 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