]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4059 page handlers all return nothing
authorcash <cash.costello@gmail.com>
Sat, 5 Nov 2011 02:40:06 +0000 (22:40 -0400)
committercash <cash.costello@gmail.com>
Sat, 5 Nov 2011 02:40:06 +0000 (22:40 -0400)
29 files changed:
engine/lib/admin.php
engine/lib/deprecated-1.8.php
engine/lib/elgglib.php
engine/lib/pagehandler.php
engine/lib/river.php
engine/lib/tags.php
engine/lib/user_settings.php
engine/lib/users.php
mod/blog/start.php
mod/bookmarks/start.php
mod/categories/start.php
mod/dashboard/start.php
mod/developers/start.php
mod/diagnostics/start.php
mod/externalpages/start.php
mod/file/start.php
mod/groups/start.php
mod/invitefriends/start.php
mod/members/start.php
mod/messageboard/start.php
mod/messages/start.php
mod/notifications/start.php
mod/pages/start.php
mod/profile/start.php
mod/reportedcontent/start.php
mod/search/start.php
mod/thewire/start.php
mod/twitter_api/start.php
mod/uservalidationbyemail/start.php

index ae6429baf4d3d443bb5c711f7927e20a7aa1d7fc..c0a5c099597400edafb7834c10f0d2b85f63a1e2 100644 (file)
@@ -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/<plugin_id>/<size>/<ss_name>.<ext>
  *
  * @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) {
index beba7d2b71619f68f32f3ef83d88e72774f2397f..e1866498b70af96e9843601c698dca7a9caca0d7 100644 (file)
@@ -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;
+}
index a6f5fbc6f1b60f27c9c3c9d9cae7557e3d7cd6b9..03774deb471689b5bbcb4ab88ff3b595345b34ce 100644 (file)
@@ -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
index 0d5e5f89bb90cd83d54703fd5fba801cae15d2e9..91e568c1dc784ce3d0392e6871597278e9279f60 100644 (file)
@@ -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;
-}
index f430eb2247a3bf95f09c794173ce139637d5fb31..b2fead824ce764f3349c1a553bdfa6975a9c08fc 100644 (file)
@@ -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) {
index 6275d653c240d656b9ae66191c349253e7f39adb..b2c9a672fc7ccdb24390b8f5df412da1da6689d8 100644 (file)
@@ -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);
 }
 
 /**
index bb5d8d6c4ee9cb6149ce7b4ae9c25bc6c1cdef0b..12084662bf813f8c0034b8df316e4cf06c751996 100644 (file)
@@ -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;
+       }
 }
 
 /**
index 843b897e944c54db0ab404d9cd86acad2d574846..3001a2ac6635724038952ab24572cd713d50ba1a 100644 (file)
@@ -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/<username>/<size>/<icontime>
  *
  * @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) {
index 81837c48e692da3541ac794de7e8522eef32772b..b2da00bc769f7c6a00eba6dd7f43da35c7627d9a 100644 (file)
@@ -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);
+       }
 }
 
 /**
index 2a7b44e97a55b831f7fb6c45542d0ba21c916b21..6d9dc9b3d0aab141ebe781f5938da14766b9cf36 100644 (file)
@@ -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;
 }
 
 /**
index b6bc4a55cbc08e3905558df55a732f2ce180eec9..3cec516f1b7eb2c28adabb4bc0b11f0c42a072a8 100644 (file)
@@ -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;
 }
 
 /**
index 5635ead57cc280ccef9f8b00f47a3b042e2c7b13..0197ee64f15179013142a760a0b9b3aa054fe305 100644 (file)
@@ -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();
index ab9a174a41c5103bd853f0fd2cdb34a2dc6ca4bf..c89e3d36f2944b64f8a5b53d92997a425ff53062 100644 (file)
@@ -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])) {
index 735e15042892b42457f5033b07b268c51ffc20f0..0bcc08bd9db94db57abb7146c191aeacdfc3e9c0 100644 (file)
@@ -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');
 
index 3169503be1f1e9a9dee381dd191ca8e159d129b9..271051ba93014ec9d53cb2d27fc6158814c8c225 100644 (file)
@@ -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') {
index 9007fc9ba8d01bcd1def483dee872170e978cf12..bb20fc7ba8ab5ad5391caaabf15581811623149b 100644 (file)
@@ -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'];
index 1b5b03ce7ccb04a3e46c7d7d343c36d6b06c9422..710ccc0b25a3cd25eb6240614f4c292ddc94f311 100644 (file)
@@ -192,6 +192,7 @@ function groups_setup_sidebar_menus() {
  *  Group members:        groups/members/<guid>
  *
  * @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/<guid>
  *
  * @param array $page Array of url segments for routing
+ * @return void
  */
 function discussion_page_handler($page) {
 
index f39d25f4b19d70b50dcbfa242880d03d6c922be1..61cfed96c5b8f771a13da07d8a64da002aee5922 100644 (file)
@@ -27,6 +27,7 @@ function invitefriends_init() {
  * Page handler function
  * 
  * @param array $page Page URL segments
+ * @return void
  */
 function invitefriends_page_handler($page) {
        gatekeeper();
index 2c1793c1777d546db74d251a2644afcbe592dd9a..1d734da1786cd8c8cbce0ea3c5665fe2f04b686d 100644 (file)
@@ -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';
index 0b0155069e3801d83f122e463503c4bcf5e1c7f6..9db16cf3b9bcf7fa1490bbb2951b9e96ccd293db 100644 (file)
@@ -42,7 +42,7 @@ function messageboard_init() {
  *  Group messageboard:                messageboard/group/<guid>/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;
 }
 
 /**
index 4a3b0b250362532e6f840a5ea2fe240633433c19..631a5f731bd87e35445e46b10e7a1cb568c9f9ca 100644 (file)
@@ -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;
 }
 
 /**
index c6701cc3e58c8a83c7fc64e7cd0eef6a0d0fd127..7ec82cfc937dd7c80c7c90b39f848fa146a3aaf1 100644 (file)
@@ -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;
 }
 
 /**
index 744306649012a62388d19a9294ece705572a72f1..fd1d7df4769f68e46bd0e336789a43a47ca28c31 100644 (file)
@@ -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;
 }
 
 /**
index 0f13ad8445343352b11a8a46bb22a9691bf427b5..1c82d55f52ada385b456afca5bd01d5cce128b05 100644 (file)
@@ -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) {
 
index 66a1248d92e638cb51499a2173edde2637f9420f..0638feb52f87a66ad50d28dd6f11c0e8abed6c33 100644 (file)
@@ -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
index 9ab14f42fd9241205a6c7d02a2dfc6c5ae95463d..a88c6ec031412edcfff5456082bb23e840ac1a7b 100644 (file)
@@ -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) {
 
index d5e9953598b79415265008c23d1ae7c13c79a241..f46d9ec757a0df7652fbb8fcb15ea857e5b2cbe2 100644 (file)
@@ -84,58 +84,57 @@ function thewire_init() {
  * thewire/tag/<tag>            View wire posts tagged with <tag>
  *
  * @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;
+       }
 }
 
 /**
index b17643c8c12c72e8ce48dbdc4e90a71066ab448d..fd2ff6493c0aeb6b85516a4836e1b483543eaabc 100644 (file)
@@ -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;
        }
 }
 
index d3d0c3488a19e26a8cbf10183833963df4da685f..a674511cfc64a019b4db88ca652a543b9fac7c8e 100644 (file)
@@ -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('');
 }
 
 /**