aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/admin.php9
-rw-r--r--engine/lib/cron.php3
-rw-r--r--engine/lib/elgglib.php15
-rw-r--r--engine/lib/entities.php4
-rw-r--r--engine/lib/pagehandler.php6
-rw-r--r--engine/lib/river.php3
-rw-r--r--engine/lib/tags.php3
-rw-r--r--engine/lib/user_settings.php3
-rw-r--r--engine/lib/users.php30
9 files changed, 52 insertions, 24 deletions
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/<plugin_id>/<size>/<ss_name>.<ext>
*
* @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/<username>/<size>/<icontime>
*
* @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;
}
/**