aboutsummaryrefslogtreecommitdiff
path: root/mod/messages/start.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-03-13 02:13:17 +0100
committerSem <sembrestels@riseup.net>2013-03-13 02:13:17 +0100
commitd730a0c5861c2e79faa3e58dd2b171ca4d197c6f (patch)
treecb4658e1c60a60c5f663845d49b108dd4608a89a /mod/messages/start.php
parent0fb3e5396d10d21323eb3bbc04727fd4a5a6d06d (diff)
parent34b14b305f5a106316fdc403c4ce80b25e89b51d (diff)
downloadelgg-d730a0c5861c2e79faa3e58dd2b171ca4d197c6f.tar.gz
elgg-d730a0c5861c2e79faa3e58dd2b171ca4d197c6f.tar.bz2
Merge tag '1.8.14' of git://github.com/Elgg/Elgg into foxglove-3
Elgg 1.8.14 Conflicts: mod/tinymce/vendor/tinymce/jscripts/tiny_mce/langs/en.js mod/tinymce/vendor/tinymce/jscripts/tiny_mce/themes/advanced/langs/en_dlg.js
Diffstat (limited to 'mod/messages/start.php')
-rw-r--r--mod/messages/start.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/mod/messages/start.php b/mod/messages/start.php
index 50952ef4b..2bf0526da 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;
}
$user = get_user_by_username($page[1]);