]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4610 better handling of content requiring a logged in user
authorCash Costello <cash.costello@gmail.com>
Sat, 23 Jun 2012 14:35:29 +0000 (10:35 -0400)
committerCash Costello <cash.costello@gmail.com>
Sat, 23 Jun 2012 14:35:29 +0000 (10:35 -0400)
languages/en.php
mod/blog/lib/blog.php
mod/bookmarks/pages/bookmarks/view.php
mod/file/pages/file/view.php
mod/groups/lib/discussion.php
mod/pages/pages/pages/view.php
mod/thewire/pages/thewire/view.php

index 03e6dfa84c6f21d86215f1f22d08025ed9b7aafc..64c95b866b71f3fae57f28f13d14830998277e97 100644 (file)
@@ -235,7 +235,7 @@ $english = array(
        'pageownerunavailable' => 'Warning: The page owner %d is not accessible!',
        'viewfailure' => 'There was an internal failure in the view %s',
        'changebookmark' => 'Please change your bookmark for this page',
-       'noaccess' => 'The content you were trying to view has been removed or you do not have permission to view it.',
+       'noaccess' => 'You need to login to view this content or the content has been removed or you do not have permission to view it.',
        'error:missing_data' => 'There was some data missing in your request',
 
        'error:default' => 'Oops...something went wrong.',
index 43de7a6468499f0996eef0a159c6d940ddc82c7a..9a02a8cc37a0f3fbd4f6d03a5e09a3fa41bf38a4 100644 (file)
@@ -22,8 +22,9 @@ function blog_get_page_content_read($guid = NULL) {
        $return['filter'] = '';
 
        if (!elgg_instanceof($blog, 'object', 'blog')) {
-               $return['content'] = elgg_echo('noaccess');
-               return $return;
+               register_error(elgg_echo('noaccess'));
+               $_SESSION['last_forward_from'] = current_page_url();
+               forward('');
        }
 
        $return['title'] = $blog->title;
index c819b8b41d14f40ff9fda39f27cfdd614223cd9d..70a6a5bfef4c26940b11b5e939e9bab97c697cc6 100644 (file)
@@ -8,6 +8,7 @@
 $bookmark = get_entity(get_input('guid'));
 if (!$bookmark) {
        register_error(elgg_echo('noaccess'));
+       $_SESSION['last_forward_from'] = current_page_url();
        forward('');
 }
 
index ec51b30e67b8785089759e5d0650372395b8ecfa..6c9566a8979f5b3d8f0b7db2fcf6c0093939575c 100644 (file)
@@ -8,6 +8,7 @@
 $file = get_entity(get_input('guid'));
 if (!$file) {
        register_error(elgg_echo('noaccess'));
+       $_SESSION['last_forward_from'] = current_page_url();
        forward('');
 }
 
index 55642644db11c0208f9e4224d12b6b99638967ec..02ab27fdc97530375b7dc8caec6e379cb7646546 100644 (file)
@@ -149,8 +149,9 @@ function discussion_handle_view_page($guid) {
 
        $topic = get_entity($guid);
        if (!$topic) {
-               register_error(elgg_echo('discussion:topic:notfound'));
-               forward();
+               register_error(elgg_echo('noaccess'));
+               $_SESSION['last_forward_from'] = current_page_url();
+               forward('');
        }
 
        $group = $topic->getContainerEntity();
index 6b9d03f494c59132500d0fdae276f0a0498cd378..e1c3fdbfd30d6fede7d970a5894d331342cf681e 100644 (file)
@@ -9,7 +9,8 @@ $page_guid = get_input('guid');
 $page = get_entity($page_guid);
 if (!$page) {
        register_error(elgg_echo('noaccess'));
-       forward();
+       $_SESSION['last_forward_from'] = current_page_url();
+       forward('');
 }
 
 elgg_set_page_owner_guid($page->getContainerGUID());
index 1818e725a274e045d8ee8d293f4e73cf8ef8adf5..1709e5e9a94f75a9911724eca91d4ad2ce4e9626 100644 (file)
@@ -6,6 +6,7 @@
 $post = get_entity(get_input('guid'));
 if (!$post) {
        register_error(elgg_echo('noaccess'));
+       $_SESSION['last_forward_from'] = current_page_url();
        forward('');
 }
 $owner = $post->getOwnerEntity();