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.
---
languages/en.php | 1 +
1 file changed, 1 insertion(+)
(limited to 'languages')
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!",
--
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 'languages')
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 3161a7b0b27508066f26b8cd920b1817f23beeef Mon Sep 17 00:00:00 2001
From: Cash Costello
Date: Tue, 13 Sep 2011 21:14:11 -0400
Subject: Fixes #3623 added non-bundled filter option for plugins
---
languages/en.php | 1 +
views/default/admin/plugins.php | 11 +++++++++++
2 files changed, 12 insertions(+)
(limited to 'languages')
diff --git a/languages/en.php b/languages/en.php
index ab3c523de..6e07b256b 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -601,6 +601,7 @@ $english = array(
'admin:plugins:category:inactive' => 'Inactive plugins',
'admin:plugins:category:admin' => 'Admin',
'admin:plugins:category:bundled' => 'Bundled',
+ 'admin:plugins:category:nonbundled' => 'Non-bundled',
'admin:plugins:category:content' => 'Content',
'admin:plugins:category:development' => 'Development',
'admin:plugins:category:enhancement' => 'Enhancements',
diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php
index cd0b83c00..62e6f556a 100644
--- a/views/default/admin/plugins.php
+++ b/views/default/admin/plugins.php
@@ -45,6 +45,11 @@ foreach ($installed_plugins as $id => $plugin) {
unset($installed_plugins[$id]);
}
break;
+ case 'nonbundled':
+ if (in_array('bundled', $plugin_categories)) {
+ unset($installed_plugins[$id]);
+ }
+ break;
default:
if (!in_array($show_category, $plugin_categories)) {
unset($installed_plugins[$id]);
@@ -96,10 +101,16 @@ switch ($sort) {
asort($categories);
+// we want bundled/nonbundled pulled to be at the top of the list
+unset($categories['bundled']);
+unset($categories['nonbundled']);
+
$common_categories = array(
'all' => elgg_echo('admin:plugins:category:all'),
'active' => elgg_echo('admin:plugins:category:active'),
'inactive' => elgg_echo('admin:plugins:category:inactive'),
+ 'bundled' => elgg_echo('admin:plugins:category:bundled'),
+ 'nonbundled' => elgg_echo('admin:plugins:category:nonbundled'),
);
$categories = array_merge($common_categories, $categories);
--
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 'languages')
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 f831b081a4baf64c368a6156712b7151f3497e46 Mon Sep 17 00:00:00 2001
From: cash
Date: Sat, 17 Sep 2011 11:47:37 -0400
Subject: Fixes #3819 added the request action words to the language file
---
languages/en.php | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
(limited to 'languages')
diff --git a/languages/en.php b/languages/en.php
index 3a922b889..6c3c041cd 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -811,6 +811,9 @@ $english = array(
'upgrade' => 'Upgrade',
'sort' => 'Sort',
'filter' => 'Filter',
+ 'new' => 'New',
+ 'add' => 'Add',
+ 'create' => 'Create',
'site' => 'Site',
'activity' => 'Activity',
@@ -1053,10 +1056,10 @@ If you requested this click on the link below, otherwise ignore this email.
* user default access
*/
-'default_access:settings' => "Your default access level",
-'default_access:label' => "Default access",
-'user:default_access:success' => "Your new default access level was saved.",
-'user:default_access:failure' => "Your new default access level could not be saved.",
+ 'default_access:settings' => "Your default access level",
+ 'default_access:label' => "Default access",
+ 'user:default_access:success' => "Your new default access level was saved.",
+ 'user:default_access:failure' => "Your new default access level could not be saved.",
/**
* XML-RPC
--
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 'languages')
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 0a0414619d4a82494403e8334e9a5367f893667e Mon Sep 17 00:00:00 2001
From: cash
Date: Sun, 25 Sep 2011 15:41:30 -0400
Subject: Refs #3842 adding river view back so that those upgrading from
earlier Elgg views don't have empty river messages
---
languages/en.php | 1 +
views/default/river/user/default/profileupdate.php | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
create mode 100644 views/default/river/user/default/profileupdate.php
(limited to 'languages')
diff --git a/languages/en.php b/languages/en.php
index d83d4773b..9d0590b2d 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -408,6 +408,7 @@ $english = array(
'river' => "River",
'river:friend:user:default' => "%s is now a friend with %s",
'river:update:user:avatar' => '%s has a new avatar',
+ 'river:update:user:profile' => '%s has updated their profile',
'river:noaccess' => 'You do not have permission to view this item.',
'river:posted:generic' => '%s posted',
'riveritem:single:user' => 'a user',
diff --git a/views/default/river/user/default/profileupdate.php b/views/default/river/user/default/profileupdate.php
new file mode 100644
index 000000000..a344131d6
--- /dev/null
+++ b/views/default/river/user/default/profileupdate.php
@@ -0,0 +1,19 @@
+getSubjectEntity();
+
+$subject_link = elgg_view('output/url', array(
+ 'href' => $subject->getURL(),
+ 'text' => $subject->name,
+ 'class' => 'elgg-river-subject',
+));
+
+$string = elgg_echo('river:update:user:profile', array($subject_link));
+
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'summary' => $string,
+));
--
cgit v1.2.3