From 61d24f4b7b4fd4d5e960593a25a0d96b11891ff0 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 5 Nov 2011 19:15:42 -0400 Subject: Fixes #4024 fixed a lot of notices - enough for this release - found a few bugs --- engine/classes/ElggMenuItem.php | 3 +++ engine/lib/elgglib.php | 8 ++++++-- engine/lib/navigation.php | 8 ++++++-- engine/lib/views.php | 9 +++++++-- mod/blog/start.php | 6 +++++- mod/file/start.php | 2 +- mod/groups/lib/discussion.php | 2 +- mod/groups/lib/groups.php | 2 +- mod/groups/views/default/object/groupforumtopic.php | 3 +-- mod/notifications/groups.php | 2 +- mod/notifications/index.php | 10 ++++++++-- mod/profile/start.php | 2 +- mod/thewire/pages/thewire/everyone.php | 2 +- pages/settings/account.php | 2 +- views/default/forms/login.php | 2 +- views/default/input/button.php | 2 +- views/default/output/access.php | 2 +- views/default/page/components/gallery.php | 1 + views/default/page/components/list.php | 8 ++++---- views/default/page/components/module.php | 2 +- views/default/page/layouts/one_column.php | 4 +++- views/default/page/layouts/widgets.php | 8 ++++++-- 22 files changed, 61 insertions(+), 29 deletions(-) diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 8ddb1ecd8..289919a8e 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -100,6 +100,9 @@ class ElggMenuItem { if (!isset($options['name']) || !isset($options['text'])) { return NULL; } + if (!isset($options['href'])) { + $options['href'] = ''; + } $item = new ElggMenuItem($options['name'], $options['text'], $options['href']); unset($options['name']); diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 10804fdca..47ca157e1 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1475,8 +1475,12 @@ function elgg_http_url_is_identical($url1, $url2, $ignore_params = array('offset $url1_info = parse_url($url1); $url2_info = parse_url($url2); - $url1_info['path'] = trim($url1_info['path'], '/'); - $url2_info['path'] = trim($url2_info['path'], '/'); + if (isset($url1_info['path'])) { + $url1_info['path'] = trim($url1_info['path'], '/'); + } + if (isset($url2_info['path'])) { + $url2_info['path'] = trim($url2_info['path'], '/'); + } // compare basic bits $parts = array('scheme', 'host', 'path'); diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index aaf9fb544..176790188 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -207,7 +207,7 @@ function elgg_register_title_button($handler = null, $name = 'add') { */ function elgg_push_breadcrumb($title, $link = NULL) { global $CONFIG; - if (!is_array($CONFIG->breadcrumbs)) { + if (!isset($CONFIG->breadcrumbs)) { $CONFIG->breadcrumbs = array(); } @@ -242,7 +242,11 @@ function elgg_pop_breadcrumb() { function elgg_get_breadcrumbs() { global $CONFIG; - return (is_array($CONFIG->breadcrumbs)) ? $CONFIG->breadcrumbs : array(); + if (isset($CONFIG->breadcrumbs) && is_array($CONFIG->breadcrumbs)) { + return $CONFIG->breadcrumbs; + } + + return array(); } /** diff --git a/engine/lib/views.php b/engine/lib/views.php index 6ca68ac8c..0f806b8be 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -743,7 +743,11 @@ function elgg_view_menu($menu_name, array $vars = array()) { $sort_by = elgg_extract('sort_by', $vars, 'text'); - $menu = $CONFIG->menus[$menu_name]; + if (isset($CONFIG->menus[$menu_name])) { + $menu = $CONFIG->menus[$menu_name]; + } else { + $menu = array(); + } // Give plugins a chance to add menu items just before creation. // This supports dynamic menus (example: user_hover). @@ -1198,7 +1202,8 @@ function elgg_view_image_block($image, $body, $vars = array()) { * @since 1.8.0 */ function elgg_view_module($type, $title, $body, $vars = array()) { - $vars['class'] .= " elgg-module-$type"; + + $vars['class'] = elgg_extract('class', $vars, '') . " elgg-module-$type"; $vars['title'] = $title; $vars['body'] = $body; return elgg_view('page/components/module', $vars); diff --git a/mod/blog/start.php b/mod/blog/start.php index 052c63651..fa57e7b96 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -145,7 +145,11 @@ function blog_page_handler($page) { return false; } - $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); + if (isset($params['sidebar'])) { + $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); + } else { + $params['sidebar'] = elgg_view('blog/sidebar', array('page' => $page_type)); + } $body = elgg_view_layout('content', $params); diff --git a/mod/file/start.php b/mod/file/start.php index d6e17cc4b..e15a9ad61 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -389,7 +389,7 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) { if ($size == 'large') { $ext = '_lrg'; } else { - $exit = ''; + $ext = ''; } $url = "mod/file/graphics/icons/{$type}{$ext}.gif"; diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php index 68e5e4884..2bda4678e 100644 --- a/mod/groups/lib/discussion.php +++ b/mod/groups/lib/discussion.php @@ -192,7 +192,7 @@ function discussion_handle_view_page($guid) { ); $body = elgg_view_layout('content', $params); - echo elgg_view_page($title, $body); + echo elgg_view_page($topic->title, $body); } /** diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php index 590ba2b35..7798e5dc3 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -447,7 +447,7 @@ function groups_register_profile_buttons($group) { } // group members - if ($group->isMember($user)) { + if ($group->isMember(elgg_get_logged_in_user_entity())) { if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) { // leave $url = elgg_get_site_url() . "action/groups/leave?group_guid={$group->getGUID()}"; diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php index a579d89a4..34e0ee3cc 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -28,7 +28,7 @@ $tags = elgg_view('output/tags', array('tags' => $topic->tags)); $date = elgg_view_friendly_time($topic->time_created); $replies_link = ''; -$replies_text = ''; +$reply_text = ''; $num_replies = elgg_get_annotations(array( 'annotation_name' => 'group_topic_post', 'guid' => $topic->getGUID(), @@ -76,7 +76,6 @@ if ($full) { $body = elgg_view('output/longtext', array('value' => $topic->description)); echo << 'notify', 'relationship_guid' => elgg_get_logged_in_user_guid(), 'types' => 'user', 'limit' => 99999))) { +if ($people_ents = elgg_get_entities_from_relationship(array( + 'relationship' => 'notify', + 'relationship_guid' => elgg_get_logged_in_user_guid(), + 'types' => 'user', + 'limit' => 99999, + ))) { + foreach($people_ents as $ent) { $people[] = $ent->guid; } diff --git a/mod/profile/start.php b/mod/profile/start.php index 0ee2d0152..adee838fc 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -84,7 +84,7 @@ function profile_page_handler($page) { $content = elgg_view_layout('widgets', $params); $body = elgg_view_layout('one_column', array('content' => $content)); - echo elgg_view_page($title, $body); + echo elgg_view_page($user->name, $body); return true; } diff --git a/mod/thewire/pages/thewire/everyone.php b/mod/thewire/pages/thewire/everyone.php index e78395c31..4e88d17af 100644 --- a/mod/thewire/pages/thewire/everyone.php +++ b/mod/thewire/pages/thewire/everyone.php @@ -14,7 +14,7 @@ if (elgg_is_logged_in()) { $content .= elgg_view('input/urlshortener'); } -$content .= elgg_list_entities(array( +$content = elgg_list_entities(array( 'type' => 'object', 'subtype' => 'thewire', 'limit' => 15, diff --git a/pages/settings/account.php b/pages/settings/account.php index e6a5da97b..1a57f89d8 100644 --- a/pages/settings/account.php +++ b/pages/settings/account.php @@ -16,7 +16,7 @@ if ((!elgg_get_page_owner_entity()) || (!elgg_get_page_owner_entity()->canEdit() $title = elgg_echo('usersettings:user'); -$content .= elgg_view('core/settings/account'); +$content = elgg_view('core/settings/account'); $params = array( 'content' => $content, diff --git a/views/default/forms/login.php b/views/default/forms/login.php index 9536bb439..6f6cc9906 100644 --- a/views/default/forms/login.php +++ b/views/default/forms/login.php @@ -31,7 +31,7 @@ elgg_echo('login'))); ?> 'returntoreferer', 'value' => 'true')); } ?> diff --git a/views/default/input/button.php b/views/default/input/button.php index c21989919..9957fdc54 100644 --- a/views/default/input/button.php +++ b/views/default/input/button.php @@ -33,7 +33,7 @@ switch ($vars['type']) { } // blank src if trying to access an offsite image. @todo why? -if (strpos($vars['src'], elgg_get_site_url()) === false) { +if (isset($vars['src']) && strpos($vars['src'], elgg_get_site_url()) === false) { $vars['src'] = ""; } ?> diff --git a/views/default/output/access.php b/views/default/output/access.php index f312608d5..811948323 100644 --- a/views/default/output/access.php +++ b/views/default/output/access.php @@ -20,7 +20,7 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) { // we decided to show that the item is in a group, rather than its actual access level // not required. Group ACLs are prepended with "Group: " when written. //$access_id_string = elgg_echo('groups:group') . $container->name; - $membership = $is_group->membership; + $membership = $container->membership; if ($membership == ACCESS_PUBLIC) { $access_class .= ' elgg-access-group-open'; diff --git a/views/default/page/components/gallery.php b/views/default/page/components/gallery.php index f03eb1109..149ceeaf8 100644 --- a/views/default/page/components/gallery.php +++ b/views/default/page/components/gallery.php @@ -39,6 +39,7 @@ if (isset($vars['item_class'])) { $item_class = "$item_class {$vars['item_class']}"; } +$nav = ''; if ($pagination && $count) { $nav .= elgg_view('navigation/pagination', array( 'offset' => $offset, diff --git a/views/default/page/components/list.php b/views/default/page/components/list.php index c83fa0966..c0db50bc5 100644 --- a/views/default/page/components/list.php +++ b/views/default/page/components/list.php @@ -17,10 +17,10 @@ */ $items = $vars['items']; -$offset = $vars['offset']; -$limit = $vars['limit']; -$count = $vars['count']; -$base_url = $vars['base_url']; +$offset = elgg_extract('offset', $vars); +$limit = elgg_extract('limit', $vars); +$count = elgg_extract('count', $vars); +$base_url = elgg_extract('base_url', $vars, ''); $pagination = elgg_extract('pagination', $vars, true); $offset_key = elgg_extract('offset_key', $vars, 'offset'); $position = elgg_extract('position', $vars, 'after'); diff --git a/views/default/page/components/module.php b/views/default/page/components/module.php index 0a2f1c35a..7e1eaff20 100644 --- a/views/default/page/components/module.php +++ b/views/default/page/components/module.php @@ -28,7 +28,7 @@ if (isset($vars['id'])) { $id = "id=\"{$vars['id']}\""; } -if ($vars['header']) { +if (isset($vars['header'])) { $header = "
$header
"; } elseif ($title) { $header = "

$title

"; diff --git a/views/default/page/layouts/one_column.php b/views/default/page/layouts/one_column.php index 7546a4cdf..491d5b459 100644 --- a/views/default/page/layouts/one_column.php +++ b/views/default/page/layouts/one_column.php @@ -30,7 +30,9 @@ $nav = elgg_extract('nav', $vars, elgg_view('navigation/breadcrumbs')); echo $vars['content']; // @deprecated 1.8 - echo $vars['area1']; + if (isset($vars['area1'])) { + echo $vars['area1']; + } ?> \ No newline at end of file diff --git a/views/default/page/layouts/widgets.php b/views/default/page/layouts/widgets.php index b2c54e854..e3819cc20 100644 --- a/views/default/page/layouts/widgets.php +++ b/views/default/page/layouts/widgets.php @@ -39,10 +39,14 @@ echo $vars['content']; $widget_class = "elgg-col-1of{$num_columns}"; for ($column_index = 1; $column_index <= $num_columns; $column_index++) { - $column_widgets = $widgets[$column_index]; + if (isset($widgets[$column_index])) { + $column_widgets = $widgets[$column_index]; + } else { + $column_widgets = array(); + } echo "
"; - if (is_array($column_widgets) && sizeof($column_widgets) > 0) { + if (sizeof($column_widgets) > 0) { foreach ($column_widgets as $widget) { if (array_key_exists($widget->handler, $widget_types)) { echo elgg_view_entity($widget, array('show_access' => $show_access)); -- cgit v1.2.3