aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/start.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2014-01-22 03:37:52 +0100
committerSem <sembrestels@riseup.net>2014-01-22 03:37:52 +0100
commit4a2ed114bb18c5363f594a380676c5654f4165a4 (patch)
tree3a37094b249c40e3e6bf122691db53115f65f8f0 /mod/blog/start.php
parent673932bc46a3918293a28c2c2fc622b3e5ff6bde (diff)
parent0dd36c458d41e77521c36ae572fe73114ad4bc5a (diff)
downloadelgg-4a2ed114bb18c5363f594a380676c5654f4165a4.tar.gz
elgg-4a2ed114bb18c5363f594a380676c5654f4165a4.tar.bz2
Merge tag '1.8.18' of git://github.com/Elgg/Elgg into develop
1.8.18 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/blog/start.php')
-rw-r--r--mod/blog/start.php28
1 files changed, 24 insertions, 4 deletions
diff --git a/mod/blog/start.php b/mod/blog/start.php
index eb6eee05f..e724b91c2 100644
--- a/mod/blog/start.php
+++ b/mod/blog/start.php
@@ -41,8 +41,8 @@ function blog_init() {
// override the default url to view a blog object
elgg_register_entity_url_handler('object', 'blog', 'blog_url_handler');
- // notifications
- register_notification_object('object', 'blog', elgg_echo('blog:newpost'));
+ // notifications - need to register for unique event because of draft/published status
+ elgg_register_event_handler('publish', 'object', 'object_notifications');
elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'blog_notify_message');
// add blog link to
@@ -113,14 +113,23 @@ function blog_page_handler($page) {
switch ($page_type) {
case 'owner':
$user = get_user_by_username($page[1]);
+ if (!$user) {
+ forward('', '404');
+ }
$params = blog_get_page_content_list($user->guid);
break;
case 'friends':
$user = get_user_by_username($page[1]);
+ if (!$user) {
+ forward('', '404');
+ }
$params = blog_get_page_content_friends($user->guid);
break;
case 'archive':
$user = get_user_by_username($page[1]);
+ if (!$user) {
+ forward('', '404');
+ }
$params = blog_get_page_content_archive($user->guid, $page[2], $page[3]);
break;
case 'view':
@@ -139,7 +148,11 @@ function blog_page_handler($page) {
$params = blog_get_page_content_edit($page_type, $page[1], $page[2]);
break;
case 'group':
- if ($page[2] == 'all') {
+ $group = get_entity($page[1]);
+ if (!elgg_instanceof($group, 'group')) {
+ forward('', '404');
+ }
+ if (!isset($page[2]) || $page[2] == 'all') {
$params = blog_get_page_content_list($page[1]);
} else {
$params = blog_get_page_content_archive($page[1], $page[3], $page[4]);
@@ -214,7 +227,14 @@ function blog_entity_menu_setup($hook, $type, $return, $params) {
return $return;
}
- if ($entity->canEdit() && $entity->status != 'published') {
+ if ($entity->status != 'published') {
+ // draft status replaces access
+ foreach ($return as $index => $item) {
+ if ($item->getName() == 'access') {
+ unset($return[$index]);
+ }
+ }
+
$status_text = elgg_echo("blog:status:{$entity->status}");
$options = array(
'name' => 'published_status',