diff options
-rw-r--r-- | engine/classes/ElggUser.php | 9 | ||||
-rw-r--r-- | engine/lib/access.php | 4 | ||||
-rw-r--r-- | engine/lib/annotations.php | 4 | ||||
-rw-r--r-- | engine/lib/elgglib.php | 2 | ||||
-rw-r--r-- | engine/lib/entities.php | 6 | ||||
-rw-r--r-- | engine/lib/metadata.php | 11 | ||||
-rw-r--r-- | engine/schema/mysql.sql | 1 | ||||
-rw-r--r-- | engine/tests/api/metastrings.php | 6 | ||||
-rw-r--r-- | engine/tests/objects/objects.php | 45 | ||||
-rw-r--r-- | install/ElggInstaller.php | 2 | ||||
-rw-r--r-- | languages/en.php | 2 | ||||
-rw-r--r-- | mod/bookmarks/actions/bookmarks/save.php | 2 | ||||
-rw-r--r-- | mod/search/views/default/search/list.php | 2 | ||||
-rw-r--r-- | mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php | 2 | ||||
-rw-r--r-- | views/default/navigation/pagination.php | 5 | ||||
-rw-r--r-- | views/default/object/plugin/full.php | 7 | ||||
-rw-r--r-- | views/default/object/plugin/invalid.php | 5 | ||||
-rw-r--r-- | views/default/page/components/list.php | 2 |
18 files changed, 93 insertions, 24 deletions
diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index d37a1a10d..e9cbc6cb2 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -457,7 +457,14 @@ class ElggUser extends ElggEntity * @return array|false */ public function getObjects($subtype = "", $limit = 10, $offset = 0) { - return get_user_objects($this->getGUID(), $subtype, $limit, $offset); + $params = array( + 'type' => 'object', + 'subtype' => $subtype, + 'owner_guid' => $this->getGUID(), + 'limit' => $limit, + 'offset' => $offset + ); + return elgg_get_entities($params); } /** diff --git a/engine/lib/access.php b/engine/lib/access.php index dba1e1ec6..6be252c6a 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -671,8 +671,10 @@ function add_user_to_access_collection($user_guid, $collection_id) { return false; } + // if someone tries to insert the same data twice, we do a no-op on duplicate key $q = "INSERT INTO {$CONFIG->dbprefix}access_collection_membership - SET access_collection_id = {$collection_id}, user_guid = {$user_guid}"; + SET access_collection_id = $collection_id, user_guid = $user_guid + ON DUPLICATE KEY UPDATE user_guid = user_guid"; $result = insert_data($q); return $result !== false; diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 5049d455b..f32dee0f0 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -209,9 +209,11 @@ function elgg_get_annotations(array $options = array()) { * Deletes annotations based on $options. * * @warning Unlike elgg_get_annotations() this will not accept an empty options array! + * This requires at least one constraint: annotation_owner_guid(s), + * annotation_name(s), annotation_value(s), or guid(s) must be set. * * @param array $options An options array. {@See elgg_get_annotations()} - * @return mixed + * @return mixed Null if the metadata name is invalid. Bool on success or fail. * @since 1.8.0 */ function elgg_delete_annotations(array $options) { diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 3c56567e9..aba84bd48 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1970,7 +1970,7 @@ function elgg_is_valid_options_for_batch_operation($options, $type) { // at least one of these is required. $required = array( // generic restraints - 'guid', 'guids', 'limit' + 'guid', 'guids' ); switch ($type) { diff --git a/engine/lib/entities.php b/engine/lib/entities.php index f3bf9fb29..67011b802 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1378,6 +1378,10 @@ function disable_entity($guid, $reason = "", $recursive = true) { } if ($recursive) { + $hidden = 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 @@ -1391,6 +1395,8 @@ function disable_entity($guid, $reason = "", $recursive = true) { $e->disable($reason); } } + access_show_hidden_entities($hidden); + elgg_set_ignore_access($ia); } $entity->disableMetadata(); diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 19e8aa3c8..012c73ad9 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -294,11 +294,11 @@ function elgg_get_metadata(array $options = array()) { * Deletes metadata based on $options. * * @warning Unlike elgg_get_metadata() this will not accept an empty options array! - * This requires some constraints: metadata_owner_guid(s), - * metadata_name(s), metadata_value(s), or limit must be set. + * This requires at least one constraint: metadata_owner_guid(s), + * metadata_name(s), metadata_value(s), or guid(s) must be set. * - * @param array $options An options array. {@See elgg_get_metadata()} - * @return mixed + * @param array $options An options array. {@see elgg_get_metadata()} + * @return mixed Null if the metadata name is invalid. Bool on success or fail. * @since 1.8.0 */ function elgg_delete_metadata(array $options) { @@ -307,7 +307,8 @@ function elgg_delete_metadata(array $options) { } $options['metastring_type'] = 'metadata'; - return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback'); + $result = elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback'); + return $result; } /** diff --git a/engine/schema/mysql.sql b/engine/schema/mysql.sql index 74cf2ce74..6c6e9db89 100644 --- a/engine/schema/mysql.sql +++ b/engine/schema/mysql.sql @@ -361,6 +361,7 @@ CREATE TABLE `prefix_system_log` ( `access_id` int(11) NOT NULL, `enabled` enum('yes','no') NOT NULL DEFAULT 'yes', `time_created` int(11) NOT NULL, + `ip_address` varchar(15) NOT NULL, PRIMARY KEY (`id`), KEY `object_id` (`object_id`), KEY `object_class` (`object_class`), diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index a96388217..0a8945084 100644 --- a/engine/tests/api/metastrings.php +++ b/engine/tests/api/metastrings.php @@ -132,7 +132,7 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { public function testKeepMeFromDeletingEverything() { foreach ($this->metastringTypes as $type) { $required = array( - 'guid', 'guids', 'limit' + 'guid', 'guids' ); switch ($type) { @@ -160,6 +160,10 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { $options = array(); $this->assertFalse(elgg_is_valid_options_for_batch_operation($options, $type)); + // limit alone isn't valid: + $options = array('limit' => 10); + $this->assertFalse(elgg_is_valid_options_for_batch_operation($options, $type)); + foreach ($required as $key) { $options = array(); diff --git a/engine/tests/objects/objects.php b/engine/tests/objects/objects.php index 0d0df6b75..cd507d5ab 100644 --- a/engine/tests/objects/objects.php +++ b/engine/tests/objects/objects.php @@ -194,7 +194,50 @@ class ElggCoreObjectTest extends ElggCoreUnitTest { $old = elgg_set_ignore_access(true); } - + // see http://trac.elgg.org/ticket/1196 + public function testElggEntityRecursiveDisableWhenLoggedOut() { + $e1 = new ElggObject(); + $e1->access_id = ACCESS_PUBLIC; + $e1->owner_guid = 0; + $e1->container_guid = 0; + $e1->save(); + $guid1 = $e1->getGUID(); + + $e2 = new ElggObject(); + $e2->container_guid = $guid1; + $e2->access_id = ACCESS_PUBLIC; + $e2->owner_guid = 0; + $e2->save(); + $guid2 = $e2->getGUID(); + + // fake being logged out + $user = $_SESSION['user']; + unset($_SESSION['user']); + $ia = elgg_set_ignore_access(true); + + $this->assertTrue(disable_entity($guid1, null, true)); + + // "log in" original user + $_SESSION['user'] = $user; + elgg_set_ignore_access($ia); + + $this->assertFalse(get_entity($guid1)); + $this->assertFalse(get_entity($guid2)); + + $db_prefix = get_config('dbprefix'); + $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $guid1"; + $r = get_data_row($q); + $this->assertEqual('no', $r->enabled); + + $q = "SELECT * FROM {$db_prefix}entities WHERE guid = $guid2"; + $r = get_data_row($q); + $this->assertEqual('no', $r->enabled); + + access_show_hidden_entities(true); + delete_entity($guid1); + delete_entity($guid2); + access_show_hidden_entities(false); + } protected function get_object_row($guid) { global $CONFIG; diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php index 0e75ed008..b6c28fa8d 100644 --- a/install/ElggInstaller.php +++ b/install/ElggInstaller.php @@ -391,7 +391,7 @@ class ElggInstaller { $formVars = array( 'sitename' => array( 'type' => 'text', - 'value' => 'New Elgg site', + 'value' => 'My New Community', 'required' => TRUE, ), 'siteemail' => array( diff --git a/languages/en.php b/languages/en.php index 76ef07b4d..b34d1cc58 100644 --- a/languages/en.php +++ b/languages/en.php @@ -1037,7 +1037,7 @@ Once you have logged in, we highly recommend that you change your password. 'upgrading' => 'Upgrading...', 'upgrade:db' => 'Your database was upgraded.', - 'upgrade:core' => 'Your elgg installation was upgraded.', + 'upgrade:core' => 'Your Elgg installation was upgraded.', 'upgrade:unable_to_upgrade' => 'Unable to upgrade.', 'upgrade:unable_to_upgrade_info' => 'This installation cannot be upgraded because legacy views diff --git a/mod/bookmarks/actions/bookmarks/save.php b/mod/bookmarks/actions/bookmarks/save.php index f240c4b26..3ca6bef32 100644 --- a/mod/bookmarks/actions/bookmarks/save.php +++ b/mod/bookmarks/actions/bookmarks/save.php @@ -5,8 +5,6 @@ * @package Bookmarks */ -gatekeeper(); - $title = strip_tags(get_input('title')); $description = get_input('description'); $address = get_input('address'); diff --git a/mod/search/views/default/search/list.php b/mod/search/views/default/search/list.php index c5249fe77..1ed40be1b 100644 --- a/mod/search/views/default/search/list.php +++ b/mod/search/views/default/search/list.php @@ -39,7 +39,7 @@ $url = elgg_get_site_url() . "search?$query"; // get pagination if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) { $nav = elgg_view('navigation/pagination',array( - 'baseurl' => $url, + 'base_url' => $url, 'offset' => $vars['params']['offset'], 'count' => $vars['results']['count'], 'limit' => $vars['params']['limit'], diff --git a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php index 2afd6022d..cbd13a709 100644 --- a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php +++ b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php @@ -40,7 +40,7 @@ elgg_set_ignore_access($ia); // setup pagination $pagination = elgg_view('navigation/pagination',array( - 'baseurl' => 'admin/users/unvalidated', + 'base_url' => 'admin/users/unvalidated', 'offset' => $offset, 'count' => $count, 'limit' => $limit, diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index ad4689d83..e0d355327 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -8,7 +8,7 @@ * @uses int $vars['offset'] The offset in the list * @uses int $vars['limit'] Number of items per page * @uses int $vars['count'] Number of items in list - * @uses string $vars['baseurl'] Base URL to use in links + * @uses string $vars['base_url'] Base URL to use in links * @uses string $vars['offset_key'] The string to use for offet in the URL */ @@ -28,6 +28,9 @@ $offset_key = elgg_extract('offset_key', $vars, 'offset'); // some views pass an empty string for base_url if (isset($vars['base_url']) && $vars['base_url']) { $base_url = $vars['base_url']; +} else if (isset($vars['baseurl']) && $vars['baseurl']) { + elgg_deprecated_notice("Use 'base_url' instead of 'baseurl' for the navigation/pagination view", 1.8); + $base_url = $vars['baseurl']; } else { $base_url = current_page_url(); } diff --git a/views/default/object/plugin/full.php b/views/default/object/plugin/full.php index 8955178a6..74bd31d1c 100644 --- a/views/default/object/plugin/full.php +++ b/views/default/object/plugin/full.php @@ -21,6 +21,7 @@ $name = $plugin->getManifest()->getName(); $can_activate = $plugin->canActivate(); $max_priority = elgg_get_max_plugin_priority(); $actions_base = '/action/admin/plugins/'; +$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID()); $ts = time(); $token = generate_action_token($ts); @@ -196,7 +197,7 @@ if ($files) { ?> -<div class="<?php echo $draggable; ?> elgg-plugin <?php echo $active_class ?>" id="<?php echo $plugin->getID(); ?>"> +<div class="<?php echo $draggable; ?> elgg-plugin <?php echo $active_class ?>" id="<?php echo $css_id; ?>"> <div class="elgg-image-block"> <div class="elgg-image-alt"> <?php if ($links) : ?> @@ -247,7 +248,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new) <div class="pts"> <?php echo elgg_view('output/url', array( - 'href' => "#elgg-plugin-manifest-{$plugin->getID()}", + 'href' => "#elgg-plugin-manifest-$css_id", 'text' => elgg_echo("admin:plugins:label:moreinfo"), 'rel' => 'toggle', )); @@ -255,7 +256,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new) </div> </div> </div> - <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>"> + <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $css_id; ?>"> <?php if ($screenshots_html) { diff --git a/views/default/object/plugin/invalid.php b/views/default/object/plugin/invalid.php index bb518cd53..f24e1836c 100644 --- a/views/default/object/plugin/invalid.php +++ b/views/default/object/plugin/invalid.php @@ -16,6 +16,7 @@ $id = $plugin->getID(); $path = htmlspecialchars($plugin->getPath()); $message = elgg_echo('admin:plugins:warning:invalid', array($id)); $error = $plugin->getError(); +$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID()); ?> @@ -27,14 +28,14 @@ $error = $plugin->getError(); <div class="pts"> <?php echo elgg_view('output/url', array( - 'href' => "#elgg-plugin-manifest-{$plugin->getID()}", + 'href' => "#elgg-plugin-manifest-$css_id", 'text' => elgg_echo("admin:plugins:label:moreinfo"), 'rel' => 'toggle', )); ?> </div> - <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>"> + <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $css_id; ?>"> <p><?php echo elgg_echo('admin:plugins:label:location') . ": " . $path; ?></p> <p><?php echo $error; ?></p> </div> diff --git a/views/default/page/components/list.php b/views/default/page/components/list.php index c0db50bc5..28c907ab6 100644 --- a/views/default/page/components/list.php +++ b/views/default/page/components/list.php @@ -40,7 +40,7 @@ $nav = ""; if ($pagination && $count) { $nav .= elgg_view('navigation/pagination', array( - 'baseurl' => $base_url, + 'base_url' => $base_url, 'offset' => $offset, 'count' => $count, 'limit' => $limit, |