From a6846beb2f74aa38215b09a6a6dc18b912446bba Mon Sep 17 00:00:00 2001 From: Richard Loxley Date: Wed, 27 Jul 2011 16:30:28 +0100 Subject: Fixes Ticket #3709 "Embed plugin: uploading a file in Firefox tries to save a JSON file in the user's browser" --- engine/lib/actions.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 4ccffd267..99e22e104 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -446,7 +446,17 @@ function ajax_forward_hook($hook, $type, $reason, $params) { $params['status'] = -1; } - header("Content-type: application/json"); + // Check the requester can accept JSON responses, if not fall back to + // returning JSON in a plain-text response. Some libraries request + // JSON in an invisible iframe which they then read from the iframe, + // however some browsers will not accept the JSON MIME type. + if (stripos($_SERVER['HTTP_ACCEPT'], 'application/json') === FALSE) { + header("Content-type: text/plain"); + } + else { + header("Content-type: application/json"); + } + echo json_encode($params); exit; } -- cgit v1.2.3 From 79bc4476464e53d38a36f59f9a438f7592215951 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Thu, 25 Aug 2011 15:48:11 -0700 Subject: Fixes #3535. elgg_view_form() automatically adds elgg-form-action-name. --- engine/lib/views.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/views.php b/engine/lib/views.php index fe3265347..68c1badbc 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1224,6 +1224,9 @@ function elgg_view_river_item($item, array $vars = array()) { * sets the action by default to "action/$action". Automatically wraps the forms/$action * view with a
tag and inserts the anti-csrf security tokens. * + * @tip This automatically appends elgg-form-action-name to the form's class. It replaces any + * slashes with dashes (blog/save becomes elgg-form-blog-save) + * * @example * echo elgg_view_form('login'); * @@ -1253,9 +1256,18 @@ function elgg_view_form($action, $form_vars = array(), $body_vars = array()) { $defaults = array( 'action' => $CONFIG->wwwroot . "action/$action", - 'body' => elgg_view("forms/$action", $body_vars), + 'body' => elgg_view("forms/$action", $body_vars) ); + $form_class = 'elgg-form-' . preg_replace('/[^a-z0-9]/i', '-', $action); + + // append elgg-form class to any class options set + if (isset($form_vars['class'])) { + $form_vars['class'] = $form_vars['class'] . " $form_class"; + } else { + $form_vars['class'] = $form_class; + } + return elgg_view('input/form', array_merge($defaults, $form_vars)); } -- cgit v1.2.3 From 0179e8c68b0827d77c61a31c8c0d6bf4a277c785 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sat, 27 Aug 2011 10:41:35 -0700 Subject: Fixes #3434. Manifests are checked more carefully on anything that checks deps. Disabling plugins with invalid manifests from admin page. --- engine/classes/ElggPluginPackage.php | 6 +++++- engine/lib/plugins.php | 7 ++++++- languages/en.php | 1 + views/default/admin/plugins.php | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index 977b72d76..02b985285 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -334,7 +334,11 @@ class ElggPluginPackage { // first, check if any active plugin conflicts with us. foreach ($enabled_plugins as $plugin) { - $temp_conflicts = $plugin->getManifest()->getConflicts(); + $temp_conflicts = array(); + $temp_manifest = $plugin->getManifest(); + if ($temp_manifest instanceof ElggPluginManifest) { + $temp_conflicts = $plugin->getManifest()->getConflicts(); + } foreach ($temp_conflicts as $conflict) { if ($conflict['type'] == 'plugin' && $conflict['name'] == $this_id) { $result = $this->checkDepPlugin($conflict, $enabled_plugins, false); diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 88217b782..ba98e94f1 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -548,7 +548,12 @@ function elgg_get_plugins_provides($type = null, $name = null) { $provides = array(); foreach ($active_plugins as $plugin) { - if ($plugin_provides = $plugin->getManifest()->getProvides()) { + $plugin_provides = array(); + $manifest = $plugin->getManifest(); + if ($manifest instanceof ElggPluginManifest) { + $plugin_provides = $plugin->getManifest()->getProvides(); + } + if ($plugin_provides) { foreach ($plugin_provides as $provided) { $provides[$provided['type']][$provided['name']] = array( 'version' => $provided['version'], diff --git a/languages/en.php b/languages/en.php index c30a1bdd8..da5f0ef81 100644 --- a/languages/en.php +++ b/languages/en.php @@ -103,6 +103,7 @@ $english = array( 'ElggPlugin:Dependencies:Priority:Uninstalled' => '%s is not installed', 'ElggPlugin:Dependencies:Suggests:Unsatisfied' => 'Missing', + 'ElggPlugin:InvalidAndDeactivated' => '%s is an invalid plugin and has been deactivated.', 'InvalidParameterException:NonElggUser' => "Passing a non-ElggUser to an ElggUser constructor!", diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php index 1aa899fcc..cd0b83c00 100644 --- a/views/default/admin/plugins.php +++ b/views/default/admin/plugins.php @@ -20,6 +20,11 @@ $categories = array(); foreach ($installed_plugins as $id => $plugin) { if (!$plugin->isValid()) { + if ($plugin->isActive()) { + // force disable and warn + register_error(elgg_echo('ElggPlugin:InvalidAndDeactivated', array($plugin->getId()))); + $plugin->deactivate(); + } continue; } -- cgit v1.2.3 From e32bfa450e9a07f6f6575b84d18eb63bd72969f4 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Mon, 29 Aug 2011 18:38:04 -0700 Subject: Fixes #3461: Using absolute URLs for lightbox CSS. --- engine/lib/views.php | 2 +- views/default/css/lightbox.php | 371 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 views/default/css/lightbox.php (limited to 'engine') diff --git a/engine/lib/views.php b/engine/lib/views.php index 68c1badbc..16aa147e4 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1560,7 +1560,7 @@ function elgg_views_boot() { elgg_register_simplecache_view('js/lightbox'); $lightbox_js_url = elgg_get_simplecache_url('js', 'lightbox'); elgg_register_js('lightbox', $lightbox_js_url); - $lightbox_css_url = 'vendors/jquery/fancybox/jquery.fancybox-1.3.4.css'; + $lightbox_css_url = elgg_get_simplecache_url('css', 'lightbox'); elgg_register_css('lightbox', $lightbox_css_url); $elgg_css_url = elgg_get_simplecache_url('css', 'elgg'); diff --git a/views/default/css/lightbox.php b/views/default/css/lightbox.php new file mode 100644 index 000000000..55e6ec604 --- /dev/null +++ b/views/default/css/lightbox.php @@ -0,0 +1,371 @@ + + +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. + * + * Version: 1.3.4 (11/11/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + width: 40px; + height: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + z-index: 1104; + display: none; +} + +#fancybox-loading div { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background-image: url('fancybox/fancybox.png'); +} + +#fancybox-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + z-index: 1100; + display: none; +} + +#fancybox-tmp { + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; +} + +#fancybox-wrap { + position: absolute; + top: 0; + left: 0; + padding: 20px; + z-index: 1101; + outline: none; + display: none; +} + +#fancybox-outer { + position: relative; + width: 100%; + height: 100%; + background: #fff; +} + +#fancybox-content { + width: 0; + height: 0; + padding: 0; + outline: none; + position: relative; + overflow: hidden; + z-index: 1102; + border: 0px solid #fff; +} + +#fancybox-hide-sel-frame { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; + z-index: 1101; +} + +#fancybox-close { + position: absolute; + top: -15px; + right: -15px; + width: 30px; + height: 30px; + background: transparent url('fancybox/fancybox.png') -40px 0px; + cursor: pointer; + z-index: 1103; + display: none; +} + +#fancybox-error { + color: #444; + font: normal 12px/20px Arial; + padding: 14px; + margin: 0; +} + +#fancybox-img { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; +} + +#fancybox-frame { + width: 100%; + height: 100%; + border: none; + display: block; +} + +#fancybox-left, #fancybox-right { + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background: transparent url('fancybox/blank.gif'); + z-index: 1102; + display: none; +} + +#fancybox-left { + left: 0px; +} + +#fancybox-right { + right: 0px; +} + +#fancybox-left-ico, #fancybox-right-ico { + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; +} + +#fancybox-left-ico { + background-image: url('fancybox/fancybox.png'); + background-position: -40px -30px; +} + +#fancybox-right-ico { + background-image: url('fancybox/fancybox.png'); + background-position: -40px -60px; +} + +#fancybox-left:hover, #fancybox-right:hover { + visibility: visible; /* IE6 */ +} + +#fancybox-left:hover span { + left: 20px; +} + +#fancybox-right:hover span { + left: auto; + right: 20px; +} + +.fancybox-bg { + position: absolute; + padding: 0; + margin: 0; + border: 0; + width: 20px; + height: 20px; + z-index: 1001; +} + +#fancybox-bg-n { + top: -20px; + left: 0; + width: 100%; + background-image: url('fancybox/fancybox-x.png'); +} + +#fancybox-bg-ne { + top: -20px; + right: -20px; + background-image: url('fancybox/fancybox.png'); + background-position: -40px -162px; +} + +#fancybox-bg-e { + top: 0; + right: -20px; + height: 100%; + background-image: url('fancybox/fancybox-y.png'); + background-position: -20px 0px; +} + +#fancybox-bg-se { + bottom: -20px; + right: -20px; + background-image: url('fancybox/fancybox.png'); + background-position: -40px -182px; +} + +#fancybox-bg-s { + bottom: -20px; + left: 0; + width: 100%; + background-image: url('fancybox/fancybox-x.png'); + background-position: 0px -20px; +} + +#fancybox-bg-sw { + bottom: -20px; + left: -20px; + background-image: url('fancybox/fancybox.png'); + background-position: -40px -142px; +} + +#fancybox-bg-w { + top: 0; + left: -20px; + height: 100%; + background-image: url('fancybox/fancybox-y.png'); +} + +#fancybox-bg-nw { + top: -20px; + left: -20px; + background-image: url('fancybox/fancybox.png'); + background-position: -40px -122px; +} + +#fancybox-title { + font-family: Helvetica; + font-size: 12px; + z-index: 1102; +} + +.fancybox-title-inside { + padding-bottom: 10px; + text-align: center; + color: #333; + background: #fff; + position: relative; +} + +.fancybox-title-outside { + padding-top: 10px; + color: #fff; +} + +.fancybox-title-over { + position: absolute; + bottom: 0; + left: 0; + color: #FFF; + text-align: left; +} + +#fancybox-title-over { + padding: 10px; + background-image: url('fancybox/fancy_title_over.png'); + display: block; +} + +.fancybox-title-float { + position: absolute; + left: 0; + bottom: -20px; + height: 32px; +} + +#fancybox-title-float-wrap { + border: none; + border-collapse: collapse; + width: auto; +} + +#fancybox-title-float-wrap td { + border: none; + white-space: nowrap; +} + +#fancybox-title-float-left { + padding: 0 0 0 15px; + background: url('fancybox/fancybox.png') -40px -90px no-repeat; +} + +#fancybox-title-float-main { + color: #FFF; + line-height: 29px; + font-weight: bold; + padding: 0 0 3px 0; + background: url('fancybox/fancybox-x.png') 0px -40px; +} + +#fancybox-title-float-right { + padding: 0 0 0 15px; + background: url('fancybox/fancybox.png') -55px -90px no-repeat; +} + +/* IE6 */ + +.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); } + +.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame { + height: expression(this.parentNode.clientHeight + "px"); +} + +#fancybox-loading.fancybox-ie6 { + position: absolute; margin-top: 0; + top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'); +} + +#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); } + +/* IE6, IE7, IE8 */ +.fancybox-ie .fancybox-bg { background: transparent !important; } + +.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } \ No newline at end of file -- cgit v1.2.3 From 9a53ddf57cdbf557b0d4f21d0fdf01b4b92569c4 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Tue, 30 Aug 2011 20:52:12 -0700 Subject: Fixes #3543. Ported access collections fix to master. --- actions/friends/collections/add.php | 36 ++--- actions/friends/collections/delete.php | 29 +--- actions/friends/collections/edit.php | 14 +- engine/lib/access.php | 190 +++++++++++++--------- engine/tests/api/access_collections.php | 269 ++++++++++++++++++++++++++++++++ languages/en.php | 2 + 6 files changed, 419 insertions(+), 121 deletions(-) create mode 100644 engine/tests/api/access_collections.php (limited to 'engine') diff --git a/actions/friends/collections/add.php b/actions/friends/collections/add.php index 8ec6a085f..1e2bc1d5c 100644 --- a/actions/friends/collections/add.php +++ b/actions/friends/collections/add.php @@ -9,28 +9,24 @@ $collection_name = get_input('collection_name'); $friends = get_input('friends_collection'); -//first check to make sure that a collection name has been set and create the new colection -if ($collection_name) { +if (!$collection_name) { + register_error(elgg_echo("friends:nocollectionname")); + forward(REFERER); +} - //create the collection - $create_collection = create_access_collection($collection_name, elgg_get_logged_in_user_guid()); +$id = create_access_collection($collection_name); - //if the collection was created and the user passed some friends from the form, add them - if ($create_collection && (!empty($friends))) { - //add friends to the collection - foreach ($friends as $friend) { - add_user_to_access_collection($friend, $create_collection); - } +if ($id) { + $result = update_access_collection($id, $friends); + if ($result) { + system_message(elgg_echo("friends:collectionadded")); + // go to the collections page + forward("pg/collections/" . get_loggedin_user()->username); + } else { + register_error(elgg_echo("friends:nocollectionname")); + forward(REFERER); } - - // Success message - system_message(elgg_echo("friends:collectionadded")); - // Forward to the collections page - forward("collections/" . elgg_get_logged_in_user_entity()->username); - } else { register_error(elgg_echo("friends:nocollectionname")); - - // Forward to the add collection page - forward("collections/add"); -} + forward(REFERER); +} \ No newline at end of file diff --git a/actions/friends/collections/delete.php b/actions/friends/collections/delete.php index fe719d74b..ff8f1fb55 100644 --- a/actions/friends/collections/delete.php +++ b/actions/friends/collections/delete.php @@ -8,29 +8,16 @@ $collection_id = (int) get_input('collection'); -// Check to see that the access collection exist and grab its owner -$get_collection = get_access_collection($collection_id); - -if ($get_collection) { - - if ($get_collection->owner_guid == elgg_get_logged_in_user_guid()) { - - $delete_collection = delete_access_collection($collection_id); +// check the ACL exists and we can edit +if (!can_edit_access_collection($collection_id)) { + register_error(elgg_echo("friends:collectiondeletefailed")); + forward(REFERER); +} - // Success message - if ($delete_collection) { - system_message(elgg_echo("friends:collectiondeleted")); - } else { - register_error(elgg_echo("friends:collectiondeletefailed")); - } - } else { - // Failure message - register_error(elgg_echo("friends:collectiondeletefailed")); - } +if (delete_access_collection($collection_id)) { + system_message(elgg_echo("friends:collectiondeleted")); } else { - // Failure message register_error(elgg_echo("friends:collectiondeletefailed")); } -// Forward to the collections page -forward("collections/" . elgg_get_logged_in_user_entity()->username); +forward(REFERER); diff --git a/actions/friends/collections/edit.php b/actions/friends/collections/edit.php index b7fb716f2..9eb5e1eab 100644 --- a/actions/friends/collections/edit.php +++ b/actions/friends/collections/edit.php @@ -9,7 +9,15 @@ $collection_id = get_input('collection_id'); $friends = get_input('friend'); -//chech the collection exists and the current user owners it -update_access_collection($collection_id, $friends); +// check it exists and we can edit +if (!can_edit_access_collection($collection_id)) { + system_message(elgg_echo('friends:collection:edit_failed')); +} -exit; +if (update_access_collection($collection_id, $friends)) { + system_message(elgg_echo('friends:collections:edited')); +} else { + system_message(elgg_echo('friends:collection:edit_failed')); +} + +forward(REFERER); \ No newline at end of file diff --git a/engine/lib/access.php b/engine/lib/access.php index cde3d256f..1a4a22162 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -410,6 +410,43 @@ function get_write_access_array($user_id = 0, $site_id = 0, $flush = false) { return $tmp_access_array; } + +/** + * Can the user write to the access collection? + * + * Hook into the access:collections:write, user to change this. + * + * Respects access control disabling for admin users and {@see elgg_set_ignore_access()} + * + * @see get_write_access_array() + * + * @param int $collection_id The collection id + * @param mixed $user_guid The user GUID to check for. Defaults to logged in user. + * @return bool + */ +function can_edit_access_collection($collection_id, $user_guid = null) { + if ($user_guid) { + $user = get_entity((int) $user_guid); + } else { + $user = get_loggedin_user(); + } + + $collection = get_access_collection($collection_id); + + if (!($user instanceof ElggUser) || !$collection) { + return false; + } + + $write_access = get_write_access_array($user->getGUID(), null, true); + + // don't ignore access when checking users. + if ($user_guid) { + return array_key_exists($collection_id, $write_access); + } else { + return elgg_get_ignore_access() || array_key_exists($collection_id, $write_access); + } +} + /** * Creates a new access collection. * @@ -483,37 +520,30 @@ function create_access_collection($name, $owner_guid = 0, $site_guid = 0) { function update_access_collection($collection_id, $members) { global $CONFIG; - $collection_id = (int) $collection_id; - $members = (is_array($members)) ? $members : array(); + $acl = get_access_collection($collection_id); - $collections = get_write_access_array(); - - if (array_key_exists($collection_id, $collections)) { - $cur_members = get_members_of_access_collection($collection_id, true); - $cur_members = (is_array($cur_members)) ? $cur_members : array(); + if (!$acl) { + return false; + } + $members = (is_array($members)) ? $members : array(); - $remove_members = array_diff($cur_members, $members); - $add_members = array_diff($members, $cur_members); + $cur_members = get_members_of_access_collection($collection_id, true); + $cur_members = (is_array($cur_members)) ? $cur_members : array(); - $params = array( - 'collection_id' => $collection_id, - 'members' => $members, - 'add_members' => $add_members, - 'remove_members' => $remove_members - ); + $remove_members = array_diff($cur_members, $members); + $add_members = array_diff($members, $cur_members); - foreach ($add_members as $guid) { - add_user_to_access_collection($guid, $collection_id); - } + $result = true; - foreach ($remove_members as $guid) { - remove_user_from_access_collection($guid, $collection_id); - } + foreach ($add_members as $guid) { + $result = $result && add_user_to_access_collection($guid, $collection_id); + } - return true; + foreach ($remove_members as $guid) { + $result = $result && remove_user_from_access_collection($guid, $collection_id); } - return false; + return $result; } /** @@ -527,27 +557,26 @@ function update_access_collection($collection_id, $members) { * @see update_access_collection() */ function delete_access_collection($collection_id) { + global $CONFIG; + $collection_id = (int) $collection_id; - $collections = get_write_access_array(null, null, TRUE); $params = array('collection_id' => $collection_id); if (!elgg_trigger_plugin_hook('access:collections:deletecollection', 'collection', $params, true)) { return false; } - if (array_key_exists($collection_id, $collections)) { - global $CONFIG; - $query = "delete from {$CONFIG->dbprefix}access_collection_membership" - . " where access_collection_id = {$collection_id}"; - delete_data($query); + // Deleting membership doesn't affect result of deleting ACL. + $q = "DELETE FROM {$CONFIG->dbprefix}access_collection_membership + WHERE access_collection_id = {$collection_id}"; + delete_data($q); + + $q = "DELETE FROM {$CONFIG->dbprefix}access_collections + WHERE id = {$collection_id}"; + $result = delete_data($q); - $query = "delete from {$CONFIG->dbprefix}access_collections where id = {$collection_id}"; - delete_data($query); - return true; - } else { - return false; - } + return $result; } /** @@ -584,45 +613,34 @@ function get_access_collection($collection_id) { * @see remove_user_from_access_collection() */ function add_user_to_access_collection($user_guid, $collection_id) { + global $CONFIG; + $collection_id = (int) $collection_id; $user_guid = (int) $user_guid; - $collections = get_write_access_array(); + $user = get_user($user_guid); - if (!($collection = get_access_collection($collection_id))) { - return false; - } + $collection = get_access_collection($collection_id); - $user = get_user($user_guid); - if (!$user) { + if (!($user instanceof Elgguser) || !$collection) { return false; } - // to add someone to a collection, the user must be a member of the collection or - // no one must own it - if ((array_key_exists($collection_id, $collections) || $collection->owner_guid == 0)) { - $result = true; - } else { - $result = false; - } - $params = array( 'collection_id' => $collection_id, - 'collection' => $collection, 'user_guid' => $user_guid ); - $result = elgg_trigger_plugin_hook('access:collections:add_user', 'collection', $params, $result); + $result = elgg_trigger_plugin_hook('access:collections:add_user', 'collection', $params, true); if ($result == false) { return false; } try { - global $CONFIG; - $query = "insert into {$CONFIG->dbprefix}access_collection_membership" - . " set access_collection_id = {$collection_id}, user_guid = {$user_guid}"; - insert_data($query); + $q = "INSERT INTO {$CONFIG->dbprefix}access_collection_membership + SET access_collection_id = {$collection_id}, + user_guid = {$user_guid}"; + insert_data($q); } catch (DatabaseException $e) { - // nothing. return false; } @@ -640,34 +658,32 @@ function add_user_to_access_collection($user_guid, $collection_id) { * @return true|false Depending on success */ function remove_user_from_access_collection($user_guid, $collection_id) { + global $CONFIG; + $collection_id = (int) $collection_id; $user_guid = (int) $user_guid; - $collections = get_write_access_array(); - $user = $user = get_user($user_guid); + $user = get_user($user_guid); + + $collection = get_access_collection($collection_id); - if (!($collection = get_access_collection($collection_id))) { + if (!($user instanceof Elgguser) || !$collection) { return false; } - if ((array_key_exists($collection_id, $collections) || $collection->owner_guid == 0) && $user) { - global $CONFIG; - $params = array( - 'collection_id' => $collection_id, - 'user_guid' => $user_guid - ); - - if (!elgg_trigger_plugin_hook('access:collections:remove_user', 'collection', $params, true)) { - return false; - } - - delete_data("delete from {$CONFIG->dbprefix}access_collection_membership " - . "where access_collection_id = {$collection_id} and user_guid = {$user_guid}"); - - return true; + $params = array( + 'collection_id' => $collection_id, + 'user_guid' => $user_guid + ); + if (!elgg_trigger_plugin_hook('access:collections:remove_user', 'collection', $params, true)) { + return false; } - return false; + $q = "DELETE FROM {$CONFIG->dbprefix}access_collection_membership + WHERE access_collection_id = {$collection_id} + AND user_guid = {$user_guid}"; + + return delete_data($q); } /** @@ -939,8 +955,17 @@ function access_init() { * @since 1.7.0 * @elgg_event_handler permissions_check all */ -function elgg_override_permissions_hook() { - $user_guid = elgg_get_logged_in_user_guid(); +function elgg_override_permissions_hook($hook, $type, $value, $params) { + $user = elgg_extract('user', $params); + if (!$user) { + $user = elgg_get_logged_in_user(); + } + + if (!$user instanceof ElggUser) { + return false; + } + + $user_guid = $user->guid; // check for admin if ($user_guid && elgg_is_admin_user($user_guid)) { @@ -956,9 +981,20 @@ function elgg_override_permissions_hook() { return NULL; } +/** + * Runs unit tests for the entities object. + */ +function access_test($hook, $type, $value, $params) { + global $CONFIG; + $value[] = $CONFIG->path . 'engine/tests/api/access_collections.php'; + return $value; +} + // This function will let us know when 'init' has finished elgg_register_event_handler('init', 'system', 'access_init', 9999); // For overrided permissions elgg_register_plugin_hook_handler('permissions_check', 'all', 'elgg_override_permissions_hook'); elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'elgg_override_permissions_hook'); + +elgg_register_plugin_hook_handler('unit_test', 'system', 'access_test'); \ No newline at end of file diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php new file mode 100644 index 000000000..1e61c45bb --- /dev/null +++ b/engine/tests/api/access_collections.php @@ -0,0 +1,269 @@ +dbPrefix = get_config("dbprefix"); + + $user = new ElggUser(); + $user->username = 'test_user_' . rand(); + $user->email = 'fake_email@fake.com' . rand(); + $user->name = 'fake user'; + $user->access_id = ACCESS_PUBLIC; + $user->salt = generate_random_cleartext_password(); + $user->password = generate_user_password($user, rand()); + $user->owner_guid = 0; + $user->container_guid = 0; + $user->save(); + + $this->user = $user; + } + + /** + * Called before each test method. + */ + public function setUp() { + + } + + /** + * Called after each test method. + */ + public function tearDown() { + // do not allow SimpleTest to interpret Elgg notices as exceptions + $this->swallowErrors(); + } + + /** + * Called after each test object. + */ + public function __destruct() { + // all __destruct() code should go above here + $this->user->delete(); + parent::__destruct(); + } + + public function testCreateGetDeleteACL() { + global $DB_QUERY_CACHE; + + $acl_name = 'test access collection'; + $acl_id = create_access_collection($acl_name); + + $this->assertTrue(is_int($acl_id)); + + $q = "SELECT * FROM {$this->dbPrefix}access_collections WHERE id = $acl_id"; + $acl = get_data_row($q); + + $this->assertEqual($acl->id, $acl_id); + + if ($acl) { + $DB_QUERY_CACHE = array(); + + $this->assertEqual($acl->name, $acl_name); + + $result = delete_access_collection($acl_id); + $this->assertTrue($result); + + $q = "SELECT * FROM {$this->dbPrefix}access_collections WHERE id = $acl_id"; + $data = get_data($q); + $this->assertFalse($data); + } + } + + public function testAddRemoveUserToACL() { + $acl_id = create_access_collection('test acl'); + + $result = add_user_to_access_collection($this->user->guid, $acl_id); + $this->assertTrue($result); + + if ($result) { + $result = remove_user_from_access_collection($this->user->guid, $acl_id); + $this->assertTrue($result); + } + + delete_access_collection($acl_id); + } + + public function testUpdateACL() { + // another fake user to test with + $user = new ElggUser(); + $user->username = 'test_user_' . rand(); + $user->email = 'fake_email@fake.com' . rand(); + $user->name = 'fake user'; + $user->access_id = ACCESS_PUBLIC; + $user->salt = generate_random_cleartext_password(); + $user->password = generate_user_password($user, rand()); + $user->owner_guid = 0; + $user->container_guid = 0; + $user->save(); + + $acl_id = create_access_collection('test acl'); + + $member_lists = array( + // adding + array( + $this->user->guid, + $user->guid + ), + // removing one, keeping one. + array( + $user->guid + ), + // removing one, adding one + array( + $this->user->guid, + ), + // removing all. + array() + ); + + foreach ($member_lists as $members) { + $result = update_access_collection($acl_id, $members); + $this->assertTrue($result); + + if ($result) { + $q = "SELECT * FROM {$this->dbPrefix}access_collection_membership + WHERE access_collection_id = $acl_id"; + $data = get_data($q); + + if (count($members) == 0) { + $this->assertFalse($data); + } else { + $this->assertEqual(count($members), count($data)); + } + foreach ($data as $row) { + $this->assertTrue(in_array($row->user_guid, $members)); + } + } + } + + delete_access_collection($acl_id); + $user->delete(); + } + + public function testCanEditACL() { + $acl_id = create_access_collection('test acl', $this->user->guid); + + // should be true since it's the owner + $result = can_edit_access_collection($acl_id, $this->user->guid); + $this->assertTrue($result); + + // should be true since IA is on. + $ia = elgg_set_ignore_access(true); + $result = can_edit_access_collection($acl_id); + $this->assertTrue($result); + elgg_set_ignore_access($ia); + + // should be false since IA is off + $ia = elgg_set_ignore_access(false); + $result = can_edit_access_collection($acl_id); + $this->assertFalse($result); + elgg_set_ignore_access($ia); + + delete_access_collection($acl_id); + } + + public function testCanEditACLHook() { + // if only we supported closures! + global $acl_test_info; + + $acl_id = create_access_collection('test acl'); + + $acl_test_info = array( + 'acl_id' => $acl_id, + 'user' => $this->user + ); + + function test_acl_access_hook($hook, $type, $value, $params) { + global $acl_test_info; + if ($params['user_id'] == $acl_test_info['user']->guid) { + $acl = get_access_collection($acl_test_info['acl_id']); + $value[$acl->id] = $acl->name; + } + + return $value; + } + + register_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook'); + + // enable security since we usually run as admin + $ia = elgg_set_ignore_access(false); + $result = can_edit_access_collection($acl_id, $this->user->guid); + $this->assertTrue($result); + $ia = elgg_set_ignore_access($ia); + + unregister_plugin_hook('access:collections:write', 'all', 'test_acl_access_hook'); + } + + // groups interface + // only runs if the groups plugin is enabled because implementation is split between + // core and the plugin. + public function testCreateDeleteGroupACL() { + if (!is_plugin_enabled('groups')) { + return; + } + + $group = new ElggGroup(); + $group->name = 'Test group'; + $group->save(); + $acl = get_access_collection($group->group_acl); + + // ACLs are owned by groups + $this->assertEqual($acl->owner_guid, $group->guid); + + // removing group and acl + $this->assertTrue($group->delete()); + + $acl = get_access_collection($group->group_acl); + $this->assertFalse($acl); + + $group->delete(); + } + + public function testJoinLeaveGroupACL() { + if (!is_plugin_enabled('groups')) { + return; + } + + $group = new ElggGroup(); + $group->name = 'Test group'; + $group->save(); + + $result = $group->join($this->user); + $this->assertTrue($result); + + // disable security since we run as admin + $ia = elgg_set_ignore_access(false); + + // need to set the page owner to emulate being in a group context. + // this is kinda hacky. + elgg_set_page_owner_guid($group->getGUID()); + + if ($result) { + $can_edit = can_edit_access_collection($group->group_acl, $this->user->guid); + $this->assertTrue($can_edit); + } + + $result = $group->leave($this->user); + $this->assertTrue($result); + + if ($result) { + $can_edit = can_edit_access_collection($group->group_acl, $this->user->guid); + $this->assertFalse($can_edit); + } + + elgg_set_ignore_access($ia); + + $group->delete(); + } +} diff --git a/languages/en.php b/languages/en.php index da5f0ef81..ab3c523de 100644 --- a/languages/en.php +++ b/languages/en.php @@ -344,6 +344,8 @@ $english = array( 'friends:nocollectionname' => "You need to give your collection a name before it can be created.", 'friends:collections:members' => "Collection members", 'friends:collections:edit' => "Edit collection", + 'friends:collections:edited' => "Saved collection", + 'friends:collection:edit_failed' => 'Could not save collection.', 'friendspicker:chararray' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', -- cgit v1.2.3 From 4d47ecbb311d556f155ad866bbce358fbfb51218 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sat, 3 Sep 2011 11:49:59 -0700 Subject: Fixed typo in call to function. --- engine/lib/access.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/access.php b/engine/lib/access.php index 1a4a22162..678c9e77b 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -958,7 +958,7 @@ function access_init() { function elgg_override_permissions_hook($hook, $type, $value, $params) { $user = elgg_extract('user', $params); if (!$user) { - $user = elgg_get_logged_in_user(); + $user = elgg_get_logged_in_user_entity(); } if (!$user instanceof ElggUser) { -- cgit v1.2.3 From c3d0cf509298298159db0ca75a71aa3676c548e5 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sun, 4 Sep 2011 17:15:42 -0700 Subject: Refs #3661. Merged $CONFIG->lastcache fix to master. Fixes #3530. $CONFIG->lastcache has correct value on page load when cache is regenerated. git-svn-id: http://code.elgg.org/elgg/branches/1.7@9204 36083f99-b078-4883-b0ff-0f9b5a30f544 Conflicts: engine/start.php --- engine/start.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engine') diff --git a/engine/start.php b/engine/start.php index 713d94cc6..132c060b4 100644 --- a/engine/start.php +++ b/engine/start.php @@ -144,7 +144,9 @@ if (!defined('UPGRADING')) { $lastcached = datalist_get("simplecache_lastcached_$viewtype"); if ($lastupdate == 0 || $lastcached < $lastupdate) { elgg_regenerate_simplecache($viewtype); + $lastcached = datalist_get("simplecache_lastcached_$viewtype"); } + $CONFIG->lastcache = $lastcached; } // System loaded and ready -- cgit v1.2.3 From 9f3c651ccd3f0f43a9d8d61cff4b71e3e29069d7 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sun, 4 Sep 2011 17:43:56 -0700 Subject: Refs #3661. Merged XSS fixes in search to master. --- engine/lib/entities.php | 8 ++++++-- mod/search/search_hooks.php | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 10313fc8c..68aa7c8fb 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1118,8 +1118,12 @@ function elgg_get_guid_based_where_sql($column, $guids) { $guids_sanitized = array(); foreach ($guids as $guid) { - if (($guid != sanitise_int($guid))) { - return FALSE; + if ($guid !== ELGG_ENTITIES_NO_VALUE) { + $guid = sanitise_int($guid); + + if (!$guid) { + return false; + } } $guids_sanitized[] = $guid; } diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php index 428d6f700..b302272fb 100644 --- a/mod/search/search_hooks.php +++ b/mod/search/search_hooks.php @@ -202,6 +202,10 @@ function search_tags_hook($hook, $type, $value, $params) { $search_tag_names = $valid_tag_names; } + if (!$search_tag_names) { + return array('entities' => array(), 'count' => $count); + } + // don't use elgg_get_entities_from_metadata() here because of // performance issues. since we don't care what matches at this point // use an IN clause to grab everything that matches at once and sort @@ -337,7 +341,7 @@ function search_comments_hook($hook, $type, $value, $params) { $container_and = ''; if ($params['container_guid'] && $params['container_guid'] !== ELGG_ENTITIES_ANY_VALUE) { - $container_and = 'AND e.container_guid = ' . sanitise_string($params['container_guid']); + $container_and = 'AND e.container_guid = ' . sanitise_int($params['container_guid']); } $e_access = get_access_sql_suffix('e'); -- cgit v1.2.3 From b5899156dfba7aa51e14fba302219e73793fa6a2 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sun, 4 Sep 2011 17:45:58 -0700 Subject: Refs #3661. Merged lat/long metadata fixes to master. --- engine/classes/ElggEntity.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 6edc99dd4..7c8828a98 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -1432,11 +1432,7 @@ abstract class ElggEntity extends ElggData implements * @return true */ public function setLocation($location) { - $location = sanitise_string($location); - - $this->location = $location; - - return true; + return $this->location = $location; } /** @@ -1449,9 +1445,6 @@ abstract class ElggEntity extends ElggData implements * @todo Unimplemented */ public function setLatLong($lat, $long) { - $lat = sanitise_string($lat); - $long = sanitise_string($long); - $this->set('geo:lat', $lat); $this->set('geo:long', $long); -- cgit v1.2.3 From 0cf99813eb034aa1219a15ba86a105d63a584cc0 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sun, 4 Sep 2011 17:55:26 -0700 Subject: Fixes #3661. Pulled in recursive delete fixes to master. --- engine/lib/entities.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engine') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 68aa7c8fb..cea8af1da 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1498,6 +1498,7 @@ function delete_entity($guid, $recursive = true) { $entity_disable_override = access_get_show_hidden_status(); access_show_hidden_entities(true); + $ia = elgg_set_ignore_access(true); $sub_entities = get_data("SELECT * from {$CONFIG->dbprefix}entities WHERE container_guid=$guid or owner_guid=$guid @@ -1510,6 +1511,7 @@ function delete_entity($guid, $recursive = true) { access_show_hidden_entities($entity_disable_override); $__RECURSIVE_DELETE_TOKEN = null; + elgg_set_ignore_access($ia); } // Now delete the entity itself -- cgit v1.2.3 From 0c691827db6066c8e371279a87682decf4c511d3 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Mon, 5 Sep 2011 16:46:37 -0700 Subject: Improved documentation for deprecated functions. --- engine/lib/deprecated-1.8.php | 85 ++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 42 deletions(-) (limited to 'engine') diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index ff4fa0756..8118d84dd 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -1146,7 +1146,7 @@ function get_entities_from_metadata_groups_multi($group_guid, $meta_array, $enti * @param bool $navigation Display pagination? Default: true * * @return string A viewable list of entities - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_location() */ function list_entities_in_area($lat, $long, $radius, $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) { elgg_deprecated_notice('list_entities_in_area() was deprecated. Use elgg_list_entities_from_location()', 1.8); @@ -1195,7 +1195,7 @@ function list_entities_in_area($lat, $long, $radius, $type = "", $subtype = "", * @param bool $navigation Display pagination? Default: true * * @return string A viewable list of entities - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_list_entities_from_location() */ function list_entities_location($location, $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $navigation = true) { elgg_deprecated_notice('list_entities_location() was deprecated. Use elgg_list_entities_from_metadata()', 1.8); @@ -1220,7 +1220,7 @@ function list_entities_location($location, $type = "", $subtype = "", $owner_gui * @param int|array $container_guid Container GUID * * @return array A list of entities. - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_location() */ function get_entities_in_area($lat, $long, $radius, $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = NULL) { elgg_deprecated_notice('get_entities_in_area() was deprecated by elgg_get_entities_from_location()!', 1.8); @@ -1369,7 +1369,7 @@ function list_entities_from_metadata_multi($meta_array, $entity_type = "", $enti * Deprecated by elgg_register_menu_item(). Set $menu_name to 'page'. * * @see elgg_register_menu_item() - * @deprecated 1.8 + * @deprecated 1.8 Use the new menu system * * @param string $label The label * @param string $link The link @@ -1411,7 +1411,7 @@ function add_submenu_item($label, $link, $group = 'default', $onclick = false, $ /** * Remove an item from submenu by label * - * @deprecated 1.8 + * @deprecated 1.8 Use the new menu system * @see elgg_unregister_menu_item() * * @param string $label The item label @@ -1429,7 +1429,7 @@ function remove_submenu_item($label, $group = 'a') { * Use elgg_view_menu(). Set $menu_name to 'owner_block'. * * @see elgg_view_menu() - * @deprecated 1.8 + * @deprecated 1.8 Use the new menu system. elgg_view_menu() * * @return string */ @@ -1465,7 +1465,7 @@ function add_menu($menu_name, $menu_url, $menu_children = array(), $context = "" * @param string $menu_name The name of the menu item * * @return true|false Depending on success - * @deprecated 1.8 + * @deprecated 1.8 Use the new menu system */ function remove_menu($menu_name) { elgg_deprecated_notice("remove_menu() deprecated by elgg_unregister_menu_item()", 1.8); @@ -1478,7 +1478,7 @@ function remove_menu($menu_name) { * @param string $title The title * * @return string The optimised title - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_friendly_title() */ function friendly_title($title) { elgg_deprecated_notice('friendly_title was deprecated by elgg_get_friendly_title', 1.8); @@ -1491,7 +1491,7 @@ function friendly_title($title) { * @param int $time A UNIX epoch timestamp * * @return string The friendly time - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_view_friendly_time() */ function friendly_time($time) { elgg_deprecated_notice('friendly_time was deprecated by elgg_view_friendly_time', 1.8); @@ -1501,7 +1501,7 @@ function friendly_time($time) { /** * Filters a string into an array of significant words * - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. * * @param string $string A string * @@ -1539,7 +1539,7 @@ function filter_string($string) { /** * Returns true if the word in $input is considered significant * - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. * * @param string $input A word * @@ -1645,7 +1645,7 @@ function get_context() { /** * Returns a list of plugins to load, in the order that they should be loaded. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_plugin_ids_in_dir() or elgg_get_plugins() * * @return array List of plugins */ @@ -1676,7 +1676,7 @@ function get_plugin_list() { * elgg_regenerate_simplecache(); * elgg_filepath_cache_reset(); * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_generate_plugin_entities() and elgg_set_plugin_priorities() * * @param array $pluginorder Optionally, a list of existing plugins and their orders * @@ -1708,7 +1708,7 @@ function regenerate_plugin_list($pluginorder = FALSE) { * * i.e., if the last plugin was in /mod/foobar/, get_plugin_name would return foo_bar. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_calling_plugin_id() * * @param boolean $mainfilename If set to true, this will instead determine the * context from the main script filename called by @@ -1727,7 +1727,7 @@ function get_plugin_name($mainfilename = false) { * * @example plugins/manifest.xml Example 1.8-style manifest file. * - * @deprecated 1.8 + * @deprecated 1.8 Use ElggPlugin->getManifest() * * @param string $plugin Plugin name. * @return array of values @@ -1750,7 +1750,7 @@ function load_plugin_manifest($plugin) { * This function checks a plugin manifest 'elgg_version' value against the current install * returning TRUE if the elgg_version is >= the current install's version. * - * @deprecated 1.8 + * @deprecated 1.8 Use ElggPlugin->canActivate() * * @param string $manifest_elgg_version_string The build version (eg 2009010201). * @return bool @@ -1773,7 +1773,7 @@ function check_plugin_compatibility($manifest_elgg_version_string) { /** * Shorthand function for finding the plugin settings. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_calling_plugin_entity() or elgg_get_plugin_from_id() * * @param string $plugin_id Optional plugin id, if not specified * then it is detected from where you are calling. @@ -1792,7 +1792,7 @@ function find_plugin_settings($plugin_id = null) { /** * Return an array of installed plugins. * - * @deprecated 1.8 + * @deprecated 1.8 use elgg_get_plugins() * * @param string $status any|enabled|disabled * @return array @@ -1843,7 +1843,7 @@ function get_installed_plugins($status = 'all') { * elgg_regenerate_simplecache(); * elgg_filepath_cache_reset(); * - * @deprecated 1.8 + * @deprecated 1.8 Use ElggPlugin->activate() * * @param string $plugin The plugin name. * @param int $site_guid The site id, if not specified then this is detected. @@ -1884,7 +1884,7 @@ function enable_plugin($plugin, $site_guid = null) { * elgg_regenerate_simplecache(); * elgg_filepath_cache_reset(); * - * @deprecated 1.8 + * @deprecated 1.8 Use ElggPlugin->deactivate() * * @param string $plugin The plugin name. * @param int $site_guid The site id, if not specified then this is detected. @@ -1915,7 +1915,7 @@ function disable_plugin($plugin, $site_guid = 0) { /** * Return whether a plugin is enabled or not. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_is_active_plugin() * * @param string $plugin The plugin name. * @param int $site_guid The site id, if not specified then this is detected. @@ -1943,7 +1943,7 @@ function is_plugin_enabled($plugin, $site_guid = 0) { * @param mixed $container_guid The container(s) GUIDs * * @return array A list of entities. - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_private_settings() */ function get_entities_from_private_setting($name = "", $value = "", $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, @@ -2022,13 +2022,13 @@ $container_guid = null) { * @param mixed $container_guid Container GUID * * @return array A list of entities. - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_private_settings() */ function get_entities_from_private_setting_multi(array $name, $type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null) { - elgg_deprecated_notice('get_entities_from_private_setting_multi() was deprecated by elgg_get_entities_from_private_setting()!', 1.8); + elgg_deprecated_notice('get_entities_from_private_setting_multi() was deprecated by elgg_get_entities_from_private_settings()!', 1.8); $options = array(); @@ -2194,7 +2194,7 @@ $subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $count = false, $site_ /** * Displays a human-readable list of entities * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_list_entities_from_relationship_count() * * @param string $relationship The relationship eg "friends_of" * @param bool $inverse_relationship Inverse relationship owners @@ -2245,7 +2245,7 @@ $listtypetoggle = false, $pagination = true) { * Gets the number of entities by a the number of entities related to * them in a particular way also constrained by metadata. * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_entities_from_relationship() * * @param string $relationship The relationship eg "friends_of" * @param int $relationship_guid The guid of the entity to use query @@ -2337,7 +2337,7 @@ $subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $count = false, $site_ * @param int $posted_max The maximum time period to look at. Default: none * * @return array|false Depending on success - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_river() */ function get_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '', $type = '', $subtype = '', $action_type = '', $limit = 20, $offset = 0, $posted_min = 0, @@ -2404,7 +2404,7 @@ $posted_max = 0) { * @param bool $pagination Show pagination? * * @return string Human-readable river. - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_list_river() */ function elgg_view_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '', $type = '', $subtype = '', $action_type = '', $limit = 20, $posted_min = 0, @@ -2433,7 +2433,8 @@ $posted_max = 0, $pagination = true) { /** * Construct and execute the query required for the activity stream. * - * @deprecated 1.8 + * @deprecated 1.8 This is outdated and uses the systemlog table instead of the river table. + * Don't use it. */ function get_activity_stream_data($limit = 10, $offset = 0, $type = "", $subtype = "", $owner_guid = "", $owner_relationship = "") { @@ -2668,7 +2669,7 @@ function list_site_members($site_guid, $limit = 10, $fullview = true) { * @param int $collection_guid Collection GUID * * @return mixed - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. */ function add_site_collection($site_guid, $collection_guid) { elgg_deprecated_notice("add_site_collection has been deprecated", 1.8); @@ -2687,7 +2688,7 @@ function add_site_collection($site_guid, $collection_guid) { * @param int $collection_guid Collection GUID * * @return mixed - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. */ function remove_site_collection($site_guid, $collection_guid) { elgg_deprecated_notice("remove_site_collection has been deprecated", 1.8); @@ -2706,7 +2707,7 @@ function remove_site_collection($site_guid, $collection_guid) { * @param int $offset Offset * * @return mixed - * @deprecated 1.8 + * @deprecated 1.8 Don't use this. */ function get_site_collections($site_guid, $subtype = "", $limit = 10, $offset = 0) { elgg_deprecated_notice("get_site_collections has been deprecated", 1.8); @@ -2944,7 +2945,7 @@ $limit = 0, $offset = 0) { * @param bool $status Validated (true) or false * @param string $method Optional method to say how a user was validated * @return bool - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_set_user_validation_status() */ function set_user_validation_status($user_guid, $status, $method = '') { elgg_deprecated_notice("set_user_validation_status() is deprecated", 1.8); @@ -2957,7 +2958,7 @@ function set_user_validation_status($user_guid, $status, $method = '') { * This function invalidates any existing validation value. * * @param int $user_guid User's GUID - * @deprecated 1.8 + * @deprecated 1.8 Hook into the register, user plugin hook and request validation. */ function request_user_validation($user_guid) { elgg_deprecated_notice("request_user_validation() is deprecated. @@ -3314,7 +3315,7 @@ function clear_all_plugin_settings($plugin_id = "") { * @param int $entity_owner_guid Owner guid for the entity * * @return array - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_annotations() */ function get_annotations($entity_guid = 0, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", $timelower = 0, @@ -3379,7 +3380,7 @@ $timeupper = 0, $entity_owner_guid = 0) { * @param true|false $asc Display annotations in ascending order. (Default: true) * * @return string HTML (etc) version of the annotation list - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_list_annotations() */ function list_annotations($entity_guid, $name = "", $limit = 25, $asc = true) { elgg_deprecated_notice('list_annotations() is deprecated by elgg_list_annotations()', 1.8); @@ -3412,7 +3413,7 @@ function list_annotations($entity_guid, $name = "", $limit = 25, $asc = true) { * @param unknown_type $timelower * @param unknown_type $timeupper * @param unknown_type $calculation - * @deprecated 1.8 + * @internal Don't use this at all. */ function elgg_deprecated_annotation_calculation($entity_guid = 0, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0, $timelower = 0, @@ -3590,7 +3591,7 @@ $value = "", $value_type = "", $owner_guid = 0) { * @param int $timeupper Upper time limit * * @return int - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_get_annotations() and pass anntoation_calculation => */ function get_annotations_calculate_x($sum = "avg", $entity_guid, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0, @@ -4501,7 +4502,7 @@ function save_widget_info($widget_guid, $params) { * @param int $owner Owner guid * * @return void - * @deprecated 1.8 + * @deprecated 1.8 Don't use. */ function reorder_widgets_from_panel($panelstring1, $panelstring2, $panelstring3, $context, $owner) { elgg_deprecated_notice("reorder_widgets_from_panel() is deprecated", 1.8); @@ -4609,7 +4610,7 @@ function reorder_widgets_from_panel($panelstring1, $panelstring2, $panelstring3, * @param string $context The context we wish to enable context for * * @return void - * @deprecated 1.8 + * @deprecated 1.8 Don't use. */ function use_widgets($context) { elgg_deprecated_notice("use_widgets is deprecated", 1.8); @@ -4632,7 +4633,7 @@ function use_widgets($context) { * Determines whether or not the current context is using widgets * * @return bool Depending on widget status - * @deprecated 1.8 + * @deprecated 1.8 Don't use. */ function using_widgets() { elgg_deprecated_notice("using_widgets is deprecated", 1.8); @@ -4654,7 +4655,7 @@ function using_widgets() { * @param ElggObject $widget The widget to display * @return string The HTML for the widget, including JavaScript wrapper * - * @deprecated 1.8 + * @deprecated 1.8 Use elgg_view_entity() */ function display_widget(ElggObject $widget) { elgg_deprecated_notice("display_widget() was been deprecated. Use elgg_view_entity().", 1.8); -- cgit v1.2.3 From 4144076f40185ff6fdb0f14441d88e6c700f1e85 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Mon, 5 Sep 2011 21:32:36 -0700 Subject: Fixed a stupid problem I introduced in the installation and only just caught >:O --- CHANGES.txt | 3 +++ engine/lib/access.php | 7 ++++--- version.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/CHANGES.txt b/CHANGES.txt index cccd75d5e..2df4d2637 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -73,6 +73,9 @@ Version 1.8.0 (Jackie) core. The original dashboard can be restored by the new Dashboard plugin. * twitter_service - Replaced by Twitter API. + Elgg 1.8.0.1 was released immediately after 1.8.0 to correct a problem in + installation. + Previous and Merged Changes: diff --git a/engine/lib/access.php b/engine/lib/access.php index 678c9e77b..6da747463 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -961,9 +961,10 @@ function elgg_override_permissions_hook($hook, $type, $value, $params) { $user = elgg_get_logged_in_user_entity(); } - if (!$user instanceof ElggUser) { - return false; - } + // don't do this so ignore access still works. +// if (!$user instanceof ElggUser) { +// return false; +// } $user_guid = $user->guid; diff --git a/version.php b/version.php index 932d31961..5bc115d35 100644 --- a/version.php +++ b/version.php @@ -14,4 +14,4 @@ $version = 2011061200; // Human-friendly version name -$release = '1.8.0'; +$release = '1.8.0.1'; -- cgit v1.2.3 From 9097dd60953aa7f590a8de57c1c8302bf16beaef Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 10 Sep 2011 18:09:15 -0400 Subject: Fixes #3782 only deleting metadata if the entity has been saved --- engine/classes/ElggEntity.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 7c8828a98..2fa0d7b02 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -371,13 +371,18 @@ abstract class ElggEntity extends ElggData implements * Deletes all metadata on this object (metadata.entity_guid = $this->guid). * If you pass a name, only metadata matching that name will be deleted. * - * @warning Calling this with no or empty arguments will clear all metadata on the entity. + * @warning Calling this with no $name will clear all metadata on the entity. * - * @param null|string $name The metadata name to remove. + * @param null|string $name The name of the metadata to remove. * @return bool * @since 1.8 */ public function deleteMetadata($name = null) { + + if (!$this->guid) { + return false; + } + $options = array( 'guid' => $this->guid, 'limit' => 0 -- cgit v1.2.3 From 4f6968700eb5eff3e45fdb4935c275e41a1d3adf Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 10 Sep 2011 18:35:32 -0400 Subject: made the documentation of the plugin settings code a little clearer --- engine/lib/plugins.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index ba98e94f1..fd85ed9f0 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -816,7 +816,7 @@ function elgg_set_plugin_user_setting($name, $value, $user_guid = null, $plugin_ /** * Unsets a user-specific plugin setting * - * @param str $name Name of the plugin setting + * @param str $name Name of the setting * @param int $user_guid Defaults to logged in user * @param str $plugin_id Defaults to contextual plugin name * @@ -839,7 +839,7 @@ function elgg_unset_plugin_user_setting($name, $user_guid = null, $plugin_id = n /** * Get a user specific setting for a plugin. * - * @param string $name The name. + * @param string $name The name of the setting. * @param int $user_guid Guid of owning user * @param string $plugin_id Optional plugin name, if not specified * it is detected from where you are calling. @@ -863,7 +863,7 @@ function elgg_get_plugin_user_setting($name, $user_guid = null, $plugin_id = nul /** * Set a setting for a plugin. * - * @param string $name The name - note, can't be "title". + * @param string $name The name of the setting - note, can't be "title". * @param mixed $value The value. * @param string $plugin_id Optional plugin name, if not specified * then it is detected from where you are calling from. @@ -887,7 +887,7 @@ function elgg_set_plugin_setting($name, $value, $plugin_id = null) { /** * Get setting for a plugin. * - * @param string $name The name. + * @param string $name The name of the setting. * @param string $plugin_id Optional plugin name, if not specified * then it is detected from where you are calling from. * @@ -910,7 +910,7 @@ function elgg_get_plugin_setting($name, $plugin_id = null) { /** * Unsets a plugin setting. * - * @param string $name The name. + * @param string $name The name of the setting. * @param string $plugin_id Optional plugin name, if not specified * then it is detected from where you are calling from. * -- cgit v1.2.3 From 03a14b636d9787c3fdd90301433fc51721d541f5 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 10 Sep 2011 20:57:10 -0400 Subject: Fixes #3688 setting the page setup variable in $CONFIG before trigger the event to prevent a stack overflow --- engine/lib/views.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/views.php b/engine/lib/views.php index 16aa147e4..54fd52c70 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -369,8 +369,8 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie // Trigger the pagesetup event if (!isset($CONFIG->pagesetupdone)) { - elgg_trigger_event('pagesetup', 'system'); $CONFIG->pagesetupdone = true; + elgg_trigger_event('pagesetup', 'system'); } if (!is_array($usercache)) { -- cgit v1.2.3 From 7181f99b01369e4c17c830ae85c935f6648e679e Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 10 Sep 2011 21:18:22 -0400 Subject: Fixes #3665, #3660 added plugin hooks for page and layouts so that rss icon for page meta menu can be registered consistently --- engine/lib/views.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'engine') diff --git a/engine/lib/views.php b/engine/lib/views.php index 54fd52c70..0646851f0 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -617,13 +617,12 @@ function elgg_view_page($title, $body, $page_shell = 'default', $vars = array()) $vars['title'] = $title; $vars['body'] = $body; $vars['sysmessages'] = $messages; + + $vars = elgg_trigger_plugin_hook('output:before', 'page', null, $vars); // check for deprecated view if ($page_shell == 'default' && elgg_view_exists('pageshells/pageshell')) { elgg_deprecated_notice("pageshells/pageshell is deprecated by page/$page_shell", 1.8); - global $CONFIG; - - $vars['config'] = $CONFIG; $output = elgg_view('pageshells/pageshell', $vars); } else { $output = elgg_view("page/$page_shell", $vars); @@ -681,15 +680,19 @@ function elgg_view_layout($layout_name, $vars = array()) { $param_array = $vars; } + $params = elgg_trigger_plugin_hook('output:before', 'layout', null, $param_array); + // check deprecated location if (elgg_view_exists("canvas/layouts/$layout_name")) { elgg_deprecated_notice("canvas/layouts/$layout_name is deprecated by page/layouts/$layout_name", 1.8); - return elgg_view("canvas/layouts/$layout_name", $param_array); + $output = elgg_view("canvas/layouts/$layout_name", $params); } elseif (elgg_view_exists("page/layouts/$layout_name")) { - return elgg_view("page/layouts/$layout_name", $param_array); + $output = elgg_view("page/layouts/$layout_name", $params); } else { - return elgg_view("page/layouts/default", $param_array); + $output = elgg_view("page/layouts/default", $params); } + + return elgg_trigger_plugin_hook('output:after', 'layout', $params, $output); } /** @@ -1567,7 +1570,7 @@ function elgg_views_boot() { elgg_register_css('elgg', $elgg_css_url, 1); elgg_load_css('elgg'); - elgg_register_event_handler('pagesetup', 'system', 'elgg_views_add_rss_link'); + elgg_register_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link'); // discover the built-in view types // @todo the cache is loaded in load_plugins() but we need to know view_types earlier -- cgit v1.2.3 From 60b1f78d9dbc8a1d1830a5d68d6ebb27c58d3efa Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 10 Sep 2011 21:30:02 -0400 Subject: Fixes #3741 fixed menu code so that all links do not get empty title and confirm attributes --- engine/classes/ElggMenuItem.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index cfdc2f5fa..f7a6b5c65 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -59,7 +59,7 @@ class ElggMenuItem { /** * @var string Tooltip */ - protected $title = ''; + protected $title = false; /** * @var string The string to display if link is clicked @@ -552,6 +552,8 @@ class ElggMenuItem { if ($this->confirm) { $vars['confirm'] = $this->confirm; return elgg_view('output/confirmlink', $vars); + } else { + unset($vars['confirm']); } return elgg_view('output/url', $vars); -- cgit v1.2.3 From d3b4548a57668ffef7c02b9bc3b84e69a0a5eb8b Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 11 Sep 2011 07:34:36 -0400 Subject: Fixes #3794 fixes menu links so that admins can edit avatars --- engine/lib/users.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'engine') diff --git a/engine/lib/users.php b/engine/lib/users.php index 48f10f974..36e137876 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1419,11 +1419,14 @@ function elgg_profile_page_handler($page) { */ function users_pagesetup() { - if (elgg_get_page_owner_guid()) { + $owner = elgg_get_page_owner_entity(); + $viewer = elgg_get_logged_in_user_entity(); + + if ($owner) { $params = array( 'name' => 'friends', 'text' => elgg_echo('friends'), - 'href' => 'friends/' . elgg_get_page_owner_entity()->username, + 'href' => 'friends/' . $owner->username, 'contexts' => array('friends') ); elgg_register_menu_item('page', $params); @@ -1431,43 +1434,43 @@ function users_pagesetup() { $params = array( 'name' => 'friends:of', 'text' => elgg_echo('friends:of'), - 'href' => 'friendsof/' . elgg_get_page_owner_entity()->username, + 'href' => 'friendsof/' . $owner->username, 'contexts' => array('friends') ); elgg_register_menu_item('page', $params); - } - - // topbar - $user = elgg_get_logged_in_user_entity(); - if ($user) { + elgg_register_menu_item('page', array( 'name' => 'edit_avatar', - 'href' => "avatar/edit/{$user->username}", + 'href' => "avatar/edit/{$owner->username}", 'text' => elgg_echo('avatar:edit'), 'contexts' => array('profile_edit'), )); elgg_register_menu_item('page', array( 'name' => 'edit_profile', - 'href' => "profile/{$user->username}/edit", + 'href' => "profile/{$owner->username}/edit", 'text' => elgg_echo('profile:edit'), 'contexts' => array('profile_edit'), )); + } - $icon_url = $user->getIconURL('topbar'); + // topbar + if ($viewer) { + + $icon_url = $viewer->getIconURL('topbar'); $class = 'elgg-border-plain elgg-transition'; $title = elgg_echo('profile'); elgg_register_menu_item('topbar', array( 'name' => 'profile', - 'href' => $user->getURL(), - 'text' => "\"$user-name\" title=\"$title\" class=\"$class\" />", + 'href' => $viewer->getURL(), + 'text' => "\"$viewer-name\" title=\"$title\" class=\"$class\" />", 'priority' => 100, 'link_class' => 'elgg-topbar-avatar', )); elgg_register_menu_item('topbar', array( 'name' => 'friends', - 'href' => "friends/{$user->username}", + 'href' => "friends/{$viewer->username}", 'text' => elgg_view_icon('users'), 'title' => elgg_echo('friends'), 'priority' => 300, @@ -1475,7 +1478,7 @@ function users_pagesetup() { elgg_register_menu_item('topbar', array( 'name' => 'usersettings', - 'href' => "settings/user/{$user->username}", + 'href' => "settings/user/{$viewer->username}", 'text' => elgg_view_icon('settings') . elgg_echo('settings'), 'priority' => 500, 'section' => 'alt', @@ -1489,7 +1492,6 @@ function users_pagesetup() { 'priority' => 1000, 'section' => 'alt', )); - } } -- cgit v1.2.3 From 2c61de1a32a4b9dbdf50d8e25109dc4130237f78 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Mon, 12 Sep 2011 21:29:24 -0400 Subject: Fixes #3801 fixed documentation for page_owner_entity() --- engine/lib/deprecated-1.8.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index 8118d84dd..f0f4bd9dc 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -1576,7 +1576,7 @@ function page_owner() { /** * Gets the owner entity for the current page. * - * @deprecated 1.8 Use elgg_get_page_owner() + * @deprecated 1.8 Use elgg_get_page_owner_entity() * @return ElggEntity|false The current page owner or false if none. */ function page_owner_entity() { -- cgit v1.2.3 From d9392db5ecd670a46f25dfd1a9dd11bb3142af10 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Mon, 12 Sep 2011 21:47:11 -0400 Subject: Refs #3800 including jeditable on more admin pages --- engine/lib/admin.php | 10 ++++------ views/default/js/admin.php | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/lib/admin.php b/engine/lib/admin.php index c16da9295..93ee43008 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -239,6 +239,9 @@ function admin_init() { elgg_register_action('profile/fields/reorder', '', 'admin'); elgg_register_simplecache_view('js/admin'); + $url = elgg_get_simplecache_url('js', 'admin'); + elgg_register_js('elgg.admin', $url); + elgg_register_js('jquery.jeditable', 'vendors/jquery/jquery.jeditable.mini.js'); // administer // dashboard @@ -434,11 +437,7 @@ function admin_settings_page_handler($page) { elgg_set_context('admin'); elgg_unregister_css('elgg'); - $url = elgg_get_simplecache_url('js', 'admin'); - elgg_register_js('elgg.admin', $url); elgg_load_js('elgg.admin'); - - elgg_register_js('jquery.jeditable', 'vendors/jquery/jquery.jeditable.mini.js'); elgg_load_js('jquery.jeditable'); // default to dashboard @@ -548,9 +547,8 @@ function admin_markdown_page_handler($pages) { elgg_set_context('admin'); elgg_unregister_css('elgg'); - $url = elgg_get_simplecache_url('js', 'admin'); - elgg_register_js('elgg.admin', $url); elgg_load_js('elgg.admin'); + elgg_load_js('jquery.jeditable'); elgg_load_library('elgg:markdown'); $plugin_id = elgg_extract(0, $pages); diff --git a/views/default/js/admin.php b/views/default/js/admin.php index 2f2f59287..253a73887 100644 --- a/views/default/js/admin.php +++ b/views/default/js/admin.php @@ -32,6 +32,7 @@ elgg.admin.init = function () { }); // in-line editing for custom profile fields. + // @note this requires jquery.jeditable plugin $(".elgg-state-editable").editable(elgg.admin.editProfileField, { type: 'text', onblur: 'submit', -- cgit v1.2.3 From 710b17aa37dd5c90db695219defdfef7a889f29a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Wed, 14 Sep 2011 21:09:48 -0400 Subject: Fixes #3681 fixed Utilities menu collisions in admin section and added documentation about registering more than one menu item with the same name to a menu --- engine/lib/navigation.php | 3 ++ languages/en.php | 3 +- mod/diagnostics/languages/en.php | 2 +- mod/diagnostics/start.php | 2 +- .../admin/develop_utilities/diagnostics.php | 30 +++++++++++ .../views/default/admin/utilities/diagnostics.php | 30 ----------- mod/logbrowser/languages/en.php | 2 +- mod/logbrowser/start.php | 2 +- .../admin/administer_utilities/logbrowser.php | 63 ++++++++++++++++++++++ .../views/default/admin/utilities/logbrowser.php | 63 ---------------------- mod/reportedcontent/languages/en.php | 2 +- mod/reportedcontent/start.php | 2 +- .../admin/administer_utilities/reportedcontent.php | 13 +++++ .../default/admin/utilities/reportedcontent.php | 13 ----- 14 files changed, 117 insertions(+), 113 deletions(-) create mode 100644 mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php delete mode 100644 mod/diagnostics/views/default/admin/utilities/diagnostics.php create mode 100644 mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php delete mode 100644 mod/logbrowser/views/default/admin/utilities/logbrowser.php create mode 100644 mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php delete mode 100644 mod/reportedcontent/views/default/admin/utilities/reportedcontent.php (limited to 'engine') diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index cefe40ecf..0e9ec1c17 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -53,6 +53,9 @@ * 'register', 'menu:'. If you do, you may end up with many incorrect * links on a context-sensitive menu. * + * @warning A menu item's name must be unique per menu. If more than one menu + * item with the same name are registered, the last menu item takes priority. + * * @see elgg_view_menu() for the plugin hooks available for modifying a menu as * it is being rendered. * diff --git a/languages/en.php b/languages/en.php index 6e07b256b..3a922b889 100644 --- a/languages/en.php +++ b/languages/en.php @@ -544,7 +544,8 @@ $english = array( 'admin:statistics:overview' => 'Overview', 'admin:appearance' => 'Appearance', - 'admin:utilities' => 'Utilities', + 'admin:administer_utilities' => 'Utilities', + 'admin:develop_utilities' => 'Utilities', 'admin:users' => "Users", 'admin:users:online' => 'Currently Online', diff --git a/mod/diagnostics/languages/en.php b/mod/diagnostics/languages/en.php index 6d71945e3..c4e337b50 100644 --- a/mod/diagnostics/languages/en.php +++ b/mod/diagnostics/languages/en.php @@ -7,7 +7,7 @@ $english = array( - 'admin:utilities:diagnostics' => 'System Diagnostics', + 'admin:develop_utilities:diagnostics' => 'System Diagnostics', 'diagnostics' => 'System diagnostics', 'diagnostics:report' => 'Diagnostics Report', 'diagnostics:unittester' => 'Unit Tests', diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index c55b10483..735e15042 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -16,7 +16,7 @@ function diagnostics_init() { elgg_register_page_handler('diagnostics','diagnostics_page_handler'); // Add admin menu item - elgg_register_admin_menu_item('develop', 'diagnostics', 'utilities'); + elgg_register_admin_menu_item('develop', 'diagnostics', 'develop_utilities'); // Register some actions $file = elgg_get_plugins_path() . "diagnostics/actions/download.php"; diff --git a/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php new file mode 100644 index 000000000..76f12b0ae --- /dev/null +++ b/mod/diagnostics/views/default/admin/develop_utilities/diagnostics.php @@ -0,0 +1,30 @@ +' . 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', + ); + $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); +echo elgg_view_module('inline', $unit_tests_title, $unit_tests); diff --git a/mod/diagnostics/views/default/admin/utilities/diagnostics.php b/mod/diagnostics/views/default/admin/utilities/diagnostics.php deleted file mode 100644 index 76f12b0ae..000000000 --- a/mod/diagnostics/views/default/admin/utilities/diagnostics.php +++ /dev/null @@ -1,30 +0,0 @@ -' . 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', - ); - $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); -echo elgg_view_module('inline', $unit_tests_title, $unit_tests); diff --git a/mod/logbrowser/languages/en.php b/mod/logbrowser/languages/en.php index 90689a1b0..3b6ead272 100644 --- a/mod/logbrowser/languages/en.php +++ b/mod/logbrowser/languages/en.php @@ -6,7 +6,7 @@ */ $english = array( - 'admin:utilities:logbrowser' => 'Log browser', + 'admin:administer_utilities:logbrowser' => 'Log browser', 'logbrowser' => 'Log browser', 'logbrowser:browse' => 'Browse system log', 'logbrowser:search' => 'Refine results', diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index 71b6115a5..3bffe800a 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -14,7 +14,7 @@ function logbrowser_init() { elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'logbrowser_user_hover_menu'); - elgg_register_admin_menu_item('administer', 'logbrowser', 'utilities'); + elgg_register_admin_menu_item('administer', 'logbrowser', 'administer_utilities'); } /** diff --git a/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php new file mode 100644 index 000000000..dadc6cda3 --- /dev/null +++ b/mod/logbrowser/views/default/admin/administer_utilities/logbrowser.php @@ -0,0 +1,63 @@ +guid; + } +} else { + $user_guid = get_input('user_guid',0); + if ($user_guid) { + $user = (int) $user_guid; + } else { + $user = ""; + } +} + +$timelower = get_input('timelower'); +if ($timelower) { + $timelower = strtotime($timelower); +} + +$timeupper = get_input('timeupper'); +if ($timeupper) { + $timeupper = strtotime($timeupper); +} + +$form = elgg_view('logbrowser/form', array( + 'user_guid' => $user, + 'timeupper' => $timeupper, + 'timelower' => $timelower, +)); + +// Get log entries +$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower); +$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower); + +$table = elgg_view('logbrowser/table', array('log_entries' => $log)); + +$nav = elgg_view('navigation/pagination',array( + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, +)); + +// display admin body +$body = <<<__HTML +$form +$nav +$table +$nav +__HTML; + +echo $body; diff --git a/mod/logbrowser/views/default/admin/utilities/logbrowser.php b/mod/logbrowser/views/default/admin/utilities/logbrowser.php deleted file mode 100644 index dadc6cda3..000000000 --- a/mod/logbrowser/views/default/admin/utilities/logbrowser.php +++ /dev/null @@ -1,63 +0,0 @@ -guid; - } -} else { - $user_guid = get_input('user_guid',0); - if ($user_guid) { - $user = (int) $user_guid; - } else { - $user = ""; - } -} - -$timelower = get_input('timelower'); -if ($timelower) { - $timelower = strtotime($timelower); -} - -$timeupper = get_input('timeupper'); -if ($timeupper) { - $timeupper = strtotime($timeupper); -} - -$form = elgg_view('logbrowser/form', array( - 'user_guid' => $user, - 'timeupper' => $timeupper, - 'timelower' => $timelower, -)); - -// Get log entries -$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower); -$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower); - -$table = elgg_view('logbrowser/table', array('log_entries' => $log)); - -$nav = elgg_view('navigation/pagination',array( - 'offset' => $offset, - 'count' => $count, - 'limit' => $limit, -)); - -// display admin body -$body = <<<__HTML -$form -$nav -$table -$nav -__HTML; - -echo $body; diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php index c047644e3..c2e197879 100644 --- a/mod/reportedcontent/languages/en.php +++ b/mod/reportedcontent/languages/en.php @@ -8,7 +8,7 @@ $english = array( 'item:object:reported_content' => 'Reported items', - 'admin:utilities:reportedcontent' => 'Reported content', + 'admin:administer_utilities:reportedcontent' => 'Reported content', 'reportedcontent' => 'Reported content', 'reportedcontent:this' => 'Report this', 'reportedcontent:this:tooltip' => 'Report this page to an administrator', diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 87b4b3c7b..66a1248d9 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -39,7 +39,7 @@ function reportedcontent_init() { // Add admin menu item // @todo Might want to move this to a 'feedback' section. something other than utils - elgg_register_admin_menu_item('administer', 'reportedcontent', 'utilities'); + elgg_register_admin_menu_item('administer', 'reportedcontent', 'administer_utilities'); elgg_register_widget_type( 'reportedcontent', diff --git a/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php new file mode 100644 index 000000000..32f108312 --- /dev/null +++ b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php @@ -0,0 +1,13 @@ + 'object', 'subtypes' => 'reported_content')); +if (!$list) { + $list = '

' . elgg_echo('reportedcontent:none') . '

'; +} + +echo $list; \ No newline at end of file diff --git a/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php b/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php deleted file mode 100644 index 32f108312..000000000 --- a/mod/reportedcontent/views/default/admin/utilities/reportedcontent.php +++ /dev/null @@ -1,13 +0,0 @@ - 'object', 'subtypes' => 'reported_content')); -if (!$list) { - $list = '

' . elgg_echo('reportedcontent:none') . '

'; -} - -echo $list; \ No newline at end of file -- cgit v1.2.3 From 6fab3ed243d3e2688916dcb65141e37bef1cc4c3 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 15 Sep 2011 21:21:14 -0400 Subject: Fixes #3178 updated elgg_view_icon() to take an optional class --- engine/lib/views.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/lib/views.php b/engine/lib/views.php index 0646851f0..2f1661e83 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1308,15 +1308,16 @@ function elgg_view_list_item($item, array $vars = array()) { * Shorthand for * * @param string $name The specific icon to display - * @param bool $float Whether to float the icon + * @param string $class Additional class: float, float-alt, or custom class * * @return string The html for displaying an icon */ -function elgg_view_icon($name, $float = false) { - if ($float) { - $float = 'float'; +function elgg_view_icon($name, $class = '') { + // @todo deprecate boolean in Elgg 1.9 + if (is_bool($class) && $class === true) { + $class = 'float'; } - return ""; + return ""; } /** -- cgit v1.2.3 From 4900853196f83a902a2acac11ae1bd4813bcb3fc Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 18 Sep 2011 14:20:03 -0400 Subject: Fixes #3786 menu code was corrupting link class if an additional class was passed through getContent() --- engine/classes/ElggMenuItem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index f7a6b5c65..b9c81fd78 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -543,7 +543,7 @@ class ElggMenuItem { if ($this->data['linkClass']) { if (isset($vars['class'])) { - $vars['class'] += $this->getLinkClass(); + $vars['class'] = $vars['class'] . ' ' . $this->getLinkClass(); } else { $vars['class'] = $this->getLinkClass(); } -- cgit v1.2.3 From 6e8ab94aa23f13b62727d3af42fc012c8eefef9a Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Mon, 19 Sep 2011 15:29:44 -0400 Subject: don't generate false internalid deprecation notices: http://trac.elgg.org/ticket/2921#comment:3 --- engine/lib/views.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/lib/views.php b/engine/lib/views.php index 2f1661e83..f6e5aa6b8 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -411,19 +411,25 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie } // internalname => name (1.8) - if (isset($vars['internalname']) && !isset($vars['name'])) { + 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'] = ''; + } $vars['internalname'] = $vars['name']; } // internalid => id (1.8) - if (isset($vars['internalid']) && !isset($vars['name'])) { + if (isset($vars['internalid']) && !isset($vars['__ignoreInternalid']) && !isset($vars['name'])) { elgg_deprecated_notice('You should pass $vars[\'id\'] now instead of $vars[\'internalid\']', 1.8, 2); $vars['id'] = $vars['internalid']; } elseif (isset($vars['id'])) { + if (!isset($vars['internalid'])) { + $vars['__ignoreInternalid'] = ''; + } $vars['internalid'] = $vars['id']; } -- cgit v1.2.3 From a6805f3f58caecdeb6e149a9da292937e21ea2e5 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 22 Sep 2011 08:40:09 -0400 Subject: Fixes #3834 not loading version.php hundreds of times - thanks to srokap --- engine/lib/upgrade.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/lib/upgrade.php b/engine/lib/upgrade.php index dc3911062..dc1213187 100644 --- a/engine/lib/upgrade.php +++ b/engine/lib/upgrade.php @@ -160,7 +160,7 @@ function elgg_get_upgrade_files($upgrade_path = null) { } /** - * Get the current version information + * Get the current Elgg version information * * @param bool $humanreadable Whether to return a human readable version (default: false) * @@ -169,13 +169,18 @@ function elgg_get_upgrade_files($upgrade_path = null) { function get_version($humanreadable = false) { global $CONFIG; + static $version, $release; + if (isset($CONFIG->path)) { - if (include($CONFIG->path . "version.php")) { - return (!$humanreadable) ? $version : $release; + if (!isset($version) || !isset($release)) { + if (!include($CONFIG->path . "version.php")) { + return false; + } } + return (!$humanreadable) ? $version : $release; } - return FALSE; + return false; } /** -- cgit v1.2.3 From 9858bd526fce9016dc82d1f21b35e6ceb969c140 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 22 Sep 2011 21:32:49 -0400 Subject: Fixes #3808 not translating manifest fields through elgg_echo() --- engine/classes/ElggPluginManifest.php | 38 +++++++---------------------------- languages/en.php | 1 + views/default/admin/plugins.php | 8 +++++++- 3 files changed, 15 insertions(+), 32 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index 0f3b1d7a8..0e47f388d 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -224,20 +224,15 @@ class ElggPluginManifest { /** * Returns the plugin name * - * @param bool $elgg_echo Run the name through elgg_echo. * @return string */ - public function getName($elgg_echo = true) { + public function getName() { $name = $this->parser->getAttribute('name'); if (!$name && $this->pluginID) { $name = ucwords(str_replace('_', ' ', $this->pluginID)); } - if ($elgg_echo) { - $name = elgg_echo($name); - } - return $name; } @@ -245,33 +240,21 @@ class ElggPluginManifest { /** * Return the description * - * @param bool $elgg_echo Run the description through elgg_echo. * @return string */ - public function getDescription($elgg_echo = true) { - $desc = $this->parser->getAttribute('description'); - - if ($elgg_echo) { - return elgg_echo($desc); - } else { - return $desc; - } + public function getDescription() { + return $this->parser->getAttribute('description'); } /** * Return the short description * - * @param bool $elgg_echo Run the blurb through elgg_echo. * @return string */ - public function getBlurb($elgg_echo = true) { + public function getBlurb() { $blurb = $this->parser->getAttribute('blurb'); - if ($blurb) { - if ($elgg_echo) { - $blurb = elgg_echo($blurb); - } - } else { + if (!$blurb) { $blurb = elgg_get_excerpt($this->getDescription()); } @@ -348,10 +331,9 @@ class ElggPluginManifest { /** * Return the screenshots listed. * - * @param bool $elgg_echo Run the screenshot's description through elgg_echo. * @return array */ - public function getScreenshots($elgg_echo = true) { + public function getScreenshots() { $ss = $this->parser->getAttribute('screenshot'); if (!$ss) { @@ -360,13 +342,7 @@ class ElggPluginManifest { $normalized = array(); foreach ($ss as $s) { - $normalized_s = $this->buildStruct($this->screenshotStruct, $s); - - if ($elgg_echo) { - $normalized_s['description'] = elgg_echo($normalized_s['description']); - } - - $normalized[] = $normalized_s; + $normalized[] = $this->buildStruct($this->screenshotStruct, $s); } return $normalized; diff --git a/languages/en.php b/languages/en.php index 6c3c041cd..d83d4773b 100644 --- a/languages/en.php +++ b/languages/en.php @@ -613,6 +613,7 @@ $english = array( 'admin:plugins:category:multimedia' => 'Multimedia', 'admin:plugins:category:theme' => 'Themes', 'admin:plugins:category:widget' => 'Widgets', + 'admin:plugins:category:utility' => 'Utilities', 'admin:plugins:sort:priority' => 'Priority', 'admin:plugins:sort:alpha' => 'Alphabetical', diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php index 62e6f556a..451936335 100644 --- a/views/default/admin/plugins.php +++ b/views/default/admin/plugins.php @@ -60,7 +60,13 @@ foreach ($installed_plugins as $id => $plugin) { if (isset($plugin_categories)) { foreach ($plugin_categories as $category) { if (!array_key_exists($category, $categories)) { - $categories[$category] = elgg_echo("admin:plugins:category:$category"); + // if localization string not defined, fall back to original category string + $cat_raw_string = "admin:plugins:category:$category"; + $cat_display_string = elgg_echo($cat_raw_string); + if ($cat_display_string == $cat_raw_string) { + $cat_display_string = ucwords($category); + } + $categories[$category] = $cat_display_string; } } } -- cgit v1.2.3 From e5926823b0876377a04fbe47605f3524d5a67f21 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Fri, 23 Sep 2011 21:30:03 -0700 Subject: Refs #3859. Using PHP internal functions to expire cache in +6 months instead of doing math manually to avoid int overflow. --- engine/handlers/cache_handler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/handlers/cache_handler.php b/engine/handlers/cache_handler.php index 7d6f42dc3..94a0e64e9 100644 --- a/engine/handlers/cache_handler.php +++ b/engine/handlers/cache_handler.php @@ -64,7 +64,7 @@ $view = $matches[3]; switch ($type) { case 'css': header("Content-type: text/css", true); - header('Expires: ' . date('r', time() + 86400000), true); + header('Expires: ' . date('r', strtotime("+6 months")), true); header("Pragma: public", true); header("Cache-Control: public", true); @@ -72,7 +72,7 @@ switch ($type) { break; case 'js': header('Content-type: text/javascript', true); - header('Expires: ' . date('r', time() + 864000000), true); + header('Expires: ' . date('r', strtotime("+6 months")), true); header("Pragma: public", true); header("Cache-Control: public", true); -- cgit v1.2.3 From d9d3cc65e96c54332f22f90ac17b014dfe183ddf Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 24 Sep 2011 17:29:41 -0400 Subject: Fixes #3828 correct list classes --- engine/lib/deprecated-1.8.php | 2 +- engine/lib/river.php | 2 +- engine/lib/views.php | 2 +- mod/likes/views/default/likes/count.php | 9 +++++++-- mod/likes/views/default/likes/css.php | 2 +- mod/likes/views/default/likes/js.php | 2 +- mod/messageboard/views/default/messageboard/js.php | 2 +- views/default/css/elements/components.php | 4 ++-- 8 files changed, 15 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index f0f4bd9dc..beba7d2b7 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -2424,7 +2424,7 @@ $posted_max = 0, $pagination = true) { 'offset' => $offset, 'limit' => $limit, 'pagination' => $pagination, - 'list-class' => 'elgg-river-list', + 'list-class' => 'elgg-list-river', ); return elgg_view('page/components/list', $params); diff --git a/engine/lib/river.php b/engine/lib/river.php index 64ddcfdc1..a11e6145c 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -378,7 +378,7 @@ function elgg_list_river(array $options = array()) { 'offset' => (int) max(get_input('offset', 0), 0), 'limit' => (int) max(get_input('limit', 20), 0), 'pagination' => TRUE, - 'list_class' => 'elgg-river', + 'list_class' => 'elgg-list-river elgg-river', // @todo remove elgg-river in Elgg 1.9 ); $options = array_merge($defaults, $options); diff --git a/engine/lib/views.php b/engine/lib/views.php index f6e5aa6b8..9a236508f 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1044,7 +1044,7 @@ $list_type_toggle = true, $pagination = true) { function elgg_view_annotation_list($annotations, array $vars = array()) { $defaults = array( 'items' => $annotations, - 'list_class' => 'elgg-annotation-list', + 'list_class' => 'elgg-list-annotation elgg-annotation-list', // @todo remove elgg-annotation-list in Elgg 1.9 'full_view' => true, 'offset_key' => 'annoff', ); diff --git a/mod/likes/views/default/likes/count.php b/mod/likes/views/default/likes/count.php index bdc50bcd1..071a069bd 100644 --- a/mod/likes/views/default/likes/count.php +++ b/mod/likes/views/default/likes/count.php @@ -24,8 +24,13 @@ if ($num_of_likes) { 'href' => "#likes-$guid" ); $list = elgg_view('output/url', $params); - $list .= "