From ada8737fa50d1aeaa33db8a1c1d740a6da449829 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Mon, 19 Dec 2011 13:58:37 -0500 Subject: Solves issue 4222: incorrectly nested lists in Firefox --- mod/tinymce/views/default/js/tinymce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/tinymce/views/default/js/tinymce.php b/mod/tinymce/views/default/js/tinymce.php index 20236d657..e6e2865a5 100644 --- a/mod/tinymce/views/default/js/tinymce.php +++ b/mod/tinymce/views/default/js/tinymce.php @@ -38,7 +38,7 @@ elgg.tinymce.init = function() { mode : "specific_textareas", editor_selector : "elgg-input-longtext", theme : "advanced", - plugins : "spellchecker,autosave,fullscreen,paste", + plugins : "lists,spellchecker,autosave,fullscreen,paste", relative_urls : false, remove_script_host : false, document_base_url : elgg.config.wwwroot, -- cgit v1.2.3 From 8c73e5da141ea76f10973936267aa726d8892ad3 Mon Sep 17 00:00:00 2001 From: Ismayil Khayredinov Date: Fri, 23 Dec 2011 16:19:23 +0100 Subject: fixes for tab rendering --- views/default/navigation/tabs.php | 92 ++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php index e8fde3579..219646c64 100644 --- a/views/default/navigation/tabs.php +++ b/views/default/navigation/tabs.php @@ -5,8 +5,8 @@ * @uses string $vars['type'] horizontal || vertical - Defaults to horizontal * @uses string $vars['class'] Additional class to add to ul * @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array( - * 'title' => string, // Title of link - * 'url' => string, // URL for the link + * 'text' => string, // Title of link + * 'href' => string, // URL for the link * 'class' => string // Class of the li element * 'id' => string, // ID of the li element * 'selected' => bool // if this li element is currently selected @@ -15,58 +15,68 @@ * ) */ +$options = elgg_clean_vars($vars); + $type = elgg_extract('type', $vars, 'horizontal'); + if ($type == 'horizontal') { - $type_class = "elgg-tabs elgg-htabs"; + $options['class'] = "elgg-tabs elgg-htabs"; } else { - $type_class = "elgg-tabs elgg-vtabs"; + $options['class'] = "elgg-tabs elgg-vtabs"; } - if (isset($vars['class'])) { - $type_class = "$type_class {$vars['class']}"; + $options['class'] = "{$options['class']} {$vars['class']}"; } +unset($options['tabs']); +unset($options['type']); + +$options = elgg_format_attributes($options); + if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) { -?> - + Date: Fri, 23 Dec 2011 14:24:04 -0500 Subject: Fixes #4240 not showing draft blog posts in group module --- mod/blog/views/default/blog/group_module.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/blog/views/default/blog/group_module.php b/mod/blog/views/default/blog/group_module.php index 028827178..6082cdafd 100644 --- a/mod/blog/views/default/blog/group_module.php +++ b/mod/blog/views/default/blog/group_module.php @@ -20,11 +20,12 @@ $options = array( 'type' => 'object', 'subtype' => 'blog', 'container_guid' => elgg_get_page_owner_guid(), + 'metadata_name_value_pairs' => array('name' => 'status', 'value' => 'published'), 'limit' => 6, 'full_view' => false, 'pagination' => false, ); -$content = elgg_list_entities($options); +$content = elgg_list_entities_from_metadata($options); elgg_pop_context(); if (!$content) { -- cgit v1.2.3 From 3d3312d47597249def3ed8efdcbf68869e3fef31 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 23 Dec 2011 15:07:03 -0500 Subject: Refs #4239 improved the documentation on ElggBatch for the limit option --- engine/classes/ElggBatch.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/engine/classes/ElggBatch.php b/engine/classes/ElggBatch.php index 62128e34f..2a97f9ff5 100644 --- a/engine/classes/ElggBatch.php +++ b/engine/classes/ElggBatch.php @@ -92,7 +92,7 @@ class ElggBatch /** * Stop after this many results. * - * @var unknown_type + * @var int */ private $limit = 0; @@ -147,7 +147,9 @@ class ElggBatch * * @param string $getter The function used to get objects. Usually * an elgg_get_*() function, but can be any valid PHP callback. - * @param array $options The options array to pass to the getter function + * @param array $options The options array to pass to the getter function. If limit is + * not set, 10 is used as the default. In most cases that is not + * what you want. * @param mixed $callback An optional callback function that all results will be passed * to upon load. The callback needs to accept $result, $getter, * $options. @@ -319,13 +321,13 @@ class ElggBatch */ public function next() { // if we'll be at the end. - if ($this->processedResults + 1 >= $this->limit && $this->limit > 0) { + if (($this->processedResults + 1) >= $this->limit && $this->limit > 0) { $this->results = array(); return false; } // if we'll need new results. - if ($this->resultIndex + 1 >= $this->chunkSize) { + if (($this->resultIndex + 1) >= $this->chunkSize) { if (!$this->getNextResultsChunk()) { $this->results = array(); return false; @@ -356,4 +358,4 @@ class ElggBatch $key = key($this->results); return ($key !== NULL && $key !== FALSE); } -} \ No newline at end of file +} -- cgit v1.2.3 From 23a912aa6678bb16f866b01c175b8e73e7bf417d Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 23 Dec 2011 15:07:49 -0500 Subject: Refs #4239 fixed upgrade scripts with bad limits --- .../2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php | 3 ++- .../2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php | 1 + mod/blog/start.php | 3 ++- mod/groups/upgrades/2011030101.php | 6 +++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php b/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php index e4ab9c137..fe2af9928 100644 --- a/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php +++ b/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php @@ -9,7 +9,8 @@ $ia = elgg_set_ignore_access(true); $options = array( 'type' => 'object', - 'subtype' => 'blog' + 'subtype' => 'blog', + 'limit' => 0, ); $batch = new ElggBatch('elgg_get_entities', $options); diff --git a/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php index 4fc59ac41..41ab29998 100644 --- a/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php +++ b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php @@ -16,6 +16,7 @@ access_show_hidden_entities(true); $options = array( 'type' => 'site', 'site_guid' => 0, + 'limit' => 0, ); $batch = new ElggBatch('elgg_get_entities', $options); diff --git a/mod/blog/start.php b/mod/blog/start.php index fa57e7b96..4b825fc1f 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -248,7 +248,8 @@ function blog_run_upgrades($event, $type, $details) { $ia = elgg_set_ignore_access(true); $options = array( 'type' => 'object', - 'subtype' => 'blog' + 'subtype' => 'blog', + 'limit' => 0, ); $blogs = new ElggBatch('elgg_get_entities', $options); diff --git a/mod/groups/upgrades/2011030101.php b/mod/groups/upgrades/2011030101.php index c2a80c08c..666ae3736 100644 --- a/mod/groups/upgrades/2011030101.php +++ b/mod/groups/upgrades/2011030101.php @@ -43,7 +43,11 @@ function groups_2011030101($topic) { return $annotation[0]->delete(); } -$options = array('type' => 'object', 'subtype' => 'groupforumtopic'); +$options = array( + 'type' => 'object', + 'subtype' => 'groupforumtopic', + 'limit' => 0, +); $batch = new ElggBatch('elgg_get_entities', $options, 'groups_2011030101', 100); if ($batch->callbackResult) { -- cgit v1.2.3 From c0f3b8d03f260c5ab83289bdf4c7cf6a6c5aa6a6 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 23 Dec 2011 15:20:57 -0500 Subject: Fixes #4179 not setting excerpt if none set --- mod/blog/actions/blog/save.php | 6 +----- mod/blog/start.php | 20 +------------------- mod/blog/views/default/object/blog.php | 3 +++ 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index 8ca8ce846..8923cd0d2 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -78,11 +78,8 @@ foreach ($values as $name => $default) { case 'excerpt': if ($value) { - $value = elgg_get_excerpt($value); - } else { - $value = elgg_get_excerpt($values['description']); + $values[$name] = elgg_get_excerpt($value); } - $values[$name] = $value; break; case 'container_guid': @@ -144,7 +141,6 @@ if (!$error) { system_message(elgg_echo('blog:message:saved')); $status = $blog->status; - $db_prefix = elgg_get_config('dbprefix'); // add to river if changing status or published, regardless of new post // because we remove it for drafts. diff --git a/mod/blog/start.php b/mod/blog/start.php index 4b825fc1f..53a4dcadf 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -234,7 +234,7 @@ function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) { * Upgrade from 1.7 to 1.8. */ function blog_run_upgrades($event, $type, $details) { - $blog_upgrade_version = get_plugin_setting('upgrade_version', 'blogs'); + $blog_upgrade_version = elgg_get_plugin_setting('upgrade_version', 'blogs'); if (!$blog_upgrade_version) { // When upgrading, check if the ElggBlog class has been registered as this @@ -243,24 +243,6 @@ function blog_run_upgrades($event, $type, $details) { add_subtype('object', 'blog', 'ElggBlog'); } - // only run this on the first migration to 1.8 - // add excerpt to all blogs that don't have it. - $ia = elgg_set_ignore_access(true); - $options = array( - 'type' => 'object', - 'subtype' => 'blog', - 'limit' => 0, - ); - - $blogs = new ElggBatch('elgg_get_entities', $options); - foreach ($blogs as $blog) { - if (!$blog->excerpt) { - $blog->excerpt = elgg_get_excerpt($blog->description); - } - } - - elgg_set_ignore_access($ia); - elgg_set_plugin_setting('upgrade_version', 1, 'blogs'); } } diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index 3525b3d48..aa8074a69 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -16,6 +16,9 @@ $owner = $blog->getOwnerEntity(); $container = $blog->getContainerEntity(); $categories = elgg_view('output/categories', $vars); $excerpt = $blog->excerpt; +if (!$excerpt) { + $excerpt = elgg_get_excerpt($blog->description); +} $owner_icon = elgg_view_entity_icon($owner, 'tiny'); $owner_link = elgg_view('output/url', array( -- cgit v1.2.3 From 74f3f133432cfd4100b04db66b57dcc19ab09a20 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 23 Dec 2011 15:32:15 -0500 Subject: added access override to the forum upgrade --- mod/groups/upgrades/2011030101.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/groups/upgrades/2011030101.php b/mod/groups/upgrades/2011030101.php index 666ae3736..9ed5b321b 100644 --- a/mod/groups/upgrades/2011030101.php +++ b/mod/groups/upgrades/2011030101.php @@ -25,7 +25,7 @@ foreach ($topics as $topic) { /** - * Condense annotation into object + * Condense first annotation into object * * @param ElggObject $topic */ @@ -43,12 +43,14 @@ function groups_2011030101($topic) { return $annotation[0]->delete(); } +$previous_access = elgg_set_ignore_access(true); $options = array( 'type' => 'object', 'subtype' => 'groupforumtopic', 'limit' => 0, ); $batch = new ElggBatch('elgg_get_entities', $options, 'groups_2011030101', 100); +elgg_set_ignore_access($previous_access); if ($batch->callbackResult) { error_log("Elgg Groups upgrade (2011030101) succeeded"); -- cgit v1.2.3 From 29f54cb2cfbc0edac0bd11fb325baf375a8b7e15 Mon Sep 17 00:00:00 2001 From: Ismayil Khayredinov Date: Fri, 23 Dec 2011 23:48:53 +0100 Subject: fixes spacing. add a note on text/title --- views/default/navigation/tabs.php | 77 +++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php index 219646c64..6159fbfa5 100644 --- a/views/default/navigation/tabs.php +++ b/views/default/navigation/tabs.php @@ -5,7 +5,7 @@ * @uses string $vars['type'] horizontal || vertical - Defaults to horizontal * @uses string $vars['class'] Additional class to add to ul * @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array( - * 'text' => string, // Title of link + * 'text' => string, // The string between the tags. If not set, 'title' parameter will be used instead * 'href' => string, // URL for the link * 'class' => string // Class of the li element * 'id' => string, // ID of the li element @@ -14,7 +14,6 @@ * 'url_id' => string, // ID to pass to the link * ) */ - $options = elgg_clean_vars($vars); $type = elgg_extract('type', $vars, 'horizontal'); @@ -34,49 +33,49 @@ unset($options['type']); $options = elgg_format_attributes($options); if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) { - ?> -
    > - +
      > + $link"; - } - ?> -
    - $link"; + } + ?> +
+ Date: Fri, 23 Dec 2011 19:13:36 -0500 Subject: Fixes #3716 setting the language when registering new users --- engine/lib/users.php | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/lib/users.php b/engine/lib/users.php index 1b3cca799..4404f42e0 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -952,6 +952,7 @@ $allow_multiple_emails = false, $friend_guid = 0, $invitecode = '') { $user->password = generate_user_password($user, $password); $user->owner_guid = 0; // Users aren't owned by anyone, even if they are admin created. $user->container_guid = 0; // Users aren't contained by anyone, even if they are admin created. + $user->language = get_current_language(); $user->save(); // If $friend_guid has been set, make mutual friends -- cgit v1.2.3 From e3100d350c27804f80de3321b00be9dfc23c6d2a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 23 Dec 2011 19:26:08 -0500 Subject: Fixes #682 not deleting metadata when update, metadata event handlers return false --- engine/lib/metadata.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 050e69526..4908b3e88 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -216,12 +216,11 @@ function update_metadata($id, $name, $value, $value_type, $owner_guid, $access_i $result = update_data($query); if ($result !== false) { + // @todo this event tells you the metadata has been updated, but does not + // let you do anything about it. What is needed is a plugin hook before + // the update that passes old and new values. $obj = elgg_get_metadata_from_id($id); - if (elgg_trigger_event('update', 'metadata', $obj)) { - return true; - } else { - elgg_delete_metadata_by_id($id); - } + elgg_trigger_event('update', 'metadata', $obj); } return $result; -- cgit v1.2.3 From 9e311e7236188e826277aed3dca733e02eb21f6a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 23 Dec 2011 19:31:27 -0500 Subject: Fixes #683 not deleting annotation when event handlers return false on an update --- engine/lib/annotations.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index bfd40d1e8..6e0402804 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -163,13 +163,9 @@ function update_annotation($annotation_id, $name, $value, $value_type, $owner_gu where id=$annotation_id and $access"); if ($result !== false) { + // @todo add plugin hook that sends old and new annotation information before db access $obj = elgg_get_annotation_from_id($annotation_id); - if (elgg_trigger_event('update', 'annotation', $obj)) { - return true; - } else { - // @todo add plugin hook that sends old and new annotation information before db access - elgg_delete_annotation_by_id($annotation_id); - } + elgg_trigger_event('update', 'annotation', $obj); } return $result; -- cgit v1.2.3 From 926e11996080ee84c6c405910c06615b8db55ff5 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 23 Dec 2011 19:48:36 -0500 Subject: Fixes #4069 reusing the previous ElggObject for external pages --- mod/externalpages/actions/edit.php | 24 +++++++++++++++------- mod/externalpages/views/default/expages/menu.php | 4 ++-- .../views/default/forms/expages/edit.php | 4 ++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/mod/externalpages/actions/edit.php b/mod/externalpages/actions/edit.php index edfffe168..184aa3d82 100644 --- a/mod/externalpages/actions/edit.php +++ b/mod/externalpages/actions/edit.php @@ -1,18 +1,28 @@ subtype = $type; -$expages->owner_guid = get_loggedin_userid(); +if ($guid) { + // update + $expages = get_entity($guid); + if (!$expages) { + register_error(elgg_echo("expages:error")); + forward(REFERER); + } +} else { + // create + $expages = new ElggObject(); + $expages->subtype = $type; +} + +$expages->owner_guid = elgg_get_logged_in_user_guid(); $expages->access_id = ACCESS_PUBLIC; $expages->title = $type; $expages->description = $contents; diff --git a/mod/externalpages/views/default/expages/menu.php b/mod/externalpages/views/default/expages/menu.php index 6ed521629..831be9125 100644 --- a/mod/externalpages/views/default/expages/menu.php +++ b/mod/externalpages/views/default/expages/menu.php @@ -7,8 +7,8 @@ $type = $vars['type']; - //set the url - $url = $vars['url'] . "admin/site/expages?type="; +//set the url +$url = $vars['url'] . "admin/site/expages?type="; $pages = array('about', 'terms', 'privacy'); $tabs = array(); diff --git a/mod/externalpages/views/default/forms/expages/edit.php b/mod/externalpages/views/default/forms/expages/edit.php index ca83ea7df..a15f2a7aa 100644 --- a/mod/externalpages/views/default/forms/expages/edit.php +++ b/mod/externalpages/views/default/forms/expages/edit.php @@ -50,9 +50,9 @@ echo <<
-$hidden_value +$hidden_guid $hidden_type $submit_input -
+
EOT; -- cgit v1.2.3 From 2c4e77c49fc43add737daaa76aef710de8d01d30 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 23 Dec 2011 19:58:27 -0500 Subject: Fixes #1922 can now delete invites to invisible groups --- mod/groups/actions/groups/membership/delete_invite.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mod/groups/actions/groups/membership/delete_invite.php b/mod/groups/actions/groups/membership/delete_invite.php index 4b654f0b6..d21aa0309 100644 --- a/mod/groups/actions/groups/membership/delete_invite.php +++ b/mod/groups/actions/groups/membership/delete_invite.php @@ -9,7 +9,11 @@ $user_guid = get_input('user_guid', elgg_get_logged_in_user_guid()); $group_guid = get_input('group_guid'); $user = get_entity($user_guid); + +// invisible groups require overriding access to delete invite +$old_access = elgg_set_ignore_access(true); $group = get_entity($group_guid); +elgg_set_ignore_access($old_access); // If join request made if (check_entity_relationship($group->guid, 'invited', $user->guid)) { -- cgit v1.2.3 From a9394e1035147e3910b2dc3cf156b0361ea791cc Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 23 Dec 2011 20:43:48 -0500 Subject: Fixes #2074 adds group search --- mod/groups/languages/en.php | 1 + mod/groups/lib/groups.php | 8 +++++++- mod/groups/views/default/forms/groups/find.php | 16 ++++++++++++++++ mod/groups/views/default/forms/groups/search.php | 14 +++++++++----- mod/groups/views/default/groups/sidebar/find.php | 2 +- mod/groups/views/default/groups/sidebar/search.php | 15 +++++++++++++++ 6 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 mod/groups/views/default/forms/groups/find.php create mode 100644 mod/groups/views/default/groups/sidebar/search.php diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 09feaf8d1..3623c95fc 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -61,6 +61,7 @@ $english = array( 'groups:search:tags' => "tag", 'groups:search:title' => "Search for groups tagged with '%s'", 'groups:search:none' => "No matching groups were found", + 'groups:search_in_group' => "Search in this group", 'groups:activity' => "Group activity", 'groups:enableactivity' => 'Enable group activity', diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php index 7798e5dc3..5d6083077 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -234,6 +234,8 @@ function groups_handle_invitations_page() { function groups_handle_profile_page($guid) { elgg_set_page_owner_guid($guid); + elgg_push_context('group_profile'); + // turn this into a core function global $autofeed; $autofeed = true; @@ -247,7 +249,11 @@ function groups_handle_profile_page($guid) { $content = elgg_view('groups/profile/layout', array('entity' => $group)); if (group_gatekeeper(false)) { - $sidebar = elgg_view('groups/sidebar/members', array('entity' => $group)); + $sidebar = ''; + if (elgg_is_active_plugin('search')) { + $sidebar .= elgg_view('groups/sidebar/search', array('entity' => $group)); + } + $sidebar .= elgg_view('groups/sidebar/members', array('entity' => $group)); } else { $sidebar = ''; } diff --git a/mod/groups/views/default/forms/groups/find.php b/mod/groups/views/default/forms/groups/find.php new file mode 100644 index 000000000..ddf639b74 --- /dev/null +++ b/mod/groups/views/default/forms/groups/find.php @@ -0,0 +1,16 @@ + 'tag', + 'class' => 'elgg-input-search mbm', + 'value' => $tag_string, + 'onclick' => "if (this.value=='$tag_string') { this.value='' }", +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search:go'))); diff --git a/mod/groups/views/default/forms/groups/search.php b/mod/groups/views/default/forms/groups/search.php index ddf639b74..850b6088e 100644 --- a/mod/groups/views/default/forms/groups/search.php +++ b/mod/groups/views/default/forms/groups/search.php @@ -1,16 +1,20 @@ 'tag', + 'name' => 'q', 'class' => 'elgg-input-search mbm', 'value' => $tag_string, - 'onclick' => "if (this.value=='$tag_string') { this.value='' }", ); echo elgg_view('input/text', $params); +echo elgg_view('input/hidden', array( + 'name' => 'container_guid', + 'value' => $vars['entity']->getGUID(), +)); + echo elgg_view('input/submit', array('value' => elgg_echo('search:go'))); diff --git a/mod/groups/views/default/groups/sidebar/find.php b/mod/groups/views/default/groups/sidebar/find.php index c5c986759..c1a8da3c2 100644 --- a/mod/groups/views/default/groups/sidebar/find.php +++ b/mod/groups/views/default/groups/sidebar/find.php @@ -5,7 +5,7 @@ * @package ElggGroups */ $url = elgg_get_site_url() . 'groups/search'; -$body = elgg_view_form('groups/search', array( +$body = elgg_view_form('groups/find', array( 'action' => $url, 'method' => 'get', 'disable_security' => true, diff --git a/mod/groups/views/default/groups/sidebar/search.php b/mod/groups/views/default/groups/sidebar/search.php new file mode 100644 index 000000000..226835715 --- /dev/null +++ b/mod/groups/views/default/groups/sidebar/search.php @@ -0,0 +1,15 @@ + $url, + 'method' => 'get', + 'disable_security' => true, +), $vars); + +echo elgg_view_module('aside', elgg_echo('groups:search_in_group'), $body); \ No newline at end of file -- cgit v1.2.3 From 995472e31c181c729944d2bd9f2c4af5453705e3 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 23 Dec 2011 22:01:18 -0500 Subject: Fixes #4186 restricting the drag handle for widgets --- js/lib/ui.widgets.js | 2 +- views/default/css/admin.php | 3 +++ views/default/css/elements/modules.php | 2 +- views/default/object/widget.php | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index 47e43c876..6114aeacd 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -15,7 +15,7 @@ elgg.ui.widgets.init = function() { $(".elgg-widgets").sortable({ items: 'div.elgg-module-widget.elgg-state-draggable', connectWith: '.elgg-widgets', - handle: 'div.elgg-head', + handle: '.elgg-widget-handle', forcePlaceholderSize: true, placeholder: 'elgg-widget-placeholder', opacity: 0.8, diff --git a/views/default/css/admin.php b/views/default/css/admin.php index dc1b503cb..065a108b1 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -915,6 +915,9 @@ a.elgg-button { height: 26px; overflow: hidden; } +.elgg-module-widget.elgg-state-draggable .elgg-widget-handle { + cursor: move; +} .elgg-module-widget > .elgg-head h3 { float: left; padding: 4px 45px 0 20px; diff --git a/views/default/css/elements/modules.php b/views/default/css/elements/modules.php index 7750c208f..74092c774 100644 --- a/views/default/css/elements/modules.php +++ b/views/default/css/elements/modules.php @@ -155,7 +155,7 @@ padding: 4px 45px 0 20px; color: #666; } -.elgg-module-widget.elgg-state-draggable > .elgg-head { +.elgg-module-widget.elgg-state-draggable .elgg-widget-handle { cursor: move; } a.elgg-widget-collapse-button { diff --git a/views/default/object/widget.php b/views/default/object/widget.php index f84c44e1c..8c7ec2a03 100644 --- a/views/default/object/widget.php +++ b/views/default/object/widget.php @@ -55,8 +55,9 @@ if ($can_edit) { } $widget_header = <<
$title +

$title

$controls +
HEADER; $widget_body = << Date: Fri, 23 Dec 2011 23:01:08 -0500 Subject: Fixes #3751 adds a group blog archive page --- mod/blog/lib/blog.php | 13 +++++++++---- mod/blog/start.php | 6 +++++- mod/blog/views/default/blog/sidebar.php | 2 +- mod/blog/views/default/blog/sidebar/archives.php | 10 ++++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 590547a8c..286fe1832 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -187,11 +187,16 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) { $now = time(); - $user = get_user($owner_guid); + $owner = get_entity($owner_guid); elgg_set_page_owner_guid($owner_guid); - $crumbs_title = $user->name; - elgg_push_breadcrumb($crumbs_title, "blog/owner/{$user->username}"); + $crumbs_title = $owner->name; + if (elgg_instanceof($owner, 'user')) { + $url = "blog/owner/{$owner->username}"; + } else { + $url = "blog/group/$owner->guid/all"; + } + elgg_push_breadcrumb($crumbs_title, $url); elgg_push_breadcrumb(elgg_echo('blog:archives')); if ($lower) { @@ -209,7 +214,7 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) { ); if ($owner_guid) { - $options['owner_guid'] = $owner_guid; + $options['container_guid'] = $owner_guid; } // admin / owners can see any posts diff --git a/mod/blog/start.php b/mod/blog/start.php index 53a4dcadf..90a800799 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -136,7 +136,11 @@ function blog_page_handler($page) { $params = blog_get_page_content_edit($page_type, $page[1], $page[2]); break; case 'group': - $params = blog_get_page_content_list($page[1]); + if ($page[2] == 'all') { + $params = blog_get_page_content_list($page[1]); + } else { + $params = blog_get_page_content_archive($page[1], $page[3], $page[4]); + } break; case 'all': $params = blog_get_page_content_list(); diff --git a/mod/blog/views/default/blog/sidebar.php b/mod/blog/views/default/blog/sidebar.php index 97a23c17e..0ae2b431c 100644 --- a/mod/blog/views/default/blog/sidebar.php +++ b/mod/blog/views/default/blog/sidebar.php @@ -18,7 +18,7 @@ if ($vars['page'] == 'all') { } // only users can have archives at present -if (elgg_instanceof(elgg_get_page_owner_entity(), 'user')) { +if ($vars['page'] == 'owner' || $vars['page'] == 'group') { echo elgg_view('blog/sidebar/archives', $vars); } diff --git a/mod/blog/views/default/blog/sidebar/archives.php b/mod/blog/views/default/blog/sidebar/archives.php index 3aa3db44f..3d8f28ca4 100644 --- a/mod/blog/views/default/blog/sidebar/archives.php +++ b/mod/blog/views/default/blog/sidebar/archives.php @@ -6,6 +6,12 @@ $loggedin_user = elgg_get_logged_in_user_entity(); $page_owner = elgg_get_page_owner_entity(); +if (elgg_instanceof($page_owner, 'user')) { + $url_segment = 'blog/archive/' . $page_owner->username; +} else { + $url_segment = 'blog/group/' . $page_owner->getGUID() . '/archive'; +} + // This is a limitation of the URL schema. if ($page_owner && $vars['page'] != 'friends') { $dates = get_entity_dates('object', 'blog', $page_owner->getGUID()); @@ -13,11 +19,11 @@ if ($page_owner && $vars['page'] != 'friends') { if ($dates) { $title = elgg_echo('blog:archives'); $content = '
    '; - foreach($dates as $date) { + foreach ($dates as $date) { $timestamplow = mktime(0, 0, 0, substr($date,4,2) , 1, substr($date, 0, 4)); $timestamphigh = mktime(0, 0, 0, ((int) substr($date, 4, 2)) + 1, 1, substr($date, 0, 4)); - $link = elgg_get_site_url() . 'blog/archive/' . $page_owner->username . '/' . $timestamplow . '/' . $timestamphigh; + $link = elgg_get_site_url() . $url_segment . '/' . $timestamplow . '/' . $timestamphigh; $month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4))); $content .= "
  • $month
  • "; } -- cgit v1.2.3 From 1c2735807961ce916c27832327a07ef0bc9d5a40 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 24 Dec 2011 07:41:06 -0500 Subject: Refs #4009 registering the walled garden css and js on every request --- engine/lib/elgglib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 57d602450..c32f7fa0c 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1996,9 +1996,7 @@ function elgg_is_valid_options_for_batch_operation($options, $type) { * @access private */ function elgg_walled_garden_index() { - elgg_register_css('elgg.walled_garden', '/css/walled_garden.css'); elgg_load_css('elgg.walled_garden'); - elgg_register_js('elgg.walled_garden', '/js/walled_garden.js'); elgg_load_js('elgg.walled_garden'); $body = elgg_view('core/walled_garden/body'); @@ -2026,6 +2024,9 @@ function elgg_walled_garden_index() { function elgg_walled_garden() { global $CONFIG; + elgg_register_css('elgg.walled_garden', '/css/walled_garden.css'); + elgg_register_js('elgg.walled_garden', '/js/walled_garden.js'); + // check for external page view if (isset($CONFIG->site) && $CONFIG->site instanceof ElggSite) { $CONFIG->site->checkWalledGarden(); -- cgit v1.2.3 From e357d172fa71f9b940ed35df0dd5ee6eb6777d5a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 24 Dec 2011 07:45:22 -0500 Subject: Fixes #3272 added button to revert avatar --- actions/avatar/revert.php | 15 +++++++++++++++ engine/lib/users.php | 1 + languages/en.php | 4 ++++ views/default/core/avatar/upload.php | 12 ++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 actions/avatar/revert.php diff --git a/actions/avatar/revert.php b/actions/avatar/revert.php new file mode 100644 index 000000000..8cff40a68 --- /dev/null +++ b/actions/avatar/revert.php @@ -0,0 +1,15 @@ +icontime); + system_message(elgg_echo('avatar:revert:success')); +} else { + register_error(elgg_echo('avatar:revert:fail')); +} + +forward(REFERER); diff --git a/engine/lib/users.php b/engine/lib/users.php index 4404f42e0..3a3756923 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1550,6 +1550,7 @@ function users_init() { elgg_register_action('friends/remove'); elgg_register_action('avatar/upload'); elgg_register_action('avatar/crop'); + elgg_register_action('avatar/revert'); elgg_register_action('profile/edit'); elgg_register_action('friends/collections/add'); diff --git a/languages/en.php b/languages/en.php index 93099c98f..2f8ab41c9 100644 --- a/languages/en.php +++ b/languages/en.php @@ -363,6 +363,7 @@ $english = array( 'avatar:preview' => 'Preview', 'avatar:upload' => 'Upload a new avatar', 'avatar:current' => 'Current avatar', + 'avatar:revert' => 'Revert your avatar to the default icon', 'avatar:crop:title' => 'Avatar cropping tool', 'avatar:upload:instructions' => "Your avatar is displayed throughout the site. You can change it as often as you'd like. (File formats accepted: GIF, JPG or PNG)", 'avatar:create:instructions' => 'Click and drag a square below to match how you want your avatar cropped. A preview will appear in the box on the right. When you are happy with the preview, click \'Create your avatar\'. This cropped version will be used throughout the site as your avatar.', @@ -371,6 +372,8 @@ $english = array( 'avatar:resize:fail' => 'Resize of the avatar failed', 'avatar:crop:success' => 'Cropping the avatar succeeded', 'avatar:crop:fail' => 'Avatar cropping failed', + 'avatar:revert:success' => 'Reverting the avatar succeeded', + 'avatar:revert:fail' => 'Avatar revert failed', 'profile:edit' => 'Edit profile', 'profile:aboutme' => "About me", @@ -840,6 +843,7 @@ $english = array( 'new' => 'New', 'add' => 'Add', 'create' => 'Create', + 'revert' => 'Revert', 'site' => 'Site', 'activity' => 'Activity', diff --git a/views/default/core/avatar/upload.php b/views/default/core/avatar/upload.php index 4aa86373a..29aa59c9c 100644 --- a/views/default/core/avatar/upload.php +++ b/views/default/core/avatar/upload.php @@ -12,6 +12,17 @@ $user_avatar = elgg_view('output/img', array( $current_label = elgg_echo('avatar:current'); +$revert_button = ''; +if ($vars['entity']->icontime) { + $revert_button = elgg_view('output/url', array( + 'text' => elgg_echo('revert'), + 'title' => elgg_echo('avatar:revert'), + 'href' => 'action/avatar/revert?guid=' . elgg_get_page_owner_guid(), + 'is_action' => true, + 'class' => 'elgg-button elgg-button-cancel mll', + )); +} + $form_params = array('enctype' => 'multipart/form-data'); $upload_form = elgg_view_form('avatar/upload', $form_params, $vars); @@ -28,6 +39,7 @@ $image = <<$current_label
    $user_avatar
+$revert_button HTML; $body = << Date: Sat, 31 Dec 2011 08:52:24 -0500 Subject: Fixes #4253 added backward compatibility for blog read url --- mod/blog/start.php | 1 + 1 file changed, 1 insertion(+) diff --git a/mod/blog/start.php b/mod/blog/start.php index 90a800799..a8553b4b8 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -125,6 +125,7 @@ function blog_page_handler($page) { $params = blog_get_page_content_archive($user->guid, $page[2], $page[3]); break; case 'view': + case 'read': // Elgg 1.7 compatibility $params = blog_get_page_content_read($page[1]); break; case 'add': -- cgit v1.2.3 From c5cee37b025a2654d1a5c427ac7a709ecf4b5350 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 31 Dec 2011 09:25:30 -0500 Subject: Fixes #4248 fixed friend river text --- .../2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php | 12 ++++++++++++ version.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 engine/lib/upgrades/2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php diff --git a/engine/lib/upgrades/2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php b/engine/lib/upgrades/2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php new file mode 100644 index 000000000..4dc43cd32 --- /dev/null +++ b/engine/lib/upgrades/2011123100-1.8.2-fix_friend_river-b17e7ff8345c2269.php @@ -0,0 +1,12 @@ +dbprefix}river + SET action_type='friend' + WHERE view='river/relationship/friend/create' AND action_type='create'"; +update_data($query); diff --git a/version.php b/version.php index 29870f93f..08c1e2513 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2011122100; +$version = 2011123100; // Human-friendly version name $release = '1.8.2'; -- cgit v1.2.3 From be12f79b9dd16202b774b4c42e07be395f00eff7 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 09:55:25 -0500 Subject: Fixes #4239 rerun corrected blog status upgrade --- ...3101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php | 25 ++++++++++++++++++++++ version.php | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php diff --git a/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php b/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php new file mode 100644 index 000000000..e351c6ac9 --- /dev/null +++ b/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php @@ -0,0 +1,25 @@ + 'object', + 'subtype' => 'blog', + 'limit' => 0, +); +$batch = new ElggBatch('elgg_get_entities', $options); + +foreach ($batch as $entity) { + if (!$entity->status) { + // create metadata owned by the original owner + create_metadata($entity->getGUID(), 'status', 'published', '', $entity->owner_guid, + $entity->access_id); + } +} +elgg_set_ignore_access($ia); \ No newline at end of file diff --git a/version.php b/version.php index 08c1e2513..455f77ad1 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2011123100; +$version = 2011123101; // Human-friendly version name $release = '1.8.2'; -- cgit v1.2.3 From 6dc5a90146595b78f5fd0d9b10b628a78ca2dac7 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 10:18:01 -0500 Subject: Fixes #4256 reruns the forum topic upgrade by checking the 5 oldest topics --- mod/groups/upgrades/2011030101.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mod/groups/upgrades/2011030101.php b/mod/groups/upgrades/2011030101.php index 9ed5b321b..55edb1a16 100644 --- a/mod/groups/upgrades/2011030101.php +++ b/mod/groups/upgrades/2011030101.php @@ -9,6 +9,7 @@ $topics = elgg_get_entities(array( 'type' => 'object', 'subtype' => 'groupforumtopic', 'limit' => 5, + 'order_by' => 'e.time_created asc', )); // if not topics, no upgrade required @@ -31,6 +32,11 @@ foreach ($topics as $topic) { */ function groups_2011030101($topic) { + // do not upgrade topics that have already been upgraded + if ($topic->description) { + return true; + } + $annotation = $topic->getAnnotations('group_topic_post', 1); if (!$annotation) { // no text for this forum post so we delete (probably caused by #2624) -- cgit v1.2.3 From 0647c4f8b6e50f93450939ecd2260f44fd3da115 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 10:39:01 -0500 Subject: Fixes #4257 updates admin theme for widget menu changes --- views/default/css/admin.php | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/views/default/css/admin.php b/views/default/css/admin.php index 065a108b1..1620f126b 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -816,6 +816,27 @@ a.elgg-button { vertical-align: baseline; } +/* *************************************** + WIDGET MENU +*************************************** */ +.elgg-menu-widget > li { + position: absolute; + top: 4px; + display: inline-block; + width: 18px; + height: 18px; + padding: 2px 2px 0 0; +} +.elgg-menu-widget > .elgg-menu-item-collapse { + left: 5px; +} +.elgg-menu-widget > .elgg-menu-item-delete { + right: 5px; +} +.elgg-menu-widget > .elgg-menu-item-settings { + right: 25px; +} + /* *************************************** MORE MENUS *************************************** */ @@ -923,17 +944,8 @@ a.elgg-button { padding: 4px 45px 0 20px; color: #333; } -.elgg-module-widget > .elgg-head a { - position: absolute; - top: 4px; - display: inline-block; - width: 18px; - height: 18px; - padding: 2px 2px 0 0; -} .elgg-widget-collapse-button { - left: 5px; color: #c5c5c5; text-decoration: none; } @@ -948,12 +960,6 @@ a.elgg-widget-collapse-button:before { a.elgg-widget-collapsed:before { content: "\25BA"; } -.elgg-widget-delete-button { - right: 5px; -} -.elgg-widget-edit-button { - right: 25px; -} .elgg-module-widget > .elgg-body { border-top: 1px solid #dedede; background-color: white; -- cgit v1.2.3 From c49f6d145700c878851ed6b548674d7693238841 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 10:47:06 -0500 Subject: Fixes #4228 group sort menu view accepts selected menu item from page handler --- mod/groups/views/default/groups/group_sort_menu.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mod/groups/views/default/groups/group_sort_menu.php b/mod/groups/views/default/groups/group_sort_menu.php index c53b49c8e..f5631a31f 100644 --- a/mod/groups/views/default/groups/group_sort_menu.php +++ b/mod/groups/views/default/groups/group_sort_menu.php @@ -2,6 +2,7 @@ /** * All groups listing page navigation * + * @uses $vars['selected'] Name of the tab that has been selected */ $tabs = array( @@ -22,14 +23,13 @@ $tabs = array( ), ); -// sets default selected item -if (strpos(full_url(), 'filter') === false) { - $tabs['newest']['selected'] = true; -} - foreach ($tabs as $name => $tab) { $tab['name'] = $name; + if ($vars['selected'] == $name) { + $tab['selected'] = true; + } + elgg_register_menu_item('filter', $tab); } -- cgit v1.2.3 From 80c2e13287612e52c046063a5b3d5e5bd4c8b532 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 11:06:41 -0500 Subject: Fixes #4258 fixes add_to_river escaping --- engine/lib/river.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engine/lib/river.php b/engine/lib/river.php index 421813441..63625878f 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -44,10 +44,16 @@ $posted = 0, $annotation_id = 0) { if ($access_id === "") { $access_id = $object->access_id; } - $annotation_id = (int)$annotation_id; $type = $object->getType(); $subtype = $object->getSubtype(); + + $view = sanitise_string($view); $action_type = sanitise_string($action_type); + $subject_guid = sanitise_int($subject_guid); + $object_guid = sanitise_int($object_guid); + $access_id = sanitise_int($access_id); + $posted = sanitise_int($posted); + $annotation_id = sanitise_int($annotation_id); $params = array( 'type' => $type, -- cgit v1.2.3 From 63dfdab76fef0e44fac550b0bb1a15780470f6c6 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 11:13:01 -0500 Subject: Fixes #4152 setting access on group creation river item --- mod/groups/actions/groups/edit.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php index c4cf6667e..b513a6098 100644 --- a/mod/groups/actions/groups/edit.php +++ b/mod/groups/actions/groups/edit.php @@ -89,14 +89,10 @@ if ($new_group_flag) { $group->save(); -// group creator needs to be member of new group and river entry created -if ($new_group_flag) { - elgg_set_page_owner_guid($group->guid); - $group->join($user); - add_to_river('river/group/create', 'create', $user->guid, $group->guid); -} - // Invisible group support +// @todo this requires save to be called to create the acl for the group. This +// is an odd requirement and should be removed. Either the acl creation happens +// in the action or the visibility moves to a plugin hook if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { $visibility = (int)get_input('vis', '', false); if ($visibility != ACCESS_PUBLIC && $visibility != ACCESS_LOGGED_IN) { @@ -105,10 +101,18 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') { if ($group->access_id != $visibility) { $group->access_id = $visibility; - $group->save(); } } +$group->save(); + +// group creator needs to be member of new group and river entry created +if ($new_group_flag) { + elgg_set_page_owner_guid($group->guid); + $group->join($user); + add_to_river('river/group/create', 'create', $user->guid, $group->guid, $group->access_id); +} + // Now see if we have a file icon if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))) { -- cgit v1.2.3 From 050d445fef73bf91968841752d9e1bdb652485f6 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 15:02:38 -0500 Subject: Fixes #4254 not registering the default widgets callback more than once per event --- engine/lib/widgets.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 46f34391a..d73dd6330 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -316,7 +316,12 @@ function elgg_default_widgets_init() { // override permissions for creating widget on logged out / just created entities elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'elgg_default_widgets_permissions_override'); + // only register the callback once per event + $events = array(); foreach ($default_widgets as $info) { + $events[$info['event'] . ',' . $info['entity_type']] = $info; + } + foreach ($events as $info) { elgg_register_event_handler($info['event'], $info['entity_type'], 'elgg_create_default_widgets'); } } -- cgit v1.2.3 From a34a741acf7a6c9c468009f76d33ed4ee1fcfb65 Mon Sep 17 00:00:00 2001 From: Jeroen Dalsem Date: Thu, 29 Dec 2011 11:19:32 +0100 Subject: Small typo. Seems to work, but i prefer it nice and tidy :) --- engine/classes/ElggWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php index 0eb83913b..df807e3f7 100644 --- a/engine/classes/ElggWidget.php +++ b/engine/classes/ElggWidget.php @@ -140,7 +140,7 @@ class ElggWidget extends ElggObject { $this->order = $widgets[$rank]->order; for ($index = $rank; $index < count($widgets); $index++) { if ($widgets[$index]->guid != $this->guid) { - $widgets[$index]-> order += 10; + $widgets[$index]->order += 10; } } } -- cgit v1.2.3 From 8bb4bbe9fb32e0b0b0c8cf687d19f58a0e39f89a Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 15:23:32 -0500 Subject: Fixes #4259 using container guid for widgets when moving --- engine/classes/ElggWidget.php | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php index df807e3f7..7a5a37ac8 100644 --- a/engine/classes/ElggWidget.php +++ b/engine/classes/ElggWidget.php @@ -115,6 +115,7 @@ class ElggWidget extends ElggObject { $options = array( 'type' => 'object', 'subtype' => 'widget', + 'container_guid' => $this->container_guid, 'private_setting_name_value_pairs' => array( array('name' => 'context', 'value' => $this->getContext()), array('name' => 'column', 'value' => $column) -- cgit v1.2.3 From 7684d074729c787c03dca4b394f9b0b6a3f108e9 Mon Sep 17 00:00:00 2001 From: Evan Winslow Date: Sat, 31 Dec 2011 12:31:43 -0800 Subject: Refs #3209: Adds property docs for the four main entity classes --- engine/classes/ElggGroup.php | 3 +++ engine/classes/ElggObject.php | 3 +++ engine/classes/ElggSite.php | 4 ++++ engine/classes/ElggUser.php | 9 +++++++++ 4 files changed, 19 insertions(+) diff --git a/engine/classes/ElggGroup.php b/engine/classes/ElggGroup.php index 0190e5eac..ab223e1a4 100644 --- a/engine/classes/ElggGroup.php +++ b/engine/classes/ElggGroup.php @@ -5,6 +5,9 @@ * * @package Elgg.Core * @subpackage Groups + * + * @property string $name A short name that captures the purpose of the group + * @property string $description A longer body of content that gives more details about the group */ class ElggGroup extends ElggEntity implements Friendable { diff --git a/engine/classes/ElggObject.php b/engine/classes/ElggObject.php index 0b8340697..582308f28 100644 --- a/engine/classes/ElggObject.php +++ b/engine/classes/ElggObject.php @@ -14,6 +14,9 @@ * * @package Elgg.Core * @subpackage DataModel.Object + * + * @property string $title The title, name, or summary of this object + * @property string $description The body, description, or content of the object */ class ElggObject extends ElggEntity { diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 3ccb146fb..686046512 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -21,6 +21,10 @@ * @package Elgg.Core * @subpackage DataMode.Site * @link http://docs.elgg.org/DataModel/Sites + * + * @property string $name The name or title of the website + * @property string $description A motto, mission statement, or description of the website + * @property string $url The root web address for the site, including trailing slash */ class ElggSite extends ElggEntity { diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index a1c7147a5..ab0610ac0 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -6,6 +6,15 @@ * * @package Elgg.Core * @subpackage DataModel.User + * + * @property string $name The display name that the user will be known by in the network + * @property string $username The short, reference name for the user in the network + * @property string $email The email address to which Elgg will send email notifications + * @property string $language The language preference of the user (ISO 639-1 formatted) + * @property string $banned 'yes' if the user is banned from the network, 'no' otherwise + * @property string $admin 'yes' if the user is an administrator of the network, 'no' otherwise + * @property string $password The hashed password of the user + * @property string $salt The salt used to secure the password before hashing */ class ElggUser extends ElggEntity implements Friendable { -- cgit v1.2.3 From dfcd3dafeeb61fe61fec96f4a0a6c09ed92deda7 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 17:22:55 -0500 Subject: Fixes #4255 new widget ordering code --- engine/classes/ElggWidget.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php index 7a5a37ac8..70eaf8a73 100644 --- a/engine/classes/ElggWidget.php +++ b/engine/classes/ElggWidget.php @@ -133,17 +133,30 @@ class ElggWidget extends ElggObject { if ($rank == 0) { // top of the column $this->order = $widgets[0]->order - 10; - } elseif ($rank == count($widgets)) { + } elseif ($rank == (count($widgets)-1)) { // bottom of the column $this->order = end($widgets)->order + 10; } else { - // reorder widgets that are below - $this->order = $widgets[$rank]->order; - for ($index = $rank; $index < count($widgets); $index++) { - if ($widgets[$index]->guid != $this->guid) { - $widgets[$index]->order += 10; + // reorder widgets + + // remove the widget that's being moved from the array + foreach ($widgets as $index => $widget) { + if ($widget->guid == $this->guid) { + unset($widgets[$index]); } } + + // split the array in two and recombine with the moved array in middle + $before = array_slice($widgets, 0, $rank); + array_push($before, $this); + $after = array_slice($widgets, $rank); + $widgets = array_merge($before, $after); + ksort($widgets); + $order = 0; + foreach ($widgets as $widget) { + $widget->order = $order; + $order += 10; + } } $this->column = $column; } -- cgit v1.2.3 From 7916edda4afa2c75654a120a40f2e04c46079b57 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 20:21:37 -0500 Subject: Fixes #4204 using only the relationship for getting members of a site --- engine/classes/ElggSite.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 686046512..7ea52a195 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -235,6 +235,7 @@ class ElggSite extends ElggEntity { } $defaults = array( + 'site_guids' => ELGG_ENTITIES_ANY_VALUE, 'relationship' => 'member_of_site', 'relationship_guid' => $this->getGUID(), 'inverse_relationship' => TRUE, @@ -258,6 +259,7 @@ class ElggSite extends ElggEntity { */ public function listMembers($options = array()) { $defaults = array( + 'site_guids' => ELGG_ENTITIES_ANY_VALUE, 'relationship' => 'member_of_site', 'relationship_guid' => $this->getGUID(), 'inverse_relationship' => TRUE, -- cgit v1.2.3 From 74a62bf4224e03827d6ba3ac80256be4f74d110b Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 20:25:41 -0500 Subject: Fixes #4208 notifications do not use site guid --- engine/lib/notification.php | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/lib/notification.php b/engine/lib/notification.php index eb7e594c6..5a2f5f8ac 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -487,6 +487,7 @@ function object_notifications($event, $object_type, $object) { // (Person defined by container_guid so we can also subscribe to groups if we want) foreach ($NOTIFICATION_HANDLERS as $method => $foo) { $interested_users = elgg_get_entities_from_relationship(array( + 'site_guids' => ELGG_ENTITIES_ANY_VALUE, 'relationship' => 'notify' . $method, 'relationship_guid' => $object->container_guid, 'inverse_relationship' => TRUE, -- cgit v1.2.3 From 280f5730b49da487a5ca82c395ca265e37dad997 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 31 Dec 2011 20:35:09 -0500 Subject: Fixes #4260 get_user_sites() now works --- engine/lib/users.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/lib/users.php b/engine/lib/users.php index 3a3756923..1d67bc463 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -299,13 +299,14 @@ function get_user_sites($user_guid, $limit = 10, $offset = 0) { $offset = (int)$offset; return elgg_get_entities_from_relationship(array( + 'site_guids' => ELGG_ENTITIES_ANY_VALUE, 'relationship' => 'member_of_site', 'relationship_guid' => $user_guid, 'inverse_relationship' => FALSE, 'types' => 'site', 'limit' => $limit, - 'offset' => $offset) - ); + 'offset' => $offset, + )); } /** -- cgit v1.2.3 From 51229ebc6691f8edb17a5f15328aa626eabc09fc Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 14:05:31 -0500 Subject: Fixes #4137 moves test UI to developers plugin --- mod/developers/languages/en.php | 6 ++ mod/developers/start.php | 9 +-- .../default/admin/develop_tools/unit_tests.php | 17 ++++++ mod/diagnostics/languages/en.php | 66 +++++++--------------- .../admin/develop_utilities/diagnostics.php | 21 ------- 5 files changed, 48 insertions(+), 71 deletions(-) create mode 100644 mod/developers/views/default/admin/develop_tools/unit_tests.php diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index a2682363c..812f779fa 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -9,6 +9,7 @@ $english = array( 'admin:develop_tools' => 'Tools', 'admin:develop_tools:preview' => 'Theming Sandbox', 'admin:develop_tools:inspect' => 'Inspect', + 'admin:develop_tools:unit_tests' => 'Unit Tests', 'admin:developers' => 'Developers', 'admin:developers:settings' => 'Settings', @@ -54,6 +55,11 @@ $english = array( 'theme_preview:navigation' => 'Navigation', 'theme_preview:typography' => 'Typography', + // unit tests + 'developers:unit_tests:description' => 'Elgg has unit and integration tests for detecting bugs in its core classes and functions.', + 'developers:unit_tests:warning' => 'Warning: Do Not Run These Tests on a Production Site. They can corrupt your database.', + 'developers:unit_tests:run' => 'Run', + // status messages 'developers:settings:success' => 'Settings saved', ); diff --git a/mod/developers/start.php b/mod/developers/start.php index 79ec0655a..d77a96b36 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -63,6 +63,7 @@ function developers_setup_menu() { if (elgg_in_context('admin')) { elgg_register_admin_menu_item('develop', 'inspect', 'develop_tools'); elgg_register_admin_menu_item('develop', 'preview', 'develop_tools'); + elgg_register_admin_menu_item('develop', 'unit_tests', 'develop_tools'); elgg_register_menu_item('page', array( 'name' => 'dev_settings', @@ -76,8 +77,8 @@ function developers_setup_menu() { } /** -* Clear all the strings so the raw descriptor strings are displayed -*/ + * Clear all the strings so the raw descriptor strings are displayed + */ function developers_clear_strings() { global $CONFIG; @@ -121,8 +122,8 @@ function developers_wrap_views($hook, $type, $result, $params) { } /** -* Log the events and plugin hooks -*/ + * Log the events and plugin hooks + */ function developers_log_events($name, $type) { // filter out some very common events diff --git a/mod/developers/views/default/admin/develop_tools/unit_tests.php b/mod/developers/views/default/admin/develop_tools/unit_tests.php new file mode 100644 index 000000000..81658e88b --- /dev/null +++ b/mod/developers/views/default/admin/develop_tools/unit_tests.php @@ -0,0 +1,17 @@ +' . elgg_echo('developers:unit_tests:description') . '

'; +echo '

' . elgg_echo('developers:unit_tests:warning') . '

'; + +// create a button to run tests +$params = array( + 'text' => elgg_echo('developers:unit_tests:run'), + 'href' => 'engine/tests/suite.php', + 'class' => 'elgg-button elgg-button-submit', + 'is_trusted' => true, +); +echo '

' . elgg_view('output/url', $params) . '

'; diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index c4e337b50..3619b2ee1 100644 --- a/mod/diagnostics/languages/en.php +++ b/mod/diagnostics/languages/en.php @@ -1,71 +1,45 @@ 'System Diagnostics', - 'diagnostics' => 'System diagnostics', - 'diagnostics:report' => 'Diagnostics Report', - 'diagnostics:unittester' => 'Unit Tests', - - 'diagnostics:description' => 'The following diagnostic report is useful for diagnosing any problems with Elgg, and should be attached to any bug reports you file.', - 'diagnostics:unittester:description' => 'The following are diagnostic tests which are registered by plugins and may be performed in order to debug parts of the Elgg framework.', - - 'diagnostics:unittester:description' => 'Unit tests check Elgg Core for broken or buggy APIs.', - 'diagnostics:unittester:debug' => 'The site must be in debug mode to run unit tests.', - 'diagnostics:unittester:warning' => 'WARNING: These tests can leave behind debugging objects in your database.
DO NOT USE ON A PRODUCTION SITE!', - - 'diagnostics:test:executetest' => 'Execute test', - 'diagnostics:test:executeall' => 'Execute All', - 'diagnostics:unittester:notests' => 'Sorry, there are no unit test modules currently installed.', - 'diagnostics:unittester:testnotfound' => 'Sorry, the report could not be generated because that test was not found', - - 'diagnostics:unittester:testresult:nottestclass' => 'FAIL - Result not a test class', - 'diagnostics:unittester:testresult:fail' => 'FAIL', - 'diagnostics:unittester:testresult:success' => 'SUCCESS', - - 'diagnostics:unittest:example' => 'Example unit test, only available in debug mode.', - - 'diagnostics:unittester:report' => 'Test report for %s', - - 'diagnostics:download' => 'Download', - - - 'diagnostics:header' => '======================================================================== +/** + * Elgg diagnostics language pack. + * + * @package ElggDiagnostics + */ + +$english = array( + 'admin:develop_utilities:diagnostics' => 'System Diagnostics', + 'diagnostics' => 'System diagnostics', + 'diagnostics:report' => 'Diagnostics Report', + 'diagnostics:description' => 'The following diagnostic report is useful for diagnosing any problems with Elgg, and should be attached to any bug reports you file.', + 'diagnostics:download' => 'Download', + 'diagnostics:header' => '======================================================================== Elgg Diagnostic Report Generated %s by %s ======================================================================== ', - 'diagnostics:report:basic' => ' + 'diagnostics:report:basic' => ' Elgg Release %s, version %s ------------------------------------------------------------------------', - 'diagnostics:report:php' => ' + 'diagnostics:report:php' => ' PHP info: %s ------------------------------------------------------------------------', - 'diagnostics:report:plugins' => ' + 'diagnostics:report:plugins' => ' Installed plugins and details: %s ------------------------------------------------------------------------', - 'diagnostics:report:md5' => ' + 'diagnostics:report:md5' => ' Installed files and checksums: %s ------------------------------------------------------------------------', - 'diagnostics:report:globals' => ' + 'diagnostics:report:globals' => ' Global variables: %s ------------------------------------------------------------------------', +); - ); - - add_translation("en",$english); -?> \ No newline at end of file +add_translation("en", $english); diff --git a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php index 89e235279..c7ff3d5fc 100644 --- a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php +++ b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php @@ -14,25 +14,4 @@ $params = array( ); $diagnostics .= '

' . elgg_view('output/url', $params) . '

'; -// unit tests -$unit_tests_title = elgg_echo('diagnostics:unittester'); -$unit_tests .= '

' . elgg_echo('diagnostics:unittester:description') . '

'; -$unit_tests .= '

' . elgg_echo('diagnostics:unittester:warning') . '

'; - -if (elgg_get_config('debug')) { - // create a button to run tests - $params = array( - 'text' => elgg_echo('diagnostics:test:executeall'), - 'href' => 'engine/tests/suite.php', - 'class' => 'elgg-button elgg-button-submit', - 'is_trusted' => true, - ); - $unit_tests .= '

' . elgg_view('output/url', $params) . '

'; -} else { - // no tests when not in debug mode - $unit_tests .= elgg_echo('diagnostics:unittester:debug'); -} - -// display admin body echo elgg_view_module('inline', $diagnostics_title, $diagnostics, array('class' => 'elgg-form-settings')); -echo elgg_view_module('inline', $unit_tests_title, $unit_tests, array('class' => 'elgg-form-settings')); -- cgit v1.2.3 From 6a5476224cb3d351405eb1b7c5edcc04d5b47104 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 14:15:22 -0500 Subject: Fixes #3992 fixed notice when loading plugins for first time --- engine/lib/plugins.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index be871d025..026bc171b 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -439,9 +439,9 @@ function elgg_set_plugin_priorities(array $order) { } } - // set the missing plugins priorities + // set the missing plugins' priorities if ($return && $missing_plugins) { - if (!$priority) { + if (!isset($priority)) { $priority = 0; } foreach ($missing_plugins as $plugin) { -- cgit v1.2.3 From 2603dcebf460c71e4504b105f3df62b021be55e0 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 14:39:14 -0500 Subject: Fixes #3981 adds a better pre and code style to admin theme --- views/default/css/admin.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/views/default/css/admin.php b/views/default/css/admin.php index 1620f126b..6deceb14e 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -106,7 +106,12 @@ a:hover { text-decoration: underline; } pre, code { - background: #EBF5FF; + background-color: #EEE; + border: 1px solid #DDD; + color: #444; + overflow: auto; + margin: 15px 0; + padding: 5px; } blockquote { background: #EBF5FF; -- cgit v1.2.3 From 96e403d69956434aadd588fcfb08fb6f0a329d9c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 15:29:39 -0500 Subject: Fixes #4168 ignoring access when saving an admin notice --- engine/lib/admin.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/engine/lib/admin.php b/engine/lib/admin.php index a191d740b..1f085eee4 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -79,6 +79,10 @@ function elgg_add_admin_notice($id, $message) { if (elgg_admin_notice_exists($id)) { return false; } + + // need to handle when no one is logged in + $old_ia = elgg_set_ignore_access(true); + $admin_notice = new ElggObject(); $admin_notice->subtype = 'admin_notice'; // admins can see ACCESS_PRIVATE but no one else can. @@ -86,13 +90,16 @@ function elgg_add_admin_notice($id, $message) { $admin_notice->admin_notice_id = $id; $admin_notice->description = $message; - return $admin_notice->save(); + $result = $admin_notice->save(); + + elgg_set_ignore_access($old_ia); + + return (bool)$result; } - return FALSE; + return false; } - /** * Remove an admin notice by ID. * -- cgit v1.2.3 From 43b4629f7e3d111f2c41ab0cdfd48b38c17db92c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 15:49:00 -0500 Subject: Fixes #690 admin editing a user no longer makes them appear active --- engine/lib/users.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/engine/lib/users.php b/engine/lib/users.php index 1d67bc463..362488718 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -60,13 +60,12 @@ function create_user_entity($guid, $name, $username, $password, $salt, $email, $ $row = get_entity_as_row($guid); if ($row) { // Exists and you have access to it - $query = "SELECT guid from {$CONFIG->dbprefix}users_entity where guid = {$guid}"; if ($exists = get_data_row($query)) { $query = "UPDATE {$CONFIG->dbprefix}users_entity - set name='$name', username='$username', password='$password', salt='$salt', - email='$email', language='$language', code='$code', last_action = " - . time() . " where guid = {$guid}"; + SET name='$name', username='$username', password='$password', salt='$salt', + email='$email', language='$language', code='$code' + WHERE guid = $guid"; $result = update_data($query); if ($result != false) { @@ -79,7 +78,7 @@ function create_user_entity($guid, $name, $username, $password, $salt, $email, $ } } } else { - // Update failed, attempt an insert. + // Exists query failed, attempt an insert. $query = "INSERT into {$CONFIG->dbprefix}users_entity (guid, name, username, password, salt, email, language, code) values ($guid, '$name', '$username', '$password', '$salt', '$email', '$language', '$code')"; @@ -90,7 +89,7 @@ function create_user_entity($guid, $name, $username, $password, $salt, $email, $ if (elgg_trigger_event('create', $entity->type, $entity)) { return $guid; } else { - $entity->delete(); //delete_entity($guid); + $entity->delete(); } } } -- cgit v1.2.3 From 035c2107fdb266358ed218e6a3551e5cad39fe18 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 16:21:05 -0500 Subject: Fixes #3225 added what was missing from the basic init function example --- documentation/examples/plugins/start.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/documentation/examples/plugins/start.php b/documentation/examples/plugins/start.php index ea1e894b2..3af50ce38 100644 --- a/documentation/examples/plugins/start.php +++ b/documentation/examples/plugins/start.php @@ -8,5 +8,15 @@ elgg_register_event_handler('init', 'system', 'my_plugin_init'); function my_plugin_init() { // Rename this function based on the name of your plugin and update the // elgg_register_event_handler() call accordingly - + + // Register a script to handle (usually) a POST request (an action) + $base_dir = elgg_get_plugins_path() . 'my_plugin/actions/my_plugin'; + elgg_register_action('my_plugin', "$base_dir/my_action.php"); + + // Extend the main CSS file + elgg_extend_view('css/elgg', 'my_plugin/css'); + + // Add a menu item to the main site menu + $item = new ElggMenuItem('my_plugin', elgg_echo('my_plugin:menu'), 'my_url'); + elgg_register_menu_item('site', $item); } -- cgit v1.2.3 From 3a58c21904d22c0e2f80891f265ba4d687f838e3 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 17:40:17 -0500 Subject: Refs #2290 removes check for username --- engine/classes/ElggDiskFilestore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/classes/ElggDiskFilestore.php b/engine/classes/ElggDiskFilestore.php index 11b2bd947..f00376481 100644 --- a/engine/classes/ElggDiskFilestore.php +++ b/engine/classes/ElggDiskFilestore.php @@ -205,7 +205,7 @@ class ElggDiskFilestore extends ElggFilestore { $owner = elgg_get_logged_in_user_entity(); } - if ((!$owner) || (!$owner->username)) { + if (!$owner) { $msg = elgg_echo('InvalidParameterException:MissingOwner', array($file->getFilename(), $file->guid)); throw new InvalidParameterException($msg); -- cgit v1.2.3 From cfaa3452ae1e6035e5b9ecb668d29330b34499c2 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 17:55:42 -0500 Subject: fixed copy and paste error in documentation of ElggCache --- engine/classes/ElggCache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/classes/ElggCache.php b/engine/classes/ElggCache.php index 5c2cafcb7..dd53525b8 100644 --- a/engine/classes/ElggCache.php +++ b/engine/classes/ElggCache.php @@ -29,7 +29,7 @@ abstract class ElggCache implements ArrayAccess { * * @return void * - * @deprecated 1.8 Use ElggAccess:setVariable() + * @deprecated 1.8 Use ElggCache:setVariable() */ public function set_variable($variable, $value) { elgg_deprecated_notice('ElggCache::set_variable() is deprecated by ElggCache::setVariable()', 1.8); -- cgit v1.2.3 From ce691dd8c560abc48aaf578928d13dea6ef31565 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 18:30:17 -0500 Subject: Fixes #3209 finished adding class properties documentation --- engine/classes/ElggExtender.php | 11 +++++++++-- engine/classes/ElggObject.php | 1 + engine/classes/ElggRelationship.php | 6 ++++++ engine/classes/ElggRiverItem.php | 11 +++++++++++ mod/blog/classes/ElggBlog.php | 4 ++++ mod/thewire/classes/ElggWire.php | 4 ++++ 6 files changed, 35 insertions(+), 2 deletions(-) diff --git a/engine/classes/ElggExtender.php b/engine/classes/ElggExtender.php index d6f79d18d..bc2d67ae2 100644 --- a/engine/classes/ElggExtender.php +++ b/engine/classes/ElggExtender.php @@ -3,8 +3,7 @@ * The base class for ElggEntity extenders. * * Extenders allow you to attach extended information to an - * ElggEntity. Core supports two: ElggAnnotation, ElggMetadata, - * and ElggRelationship + * ElggEntity. Core supports two: ElggAnnotation and ElggMetadata. * * Saving the extender data to database is handled by the child class. * @@ -16,6 +15,14 @@ * @link http://docs.elgg.org/DataModel/Extenders * @see ElggAnnotation * @see ElggMetadata + * + * @property string $type annotation or metadata (read-only after save) + * @property int $id The unique identifier (read-only) + * @property int $entity_guid The GUID of the entity that this extender describes + * @property int $access_id Specifies the visibility level of this extender + * @property string $name The name of this extender + * @property mixed $value The value of the extender (int or string) + * @property int $time_created A UNIX timestamp of when the extender was created (read-only, set on first save) */ abstract class ElggExtender extends ElggData { diff --git a/engine/classes/ElggObject.php b/engine/classes/ElggObject.php index 582308f28..649e32490 100644 --- a/engine/classes/ElggObject.php +++ b/engine/classes/ElggObject.php @@ -17,6 +17,7 @@ * * @property string $title The title, name, or summary of this object * @property string $description The body, description, or content of the object + * @property array $tags Array of tags that describe the object */ class ElggObject extends ElggEntity { diff --git a/engine/classes/ElggRelationship.php b/engine/classes/ElggRelationship.php index 2d9a32cbd..efc0f7eff 100644 --- a/engine/classes/ElggRelationship.php +++ b/engine/classes/ElggRelationship.php @@ -4,6 +4,12 @@ * * @package Elgg.Core * @subpackage Core + * + * @property int $id The unique identifier (read-only) + * @property int $guid_one The GUID of the subject of the relationship + * @property string $relationship The name of the relationship + * @property int $guid_two The GUID of the object of the relationship + * @property int $time_created A UNIX timestamp of when the relationship was created (read-only, set on first save) */ class ElggRelationship extends ElggData implements Importable diff --git a/engine/classes/ElggRiverItem.php b/engine/classes/ElggRiverItem.php index fcc8f9c85..8fef6bb9d 100644 --- a/engine/classes/ElggRiverItem.php +++ b/engine/classes/ElggRiverItem.php @@ -4,6 +4,17 @@ * * @package Elgg.Core * @subpackage Core + * + * @property int $id The unique identifier (read-only) + * @property int $subject_guid The GUID of the actor + * @property int $object_guid The GUID of the object + * @property int $annotation_id The ID of the annotation involved in the action + * @property string $type The type of one of the entities involved in the action + * @property string $subtype The subtype of one of the entities involved in the action + * @property string $action_type The name of the action + * @property string $view The view for displaying this river item + * @property int $access_id The visibility of the river item + * @property int $posted UNIX timestamp when the action occurred */ class ElggRiverItem { diff --git a/mod/blog/classes/ElggBlog.php b/mod/blog/classes/ElggBlog.php index ee2ec73ef..8d4401c57 100644 --- a/mod/blog/classes/ElggBlog.php +++ b/mod/blog/classes/ElggBlog.php @@ -1,6 +1,10 @@ Date: Sun, 1 Jan 2012 19:29:17 -0500 Subject: Fixes #3939 if user does not have permissions to see the name of the access collection, it is shown as "Limited" --- engine/lib/access.php | 15 ++++++--------- languages/en.php | 2 ++ views/default/output/access.php | 5 ++++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/engine/lib/access.php b/engine/lib/access.php index 08b9283cd..7be92fbfc 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -838,7 +838,7 @@ function elgg_list_entities_from_access_id(array $options = array()) { * * @param int $entity_access_id The entity's access id * - * @return string 'Public', 'Private', etc. or false if error. + * @return string 'Public', 'Private', etc. * @since 1.7.0 * @todo I think this probably wants get_access_array() instead of get_write_access_array(), * but those two functions return different types of arrays. @@ -849,15 +849,12 @@ function get_readable_access_level($entity_access_id) { //get the access level for object in readable string $options = get_write_access_array(); - //@todo Really? Use array_key_exists() - foreach ($options as $key => $option) { - if ($key == $access) { - $entity_acl = htmlentities($option, ENT_QUOTES, 'UTF-8'); - return $entity_acl; - break; - } + if (array_key_exists($access, $options)) { + return $options[$access]; } - return false; + + // return 'Limited' if the user does not have access to the access collection + return elgg_echo('access:limited:label'); } /** diff --git a/languages/en.php b/languages/en.php index 2f8ab41c9..acc8e0bc0 100644 --- a/languages/en.php +++ b/languages/en.php @@ -270,6 +270,8 @@ $english = array( 'PUBLIC' => "Public", 'access:friends:label' => "Friends", 'access' => "Access", + 'access:limited:label' => "Limited", + 'access:help' => "The access level", /** * Dashboard and widgets diff --git a/views/default/output/access.php b/views/default/output/access.php index 811948323..91c5c721e 100644 --- a/views/default/output/access.php +++ b/views/default/output/access.php @@ -11,6 +11,7 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) { $access_id = $vars['entity']->access_id; $access_class = 'elgg-access'; $access_id_string = get_readable_access_level($access_id); + $access_id_string = htmlentities($access_id_string, ENT_QUOTES, 'UTF-8'); // if within a group or shared access collection display group name and open/closed membership status // @todo have a better way to do this instead of checking against subtype / class. @@ -35,5 +36,7 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) { $access_class .= ' elgg-access-private'; } - echo "$access_id_string"; + $help_text = elgg_echo('access:help'); + + echo "$access_id_string"; } -- cgit v1.2.3 From 147223bc786833d539b3325db966a3a1eed44956 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 1 Jan 2012 19:35:23 -0500 Subject: Fixes #2230 group acl names are not i18n friendly --- mod/groups/languages/en.php | 1 + mod/groups/start.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 3623c95fc..a4a9e2b2b 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -62,6 +62,7 @@ $english = array( 'groups:search:title' => "Search for groups tagged with '%s'", 'groups:search:none' => "No matching groups were found", 'groups:search_in_group' => "Search in this group", + 'groups:acl' => "Group: %s", 'groups:activity' => "Group activity", 'groups:enableactivity' => 'Enable group activity', diff --git a/mod/groups/start.php b/mod/groups/start.php index 09362cbbc..86a1da279 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -663,7 +663,7 @@ function group_access_options($group) { ACCESS_PRIVATE => 'private', ACCESS_LOGGED_IN => 'logged in users', ACCESS_PUBLIC => 'public', - $group->group_acl => 'Group: ' . $group->name, + $group->group_acl => elgg_echo('groups:acl', array($group->name)), ); return $access_array; } -- cgit v1.2.3 From 25d11f6cdcc200ae00332197c9bd86858e3620b8 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 1 Jan 2012 19:42:53 -0500 Subject: moved diagnostics to administer utilities menu area rather than developers --- mod/diagnostics/languages/en.php | 4 ++-- mod/diagnostics/start.php | 2 +- .../default/admin/administer_utilities/diagnostics.php | 17 +++++++++++++++++ .../default/admin/develop_utilities/diagnostics.php | 17 ----------------- 4 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php delete mode 100644 mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index 3619b2ee1..54859941d 100644 --- a/mod/diagnostics/languages/en.php +++ b/mod/diagnostics/languages/en.php @@ -6,10 +6,10 @@ */ $english = array( - 'admin:develop_utilities:diagnostics' => 'System Diagnostics', + 'admin:administer_utilities:diagnostics' => 'System Diagnostics', 'diagnostics' => 'System diagnostics', 'diagnostics:report' => 'Diagnostics Report', - 'diagnostics:description' => 'The following diagnostic report is useful for diagnosing any problems with Elgg, and should be attached to any bug reports you file.', + 'diagnostics:description' => 'The following diagnostic report can be useful for diagnosing problems with Elgg. The developers of Elgg may request that you attach it to a bug report.', 'diagnostics:download' => 'Download', 'diagnostics:header' => '======================================================================== Elgg Diagnostic Report diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 0bcc08bd9..55842800a 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -13,7 +13,7 @@ elgg_register_event_handler('init', 'system', 'diagnostics_init'); function diagnostics_init() { // Add admin menu item - elgg_register_admin_menu_item('develop', 'diagnostics', 'develop_utilities'); + elgg_register_admin_menu_item('administer', 'diagnostics', 'administer_utilities'); // Register some actions $file = elgg_get_plugins_path() . "diagnostics/actions/download.php"; diff --git a/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php new file mode 100644 index 000000000..c7ff3d5fc --- /dev/null +++ b/mod/diagnostics/views/default/admin/administer_utilities/diagnostics.php @@ -0,0 +1,17 @@ +' . elgg_echo('diagnostics:description') .'

'; +$params = array( + 'text' => elgg_echo('diagnostics:download'), + 'href' => 'action/diagnostics/download', + 'class' => 'elgg-button elgg-button-submit', + 'is_action' => true, + 'is_trusted' => true, +); +$diagnostics .= '

' . elgg_view('output/url', $params) . '

'; + +echo elgg_view_module('inline', $diagnostics_title, $diagnostics, array('class' => 'elgg-form-settings')); diff --git a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php deleted file mode 100644 index c7ff3d5fc..000000000 --- a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php +++ /dev/null @@ -1,17 +0,0 @@ -' . elgg_echo('diagnostics:description') .'

'; -$params = array( - 'text' => elgg_echo('diagnostics:download'), - 'href' => 'action/diagnostics/download', - 'class' => 'elgg-button elgg-button-submit', - 'is_action' => true, - 'is_trusted' => true, -); -$diagnostics .= '

' . elgg_view('output/url', $params) . '

'; - -echo elgg_view_module('inline', $diagnostics_title, $diagnostics, array('class' => 'elgg-form-settings')); -- cgit v1.2.3 From a5d89ccf653748c471a3c62c46a02db3be4e23dc Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Mon, 2 Jan 2012 09:13:37 -0500 Subject: Fixes #4164 adds a server statistics page to admin area --- engine/lib/admin.php | 1 + languages/en.php | 12 +++++++ views/default/admin/statistics/basic.php | 19 ---------- views/default/admin/statistics/numentities.php | 40 ---------------------- views/default/admin/statistics/overview.php | 4 +-- views/default/admin/statistics/overview/basic.php | 19 ++++++++++ .../admin/statistics/overview/numentities.php | 40 ++++++++++++++++++++++ views/default/admin/statistics/server.php | 8 +++++ views/default/admin/statistics/server/php.php | 33 ++++++++++++++++++ .../default/admin/statistics/server/web_server.php | 16 +++++++++ 10 files changed, 131 insertions(+), 61 deletions(-) delete mode 100644 views/default/admin/statistics/basic.php delete mode 100644 views/default/admin/statistics/numentities.php create mode 100644 views/default/admin/statistics/overview/basic.php create mode 100644 views/default/admin/statistics/overview/numentities.php create mode 100644 views/default/admin/statistics/server.php create mode 100644 views/default/admin/statistics/server/php.php create mode 100644 views/default/admin/statistics/server/web_server.php diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 1f085eee4..5a475a9f0 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -262,6 +262,7 @@ function admin_init() { // statistics elgg_register_admin_menu_item('administer', 'statistics', null, 20); elgg_register_admin_menu_item('administer', 'overview', 'statistics'); + elgg_register_admin_menu_item('administer', 'server', 'statistics'); // users elgg_register_admin_menu_item('administer', 'users', null, 20); diff --git a/languages/en.php b/languages/en.php index acc8e0bc0..d9149a689 100644 --- a/languages/en.php +++ b/languages/en.php @@ -568,6 +568,7 @@ $english = array( 'admin:statistics' => "Statistics", 'admin:statistics:overview' => 'Overview', + 'admin:statistics:server' => 'Server Info', 'admin:appearance' => 'Appearance', 'admin:administer_utilities' => 'Utilities', @@ -726,6 +727,17 @@ $english = array( 'admin:statistics:label:version:release' => "Release", 'admin:statistics:label:version:version' => "Version", + 'admin:server:label:php' => 'PHP', + 'admin:server:label:web_server' => 'Web Server', + 'admin:server:label:server' => 'Server', + 'admin:server:label:log_location' => 'Log Location', + 'admin:server:label:php_version' => 'PHP version', + 'admin:server:label:php_ini' => 'PHP ini file location', + 'admin:server:label:php_log' => 'PHP Log', + 'admin:server:label:mem_avail' => 'Memory available', + 'admin:server:label:mem_used' => 'Memory used', + 'admin:server:error_log' => "Web server's error log", + 'admin:user:label:search' => "Find users:", 'admin:user:label:searchbutton' => "Search", diff --git a/views/default/admin/statistics/basic.php b/views/default/admin/statistics/basic.php deleted file mode 100644 index 2c9b3b88e..000000000 --- a/views/default/admin/statistics/basic.php +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - -
: - , -
: /
\ No newline at end of file diff --git a/views/default/admin/statistics/numentities.php b/views/default/admin/statistics/numentities.php deleted file mode 100644 index af4ae2773..000000000 --- a/views/default/admin/statistics/numentities.php +++ /dev/null @@ -1,40 +0,0 @@ - - - $entry) { - arsort($entry); - foreach ($entry as $a => $b) { - - //This function controls the alternating class - $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; - - if ($a == "__base__") { - $a = elgg_echo("item:{$k}"); - if (empty($a)) - $a = $k; - } else { - if (empty($a)) { - $a = elgg_echo("item:{$k}"); - } else { - $a = elgg_echo("item:{$k}:{$a}"); - } - - if (empty($a)) { - $a = "$k $a"; - } - } - - echo <<< END - - - - -END; - } - } -?> -
{$a}:{$b}
diff --git a/views/default/admin/statistics/overview.php b/views/default/admin/statistics/overview.php index 2f5b25121..ac5aaac36 100644 --- a/views/default/admin/statistics/overview.php +++ b/views/default/admin/statistics/overview.php @@ -8,6 +8,6 @@ echo elgg_view('admin/statistics/extend'); -echo elgg_view_module('inline', elgg_echo('admin:statistics:label:basic'), elgg_view('admin/statistics/basic')); +echo elgg_view_module('inline', elgg_echo('admin:statistics:label:basic'), elgg_view('admin/statistics/overview/basic')); -echo elgg_view_module('inline', elgg_echo('admin:statistics:label:numentities'), elgg_view('admin/statistics/numentities')); \ No newline at end of file +echo elgg_view_module('inline', elgg_echo('admin:statistics:label:numentities'), elgg_view('admin/statistics/overview/numentities')); diff --git a/views/default/admin/statistics/overview/basic.php b/views/default/admin/statistics/overview/basic.php new file mode 100644 index 000000000..2c9b3b88e --- /dev/null +++ b/views/default/admin/statistics/overview/basic.php @@ -0,0 +1,19 @@ + + + + + + + + + + +
: - , -
: /
\ No newline at end of file diff --git a/views/default/admin/statistics/overview/numentities.php b/views/default/admin/statistics/overview/numentities.php new file mode 100644 index 000000000..af4ae2773 --- /dev/null +++ b/views/default/admin/statistics/overview/numentities.php @@ -0,0 +1,40 @@ + + + $entry) { + arsort($entry); + foreach ($entry as $a => $b) { + + //This function controls the alternating class + $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; + + if ($a == "__base__") { + $a = elgg_echo("item:{$k}"); + if (empty($a)) + $a = $k; + } else { + if (empty($a)) { + $a = elgg_echo("item:{$k}"); + } else { + $a = elgg_echo("item:{$k}:{$a}"); + } + + if (empty($a)) { + $a = "$k $a"; + } + } + + echo <<< END + + + + +END; + } + } +?> +
{$a}:{$b}
diff --git a/views/default/admin/statistics/server.php b/views/default/admin/statistics/server.php new file mode 100644 index 000000000..9d21addc1 --- /dev/null +++ b/views/default/admin/statistics/server.php @@ -0,0 +1,8 @@ + + + + + + + + + + + + + + + + + + + + + + +
:
:
:
:
:
diff --git a/views/default/admin/statistics/server/web_server.php b/views/default/admin/statistics/server/web_server.php new file mode 100644 index 000000000..904a54f4b --- /dev/null +++ b/views/default/admin/statistics/server/web_server.php @@ -0,0 +1,16 @@ + + + + + + + + + + +
:
:
-- cgit v1.2.3 From 24a369c78df14469097dd440bba3cee087a39e7b Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Wed, 4 Jan 2012 15:05:21 -0800 Subject: Fixes #3710. Returning false from update, event no longer deletes entity. Returning false from create, still deletes the entity because of the "return false to halt events" approach. This will be reviewed for #3784. --- engine/lib/objects.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/engine/lib/objects.php b/engine/lib/objects.php index 63d0f5cef..f186c66cb 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -52,11 +52,8 @@ function create_object_entity($guid, $title, $description) { if ($result != false) { // Update succeeded, continue $entity = get_entity($guid); - if (elgg_trigger_event('update', $entity->type, $entity)) { - return $guid; - } else { - $entity->delete(); - } + elgg_trigger_event('update', $entity->type, $entity); + return $guid; } } else { // Update failed, attempt an insert. -- cgit v1.2.3 From a92b300af8103e4168dc2091e2e8505f756cacf6 Mon Sep 17 00:00:00 2001 From: Sem Date: Tue, 3 Jan 2012 23:22:33 +0100 Subject: Refs #2051. Fixed: ElggEntity's enable does not recurse. --- engine/lib/entities.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/engine/lib/entities.php b/engine/lib/entities.php index daced6740..d2c86e470 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1385,12 +1385,15 @@ function disable_entity($guid, $reason = "", $recursive = true) { $__RECURSIVE_DELETE_TOKEN = md5(elgg_get_logged_in_user_guid()); $sub_entities = get_data("SELECT * from {$CONFIG->dbprefix}entities - WHERE container_guid=$guid + WHERE ( + container_guid=$guid or owner_guid=$guid - or site_guid=$guid", 'entity_row_to_elggstar'); + or site_guid=$guid + ) and enabled='yes'", 'entity_row_to_elggstar'); if ($sub_entities) { foreach ($sub_entities as $e) { + add_entity_relationship($e->guid, 'disabled_with', $entity->guid); $e->disable($reason); } } @@ -1446,6 +1449,17 @@ function enable_entity($guid) { $entity->deleteMetadata('disable_reason'); $entity->enableMetadata(); $entity->enableAnnotations(); + + $disabled_with_it = elgg_get_entities_from_relationship(array( + 'relationship' => 'disabled_with', + 'relationship_guid' => $entity->guid, + 'inverse_relationship' => true, + )); + + foreach ($disabled_with_it as $e) { + $e->enable(); + remove_entity_relationship($e->guid, 'disabled_with', $entity->guid); + } return $result; } @@ -2318,3 +2332,4 @@ elgg_register_plugin_hook_handler('volatile', 'metadata', 'volatile_data_export_ /** Register init system event **/ elgg_register_event_handler('init', 'system', 'entities_init'); + -- cgit v1.2.3 From 4befaea34c2617e0ae8b246bb42f582af6f100e4 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 4 Jan 2012 20:13:05 -0500 Subject: added a unit test for recursive enabling/disabling --- engine/tests/objects/entities.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php index 1772f7c1a..a4dc7946c 100644 --- a/engine/tests/objects/entities.php +++ b/engine/tests/objects/entities.php @@ -226,6 +226,39 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { $this->assertTrue($this->entity->delete()); } + public function testElggEntityRecursiveDisableAndEnable() { + global $CONFIG; + + $this->save_entity(); + $obj1 = new ElggObject(); + $obj1->container_guid = $this->entity->getGUID(); + $obj1->save(); + $obj2 = new ElggObject(); + $obj2->container_guid = $this->entity->getGUID(); + $obj2->save(); + + // disable $obj2 before disabling the container + $this->assertTrue($obj2->disable()); + + // disable entities container by $this->entity + $this->assertTrue($this->entity->disable()); + $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj1->guid}'"); + $this->assertIdentical($entity->enabled, 'no'); + + // enable entities that were disabled with the container (but not $obj2) + $this->assertTrue($this->entity->enable()); + $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj1->guid}'"); + $this->assertIdentical($entity->enabled, 'yes'); + $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$obj2->guid}'"); + $this->assertIdentical($entity->enabled, 'no'); + + // cleanup + $this->assertTrue($obj2->enable()); + $this->assertTrue($obj2->delete()); + $this->assertTrue($obj1->delete()); + $this->assertTrue($this->entity->delete()); + } + public function testElggEntityMetadata() { // let's delete a non-existent metadata $this->assertFalse($this->entity->deleteMetadata('important')); -- cgit v1.2.3 From b914774cdf2eabe217c61c9c39805c68af858d98 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 4 Jan 2012 20:14:33 -0500 Subject: fixed enabling bug, added flag for recursion, removed unnecessary code in disable function --- engine/lib/entities.php | 66 +++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/engine/lib/entities.php b/engine/lib/entities.php index d2c86e470..48c2e72b8 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1378,18 +1378,12 @@ function disable_entity($guid, $reason = "", $recursive = true) { } if ($recursive) { - // Temporary token overriding access controls - // @todo Do this better. - static $__RECURSIVE_DELETE_TOKEN; - // Make it slightly harder to guess - $__RECURSIVE_DELETE_TOKEN = md5(elgg_get_logged_in_user_guid()); - - $sub_entities = get_data("SELECT * from {$CONFIG->dbprefix}entities + $sub_entities = get_data("SELECT * FROM {$CONFIG->dbprefix}entities WHERE ( - container_guid=$guid - or owner_guid=$guid - or site_guid=$guid - ) and enabled='yes'", 'entity_row_to_elggstar'); + container_guid = $guid + OR owner_guid = $guid + OR site_guid = $guid + ) AND enabled='yes'", 'entity_row_to_elggstar'); if ($sub_entities) { foreach ($sub_entities as $e) { @@ -1397,18 +1391,14 @@ function disable_entity($guid, $reason = "", $recursive = true) { $e->disable($reason); } } - - $__RECURSIVE_DELETE_TOKEN = null; } $entity->disableMetadata(); $entity->disableAnnotations(); - // relationships can't be disabled. hope they join to the entities table. - //$entity->disableRelationships(); $res = update_data("UPDATE {$CONFIG->dbprefix}entities - set enabled='no' - where guid={$guid}"); + SET enabled = 'no' + WHERE guid = $guid"); return $res; } @@ -1423,51 +1413,51 @@ function disable_entity($guid, $reason = "", $recursive = true) { * @warning In order to enable an entity using ElggEntity::enable(), * you must first use {@link access_show_hidden_entities()}. * - * @param int $guid GUID of entity to enable + * @param int $guid GUID of entity to enable + * @param bool $recursive Recursively enable all entities disabled with the entity? * * @return bool */ -function enable_entity($guid) { +function enable_entity($guid, $recursive = true) { global $CONFIG; $guid = (int)$guid; // Override access only visible entities - $access_status = access_get_show_hidden_status(); + $old_access_status = access_get_show_hidden_status(); access_show_hidden_entities(true); + $result = false; if ($entity = get_entity($guid)) { if (elgg_trigger_event('enable', $entity->type, $entity)) { if ($entity->canEdit()) { - access_show_hidden_entities($access_status); - $result = update_data("UPDATE {$CONFIG->dbprefix}entities - set enabled='yes' - where guid={$guid}"); + SET enabled = 'yes' + WHERE guid = $guid"); $entity->deleteMetadata('disable_reason'); $entity->enableMetadata(); $entity->enableAnnotations(); - - $disabled_with_it = elgg_get_entities_from_relationship(array( - 'relationship' => 'disabled_with', - 'relationship_guid' => $entity->guid, - 'inverse_relationship' => true, - )); - - foreach ($disabled_with_it as $e) { - $e->enable(); - remove_entity_relationship($e->guid, 'disabled_with', $entity->guid); - } - return $result; + if ($recursive) { + $disabled_with_it = elgg_get_entities_from_relationship(array( + 'relationship' => 'disabled_with', + 'relationship_guid' => $entity->guid, + 'inverse_relationship' => true, + )); + + foreach ($disabled_with_it as $e) { + $e->enable(); + remove_entity_relationship($e->guid, 'disabled_with', $entity->guid); + } + } } } } - access_show_hidden_entities($access_status); - return false; + access_show_hidden_entities($old_access_status); + return $result; } /** -- cgit v1.2.3 From 1bd4a6e422e17043b6fd05b1dfcc7f6f71bd2fcc Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 4 Jan 2012 21:31:53 -0500 Subject: updated options on navigation/tabs --- mod/embed/views/default/navigation/menu/embed.php | 2 +- views/default/navigation/tabs.php | 24 +++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mod/embed/views/default/navigation/menu/embed.php b/mod/embed/views/default/navigation/menu/embed.php index 1a6a18f05..bca673f59 100644 --- a/mod/embed/views/default/navigation/menu/embed.php +++ b/mod/embed/views/default/navigation/menu/embed.php @@ -10,7 +10,7 @@ foreach ($vars['menu']['default'] as $menu_item) { $tabs[] = array( 'title' => $menu_item->getText(), 'url' => 'embed/tab/' . $menu_item->getName(), - 'url_class' => 'embed-section', + 'link_class' => 'embed-section', 'selected' => $menu_item->getSelected(), ); } diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php index 6159fbfa5..95e3f2669 100644 --- a/views/default/navigation/tabs.php +++ b/views/default/navigation/tabs.php @@ -5,13 +5,13 @@ * @uses string $vars['type'] horizontal || vertical - Defaults to horizontal * @uses string $vars['class'] Additional class to add to ul * @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array( - * 'text' => string, // The string between the tags. If not set, 'title' parameter will be used instead + * 'text' => string, // The string between the tags * 'href' => string, // URL for the link * 'class' => string // Class of the li element * 'id' => string, // ID of the li element - * 'selected' => bool // if this li element is currently selected - * 'url_class' => string, // Class to pass to the link - * 'url_id' => string, // ID to pass to the link + * 'selected' => bool // if this tab is currently selected (applied to li element) + * 'link_class' => string, // Class to pass to the link + * 'link_id' => string, // ID to pass to the link * ) */ $options = elgg_clean_vars($vars); @@ -30,11 +30,11 @@ if (isset($vars['class'])) { unset($options['tabs']); unset($options['type']); -$options = elgg_format_attributes($options); +$attributes = elgg_format_attributes($options); if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) { ?> -
    > +
      > Date: Wed, 4 Jan 2012 21:43:35 -0500 Subject: Fixes #4266 fixed limit bugs with pages plugin --- mod/pages/lib/pages.php | 2 ++ mod/pages/pages/pages/owner.php | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php index 0a6f3a620..5c5323d6f 100644 --- a/mod/pages/lib/pages.php +++ b/mod/pages/lib/pages.php @@ -78,6 +78,7 @@ function pages_register_navigation_tree($container) { 'type' => 'object', 'subtype' => 'page_top', 'container_guid' => $container->getGUID(), + 'limit' => 0, )); foreach ($top_pages as $page) { @@ -96,6 +97,7 @@ function pages_register_navigation_tree($container) { 'subtype' => 'page', 'metadata_name' => 'parent_guid', 'metadata_value' => $parent->getGUID(), + 'limit' => 0, )); foreach ($children as $child) { diff --git a/mod/pages/pages/pages/owner.php b/mod/pages/pages/pages/owner.php index 2ff45ae0c..b29332ee1 100644 --- a/mod/pages/pages/pages/owner.php +++ b/mod/pages/pages/pages/owner.php @@ -23,7 +23,6 @@ $content = elgg_list_entities(array( 'types' => 'object', 'subtypes' => 'page_top', 'container_guid' => elgg_get_page_owner_guid(), - 'limit' => $limit, 'full_view' => false, )); if (!$content) { -- cgit v1.2.3 From 84f88c43002d3c337f3fcaf2b0f8cd4c3898081f Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 4 Jan 2012 21:49:46 -0500 Subject: Fixes #4270 removed use of deprecated method --- engine/lib/web_services.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/lib/web_services.php b/engine/lib/web_services.php index 1c77b757e..07be76ec6 100644 --- a/engine/lib/web_services.php +++ b/engine/lib/web_services.php @@ -1165,7 +1165,7 @@ function list_all_apis() { * @access private */ function auth_gettoken($username, $password) { - if (authenticate($username, $password)) { + if (elgg_authenticate($username, $password)) { $token = create_user_token($username); if ($token) { return $token; -- cgit v1.2.3 From 3580c61a256b940ab1269a11f7f1593b0596e72c Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Thu, 5 Jan 2012 12:50:37 -0800 Subject: Fixes #4243. Added docs to explain the difference between annotation_calculation and calculation. --- engine/lib/annotations.php | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 6e0402804..bb7d836cc 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -179,21 +179,23 @@ function update_annotation($annotation_id, $name, $value, $value_type, $owner_gu * * @param array $options Array in format: * - * annotation_names => NULL|ARR Annotation names - * - * annotation_values => NULL|ARR Annotation values - * - * annotation_ids => NULL|ARR annotation ids - * - * annotation_case_sensitive => BOOL Overall Case sensitive - * - * annotation_owner_guids => NULL|ARR guids for annotation owners - * + * annotation_names => NULL|ARR Annotation names + * annotation_values => NULL|ARR Annotation values + * annotation_ids => NULL|ARR annotation ids + * annotation_case_sensitive => BOOL Overall Case sensitive + * annotation_owner_guids => NULL|ARR guids for annotation owners * annotation_created_time_lower => INT Lower limit for created time. - * * annotation_created_time_upper => INT Upper limit for created time. + * annotation_calculation => STR Perform the MySQL function on the annotation values returned. + * Do not confuse this "annotation_calculation" option with the + * "calculation" option to elgg_get_entities_from_annotation_calculation(). + * The "annotation_calculation" option causes this function to + * return the result of performing a mathematical calculation on + * all annotations that match the query instead of ElggAnnotation + * objects. + * See the docs for elgg_get_entities_from_annotation_calculation() + * for the proper use of the "calculation" option. * - * annotation_calculation => STR Perform the MySQL function on the annotation values returned. * * @return mixed * @since 1.8.0 @@ -384,8 +386,14 @@ function elgg_list_entities_from_annotations($options = array()) { * Get entities ordered by a mathematical calculation on annotation values * * @param array $options An options array: - * 'annotation_calculation' => The calculation to use. Must be a valid MySQL function. + * 'calculation' => The calculation to use. Must be a valid MySQL function. * Defaults to sum. Result selected as 'annotation_calculation'. + * Don't confuse this "calculation" option with the + * "annotation_calculation" option to elgg_get_annotations(). + * This "calculation" option is applied to each entity's set of + * annotations and is selected as annotation_calculation for that row. + * See the docs for elgg_get_annotations() for proper use of the + * "annotation_calculation" option. * 'order_by' => The order for the sorting. Defaults to 'annotation_calculation desc'. * 'annotation_names' => The names of annotations on the entity. * 'annotation_values' => The values of annotations on the entity. -- cgit v1.2.3 From 4cbfac796a5e863372099be9b5a79725ba080450 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 7 Jan 2012 11:31:03 -0500 Subject: pulled ODD classes out of ODDEntity --- engine/classes/ODDEntity.php | 72 -------------------------------------- engine/classes/ODDMetaData.php | 39 +++++++++++++++++++++ engine/classes/ODDRelationship.php | 33 +++++++++++++++++ 3 files changed, 72 insertions(+), 72 deletions(-) create mode 100644 engine/classes/ODDMetaData.php create mode 100644 engine/classes/ODDRelationship.php diff --git a/engine/classes/ODDEntity.php b/engine/classes/ODDEntity.php index ab3a49168..e9bb5da6a 100644 --- a/engine/classes/ODDEntity.php +++ b/engine/classes/ODDEntity.php @@ -32,75 +32,3 @@ class ODDEntity extends ODD { return "entity"; } } - -/** - * ODD Metadata class. - * - * @package Elgg.Core - * @subpackage ODD - */ -class ODDMetaData extends ODD { - - /** - * New ODD metadata - * - * @param unknown_type $uuid Unique ID - * @param unknown_type $entity_uuid Another unique ID - * @param unknown_type $name Name - * @param unknown_type $value Value - * @param unknown_type $type Type - * @param unknown_type $owner_uuid Owner ID - */ - function __construct($uuid, $entity_uuid, $name, $value, $type = "", $owner_uuid = "") { - parent::__construct(); - - $this->setAttribute('uuid', $uuid); - $this->setAttribute('entity_uuid', $entity_uuid); - $this->setAttribute('name', $name); - $this->setAttribute('type', $type); - $this->setAttribute('owner_uuid', $owner_uuid); - $this->setBody($value); - } - - /** - * Returns 'metadata' - * - * @return 'metadata' - */ - protected function getTagName() { - return "metadata"; - } -} - -/** - * ODD Relationship class. - * - * @package Elgg - * @subpackage Core - */ -class ODDRelationship extends ODD { - - /** - * New ODD Relationship - * - * @param unknown_type $uuid1 First UUID - * @param unknown_type $type Type of telationship - * @param unknown_type $uuid2 Second UUId - */ - function __construct($uuid1, $type, $uuid2) { - parent::__construct(); - - $this->setAttribute('uuid1', $uuid1); - $this->setAttribute('type', $type); - $this->setAttribute('uuid2', $uuid2); - } - - /** - * Returns 'relationship' - * - * @return 'relationship' - */ - protected function getTagName() { - return "relationship"; - } -} diff --git a/engine/classes/ODDMetaData.php b/engine/classes/ODDMetaData.php new file mode 100644 index 000000000..58862e0fb --- /dev/null +++ b/engine/classes/ODDMetaData.php @@ -0,0 +1,39 @@ +setAttribute('uuid', $uuid); + $this->setAttribute('entity_uuid', $entity_uuid); + $this->setAttribute('name', $name); + $this->setAttribute('type', $type); + $this->setAttribute('owner_uuid', $owner_uuid); + $this->setBody($value); + } + + /** + * Returns 'metadata' + * + * @return 'metadata' + */ + protected function getTagName() { + return "metadata"; + } +} diff --git a/engine/classes/ODDRelationship.php b/engine/classes/ODDRelationship.php new file mode 100644 index 000000000..2906b1c73 --- /dev/null +++ b/engine/classes/ODDRelationship.php @@ -0,0 +1,33 @@ +setAttribute('uuid1', $uuid1); + $this->setAttribute('type', $type); + $this->setAttribute('uuid2', $uuid2); + } + + /** + * Returns 'relationship' + * + * @return 'relationship' + */ + protected function getTagName() { + return "relationship"; + } +} -- cgit v1.2.3 From 1973a28f46d8678c79721aeca63b007f2b20bdcb Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 7 Jan 2012 11:38:00 -0500 Subject: Refs #3209 fixed spacing and added options for wire method --- engine/classes/ElggRiverItem.php | 23 +++++++++++------------ mod/thewire/classes/ElggWire.php | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/engine/classes/ElggRiverItem.php b/engine/classes/ElggRiverItem.php index 8fef6bb9d..d3d09cd91 100644 --- a/engine/classes/ElggRiverItem.php +++ b/engine/classes/ElggRiverItem.php @@ -5,19 +5,18 @@ * @package Elgg.Core * @subpackage Core * - * @property int $id The unique identifier (read-only) - * @property int $subject_guid The GUID of the actor - * @property int $object_guid The GUID of the object - * @property int $annotation_id The ID of the annotation involved in the action - * @property string $type The type of one of the entities involved in the action - * @property string $subtype The subtype of one of the entities involved in the action - * @property string $action_type The name of the action - * @property string $view The view for displaying this river item - * @property int $access_id The visibility of the river item - * @property int $posted UNIX timestamp when the action occurred + * @property int $id The unique identifier (read-only) + * @property int $subject_guid The GUID of the actor + * @property int $object_guid The GUID of the object + * @property int $annotation_id The ID of the annotation involved in the action + * @property string $type The type of one of the entities involved in the action + * @property string $subtype The subtype of one of the entities involved in the action + * @property string $action_type The name of the action + * @property string $view The view for displaying this river item + * @property int $access_id The visibility of the river item + * @property int $posted UNIX timestamp when the action occurred */ -class ElggRiverItem -{ +class ElggRiverItem { public $id; public $subject_guid; public $object_guid; diff --git a/mod/thewire/classes/ElggWire.php b/mod/thewire/classes/ElggWire.php index 5155a7f97..9c92dd8f2 100644 --- a/mod/thewire/classes/ElggWire.php +++ b/mod/thewire/classes/ElggWire.php @@ -2,7 +2,7 @@ /** * ElggWire Class * - * @property string $method The method used to create the wire post + * @property string $method The method used to create the wire post (site, sms, api) * @property bool $reply Whether this wire post was a reply to another post * @property int $wire_thread The identifier of the thread for this wire post */ -- cgit v1.2.3 From ef71ffca08b91f514208adfdd67249dd52fc1aa3 Mon Sep 17 00:00:00 2001 From: Sem Date: Tue, 3 Jan 2012 16:13:57 +0100 Subject: Refs #4142. Added ETag header support for user avatars. --- mod/profile/icondirect.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index f7188455e..1680d8fce 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -12,8 +12,16 @@ require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php'); global $CONFIG; $join_date = (int)$_GET['joindate']; +$last_cache = (int)$_GET['lastcache']; // icontime $guid = (int)$_GET['guid']; +// If is the same eTag, content didn't changed. +$eTag = $last_cache . $guid; +if (trim($_SERVER['HTTP_IF_NONE_MATCH']) == $eTag) { + header("HTTP/1.1 304 Not Modified"); + exit; +} + $size = strtolower($_GET['size']); if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar'))) { $size = "medium"; @@ -48,6 +56,7 @@ if ($mysql_dblink) { header("Pragma: public"); header("Cache-Control: public"); header("Content-Length: " . strlen($contents)); + header("ETag: $eTag"); // this chunking is done for supposedly better performance $split_string = str_split($contents, 1024); foreach ($split_string as $chunk) { -- cgit v1.2.3 From 946a1229a126b91de9b64d2def672c628a77e6c6 Mon Sep 17 00:00:00 2001 From: Sem Date: Tue, 3 Jan 2012 16:14:31 +0100 Subject: Refs #4142. Also added ETag in group icon. --- mod/groups/icon.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mod/groups/icon.php b/mod/groups/icon.php index f4c0f8010..607f38939 100644 --- a/mod/groups/icon.php +++ b/mod/groups/icon.php @@ -10,6 +10,13 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); $group_guid = get_input('group_guid'); $group = get_entity($group_guid); +// If is the same eTag, content didn't changed. +$eTag = $group->icontime . $group_guid; +if (trim($_SERVER['HTTP_IF_NONE_MATCH']) == $eTag) { + header("HTTP/1.1 304 Not Modified"); + exit; +} + $size = strtolower(get_input('size')); if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) $size = "medium"; @@ -37,4 +44,5 @@ header('Expires: ' . date('r',time() + 864000)); header("Pragma: public"); header("Cache-Control: public"); header("Content-Length: " . strlen($contents)); +header("ETag: $eTag"); echo $contents; -- cgit v1.2.3 From 6b8301f6433ec22b065d734e9fc26d09f723b07d Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 7 Jan 2012 12:32:46 -0500 Subject: added check for existance of IF-NONE-MATCH header in request --- mod/groups/icon.php | 10 +++++----- mod/profile/icondirect.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mod/groups/icon.php b/mod/groups/icon.php index 607f38939..104da4b41 100644 --- a/mod/groups/icon.php +++ b/mod/groups/icon.php @@ -10,15 +10,15 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); $group_guid = get_input('group_guid'); $group = get_entity($group_guid); -// If is the same eTag, content didn't changed. -$eTag = $group->icontime . $group_guid; -if (trim($_SERVER['HTTP_IF_NONE_MATCH']) == $eTag) { +// If is the same ETag, content didn't changed. +$etag = $group->icontime . $group_guid; +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { header("HTTP/1.1 304 Not Modified"); exit; } $size = strtolower(get_input('size')); -if (!in_array($size,array('large','medium','small','tiny','master','topbar'))) +if (!in_array($size, array('large', 'medium', 'small', 'tiny', 'master', 'topbar'))) $size = "medium"; $success = false; @@ -44,5 +44,5 @@ header('Expires: ' . date('r',time() + 864000)); header("Pragma: public"); header("Cache-Control: public"); header("Content-Length: " . strlen($contents)); -header("ETag: $eTag"); +header("ETag: $etag"); echo $contents; diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index 1680d8fce..6c3148f2b 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -15,9 +15,9 @@ $join_date = (int)$_GET['joindate']; $last_cache = (int)$_GET['lastcache']; // icontime $guid = (int)$_GET['guid']; -// If is the same eTag, content didn't changed. -$eTag = $last_cache . $guid; -if (trim($_SERVER['HTTP_IF_NONE_MATCH']) == $eTag) { +// If is the same ETag, content didn't changed. +$etag = $last_cache . $guid; +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { header("HTTP/1.1 304 Not Modified"); exit; } @@ -56,7 +56,7 @@ if ($mysql_dblink) { header("Pragma: public"); header("Cache-Control: public"); header("Content-Length: " . strlen($contents)); - header("ETag: $eTag"); + header("ETag: $etag"); // this chunking is done for supposedly better performance $split_string = str_split($contents, 1024); foreach ($split_string as $chunk) { -- cgit v1.2.3 From 3c425c0bd366965923933a3ee2b1bcb74d64046b Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 09:09:12 -0500 Subject: fixed some formatting --- engine/lib/elgglib.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index c32f7fa0c..6f9fb0ded 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1144,9 +1144,11 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { global $CONFIG; // plugin can return false to stop the default logging method - $params = array('level' => $level, - 'msg' => $value, - 'to_screen' => $to_screen); + $params = array( + 'level' => $level, + 'msg' => $value, + 'to_screen' => $to_screen, + ); if (!elgg_trigger_plugin_hook('debug', 'log', $params, true)) { return; } @@ -1184,7 +1186,7 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { * @see CODING.txt * * @param str $msg Message to log / display. - * @param str $dep_version Human-readable *release* version: 1.7, 1.7.3 + * @param str $dep_version Human-readable *release* version: 1.7, 1.8, ... * @param int $backtrace_level How many levels back to display the backtrace. Useful if calling from * functions that are called from other places (like elgg_view()). Set * to -1 for a full backtrace. -- cgit v1.2.3 From 05cfa919e51737d8292a6aa317f9802aee6f33bf Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 09:25:43 -0500 Subject: Fixes #4278 deprecation notices ignore debug level but do respect whether the admin is logged in --- engine/lib/elgglib.php | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 6f9fb0ded..b044d230f 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1174,7 +1174,9 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { * * This function either displays or logs the deprecation message, * depending upon the deprecation policies in {@link CODING.txt}. - * Logged messages are sent with the level of 'WARNING'. + * Logged messages are sent with the level of 'WARNING'. Only admins + * get visual deprecation notices. When non-admins are logged in, the + * notices are sent to PHP's log through elgg_dump(). * * A user-visual message will be displayed if $dep_version is greater * than 1 minor releases lower than the current Elgg version, or at all @@ -1185,11 +1187,12 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { * * @see CODING.txt * - * @param str $msg Message to log / display. - * @param str $dep_version Human-readable *release* version: 1.7, 1.8, ... - * @param int $backtrace_level How many levels back to display the backtrace. Useful if calling from - * functions that are called from other places (like elgg_view()). Set - * to -1 for a full backtrace. + * @param string $msg Message to log / display. + * @param string $dep_version Human-readable *release* version: 1.7, 1.8, ... + * @param int $backtrace_level How many levels back to display the backtrace. + * Useful if calling from functions that are called + * from other places (like elgg_view()). Set to -1 + * for a full backtrace. * * @return bool * @since 1.7.0 @@ -1198,13 +1201,13 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) { // if it's a major release behind, visual and logged // if it's a 1 minor release behind, visual and logged // if it's for current minor release, logged. - // bugfixes don't matter because you're not deprecating between them, RIGHT? + // bugfixes don't matter because we are not deprecating between them if (!$dep_version) { - return FALSE; + return false; } - $elgg_version = get_version(TRUE); + $elgg_version = get_version(true); $elgg_version_arr = explode('.', $elgg_version); $elgg_major_version = (int)$elgg_version_arr[0]; $elgg_minor_version = (int)$elgg_version_arr[1]; @@ -1212,16 +1215,16 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) { $dep_major_version = (int)$dep_version; $dep_minor_version = 10 * ($dep_version - $dep_major_version); - $visual = FALSE; + $visual = false; if (($dep_major_version < $elgg_major_version) || ($dep_minor_version < $elgg_minor_version)) { - $visual = TRUE; + $visual = true; } $msg = "Deprecated in $dep_major_version.$dep_minor_version: $msg"; - if ($visual) { + if ($visual && elgg_is_admin_logged_in()) { register_error($msg); } @@ -1249,9 +1252,9 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) { $msg .= implode("
      -> ", $stack); - elgg_log($msg, 'WARNING'); + elgg_dump($msg, elgg_is_admin_logged_in(), 'WARNING'); - return TRUE; + return true; } /** -- cgit v1.2.3 From 3b496d923045770bdf4b25452fa63253927ee56a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 10:05:45 -0500 Subject: Refs #4271 integrates fix to 1.8 branch for ODDDocument --- engine/classes/ODDDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/classes/ODDDocument.php b/engine/classes/ODDDocument.php index 4d185aba5..540c35a3b 100644 --- a/engine/classes/ODDDocument.php +++ b/engine/classes/ODDDocument.php @@ -70,8 +70,8 @@ class ODDDocument implements Iterator { public function addElement(ODD $element) { if (!is_array($this->elements)) { $this->elements = array(); - $this->elements[] = $element; } + $this->elements[] = $element; } /** -- cgit v1.2.3 From d213db79744507ab6e601167d158f256764d785e Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 10:06:58 -0500 Subject: Fixes #2002 adds ETag support to simple cache handler --- engine/handlers/cache_handler.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/engine/handlers/cache_handler.php b/engine/handlers/cache_handler.php index 94a0e64e9..b332ec379 100644 --- a/engine/handlers/cache_handler.php +++ b/engine/handlers/cache_handler.php @@ -60,26 +60,31 @@ preg_match($regex, $request, $matches); $type = $matches[1]; $viewtype = $matches[2]; $view = $matches[3]; +$ts = $matches[4]; + +// If is the same ETag, content didn't changed. +$etag = $ts; +if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { + header("HTTP/1.1 304 Not Modified"); + exit; +} switch ($type) { case 'css': header("Content-type: text/css", true); - header('Expires: ' . date('r', strtotime("+6 months")), true); - header("Pragma: public", true); - header("Cache-Control: public", true); - $view = "css/$view"; break; case 'js': header('Content-type: text/javascript', true); - header('Expires: ' . date('r', strtotime("+6 months")), true); - header("Pragma: public", true); - header("Cache-Control: public", true); - $view = "js/$view"; break; } +header('Expires: ' . date('r', strtotime("+6 months")), true); +header("Pragma: public", true); +header("Cache-Control: public", true); +header("ETag: $etag"); + $filename = $dataroot . 'views_simplecache/' . md5($viewtype . $view); if (file_exists($filename)) { -- cgit v1.2.3 From e3d38a9e9905ea19b48f5413d5c5b371f1bd7316 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 11:42:44 -0500 Subject: Fixes #4171 login success message is now i18n friendly --- actions/login.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/actions/login.php b/actions/login.php index c717faadd..256e78acb 100644 --- a/actions/login.php +++ b/actions/login.php @@ -46,10 +46,21 @@ if (!$user) { try { login($user, $persistent); + // re-register at least the core language file for users with language other than site default + register_translations(dirname(dirname(__FILE__)) . "/languages/"); } catch (LoginException $e) { register_error($e->getMessage()); forward(REFERER); } -system_message(elgg_echo('loginok')); +// elgg_echo() caches the language and does not provide a way to change the language. +// @todo we need to use the config object to store this so that the current language +// can be changed. Refs #4171 +if ($user->language) { + $message = elgg_echo('loginok', array(), $user->language); +} else { + $message = elgg_echo('loginok'); +} + +system_message($message); forward($forward_url); -- cgit v1.2.3 From 855de1b33e1ba1753ac1a5088e640e5fcff09f79 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 14:07:58 -0500 Subject: Fixes #4192 making the bottom of widget columns equal rather than height --- js/lib/ui.widgets.js | 23 +++++++++++++++-------- mod/profile/views/default/profile/js.php | 5 ++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index 6114aeacd..d897564b4 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -29,7 +29,7 @@ elgg.ui.widgets.init = function() { $('.elgg-widget-edit > form ').live('submit', elgg.ui.widgets.saveSettings); $('a.elgg-widget-collapse-button').live('click', elgg.ui.widgets.collapseToggle); - elgg.ui.widgets.equalHeight(".elgg-widgets"); + elgg.ui.widgets.setMinHeight(".elgg-widgets"); }; /** @@ -175,22 +175,29 @@ elgg.ui.widgets.saveSettings = function(event) { }; /** - * Make all elements have the same min-height + * Set the min-height so that all widget column bottoms are the same * * This addresses the issue of trying to drag a widget into a column that does - * not have any widgets. + * not have any widgets or many fewer widgets than other columns. * * @param {String} selector * @return void */ -elgg.ui.widgets.equalHeight = function(selector) { - var maxHeight = 0; +elgg.ui.widgets.setMinHeight = function(selector) { + var maxBottom = 0; $(selector).each(function() { - if ($(this).height() > maxHeight) { - maxHeight = $(this).height(); + var bottom = parseInt($(this).offset().top + $(this).height()); + if (bottom > maxBottom) { + maxBottom = bottom; + } + }) + $(selector).each(function() { + var bottom = parseInt($(this).offset().top + $(this).height()); + if (bottom < maxBottom) { + var newMinHeight = parseInt($(this).height() + (maxBottom - bottom)); + $(this).css('min-height', newMinHeight + 'px'); } }) - $(selector).css('min-height', maxHeight + 'px'); }; elgg.register_hook_handler('init', 'system', elgg.ui.widgets.init); diff --git a/mod/profile/views/default/profile/js.php b/mod/profile/views/default/profile/js.php index 16dec59df..5a08a90bd 100644 --- a/mod/profile/views/default/profile/js.php +++ b/mod/profile/views/default/profile/js.php @@ -1,6 +1,9 @@ + +// force the first column to at least be as large as the profile box in cols 2 and 3 +// we also want to run before the widget init happens so priority is < 500 elgg.register_hook_handler('init', 'system', function() { // only do this on the profile page's widget canvas. if ($('.profile').length) { $('#elgg-widget-col-1').css('min-height', $('.profile').outerHeight(true) + 1); } -}); \ No newline at end of file +}, 400); -- cgit v1.2.3 From cfcf985b803e2ce4187d1dad30905a30e4c937b8 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 14:24:09 -0500 Subject: updated groups js to use new JS hook system --- mod/groups/views/default/groups/js.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/groups/views/default/groups/js.php b/mod/groups/views/default/groups/js.php index ad742445b..1b4d33f32 100644 --- a/mod/groups/views/default/groups/js.php +++ b/mod/groups/views/default/groups/js.php @@ -1,5 +1,6 @@ -$(function() { +// this adds a class to support IE8 and older +elgg.register_hook_handler('init', 'system', function() { // jQuery uses 0-based indexing $('#groups-tools').children('li:even').addClass('odd'); }); -- cgit v1.2.3 From 229a0cc6091e11ca8431d96d022898b778a9e951 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 14:31:42 -0500 Subject: updated the messages plugin to use 1.8's JS hook system --- mod/messages/views/default/messages/js.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/messages/views/default/messages/js.php b/mod/messages/views/default/messages/js.php index 39f93e645..60cf36b92 100644 --- a/mod/messages/views/default/messages/js.php +++ b/mod/messages/views/default/messages/js.php @@ -1,5 +1,6 @@ -$(function() { +// messages plugin toggle +elgg.register_hook_handler('init', 'system', function() { $("#messages-toggle").click(function() { $('input[type=checkbox]').click(); }); -- cgit v1.2.3 From 35a5ef862d7d28a173ab78b014afc372531fb17e Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 14:37:08 -0500 Subject: Fixes #4234 forcing limit to be nonnegative --- engine/lib/entities.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 48c2e72b8..82452fba1 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -923,7 +923,7 @@ function elgg_get_entities(array $options = array()) { } if ($options['limit']) { - $limit = sanitise_int($options['limit']); + $limit = sanitise_int($options['limit'], false); $offset = sanitise_int($options['offset'], false); $query .= " LIMIT $offset, $limit"; } -- cgit v1.2.3 From 62b03cd61f5b3c837a97e71260790c15be7e4ea2 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 15:04:50 -0500 Subject: Fixes #2404 not using full set of query parameters for custom search types --- mod/search/pages/search/index.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mod/search/pages/search/index.php b/mod/search/pages/search/index.php index efa3ec037..782c2bae9 100644 --- a/mod/search/pages/search/index.php +++ b/mod/search/pages/search/index.php @@ -145,11 +145,7 @@ foreach ($custom_types as $type) { $data = htmlspecialchars(http_build_query(array( 'q' => $query, - 'entity_subtype' => $entity_subtype, - 'entity_type' => $entity_type, - 'owner_guid' => $owner_guid, 'search_type' => $type, - 'friends' => $friends ))); $url = elgg_get_site_url()."search?$data"; -- cgit v1.2.3 From 3cba074d0597d36627500607ca4a0d7cd6a79b6e Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 15:23:36 -0500 Subject: Fixes #2421 added icontime to files with thumbnails --- mod/file/actions/file/upload.php | 8 +++++--- mod/file/start.php | 3 ++- mod/file/views/default/file/specialcontent/image/default.php | 10 +++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php index 3edc87952..5242cbda2 100644 --- a/mod/file/actions/file/upload.php +++ b/mod/file/actions/file/upload.php @@ -109,7 +109,9 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { // if image, we need to create thumbnails (this should be moved into a function) if ($guid && $file->simpletype == "image") { - $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),60,60, true); + $file->icontime = time(); + + $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 60, 60, true); if ($thumbnail) { $thumb = new ElggFile(); $thumb->setMimeType($_FILES['upload']['type']); @@ -123,7 +125,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { unset($thumbnail); } - $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),153,153, true); + $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 153, 153, true); if ($thumbsmall) { $thumb->setFilename($prefix."smallthumb".$filestorename); $thumb->open("write"); @@ -133,7 +135,7 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) { unset($thumbsmall); } - $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(),600,600, false); + $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 600, 600, false); if ($thumblarge) { $thumb->setFilename($prefix."largethumb".$filestorename); $thumb->open("write"); diff --git a/mod/file/start.php b/mod/file/start.php index e15a9ad61..36142533f 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -345,7 +345,8 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) { // thumbnails get first priority if ($file->thumbnail) { - return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size"; + $ts = (int)$file->icontime; + return "mod/file/thumbnail.php?file_guid=$file->guid&size=$size&icontime=$ts"; } $mapping = array( diff --git a/mod/file/views/default/file/specialcontent/image/default.php b/mod/file/views/default/file/specialcontent/image/default.php index fbd994a0b..431ac9f4f 100644 --- a/mod/file/views/default/file/specialcontent/image/default.php +++ b/mod/file/views/default/file/specialcontent/image/default.php @@ -1,13 +1,17 @@ getGUID()}&size=large"; +$file = $vars['entity']; + +$image_url = $file->getIconURL('large'); $image_url = elgg_format_url($image_url); -$download_url = elgg_get_site_url() . "mod/file/download.php?file_guid={$vars['entity']->getGUID()}"; +$download_url = elgg_get_site_url() . "file/download/{$file->getGUID()}"; -if ($vars['full_view'] && $smallthumb = $vars['entity']->smallthumb) { +if ($vars['full_view']) { echo << -- cgit v1.2.3 From aaeed5d0c3ec561ea691cddeee20563c2b946acd Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 15:51:19 -0500 Subject: Fixes #2199 can now pass entity type/subtype to tag search --- mod/search/pages/search/index.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/mod/search/pages/search/index.php b/mod/search/pages/search/index.php index 782c2bae9..91817096b 100644 --- a/mod/search/pages/search/index.php +++ b/mod/search/pages/search/index.php @@ -236,8 +236,6 @@ if ($search_type != 'entities' || $search_type == 'all') { $current_params = $params; $current_params['search_type'] = $type; - // custom search types have no subtype. - unset($current_params['subtype']); $results = elgg_trigger_plugin_hook('search', $type, $current_params, array()); -- cgit v1.2.3 From 4f4f5a8be736c36ca8af0cd65731dd7c64da3b1a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 16:09:14 -0500 Subject: Fixes #3216 passing type/subtype for group discussions --- mod/groups/actions/discussion/reply/save.php | 6 ++---- mod/groups/actions/discussion/save.php | 2 +- mod/groups/lib/discussion.php | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mod/groups/actions/discussion/reply/save.php b/mod/groups/actions/discussion/reply/save.php index a1ed036b6..f8be8aa2c 100644 --- a/mod/groups/actions/discussion/reply/save.php +++ b/mod/groups/actions/discussion/reply/save.php @@ -4,8 +4,6 @@ * */ -gatekeeper(); - // Get input $entity_guid = (int) get_input('entity_guid'); $text = get_input('group_topic_post'); @@ -23,10 +21,10 @@ if (!$topic) { forward(REFERER); } -$user = get_loggedin_user(); +$user = elgg_get_logged_in_user_entity(); $group = $topic->getContainerEntity(); -if (!$group->canWriteToContainer($user)) { +if (!$group->canWriteToContainer()) { register_error(elgg_echo('groups:notmember')); forward(REFERER); } diff --git a/mod/groups/actions/discussion/save.php b/mod/groups/actions/discussion/save.php index a51775cd6..de4afadfb 100644 --- a/mod/groups/actions/discussion/save.php +++ b/mod/groups/actions/discussion/save.php @@ -21,7 +21,7 @@ if (!$title || !$desc) { } $container = get_entity($container_guid); -if (!$container || !$container->canWriteToContainer()) { +if (!$container || !$container->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('discussion:error:permissions')); forward(REFERER); } diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php index 2bda4678e..55642644d 100644 --- a/mod/groups/lib/discussion.php +++ b/mod/groups/lib/discussion.php @@ -92,8 +92,8 @@ function discussion_handle_edit_page($type, $guid) { forward(); } - // make sure user has permissions to write to container - if (!$group->canWriteToContainer()) { + // make sure user has permissions to add a topic to container + if (!$group->canWriteToContainer(0, 'object', 'groupforumtopic')) { register_error(elgg_echo('groups:permissions:error')); forward($group->getURL()); } @@ -173,7 +173,7 @@ function discussion_handle_view_page($guid) { 'show_add_form' => false, )); $content .= elgg_view('discussion/closed'); - } elseif ($group->canWriteToContainer() || elgg_is_admin_logged_in()) { + } elseif ($group->canWriteToContainer(0, 'object', 'groupforumtopic') || elgg_is_admin_logged_in()) { $content .= elgg_view('discussion/replies', array( 'entity' => $topic, 'show_add_form' => true, -- cgit v1.2.3 From b2bcd510b040b6d065a3a6ad5a4ea36e43db0446 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 17:48:29 -0500 Subject: coding standards fixes - comments --- engine/classes/ElggCache.php | 6 +++--- engine/classes/ElggMenuBuilder.php | 7 ++++--- engine/classes/ElggMenuItem.php | 22 +++++++++++----------- engine/classes/ElggPlugin.php | 6 +++--- engine/classes/ElggPluginPackage.php | 2 ++ engine/classes/ElggSite.php | 4 ++-- engine/lib/access.php | 6 +++--- engine/lib/admin.php | 8 ++++---- engine/lib/database.php | 14 +++++++------- engine/lib/extender.php | 2 +- engine/lib/input.php | 4 ++-- engine/lib/relationships.php | 2 +- engine/lib/river.php | 6 +++--- 13 files changed, 46 insertions(+), 43 deletions(-) diff --git a/engine/classes/ElggCache.php b/engine/classes/ElggCache.php index dd53525b8..4317f4be9 100644 --- a/engine/classes/ElggCache.php +++ b/engine/classes/ElggCache.php @@ -191,8 +191,8 @@ abstract class ElggCache implements ArrayAccess { * * @see ArrayAccess::offsetSet() * - * @param mixed $key The key (offset) to assign the value to. - * @param mixed $value The value to set. + * @param mixed $key The key (offset) to assign the value to. + * @param mixed $value The value to set. * * @return void */ @@ -205,7 +205,7 @@ abstract class ElggCache implements ArrayAccess { * * @see ArrayAccess::offsetGet() * - * @param mixed $offset The key (offset) to retrieve. + * @param mixed $key The key (offset) to retrieve. * * @return mixed */ diff --git a/engine/classes/ElggMenuBuilder.php b/engine/classes/ElggMenuBuilder.php index cadfee7f5..6f4ac702e 100644 --- a/engine/classes/ElggMenuBuilder.php +++ b/engine/classes/ElggMenuBuilder.php @@ -16,16 +16,16 @@ class ElggMenuBuilder { /** * ElggMenuBuilder constructor * - * @param string $name Identifier of the menu + * @param array $menu Array of ElggMenuItem objects */ - public function __construct($menu) { + public function __construct(array $menu) { $this->menu = $menu; } /** * Get a prepared menu array * - * @param mixed $sort_by + * @param mixed $sort_by Method to sort the menu by. @see ElggMenuBuilder::sort() * @return array */ public function getMenu($sort_by = 'text') { @@ -80,6 +80,7 @@ class ElggMenuBuilder { /** * Group the menu items into sections + * * @return void */ protected function setupSections() { diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 62547134a..2512392ad 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -2,12 +2,12 @@ /** * Elgg Menu Item * - * @package Elgg.Core - * @subpackage Navigation - * * To create a menu item that is not a link, pass false for $href. * * @since 1.8.0 + * + * @package Elgg.Core + * @subpackage Navigation */ class ElggMenuItem { @@ -70,9 +70,9 @@ class ElggMenuItem { /** * ElggMenuItem constructor * - * @param string $name Identifier of the menu item - * @param string $text Display text of the menu item - * @param string $href URL of the menu item (false if not a link) + * @param string $name Identifier of the menu item + * @param string $text Display text of the menu item + * @param string $href URL of the menu item (false if not a link) */ public function __construct($name, $text, $href) { //$this->name = $name; @@ -182,7 +182,7 @@ class ElggMenuItem { /** * Set the identifier of the menu item * - * @param string Unique identifier + * @param string $name Unique identifier * @return void */ public function setName($name) { @@ -491,7 +491,7 @@ class ElggMenuItem { /** * Set the parent menu item * - * @param ElggMenuItem $parent + * @param ElggMenuItem $parent The parent of this menu item * @return void */ public function setParent($parent) { @@ -510,7 +510,7 @@ class ElggMenuItem { /** * Add a child menu item * - * @param ElggMenuItem $item + * @param ElggMenuItem $item A child menu item * @return void */ public function addChild($item) { @@ -549,10 +549,10 @@ class ElggMenuItem { /** * Get the menu item content (usually a link) * + * @todo View code in a model. How do we feel about that? + * * @params array $vars Options to pass to output/url if a link * @return string - * - * @todo View code in a model. How do we feel about that? */ public function getContent(array $vars = array()) { diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php index c4d6ec034..33f14ae37 100644 --- a/engine/classes/ElggPlugin.php +++ b/engine/classes/ElggPlugin.php @@ -707,9 +707,9 @@ class ElggPlugin extends ElggObject { * @throws PluginException */ public function start($flags) { -// if (!$this->canActivate()) { -// return false; -// } + //if (!$this->canActivate()) { + // return false; + //} // include classes if ($flags & ELGG_PLUGIN_REGISTER_CLASSES) { diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index d240af477..2dc4bdb3d 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -303,6 +303,8 @@ class ElggPluginPackage { /** * Returns an array of present and readable text files + * + * @return array */ public function getTextFilenames() { return $this->textFiles; diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 7ea52a195..b13683a56 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -196,7 +196,7 @@ class ElggSite extends ElggEntity { * * @note You cannot disable the current site. * - * @param string $reason Optional reason for disabling + * @param string $reason Optional reason for disabling * @param bool $recursive Recursively disable all contained entities? * * @return bool @@ -219,7 +219,7 @@ class ElggSite extends ElggEntity { * accepted by elgg_get_entities(). Common parameters * include 'limit', and 'offset'. * Note: this was $limit before version 1.8 - * @param int $offset Offset @deprecated parameter + * @param int $offset Offset @deprecated parameter * * @todo remove $offset in 2.0 * diff --git a/engine/lib/access.php b/engine/lib/access.php index 7be92fbfc..dba1e1ec6 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -984,9 +984,9 @@ function elgg_override_permissions($hook, $type, $value, $params) { } // don't do this so ignore access still works with no one logged in -// if (!$user instanceof ElggUser) { -// return false; -// } + //if (!$user instanceof ElggUser) { + // return false; + //} // check for admin if ($user_guid && elgg_is_admin_user($user_guid)) { diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 1f085eee4..a573e79d6 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -179,10 +179,10 @@ function elgg_admin_notice_exists($id) { * * This function handles registering the parent if it has not been registered. * - * @param string $section The menu section to add to - * @param string $menu_id The unique ID of section - * @param string $parent_id If a child section, the parent section id - * @param int $priority The menu item priority + * @param string $section The menu section to add to + * @param string $menu_id The unique ID of section + * @param string $parent_id If a child section, the parent section id + * @param int $priority The menu item priority * * @return bool * @since 1.8.0 diff --git a/engine/lib/database.php b/engine/lib/database.php index c44fdf1fd..444bb7cc4 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -728,9 +728,9 @@ function sanitize_string($string) { /** * Sanitises an integer for database use. * - * @param int $int Integer - * @param bool[optional] $signed Whether negative values should be allowed (true) - * @return int Sanitised integer + * @param int $int Value to be sanitized + * @param bool $signed Whether negative values should be allowed (true) + * @return int */ function sanitise_int($int, $signed = true) { $int = (int) $int; @@ -745,12 +745,12 @@ function sanitise_int($int, $signed = true) { } /** - * Sanitises an integer for database use. + * Sanitizes an integer for database use. * Wrapper function for alternate English spelling (@see sanitise_int) * - * @param int $int Integer - * @param bool[optional] $signed Whether negative values should be allowed (true) - * @return int Sanitised integer + * @param int $int Value to be sanitized + * @param bool $signed Whether negative values should be allowed (true) + * @return int */ function sanitize_int($int, $signed = true) { return sanitise_int($int, $signed); diff --git a/engine/lib/extender.php b/engine/lib/extender.php index 51fc62c30..ffd3c1357 100644 --- a/engine/lib/extender.php +++ b/engine/lib/extender.php @@ -164,9 +164,9 @@ function can_edit_extender($extender_id, $type, $user_guid = 0) { * It is recommended that you do not call this directly, instead use * one of the wrapper functions such as elgg_register_annotation_url_handler(). * - * @param string $function_name The function to register * @param string $extender_type Extender type ('annotation', 'metadata') * @param string $extender_name The name of the extender + * @param string $function_name The function to register * * @return bool */ diff --git a/engine/lib/input.php b/engine/lib/input.php index 57e35786f..dda8211b6 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -188,8 +188,8 @@ function elgg_get_sticky_value($form_name, $variable = '', $default = NULL, $fil /** * Get all the values in a sticky form in an array * - * @param string $form_name The name of the form - * @param bool $filter_result Filter for bad input if true + * @param string $form_name The name of the form + * @param bool $filter_result Filter for bad input if true * * @return array * @since 1.8.0 diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 5b7080b56..fabe2d2d6 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -399,8 +399,8 @@ function elgg_list_entities_from_relationship_count($options) { /** * Sets the URL handler for a particular relationship type * - * @param string $function_name The function to register * @param string $relationship_type The relationship type. + * @param string $function_name The function to register * * @return bool Depending on success */ diff --git a/engine/lib/river.php b/engine/lib/river.php index 63625878f..547d9495e 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -108,7 +108,7 @@ $posted = 0, $annotation_id = 0) { * * @warning not checking access (should we?) * - * @param array $options + * @param array $options Parameters: * ids => INT|ARR River item id(s) * subject_guids => INT|ARR Subject guid(s) * object_guids => INT|ARR Object guid(s) @@ -215,7 +215,7 @@ function elgg_delete_river(array $options = array()) { * * @note If using types and subtypes in a query, they are joined with an AND. * - * @param array $options + * @param array $options Parameters: * ids => INT|ARR River item id(s) * subject_guids => INT|ARR Subject guid(s) * object_guids => INT|ARR Object guid(s) @@ -548,7 +548,7 @@ function elgg_river_get_action_where_sql($types) { /** * Get the where clause based on river view strings * - * @param array $types Array of view strings + * @param array $views Array of view strings * * @return string * @since 1.8.0 -- cgit v1.2.3 From c4b49227819624b14b61e6eedbfa6779cd794d45 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 19:33:21 -0500 Subject: most of the comments in the engine now past the sniffer --- engine/classes/ElggExtender.php | 11 +++++++++-- engine/classes/ElggMenuBuilder.php | 3 +-- engine/classes/ElggMenuItem.php | 8 +++----- engine/classes/ElggMetadata.php | 7 +++++++ engine/classes/ElggUser.php | 21 ++++++++++----------- engine/classes/SuccessResult.php | 2 +- engine/lib/annotations.php | 2 +- engine/lib/cache.php | 7 ++++--- engine/lib/metadata.php | 2 +- engine/lib/output.php | 8 ++++---- engine/lib/pagehandler.php | 1 + engine/lib/pageowner.php | 7 ++++--- engine/lib/plugins.php | 7 ++++--- engine/lib/users.php | 8 ++++---- 14 files changed, 54 insertions(+), 40 deletions(-) diff --git a/engine/classes/ElggExtender.php b/engine/classes/ElggExtender.php index bc2d67ae2..d94bad837 100644 --- a/engine/classes/ElggExtender.php +++ b/engine/classes/ElggExtender.php @@ -24,8 +24,15 @@ * @property mixed $value The value of the extender (int or string) * @property int $time_created A UNIX timestamp of when the extender was created (read-only, set on first save) */ -abstract class ElggExtender extends ElggData -{ +abstract class ElggExtender extends ElggData { + + /** + * (non-PHPdoc) + * + * @see ElggData::initializeAttributes() + * + * @return void + */ protected function initializeAttributes() { parent::initializeAttributes(); diff --git a/engine/classes/ElggMenuBuilder.php b/engine/classes/ElggMenuBuilder.php index 6f4ac702e..de0017599 100644 --- a/engine/classes/ElggMenuBuilder.php +++ b/engine/classes/ElggMenuBuilder.php @@ -4,8 +4,7 @@ * * @package Elgg.Core * @subpackage Navigation - * - * @since 1.8.0 + * @since 1.8.0 */ class ElggMenuBuilder { diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 2512392ad..4bc9144d4 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -4,10 +4,9 @@ * * To create a menu item that is not a link, pass false for $href. * - * @since 1.8.0 - * * @package Elgg.Core * @subpackage Navigation + * @since 1.8.0 */ class ElggMenuItem { @@ -549,10 +548,9 @@ class ElggMenuItem { /** * Get the menu item content (usually a link) * - * @todo View code in a model. How do we feel about that? - * - * @params array $vars Options to pass to output/url if a link + * @param array $vars Options to pass to output/url if a link * @return string + * @todo View code in a model. How do we feel about that? */ public function getContent(array $vars = array()) { diff --git a/engine/classes/ElggMetadata.php b/engine/classes/ElggMetadata.php index 32e7b32f1..634a122e5 100644 --- a/engine/classes/ElggMetadata.php +++ b/engine/classes/ElggMetadata.php @@ -9,6 +9,13 @@ */ class ElggMetadata extends ElggExtender { + /** + * (non-PHPdoc) + * + * @see ElggData::initializeAttributes() + * + * @return void + */ protected function initializeAttributes() { parent::initializeAttributes(); diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index ab0610ac0..bdf57c2c3 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -105,7 +105,7 @@ class ElggUser extends ElggEntity * * @param int $guid ElggUser GUID * - * @return true|false + * @return bool */ protected function load($guid) { // Test to see if we have the generic stuff @@ -141,7 +141,7 @@ class ElggUser extends ElggEntity /** * Saves this user to the database. * - * @return true|false + * @return bool */ public function save() { // Save generic stuff @@ -261,7 +261,7 @@ class ElggUser extends ElggEntity * @param int $limit The number of results to return * @param int $offset Any indexing offset * - * @return bool + * @return array */ function getSites($subtype = "", $limit = 10, $offset = 0) { return get_user_sites($this->getGUID(), $subtype, $limit, $offset); @@ -272,7 +272,7 @@ class ElggUser extends ElggEntity * * @param int $site_guid The guid of the site to add it to * - * @return true|false + * @return bool */ function addToSite($site_guid) { return add_site_user($site_guid, $this->getGUID()); @@ -283,7 +283,7 @@ class ElggUser extends ElggEntity * * @param int $site_guid The guid of the site to remove it from * - * @return true|false + * @return bool */ function removeFromSite($site_guid) { return remove_site_user($site_guid, $this->getGUID()); @@ -294,7 +294,7 @@ class ElggUser extends ElggEntity * * @param int $friend_guid The GUID of the user to add * - * @return true|false Depending on success + * @return bool */ function addFriend($friend_guid) { return user_add_friend($this->getGUID(), $friend_guid); @@ -305,7 +305,7 @@ class ElggUser extends ElggEntity * * @param int $friend_guid The GUID of the user to remove * - * @return true|false Depending on success + * @return bool */ function removeFriend($friend_guid) { return user_remove_friend($this->getGUID(), $friend_guid); @@ -314,8 +314,7 @@ class ElggUser extends ElggEntity /** * Determines whether or not this user is a friend of the currently logged in user * - * - * @return true|false + * @return bool */ function isFriend() { return $this->isFriendOf(elgg_get_logged_in_user_guid()); @@ -326,7 +325,7 @@ class ElggUser extends ElggEntity * * @param int $user_guid The GUID of the user to check against * - * @return true|false + * @return bool */ function isFriendsWith($user_guid) { return user_is_friend($this->getGUID(), $user_guid); @@ -337,7 +336,7 @@ class ElggUser extends ElggEntity * * @param int $user_guid The GUID of the user to check against * - * @return true|false + * @return bool */ function isFriendOf($user_guid) { return user_is_friend($user_guid, $this->getGUID()); diff --git a/engine/classes/SuccessResult.php b/engine/classes/SuccessResult.php index c8578a2cf..ab5468ad8 100644 --- a/engine/classes/SuccessResult.php +++ b/engine/classes/SuccessResult.php @@ -15,7 +15,7 @@ class SuccessResult extends GenericResult { * * @param string $result The result */ - public function SuccessResult($result) { + public function __construct($result) { $this->setResult($result); $this->setStatusCode(SuccessResult::$RESULT_SUCCESS); } diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index bb7d836cc..30ef7f17b 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -549,8 +549,8 @@ function elgg_comment_url_handler(ElggAnnotation $comment) { /** * Register an annotation url handler. * - * @param string $function_name The function. * @param string $extender_name The name, default 'all'. + * @param string $function_name The function. * * @return string */ diff --git a/engine/lib/cache.php b/engine/lib/cache.php index a6ebe2a30..e71ef332d 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -34,8 +34,9 @@ function elgg_get_filepath_cache() { } /** - * Function which resets the file path cache. + * Reset the file path cache. * + * @return bool */ function elgg_filepath_cache_reset() { $cache = elgg_get_filepath_cache(); @@ -47,8 +48,8 @@ function elgg_filepath_cache_reset() { /** * Saves a filepath cache. * - * @param string $type - * @param string $data + * @param string $type The type or identifier of the cache + * @param string $data The data to be saved * @return bool */ function elgg_filepath_cache_save($type, $data) { diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 4908b3e88..352e98a61 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -871,8 +871,8 @@ function metadata_update($event, $object_type, $object) { /** * Register a metadata url handler. * - * @param string $function_name The function. * @param string $extender_name The name, default 'all'. + * @param string $function The function name. * * @return bool */ diff --git a/engine/lib/output.php b/engine/lib/output.php index 6554481f5..65f51f854 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -81,10 +81,10 @@ function autop($pee, $br = 1) { } $pee = preg_replace('!(]*>)\s*
      !', "$1", $pee); $pee = preg_replace('!
      (\s*]*>)!', '$1', $pee); -// if (strpos($pee, '. Only there because of the comment. -// $pee = preg_replace_callback('!()(.*?)!is', 'clean_pre', $pee ); -// } + //if (strpos($pee, '. Only there because of the comment. + // $pee = preg_replace_callback('!()(.*?)!is', 'clean_pre', $pee ); + //} $pee = preg_replace( "|\n

      $|", '

      ', $pee ); return $pee; diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index ffcfc5b6a..a675d976a 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -120,6 +120,7 @@ function elgg_unregister_page_handler($handler) { * @param string $type The type of the hook * @param bool $result The current value of the hook * @param array $params Parameters related to the hook + * @return void */ function elgg_error_page_handler($hook, $type, $result, $params) { if (elgg_view_exists("errors/$type")) { diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php index 9d41d74c1..0cf0e0625 100644 --- a/engine/lib/pageowner.php +++ b/engine/lib/pageowner.php @@ -54,7 +54,7 @@ function elgg_get_page_owner_entity() { * Set the guid of the entity that owns this page * * @param int $guid The guid of the page owner - * + * @return void * @since 1.8.0 */ function elgg_set_page_owner_guid($guid) { @@ -173,7 +173,7 @@ function default_page_owner_handler($hook, $entity_type, $returnvalue, $params) * @warning The context is not available until the page_handler runs (after * the 'init, system' event processing has completed). * - * @param string $context The context of the page + * @param string $context The context of the page * @return bool * @since 1.8.0 */ @@ -216,6 +216,7 @@ function elgg_get_context() { * Push a context onto the top of the stack * * @param string $context The context string to add to the context stack + * @return void * @since 1.8.0 */ function elgg_push_context($context) { @@ -244,7 +245,7 @@ function elgg_pop_context() { * itself differently based on being on the dashboard or profile pages, it * can check the stack. * - * @param string $context The context string to check for + * @param string $context The context string to check for * @return bool * @since 1.8.0 */ diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 026bc171b..7968f4a6e 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -480,9 +480,10 @@ function elgg_reindex_plugin_priorities() { */ function elgg_namespace_plugin_private_setting($type, $name, $id = null) { switch ($type) { -// case 'setting': -// $name = ELGG_PLUGIN_SETTING_PREFIX . $name; -// break; + // commented out because it breaks $plugin->$name access to variables + //case 'setting': + // $name = ELGG_PLUGIN_SETTING_PREFIX . $name; + // break; case 'user_setting': if (!$id) { diff --git a/engine/lib/users.php b/engine/lib/users.php index 362488718..c03052172 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -630,10 +630,10 @@ function get_user_by_email($email) { * A function that returns a maximum of $limit users who have done something within the last * $seconds seconds or the total count of active users. * - * @param int $seconds Number of seconds (default 600 = 10min) - * @param int $limit Limit, default 10. - * @param int $offset Offset, default 0. - * @param bool $count Count, default false. + * @param int $seconds Number of seconds (default 600 = 10min) + * @param int $limit Limit, default 10. + * @param int $offset Offset, default 0. + * @param bool $count Count, default false. * * @return mixed */ -- cgit v1.2.3 From 66953a2148bb7a19ac79c1a4ccda2852ee87501e Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Mon, 9 Jan 2012 18:53:19 -0500 Subject: coding standard fixes to engine --- engine/classes/ElggBatch.php | 8 +++----- engine/classes/ElggEntity.php | 28 ++++++++++++++-------------- engine/classes/ElggMemcache.php | 24 ++++-------------------- engine/classes/ElggWidget.php | 2 +- engine/classes/XMLRPCCall.php | 4 ++-- engine/handlers/export_handler.php | 6 ++++-- engine/lib/actions.php | 3 +-- engine/lib/configuration.php | 2 +- engine/lib/filestore.php | 2 +- engine/lib/metadata.php | 16 ++++++++-------- engine/lib/navigation.php | 2 +- engine/lib/output.php | 4 ++-- engine/lib/private_settings.php | 2 +- engine/lib/users.php | 2 +- engine/lib/views.php | 13 ++++++------- 15 files changed, 50 insertions(+), 68 deletions(-) diff --git a/engine/classes/ElggBatch.php b/engine/classes/ElggBatch.php index 2a97f9ff5..3d01133fa 100644 --- a/engine/classes/ElggBatch.php +++ b/engine/classes/ElggBatch.php @@ -236,13 +236,11 @@ class ElggBatch } // if original limit < chunk size, set limit to original limit + // else if the number of results we'll fetch if greater than the original limit if ($this->limit < $this->chunkSize) { $limit = $this->limit; - } - - // if the number of results we'll fetch is greater than the original limit, - // set the limit to the number of results remaining in the original limit - elseif ($this->retrievedResults + $this->chunkSize > $this->limit) { + } elseif ($this->retrievedResults + $this->chunkSize > $this->limit) { + // set the limit to the number of results remaining in the original limit $limit = $this->limit - $this->retrievedResults; } } diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index df87082fe..2fa8e9939 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -1583,36 +1583,36 @@ abstract class ElggEntity extends ElggData implements foreach ($this->attributes as $k => $v) { $meta = NULL; - if (in_array( $k, $exportable_values)) { + if (in_array($k, $exportable_values)) { switch ($k) { - case 'guid' : // Dont use guid in OpenDD - case 'type' : // Type and subtype already taken care of - case 'subtype' : - break; + case 'guid': // Dont use guid in OpenDD + case 'type': // Type and subtype already taken care of + case 'subtype': + break; - case 'time_created' : // Created = published + case 'time_created': // Created = published $odd->setAttribute('published', date("r", $v)); - break; + break; - case 'site_guid' : // Container + case 'site_guid': // Container $k = 'site_uuid'; $v = guid_to_uuid($v); $meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v); - break; + break; - case 'container_guid' : // Container + case 'container_guid': // Container $k = 'container_uuid'; $v = guid_to_uuid($v); $meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v); - break; + break; - case 'owner_guid' : // Convert owner guid to uuid, this will be stored in metadata + case 'owner_guid': // Convert owner guid to uuid, this will be stored in metadata $k = 'owner_uuid'; $v = guid_to_uuid($v); $meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v); - break; + break; - default : + default: $meta = new ODDMetaData($uuid . "attr/$k/", $uuid, $k, $v); } diff --git a/engine/classes/ElggMemcache.php b/engine/classes/ElggMemcache.php index a54c29723..f27b017d0 100644 --- a/engine/classes/ElggMemcache.php +++ b/engine/classes/ElggMemcache.php @@ -110,22 +110,6 @@ class ElggMemcache extends ElggSharedMemoryCache { $this->expires = $expires; } - /** - * Combine a key with the namespace. - * Memcache can only accept <250 char key. If the given key is too long it is shortened. - * - * @deprecated 1.8 Use ElggMemcache::_makeMemcacheKey() - * - * @param string $key The key - * - * @return string The new key. - */ - private function make_memcache_key($key) { - elgg_deprecated_notice('ElggMemcache::make_memcache_key() is deprecated by ::_makeMemcacheKey()', 1.8); - - return $this->_makeMemcacheKey($key); - } - /** * Combine a key with the namespace. * Memcache can only accept <250 char key. If the given key is too long it is shortened. @@ -134,7 +118,7 @@ class ElggMemcache extends ElggSharedMemoryCache { * * @return string The new key. */ - private function _makeMemcacheKey($key) { + private function makeMemcacheKey($key) { $prefix = $this->getNamespace() . ":"; if (strlen($prefix . $key) > 250) { @@ -154,7 +138,7 @@ class ElggMemcache extends ElggSharedMemoryCache { * @return bool */ public function save($key, $data, $expires = null) { - $key = $this->_makeMemcacheKey($key); + $key = $this->makeMemcacheKey($key); if ($expires === null) { $expires = $this->expires; @@ -178,7 +162,7 @@ class ElggMemcache extends ElggSharedMemoryCache { * @return mixed */ public function load($key, $offset = 0, $limit = null) { - $key = $this->_makeMemcacheKey($key); + $key = $this->makeMemcacheKey($key); $result = $this->memcache->get($key); if ($result === false) { @@ -196,7 +180,7 @@ class ElggMemcache extends ElggSharedMemoryCache { * @return bool */ public function delete($key) { - $key = $this->_makeMemcacheKey($key); + $key = $this->makeMemcacheKey($key); return $this->memcache->delete($key, 0); } diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php index 70eaf8a73..e703b84cb 100644 --- a/engine/classes/ElggWidget.php +++ b/engine/classes/ElggWidget.php @@ -133,7 +133,7 @@ class ElggWidget extends ElggObject { if ($rank == 0) { // top of the column $this->order = $widgets[0]->order - 10; - } elseif ($rank == (count($widgets)-1)) { + } elseif ($rank == (count($widgets) - 1)) { // bottom of the column $this->order = end($widgets)->order + 10; } else { diff --git a/engine/classes/XMLRPCCall.php b/engine/classes/XMLRPCCall.php index 8eeba0c29..fd28f1e3e 100644 --- a/engine/classes/XMLRPCCall.php +++ b/engine/classes/XMLRPCCall.php @@ -18,7 +18,7 @@ class XMLRPCCall { * @param string $xml XML */ function __construct($xml) { - $this->_parse($xml); + $this->parse($xml); } /** @@ -45,7 +45,7 @@ class XMLRPCCall { * * @return void */ - private function _parse($xml) { + private function parse($xml) { $xml = xml_to_object($xml); // sanity check diff --git a/engine/handlers/export_handler.php b/engine/handlers/export_handler.php index b91a037e8..aa5214c23 100644 --- a/engine/handlers/export_handler.php +++ b/engine/handlers/export_handler.php @@ -72,8 +72,10 @@ if (($guid != "") && ($type == "") && ($id_or_name == "")) { $r = get_relationship($id_or_name); break; case 'volatile' : - $m = elgg_trigger_plugin_hook('volatile', 'metadata', - array('guid' => $guid, 'varname' => $id_or_name)); + $m = elgg_trigger_plugin_hook('volatile', 'metadata', array( + 'guid' => $guid, + 'varname' => $id_or_name, + )); break; default : diff --git a/engine/lib/actions.php b/engine/lib/actions.php index f415842ab..c6613e6d6 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -459,8 +459,7 @@ function ajax_forward_hook($hook, $type, $reason, $params) { // however some browsers will not accept the JSON MIME type. if (stripos($_SERVER['HTTP_ACCEPT'], 'application/json') === FALSE) { header("Content-type: text/plain"); - } - else { + } else { header("Content-type: application/json"); } diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php index 615063f3d..3fade8155 100644 --- a/engine/lib/configuration.php +++ b/engine/lib/configuration.php @@ -555,7 +555,7 @@ function set_default_config() { 'path' => "$install_root/", 'view_path' => "$install_root/views/", 'plugins_path' => "$install_root/mod/", - 'wwwroot' => $www_root, + 'wwwroot' => $www_root, 'url' => $www_root, 'site_name' => 'New Elgg site', 'language' => 'en', diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index a13d8aa27..86f6d9baa 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -18,7 +18,7 @@ */ function get_dir_size($dir, $totalsize = 0) { $handle = @opendir($dir); - while ($file = @readdir ($handle)) { + while ($file = @readdir($handle)) { if (eregi("^\.{1,2}$", $file)) { continue; } diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 352e98a61..6e1b8b39c 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -402,15 +402,15 @@ function elgg_enable_metadata(array $options) { */ function elgg_get_entities_from_metadata(array $options = array()) { $defaults = array( - 'metadata_names' => ELGG_ENTITIES_ANY_VALUE, - 'metadata_values' => ELGG_ENTITIES_ANY_VALUE, - 'metadata_name_value_pairs' => ELGG_ENTITIES_ANY_VALUE, + 'metadata_names' => ELGG_ENTITIES_ANY_VALUE, + 'metadata_values' => ELGG_ENTITIES_ANY_VALUE, + 'metadata_name_value_pairs' => ELGG_ENTITIES_ANY_VALUE, - 'metadata_name_value_pairs_operator'=> 'AND', - 'metadata_case_sensitive' => TRUE, - 'order_by_metadata' => array(), + 'metadata_name_value_pairs_operator' => 'AND', + 'metadata_case_sensitive' => TRUE, + 'order_by_metadata' => array(), - 'metadata_owner_guids' => ELGG_ENTITIES_ANY_VALUE, + 'metadata_owner_guids' => ELGG_ENTITIES_ANY_VALUE, ); $options = array_merge($defaults, $options); @@ -633,7 +633,7 @@ $owner_guids = NULL) { $i++; } - if ($where = implode (" $pair_operator ", $pair_wheres)) { + if ($where = implode(" $pair_operator ", $pair_wheres)) { $wheres[] = "($where)"; } } diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 956ca220a..dcbd7b397 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -301,7 +301,7 @@ function elgg_site_menu_setup($hook, $type, $return, $params) { // if only one item on more menu, stick it with the rest $num_menu_items = count($return['default']); if ($num_menu_items > ($max_display_items + 1)) { - $return['more'] = array_splice($return['default'], $max_display_items); + $return['more'] = array_splice($return['default'], $max_display_items); } } diff --git a/engine/lib/output.php b/engine/lib/output.php index 65f51f854..b96cf354c 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -67,7 +67,7 @@ function autop($pee, $br = 1) { $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "

      $1

      \n", $pee); // make paragraphs, including one at the end $pee = preg_replace('|

      \s*?

      |', '', $pee); // under certain strange conditions it could create a P of entirely whitespace $pee = preg_replace('!

      ([^<]+)\s*?(]*>)!', "

      $1

      $2", $pee); - $pee = preg_replace( '|

      |', "$1

      ", $pee ); + $pee = preg_replace('|

      |', "$1

      ", $pee); $pee = preg_replace('!

      \s*(]*>)\s*

      !', "$1", $pee); // don't pee all over a tag $pee = preg_replace("|

      (|", "$1", $pee); // problem with nested lists $pee = preg_replace('|

      ]*)>|i', "

      ", $pee); @@ -85,7 +85,7 @@ function autop($pee, $br = 1) { // mind the space between the ? and >. Only there because of the comment. // $pee = preg_replace_callback('!()(.*?)!is', 'clean_pre', $pee ); //} - $pee = preg_replace( "|\n

      $|", '

      ', $pee ); + $pee = preg_replace("|\n

      $|", '

      ', $pee); return $pee; } diff --git a/engine/lib/private_settings.php b/engine/lib/private_settings.php index 386af5279..1fa9bdb66 100644 --- a/engine/lib/private_settings.php +++ b/engine/lib/private_settings.php @@ -240,7 +240,7 @@ $pairs = NULL, $pair_operator = 'AND', $name_prefix = '') { $i++; } - $where = implode (" $pair_operator ", $pair_wheres); + $where = implode(" $pair_operator ", $pair_wheres); if ($where) { $wheres[] = "($where)"; } diff --git a/engine/lib/users.php b/engine/lib/users.php index c03052172..c38bb676e 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1486,7 +1486,7 @@ function users_pagesetup() { if ($viewer) { elgg_register_menu_item('topbar', array( 'name' => 'profile', - 'href' => $viewer->getURL(), + 'href' => $viewer->getURL(), 'text' => elgg_view('output/img', array( 'src' => $viewer->getIconURL('topbar'), 'alt' => $viewer->name, diff --git a/engine/lib/views.php b/engine/lib/views.php index b938dd60e..85319b2d7 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -415,7 +415,6 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie if (isset($vars['internalname']) && !isset($vars['__ignoreInternalname']) && !isset($vars['name'])) { elgg_deprecated_notice('You should pass $vars[\'name\'] now instead of $vars[\'internalname\']', 1.8, 2); $vars['name'] = $vars['internalname']; - $test=false; } elseif (isset($vars['name'])) { if (!isset($vars['internalname'])) { $vars['__ignoreInternalname'] = ''; @@ -1628,12 +1627,12 @@ function elgg_views_boot() { // set default icon sizes - can be overridden in settings.php or with plugin if (!elgg_get_config('icon_sizes')) { $icon_sizes = array( - 'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE), - 'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE, 'upscale'=>TRUE), - 'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE, 'upscale'=>TRUE), - 'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE, 'upscale'=>TRUE), - 'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE, 'upscale'=>FALSE), - 'master' => array('w'=>550, 'h'=>550, 'square'=>FALSE, 'upscale'=>FALSE), + 'topbar' => array('w' => 16, 'h' => 16, 'square' => TRUE, 'upscale' => TRUE), + 'tiny' => array('w' => 25, 'h' => 25, 'square' => TRUE, 'upscale' => TRUE), + 'small' => array('w' => 40, 'h' => 40, 'square' => TRUE, 'upscale' => TRUE), + 'medium' => array('w' => 100, 'h' => 100, 'square' => TRUE, 'upscale' => TRUE), + 'large' => array('w' => 200, 'h' => 200, 'square' => FALSE, 'upscale' => FALSE), + 'master' => array('w' => 550, 'h' => 550, 'square' => FALSE, 'upscale' => FALSE), ); elgg_set_config('icon_sizes', $icon_sizes); } -- cgit v1.2.3 From 0980beffc887277c6856f53d96d6d7fa5f624154 Mon Sep 17 00:00:00 2001 From: Jeroen Dalsem Date: Mon, 9 Jan 2012 11:45:00 +0100 Subject: Fixes #4285 move only fetches 10 items --- engine/classes/ElggWidget.php | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/classes/ElggWidget.php b/engine/classes/ElggWidget.php index e703b84cb..7914fa140 100644 --- a/engine/classes/ElggWidget.php +++ b/engine/classes/ElggWidget.php @@ -116,6 +116,7 @@ class ElggWidget extends ElggObject { 'type' => 'object', 'subtype' => 'widget', 'container_guid' => $this->container_guid, + 'limit' => false, 'private_setting_name_value_pairs' => array( array('name' => 'context', 'value' => $this->getContext()), array('name' => 'column', 'value' => $column) -- cgit v1.2.3 From 0fe0f9d6dc6577d39bf0615c0e714c7fa7d2ebf3 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Mon, 9 Jan 2012 17:29:04 -0800 Subject: Fixes #4243. Added docs for metadata_calculation option to elgg_get_metadata(). --- engine/lib/annotations.php | 16 ++++++++-------- engine/lib/metadata.php | 27 ++++++++++++--------------- engine/lib/metastrings.php | 11 +++++------ 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 30ef7f17b..7eb72612f 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -179,14 +179,14 @@ function update_annotation($annotation_id, $name, $value, $value_type, $owner_gu * * @param array $options Array in format: * - * annotation_names => NULL|ARR Annotation names - * annotation_values => NULL|ARR Annotation values - * annotation_ids => NULL|ARR annotation ids - * annotation_case_sensitive => BOOL Overall Case sensitive - * annotation_owner_guids => NULL|ARR guids for annotation owners - * annotation_created_time_lower => INT Lower limit for created time. - * annotation_created_time_upper => INT Upper limit for created time. - * annotation_calculation => STR Perform the MySQL function on the annotation values returned. + * annotation_names => NULL|ARR Annotation names + * annotation_values => NULL|ARR Annotation values + * annotation_ids => NULL|ARR annotation ids + * annotation_case_sensitive => BOOL Overall Case sensitive + * annotation_owner_guids => NULL|ARR guids for annotation owners + * annotation_created_time_lower => INT Lower limit for created time. + * annotation_created_time_upper => INT Upper limit for created time. + * annotation_calculation => STR Perform the MySQL function on the annotation values returned. * Do not confuse this "annotation_calculation" option with the * "calculation" option to elgg_get_entities_from_annotation_calculation(). * The "annotation_calculation" option causes this function to diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 6e1b8b39c..a097cd3ef 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -269,21 +269,18 @@ $access_id = ACCESS_PRIVATE, $allow_multiple = false) { * * @param array $options Array in format: * - * metadata_names => NULL|ARR metadata names - * - * metadata_values => NULL|ARR metadata values - * -* metadata_ids => NULL|ARR metadata ids - * - * metadata_case_sensitive => BOOL Overall Case sensitive - * - * metadata_owner_guids => NULL|ARR guids for metadata owners - * - * metadata_created_time_lower => INT Lower limit for created time. - * - * metadata_created_time_upper => INT Upper limit for created time. - * - * metadata_calculation => STR Perform the MySQL function on the metadata values returned. + * metadata_names => NULL|ARR metadata names + * metadata_values => NULL|ARR metadata values + * metadata_ids => NULL|ARR metadata ids + * metadata_case_sensitive => BOOL Overall Case sensitive + * metadata_owner_guids => NULL|ARR guids for metadata owners + * metadata_created_time_lower => INT Lower limit for created time. + * metadata_created_time_upper => INT Upper limit for created time. + * metadata_calculation => STR Perform the MySQL function on the metadata values returned. + * The "metadata_calculation" option causes this function to + * return the result of performing a mathematical calculation on + * all metadata that match the query instead of returning + * ElggMetadata objects. * * @return mixed * @since 1.8.0 diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 9fe9b4bff..d8fef6f1c 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -609,8 +609,7 @@ function elgg_get_metastring_sql($table, $names = null, $values = null, } /** - * Normalizes metadata / annotation option names to their - * corresponding metastrings name. + * Normalizes metadata / annotation option names to their corresponding metastrings name. * * @param array $options An options array * @since 1.8.0 @@ -631,10 +630,10 @@ function elgg_normalize_metastrings_options(array $options = array()) { // map the metadata_* options to metastring_* options $map = array( - 'names' => 'metastring_names', - 'values' => 'metastring_values', - 'case_sensitive' => 'metastring_case_sensitive', - 'owner_guids' => 'metastring_owner_guids', + 'names' => 'metastring_names', + 'values' => 'metastring_values', + 'case_sensitive' => 'metastring_case_sensitive', + 'owner_guids' => 'metastring_owner_guids', 'created_time_lower' => 'metastring_created_time_lower', 'created_time_upper' => 'metastring_created_time_upper', 'calculation' => 'metastring_calculation', -- cgit v1.2.3 From a3f0353600e749a16abbdab3cbc75b3469d6fd69 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Tue, 10 Jan 2012 16:54:49 -0800 Subject: Fixes #4269. Not using ElggBatch to delete metadata / annotations. Added unit tests for deleting annotations/md. Fixed an annoying inconsistency with "metastring/s" option in private functions. --- engine/lib/annotations.php | 2 +- engine/lib/metadata.php | 2 +- engine/lib/metastrings.php | 32 ++++++++++++++++++++++++++++++-- engine/tests/api/annotations.php | 24 ++++++++++++++++++++++++ engine/tests/api/metadata.php | 25 +++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 4 deletions(-) diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 7eb72612f..5049d455b 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -237,7 +237,7 @@ function elgg_disable_annotations(array $options) { return false; } - $options['metastrings_type'] = 'annotations'; + $options['metastring_type'] = 'annotations'; return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback'); } diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index a097cd3ef..19e8aa3c8 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -324,7 +324,7 @@ function elgg_disable_metadata(array $options) { return false; } - $options['metastrings_type'] = 'metadata'; + $options['metastring_type'] = 'metadata'; return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback'); } diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index d8fef6f1c..62b60e279 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -727,10 +727,38 @@ function elgg_batch_metastring_based_objects(array $options, $callback) { return false; } - $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback); - $r = $batch->callbackResult; + switch($options['metastring_type']) { + case 'metadata': + $objects = elgg_get_metadata($options); + break; + + case 'annotations': + $objects = elgg_get_annotations($options); + break; + + default: + return false; + } + + if (!is_array($objects)) { + $r = false; + } elseif (empty($objects)) { + // ElggBatch returns null if the results are an empty array + $r = null; + } else { + $r = true; + foreach($objects as $object) { + $r = $r && $callback($object); + } + } return $r; + +// // @todo restore once ElggBatch supports callbacks that delete rows. +// $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback); +// $r = $batch->callbackResult; +// +// return $r; } /** diff --git a/engine/tests/api/annotations.php b/engine/tests/api/annotations.php index d7551a0fa..947292970 100644 --- a/engine/tests/api/annotations.php +++ b/engine/tests/api/annotations.php @@ -43,4 +43,28 @@ class ElggCoreAnnotationAPITest extends ElggCoreUnitTest { $this->object->delete(); } + + public function testElggDeleteAnnotations() { + $e = new ElggObject(); + $e->save(); + + for ($i=0; $i<30; $i++) { + $e->annotate('test_annotation', rand(0,10000)); + } + + $options = array( + 'guid' => $e->getGUID(), + 'limit' => 0 + ); + + $annotations = elgg_get_annotations($options); + $this->assertIdentical(30, count($annotations)); + + $this->assertTrue(elgg_delete_annotations($options)); + + $annotations = elgg_get_annotations($options); + $this->assertTrue(empty($annotations)); + + $this->assertTrue($e->delete()); + } } diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php index f5b615ca8..be8ac269c 100644 --- a/engine/tests/api/metadata.php +++ b/engine/tests/api/metadata.php @@ -99,6 +99,31 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest { $this->object->delete(); } + public function testElggDeleteMetadata() { + $e = new ElggObject(); + $e->save(); + + for ($i=0; $i<30; $i++) { + $name = "test_metadata" . rand(0, 10000); + $e->$name = rand(0, 10000); + } + + $options = array( + 'guid' => $e->getGUID(), + 'limit' => 0 + ); + + $md = elgg_get_metadata($options); + $this->assertIdentical(30, count($md)); + + $this->assertTrue(elgg_delete_metadata($options)); + + $md = elgg_get_metadata($options); + $this->assertTrue(empty($md)); + + $e->delete(); + } + protected function create_metastring($string) { global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE; -- cgit v1.2.3 From 0c1ee36d6aa220376537324d427741861e00138a Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 11 Jan 2012 22:39:59 -0500 Subject: Fixes #4292 added a white list for ajax views --- engine/lib/elgglib.php | 6 ++++++ engine/lib/views.php | 33 +++++++++++++++++++++++++++++++++ mod/thewire/start.php | 2 ++ 3 files changed, 41 insertions(+) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index b044d230f..9035d95f2 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1777,6 +1777,12 @@ function elgg_ajax_page_handler($page) { unset($page[0]); $view = implode('/', $page); + $allowed_views = elgg_get_config('allowed_ajax_views'); + if (!array_key_exists($view, $allowed_views)) { + header('HTTP/1.1 403 Forbidden'); + exit; + } + // pull out GET parameters through filter $vars = array(); foreach ($_GET as $name => $value) { diff --git a/engine/lib/views.php b/engine/lib/views.php index 85319b2d7..e59edac96 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -196,6 +196,37 @@ function elgg_does_viewtype_fallback($viewtype) { return FALSE; } +/** + * Register a view to be available for ajax calls + * + * @param string $view The view name + * @return void + * @since 1.8.3 + */ +function elgg_register_ajax_view($view) { + global $CONFIG; + + if (!isset($CONFIG->allowed_ajax_views)) { + $CONFIG->allowed_ajax_views = array(); + } + + $CONFIG->allowed_ajax_views[$view] = true; +} + +/** + * Unregister a view for ajax calls + * + * @param string $view The view name + * @return void + * @since 1.8.3 + */ +function elgg_unregister_ajax_view($view) { + global $CONFIG; + + if (isset($CONFIG->allowed_ajax_views[$view])) { + unset($CONFIG->allowed_ajax_views[$view]); + } +} /** * Returns the file location for a view. @@ -1610,6 +1641,8 @@ function elgg_views_boot() { elgg_register_css('elgg', $elgg_css_url); elgg_load_css('elgg'); + elgg_register_ajax_view('js/languages'); + elgg_register_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link'); // discover the built-in view types diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 328e5d46c..202e3d1d6 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -30,6 +30,8 @@ function thewire_init() { elgg_register_simplecache_view('js/thewire'); elgg_register_js('elgg.thewire', $thewire_js, 'footer'); + elgg_register_ajax_view('thewire/previous'); + // add a site navigation item $item = new ElggMenuItem('thewire', elgg_echo('thewire'), 'thewire/all'); elgg_register_menu_item('site', $item); -- cgit v1.2.3 From c56d0160f59b1a1bfb4dcd062c086aa2b42432b9 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 11 Jan 2012 22:40:38 -0500 Subject: updated version and changes.txt --- CHANGES.txt | 23 +++++++++++++++++++++++ version.php | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5232deadc..af126c3d3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,26 @@ +Version 1.8.3 +(January 12, 2012 from https://github.com/Elgg/Elgg/tree/1.8) + + Enhancements: + * Adds a white list for ajax views + * Improved navigation tab options + * Added group specific search + * Added button for reverting avatar + * Improved documentation for core class attributes + * Adds a server info page under administer -> statistics + * Improving caching of icons and js/css + * Deprecation notices not displayed to non-admin users + + Bugfixes: + * Fixed upgrade scripts for blog posts and groups forum posts + * Can now delete invitations to invisible groups + * Fixed several widget bugs + * Fixed access level on add to group river item + * Fixed recursive entity enabling + * Fixed limit on pages in sidebar navigation + * Fixed deletion of large numbers of annotations + + Version 1.8.2 (December 21, 2011 from https://github.com/Elgg/Elgg/tree/1.8) diff --git a/version.php b/version.php index 455f77ad1..c491e06ce 100644 --- a/version.php +++ b/version.php @@ -14,4 +14,4 @@ $version = 2011123101; // Human-friendly version name -$release = '1.8.2'; +$release = '1.8.3'; -- cgit v1.2.3 From 68e4829ac0959d86c651e7ed6dc255c39694c8af Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 12 Jan 2012 06:58:10 -0500 Subject: added clearfix to increase the size of the area for the drag handle --- views/default/object/widget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/default/object/widget.php b/views/default/object/widget.php index 8c7ec2a03..0c7994f2b 100644 --- a/views/default/object/widget.php +++ b/views/default/object/widget.php @@ -55,7 +55,7 @@ if ($can_edit) { } $widget_header = <<

      $title

      +

      $title

      $controls
      HEADER; -- cgit v1.2.3