diff options
author | Steve Clay <steve@mrclay.org> | 2013-02-02 21:21:16 -0500 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2013-02-02 21:21:16 -0500 |
commit | b809dee488be374f248763741a5e1429219fe988 (patch) | |
tree | 3b3e40e28a22501577d66fa92973b187cdf40f07 | |
parent | 9b8839602051aa1b5c441695ae897c0b049ff889 (diff) | |
parent | a72b4bce06062fa0a6f2fbd7489fac3474c3dc24 (diff) | |
download | elgg-b809dee488be374f248763741a5e1429219fe988.tar.gz elgg-b809dee488be374f248763741a5e1429219fe988.tar.bz2 |
Merge branch 'fork-508' into 1.8
-rw-r--r-- | mod/messages/start.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/mod/messages/start.php b/mod/messages/start.php index e17640098..5503a675a 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -74,23 +74,30 @@ function messages_init() { */ function messages_page_handler($page) { + $current_user = elgg_get_logged_in_user_entity(); + if (!$current_user) { + register_error(elgg_echo('noaccess')); + $_SESSION['last_forward_from'] = current_page_url(); + forward(''); + } + elgg_load_library('elgg:messages'); - elgg_push_breadcrumb(elgg_echo('messages'), 'messages/inbox/' . elgg_get_logged_in_user_entity()->username); + elgg_push_breadcrumb(elgg_echo('messages'), 'messages/inbox/' . $current_user->username); if (!isset($page[0])) { $page[0] = 'inbox'; } - // supporting the old inbox url /messages/<username> - $user = get_user_by_username($page[0]); - if ($user) { + // Support the old inbox url /messages/<username>, but only if it matches the logged in user. + // Otherwise having a username like "read" on the system could confuse this function. + if ($current_user->username === $page[0]) { $page[1] = $page[0]; $page[0] = 'inbox'; } if (!isset($page[1])) { - $page[1] = elgg_get_logged_in_user_entity()->username; + $page[1] = $current_user->username; } $base_dir = elgg_get_plugins_path() . 'messages/pages/messages'; |