From c8f62956115245d023c5f049524e450f3fbcd5d6 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Mon, 7 Nov 2011 20:31:07 -0500 Subject: Refs #4007 previous solution to admin population in ElggUser was throwing warnings --- engine/classes/ElggUser.php | 1 - 1 file changed, 1 deletion(-) (limited to 'engine') diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index 51440687d..75ac008f6 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -526,7 +526,6 @@ class ElggUser extends ElggEntity 'name', 'username', 'language', - 'admin', )); } -- cgit v1.2.3 From 1c0bda3d9868cf62788eaf88317af35326e0b4e7 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 8 Nov 2011 06:45:18 -0500 Subject: it is GPL General Public License not GPL Public License --- .../examples/plugins/manifest_options/manifest.xml | 4 ++-- documentation/examples/plugins/skeleton/manifest.xml | 2 +- engine/tests/api/plugins.php | 16 ++++++++-------- engine/tests/test_files/plugin_17/manifest.xml | 4 ++-- engine/tests/test_files/plugin_18/manifest.xml | 4 ++-- mod/blog/manifest.xml | 2 +- mod/bookmarks/manifest.xml | 2 +- mod/categories/manifest.xml | 2 +- mod/custom_index/manifest.xml | 2 +- mod/dashboard/manifest.xml | 2 +- mod/developers/manifest.xml | 2 +- mod/diagnostics/manifest.xml | 2 +- mod/embed/manifest.xml | 2 +- mod/externalpages/manifest.xml | 2 +- mod/file/manifest.xml | 2 +- mod/garbagecollector/manifest.xml | 2 +- mod/groups/manifest.xml | 2 +- mod/htmlawed/manifest.xml | 2 +- mod/invitefriends/manifest.xml | 2 +- mod/likes/manifest.xml | 2 +- mod/logbrowser/manifest.xml | 2 +- mod/logrotate/manifest.xml | 2 +- mod/members/manifest.xml | 2 +- mod/messageboard/manifest.xml | 2 +- mod/messages/manifest.xml | 2 +- mod/notifications/manifest.xml | 2 +- mod/oauth_api/manifest.xml | 2 +- mod/pages/manifest.xml | 2 +- mod/profile/manifest.xml | 2 +- mod/reportedcontent/manifest.xml | 2 +- mod/search/manifest.xml | 2 +- mod/tagcloud/manifest.xml | 2 +- mod/thewire/manifest.xml | 2 +- mod/tinymce/manifest.xml | 2 +- mod/twitter/manifest.xml | 2 +- mod/twitter_api/manifest.xml | 2 +- mod/uservalidationbyemail/manifest.xml | 2 +- mod/zaudio/manifest.xml | 2 +- 38 files changed, 48 insertions(+), 48 deletions(-) (limited to 'engine') diff --git a/documentation/examples/plugins/manifest_options/manifest.xml b/documentation/examples/plugins/manifest_options/manifest.xml index 48a5a9558..baa6cc3fa 100644 --- a/documentation/examples/plugins/manifest_options/manifest.xml +++ b/documentation/examples/plugins/manifest_options/manifest.xml @@ -6,8 +6,8 @@ A concise description. This is a longer, more interesting description of my plugin, its features, and other important information. http://www.elgg.org/ - (C) Elgg 2010 - GNU Public License version 2 + (C) Elgg 2011 + GNU General Public License version 2 elgg_version diff --git a/documentation/examples/plugins/skeleton/manifest.xml b/documentation/examples/plugins/skeleton/manifest.xml index febe71999..e31624432 100644 --- a/documentation/examples/plugins/skeleton/manifest.xml +++ b/documentation/examples/plugins/skeleton/manifest.xml @@ -6,7 +6,7 @@ This is a description of my plugin and its features. http://www.elgg.org/ (C) My Name or Company 2012 - GNU Public License version 2 + GNU General Public License version 2 elgg_release diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php index 8f5f5dd1e..a0faaff0e 100644 --- a/engine/tests/api/plugins.php +++ b/engine/tests/api/plugins.php @@ -68,8 +68,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { 'blurb' => 'A concise description.', 'description' => 'A longer, more interesting description.', 'website' => 'http://www.elgg.org/', - 'copyright' => '(C) Elgg 2010', - 'license' => 'GNU Public License version 2', + 'copyright' => '(C) Elgg Foundation 2011', + 'license' => 'GNU General Public License version 2', 'requires' => array( array('type' => 'elgg_version', 'version' => '3009030802', 'comparison' => 'lt'), @@ -117,8 +117,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { 'version' => '1.0', 'description' => 'A 1.7-style manifest.', 'website' => 'http://www.elgg.org/', - 'copyright' => '(C) Elgg 2010', - 'license' => 'GNU Public License version 2', + 'copyright' => '(C) Elgg Foundation 2011', + 'license' => 'GNU General Public License version 2', 'elgg_version' => '2009030702', 'name' => 'Plugin Test 17', ); @@ -165,13 +165,13 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { } public function testElggPluginManifestGetCopyright() { - $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg 2010'); - $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg 2010'); + $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg Foundation 2011'); + $this->assertEqual($this->manifest18->getCopyright(), '(C) Elgg Foundation 2011'); } public function testElggPluginManifestGetLicense() { - $this->assertEqual($this->manifest18->getLicense(), 'GNU Public License version 2'); - $this->assertEqual($this->manifest17->getLicense(), 'GNU Public License version 2'); + $this->assertEqual($this->manifest18->getLicense(), 'GNU General Public License version 2'); + $this->assertEqual($this->manifest17->getLicense(), 'GNU General Public License version 2'); } diff --git a/engine/tests/test_files/plugin_17/manifest.xml b/engine/tests/test_files/plugin_17/manifest.xml index bb178ab93..706734265 100644 --- a/engine/tests/test_files/plugin_17/manifest.xml +++ b/engine/tests/test_files/plugin_17/manifest.xml @@ -4,7 +4,7 @@ - - + + \ No newline at end of file diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml index 445a41c2e..e0776ffc1 100644 --- a/engine/tests/test_files/plugin_18/manifest.xml +++ b/engine/tests/test_files/plugin_18/manifest.xml @@ -6,8 +6,8 @@ A concise description. A longer, more interesting description. http://www.elgg.org/ - (C) Elgg 2010 - GNU Public License version 2 + (C) Elgg Foundation 2011 + GNU General Public License version 2 elgg_version diff --git a/mod/blog/manifest.xml b/mod/blog/manifest.xml index bd5f9c396..29ee1bfc8 100644 --- a/mod/blog/manifest.xml +++ b/mod/blog/manifest.xml @@ -10,7 +10,7 @@ Adds simple blogging capabilities to your Elgg installation. http://elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/bookmarks/manifest.xml b/mod/bookmarks/manifest.xml index 679d3f1d8..b95af87f8 100644 --- a/mod/bookmarks/manifest.xml +++ b/mod/bookmarks/manifest.xml @@ -10,7 +10,7 @@ Adds the ability for users to bookmark internal and external sites. Other users can then comment on the bookmarks. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/categories/manifest.xml b/mod/categories/manifest.xml index a2f4d97fc..4a6bd0864 100644 --- a/mod/categories/manifest.xml +++ b/mod/categories/manifest.xml @@ -9,7 +9,7 @@ Site-wide Categories lets administrators define categories that users across the site can add content to. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/custom_index/manifest.xml b/mod/custom_index/manifest.xml index f93251214..80187efbc 100644 --- a/mod/custom_index/manifest.xml +++ b/mod/custom_index/manifest.xml @@ -7,7 +7,7 @@ A demonstration of how to create a front page plugin. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/dashboard/manifest.xml b/mod/dashboard/manifest.xml index 14a620268..cbbc1044c 100644 --- a/mod/dashboard/manifest.xml +++ b/mod/dashboard/manifest.xml @@ -7,7 +7,7 @@ A widget-based dashboard for your users http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/developers/manifest.xml b/mod/developers/manifest.xml index 6b672e231..93a12945d 100644 --- a/mod/developers/manifest.xml +++ b/mod/developers/manifest.xml @@ -9,7 +9,7 @@ A set of tools for writing plugins and themes. It is recommended that you have this plugin at the top of the plugin list. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release diff --git a/mod/diagnostics/manifest.xml b/mod/diagnostics/manifest.xml index a9034d695..21e847d22 100644 --- a/mod/diagnostics/manifest.xml +++ b/mod/diagnostics/manifest.xml @@ -9,7 +9,7 @@ Elgg diagnostics tool http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml index c33c8b40a..7ffbc23a4 100644 --- a/mod/embed/manifest.xml +++ b/mod/embed/manifest.xml @@ -8,7 +8,7 @@ Allows users to easily upload and embed media into text areas. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/externalpages/manifest.xml b/mod/externalpages/manifest.xml index 389ad6960..f2aef09f3 100644 --- a/mod/externalpages/manifest.xml +++ b/mod/externalpages/manifest.xml @@ -7,7 +7,7 @@ Create simple web pages for about, contact, privacy, and terms. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/file/manifest.xml b/mod/file/manifest.xml index 85ff76b41..26282a8e3 100644 --- a/mod/file/manifest.xml +++ b/mod/file/manifest.xml @@ -9,7 +9,7 @@ File browser plugin http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/garbagecollector/manifest.xml b/mod/garbagecollector/manifest.xml index 1cbf33592..5aafebf38 100644 --- a/mod/garbagecollector/manifest.xml +++ b/mod/garbagecollector/manifest.xml @@ -8,7 +8,7 @@ Perform some database cleanup tasks http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/groups/manifest.xml b/mod/groups/manifest.xml index b8fd92de7..fd28360d0 100644 --- a/mod/groups/manifest.xml +++ b/mod/groups/manifest.xml @@ -9,7 +9,7 @@ Provides group support for elgg http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/htmlawed/manifest.xml b/mod/htmlawed/manifest.xml index aac599dee..5c1f14cb5 100644 --- a/mod/htmlawed/manifest.xml +++ b/mod/htmlawed/manifest.xml @@ -8,7 +8,7 @@ Provides security filtering. Disabling this plugin is extremely insecure. DO NOT DISABLE. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 3 + GNU General Public License version 3 elgg_release 1.8 diff --git a/mod/invitefriends/manifest.xml b/mod/invitefriends/manifest.xml index 0a1ed2012..b36238a05 100644 --- a/mod/invitefriends/manifest.xml +++ b/mod/invitefriends/manifest.xml @@ -8,7 +8,7 @@ Invite friends via email invites. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/likes/manifest.xml b/mod/likes/manifest.xml index 5a18b8862..62835fcf5 100644 --- a/mod/likes/manifest.xml +++ b/mod/likes/manifest.xml @@ -8,7 +8,7 @@ Enables users to like content on the site. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/logbrowser/manifest.xml b/mod/logbrowser/manifest.xml index d3b76ee8c..4527e2cbb 100644 --- a/mod/logbrowser/manifest.xml +++ b/mod/logbrowser/manifest.xml @@ -8,7 +8,7 @@ Browse the system event log http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/logrotate/manifest.xml b/mod/logrotate/manifest.xml index db04e762f..1aa62e2e7 100644 --- a/mod/logrotate/manifest.xml +++ b/mod/logrotate/manifest.xml @@ -8,7 +8,7 @@ Rotate the system log at specific intervals http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/members/manifest.xml b/mod/members/manifest.xml index efd1ede5e..8b18c9f91 100644 --- a/mod/members/manifest.xml +++ b/mod/members/manifest.xml @@ -7,7 +7,7 @@ Lists the members of your site http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/messageboard/manifest.xml b/mod/messageboard/manifest.xml index b4f74c7d0..617813725 100644 --- a/mod/messageboard/manifest.xml +++ b/mod/messageboard/manifest.xml @@ -8,7 +8,7 @@ This plugin allows users to put a message board on their profile for other users to post comments. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/messages/manifest.xml b/mod/messages/manifest.xml index 238ccf42b..73a58d9d4 100644 --- a/mod/messages/manifest.xml +++ b/mod/messages/manifest.xml @@ -8,7 +8,7 @@ Elgg internal messages plugin. This plugin lets user send each other messages. See COPYRIGHT.txt http://www.elgg.org/ - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/notifications/manifest.xml b/mod/notifications/manifest.xml index a07486331..205476881 100644 --- a/mod/notifications/manifest.xml +++ b/mod/notifications/manifest.xml @@ -7,7 +7,7 @@ Elgg notifications plugin http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/oauth_api/manifest.xml b/mod/oauth_api/manifest.xml index 62111e258..efd3d944f 100644 --- a/mod/oauth_api/manifest.xml +++ b/mod/oauth_api/manifest.xml @@ -8,7 +8,7 @@ api http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/pages/manifest.xml b/mod/pages/manifest.xml index dfc521e11..6990bd6b0 100644 --- a/mod/pages/manifest.xml +++ b/mod/pages/manifest.xml @@ -9,7 +9,7 @@ Elgg Pages http://www.elgg.org See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/profile/manifest.xml b/mod/profile/manifest.xml index f56604c7e..86fbc7b7b 100644 --- a/mod/profile/manifest.xml +++ b/mod/profile/manifest.xml @@ -8,7 +8,7 @@ social http://elgg.org/ See COPYRIGHT.txt - GNU Public License Version 2 + GNU General Public License Version 2 true elgg_release diff --git a/mod/reportedcontent/manifest.xml b/mod/reportedcontent/manifest.xml index aea8f8114..e96620b01 100644 --- a/mod/reportedcontent/manifest.xml +++ b/mod/reportedcontent/manifest.xml @@ -7,7 +7,7 @@ Adds the option for users to report content and for admins to check it out. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/search/manifest.xml b/mod/search/manifest.xml index 9a952d3d8..513d3a6b9 100644 --- a/mod/search/manifest.xml +++ b/mod/search/manifest.xml @@ -7,7 +7,7 @@ Allow search across entities of the site http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/tagcloud/manifest.xml b/mod/tagcloud/manifest.xml index 1127e9559..c0f89f35e 100644 --- a/mod/tagcloud/manifest.xml +++ b/mod/tagcloud/manifest.xml @@ -8,7 +8,7 @@ Widget-based tag clouds. http://cashcostello.com/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/thewire/manifest.xml b/mod/thewire/manifest.xml index 9f6b0eaa9..962ed12f1 100644 --- a/mod/thewire/manifest.xml +++ b/mod/thewire/manifest.xml @@ -8,7 +8,7 @@ Microblogging for Elgg http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/tinymce/manifest.xml b/mod/tinymce/manifest.xml index ac7b23b29..61bf0c22c 100644 --- a/mod/tinymce/manifest.xml +++ b/mod/tinymce/manifest.xml @@ -8,7 +8,7 @@ TinyMCE plugin. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/twitter/manifest.xml b/mod/twitter/manifest.xml index 38380a2ba..18fa8c957 100644 --- a/mod/twitter/manifest.xml +++ b/mod/twitter/manifest.xml @@ -8,7 +8,7 @@ Elgg simple twitter widget http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/twitter_api/manifest.xml b/mod/twitter_api/manifest.xml index 51ad0dcb4..86bba4b50 100644 --- a/mod/twitter_api/manifest.xml +++ b/mod/twitter_api/manifest.xml @@ -8,7 +8,7 @@ bundled http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/uservalidationbyemail/manifest.xml b/mod/uservalidationbyemail/manifest.xml index 232ba71ca..800dd2641 100644 --- a/mod/uservalidationbyemail/manifest.xml +++ b/mod/uservalidationbyemail/manifest.xml @@ -8,7 +8,7 @@ Simple user account validation via email. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 diff --git a/mod/zaudio/manifest.xml b/mod/zaudio/manifest.xml index 767637a56..54f819658 100644 --- a/mod/zaudio/manifest.xml +++ b/mod/zaudio/manifest.xml @@ -9,7 +9,7 @@ This simple plugin lets users play mp3's in the page. http://www.elgg.org/ See COPYRIGHT.txt - GNU Public License version 2 + GNU General Public License version 2 elgg_release 1.8 -- cgit v1.2.3 From 8cca602e2bc1c65b99a2d0c2a60255ab09ca4f3d Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 10 Nov 2011 21:31:39 -0500 Subject: Fixes #4071 hellekin was right - it was a bad idea to format queries --- engine/lib/database.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'engine') diff --git a/engine/lib/database.php b/engine/lib/database.php index ddfda8f4c..c44fdf1fd 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -400,8 +400,6 @@ function get_data_row($query, $callback = "") { function elgg_query_runner($query, $callback = null, $single = false) { global $CONFIG, $DB_QUERY_CACHE; - $query = elgg_format_query($query); - // Since we want to cache results of running the callback, we need to // need to namespace the query with the callback and single result request. // http://trac.elgg.org/ticket/4049 @@ -467,7 +465,6 @@ function elgg_query_runner($query, $callback = null, $single = false) { function insert_data($query) { global $CONFIG, $DB_QUERY_CACHE; - $query = elgg_format_query($query); elgg_log("DB query $query", 'NOTICE'); $dblink = get_db_link('write'); @@ -499,7 +496,6 @@ function insert_data($query) { function update_data($query) { global $CONFIG, $DB_QUERY_CACHE; - $query = elgg_format_query($query); elgg_log("DB query $query", 'NOTICE'); $dblink = get_db_link('write'); @@ -530,7 +526,6 @@ function update_data($query) { function delete_data($query) { global $CONFIG, $DB_QUERY_CACHE; - $query = elgg_format_query($query); elgg_log("DB query $query", 'NOTICE'); $dblink = get_db_link('write'); -- cgit v1.2.3 From 19f9a2ade78ee4522d3775bdba190a636cf79da5 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 12 Nov 2011 09:50:12 -0500 Subject: removed uses of deprecated function for setting page owner guid --- engine/lib/users.php | 4 ++-- mod/groups/actions/groups/edit.php | 2 +- mod/groups/actions/groups/membership/leave.php | 2 +- mod/invitefriends/start.php | 2 +- pages/entities/index.php | 4 ++-- pages/settings/account.php | 2 +- pages/settings/statistics.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'engine') diff --git a/engine/lib/users.php b/engine/lib/users.php index ac507e060..4072740f9 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1088,14 +1088,14 @@ function collections_page_handler($page_elements) { $base = elgg_get_config('path'); if (isset($page_elements[0])) { if ($page_elements[0] == "add") { - set_page_owner(elgg_get_logged_in_user_guid()); + elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); collections_submenu_items(); require_once "{$base}pages/friends/collections/add.php"; return true; } else { $user = get_user_by_username($page_elements[0]); if ($user) { - set_page_owner($user->getGUID()); + elgg_set_page_owner_guid($user->getGUID()); if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) { collections_submenu_items(); } diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php index 27f6e0426..c4cf6667e 100644 --- a/mod/groups/actions/groups/edit.php +++ b/mod/groups/actions/groups/edit.php @@ -91,7 +91,7 @@ $group->save(); // group creator needs to be member of new group and river entry created if ($new_group_flag) { - set_page_owner($group->guid); + elgg_set_page_owner_guid($group->guid); $group->join($user); add_to_river('river/group/create', 'create', $user->guid, $group->guid); } diff --git a/mod/groups/actions/groups/membership/leave.php b/mod/groups/actions/groups/membership/leave.php index 390870df1..4f34c7dde 100644 --- a/mod/groups/actions/groups/membership/leave.php +++ b/mod/groups/actions/groups/membership/leave.php @@ -17,7 +17,7 @@ if (!$user_guid) { $group = get_entity($group_guid); -set_page_owner($group->guid); +elgg_set_page_owner_guid($group->guid); if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) { if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) { diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index be853f2ce..368f6348a 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -33,7 +33,7 @@ function invitefriends_page_handler($page) { gatekeeper(); elgg_set_context('friends'); - set_page_owner(elgg_get_logged_in_user_guid()); + elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('friends:invite'); diff --git a/pages/entities/index.php b/pages/entities/index.php index d3b935dc4..e73d65db4 100644 --- a/pages/entities/index.php +++ b/pages/entities/index.php @@ -25,9 +25,9 @@ if ($context) { // Get the entity, if possible if ($entity = get_entity($guid)) { if ($entity->container_guid) { - set_page_owner($entity->container_guid); + elgg_set_page_owner_guid($entity->container_guid); } else { - set_page_owner($entity->owner_guid); + elgg_set_page_owner_guid($entity->owner_guid); } // Set the body to be the full view of the entity, and the title to be its title diff --git a/pages/settings/account.php b/pages/settings/account.php index 1a57f89d8..1bf71973b 100644 --- a/pages/settings/account.php +++ b/pages/settings/account.php @@ -11,7 +11,7 @@ gatekeeper(); // Make sure we don't open a security hole ... if ((!elgg_get_page_owner_entity()) || (!elgg_get_page_owner_entity()->canEdit())) { - set_page_owner(elgg_get_logged_in_user_guid()); + elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); } $title = elgg_echo('usersettings:user'); diff --git a/pages/settings/statistics.php b/pages/settings/statistics.php index b7394cbe8..9df71ec5e 100644 --- a/pages/settings/statistics.php +++ b/pages/settings/statistics.php @@ -11,7 +11,7 @@ gatekeeper(); // Make sure we don't open a security hole ... if ((!elgg_get_page_owner_entity()) || (!elgg_get_page_owner_entity()->canEdit())) { - set_page_owner(elgg_get_logged_in_user_guid()); + elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); } $title = elgg_echo("usersettings:statistics"); -- cgit v1.2.3 From 6483d9d446e7fa50e16823fe20514a45416880e2 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 13 Nov 2011 16:22:57 -0500 Subject: Fixes #4082 adds output/img --- engine/lib/users.php | 11 ++++++----- mod/bookmarks/views/default/bookmarks/bookmarklet.php | 9 ++++++--- views/default/core/avatar/upload.php | 7 +++++-- views/default/forms/avatar/crop.php | 17 +++++++++++++---- views/default/icon/default.php | 7 +++++-- views/default/icon/user/default.php | 12 +++++++++--- views/default/output/img.php | 12 ++++++++++++ 7 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 views/default/output/img.php (limited to 'engine') diff --git a/engine/lib/users.php b/engine/lib/users.php index 4072740f9..9cb8ddfa7 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1476,14 +1476,15 @@ function users_pagesetup() { // 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' => $viewer->getURL(), - 'text' => "\"$viewer-name\" title=\"$title\" class=\"$class\" />", + 'text' => elgg_view('output/img', array( + 'src' => $viewer->getIconURL('topbar'), + 'alt' => $viewer->name, + 'title' => elgg_echo('profile'), + 'class' => 'elgg-border-plain elgg-transition', + )), 'priority' => 100, 'link_class' => 'elgg-topbar-avatar', )); diff --git a/mod/bookmarks/views/default/bookmarks/bookmarklet.php b/mod/bookmarks/views/default/bookmarks/bookmarklet.php index 1d0b25498..b3e9737fe 100644 --- a/mod/bookmarks/views/default/bookmarks/bookmarklet.php +++ b/mod/bookmarks/views/default/bookmarks/bookmarklet.php @@ -20,13 +20,16 @@ if (!$name && ($user = elgg_get_logged_in_user_entity())) { } $url = elgg_get_site_url(); - +$img = elgg_view('output/img', array( + 'src' => 'mod/bookmarks/graphics/bookmarklet.gif', + 'alt' => $title, +)); $bookmarklet = "getIconUrl('medium'); +$user_avatar = elgg_view('output/img', array( + 'src' => $vars['entity']->getIconUrl('medium'), + 'alt' => elgg_echo('avatar'), +)); $current_label = elgg_echo('avatar:current'); @@ -23,7 +26,7 @@ $upload_form = elgg_view_form('avatar/upload', $form_params, $vars); $image = <<
- avatar + $user_avatar HTML; diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php index f622fd60f..3e798cb27 100644 --- a/views/default/forms/avatar/crop.php +++ b/views/default/forms/avatar/crop.php @@ -9,14 +9,23 @@ elgg_load_js('jquery.imgareaselect'); elgg_load_js('elgg.avatar_cropper'); elgg_load_css('jquery.imgareaselect'); -$master_image = $vars['entity']->getIconUrl('master'); +$master_img = elgg_view('output/img', array( + 'src' => $vars['entity']->getIconUrl('master'), + 'alt' => elgg_echo('avatar'), + 'class' => 'mrl', + 'id' => 'user-avatar-cropper', +)); + +$preview_img = elgg_view('output/img', array( + 'src' => $vars['entity']->getIconUrl('master'), + 'alt' => elgg_echo('avatar'), +)); ?>
- <?php echo elgg_echo('avatar'); ?> +
-
- +
getIconURL($vars['size']); -$img = "\"$title\""; +$img = elgg_view('output/img', array( + 'src' => $entity->getIconURL($vars['size']), + 'alt' => $title, + 'class' => $class, +)); if ($url) { $params = array( diff --git a/views/default/icon/user/default.php b/views/default/icon/user/default.php index a208ec41a..c0b0e7483 100644 --- a/views/default/icon/user/default.php +++ b/views/default/icon/user/default.php @@ -47,7 +47,7 @@ if ($js) { $img_class = ''; if (isset($vars['img_class'])) { - $img_class = "class=\"{$vars['img_class']}\""; + $img_class = $vars['img_class']; } $use_hover = elgg_extract('use_hover', $vars, true); @@ -62,8 +62,14 @@ if (isset($vars['hover'])) { $spacer_url = elgg_get_site_url() . '_graphics/spacer.gif'; -$icon_url = $user->getIconURL($size); -$icon = "\"$name\""; +$icon_url = elgg_format_url($user->getIconURL($size)); +$icon = elgg_view('output/img', array( + 'src' => $spacer_url, + 'alt' => $name, + 'title' => $name, + 'class' => $img_class, + 'style' => "background: url($icon_url) no-repeat;", +)); $show_menu = $use_hover && (elgg_is_admin_logged_in() || !$user->isBanned()); diff --git a/views/default/output/img.php b/views/default/output/img.php new file mode 100644 index 000000000..d3f596801 --- /dev/null +++ b/views/default/output/img.php @@ -0,0 +1,12 @@ +"; -- cgit v1.2.3 From 2694d74593644af64737a41d32cc6191265fc02b Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 13 Nov 2011 19:48:32 -0500 Subject: added the missing set/get priority methods to ElggMenuItem --- engine/classes/ElggMenuItem.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'engine') diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 289919a8e..62547134a 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -415,6 +415,7 @@ class ElggMenuItem { * * @param int $priority The smaller numbers mean higher priority (1 before 100) * @return void + * @deprecated */ public function setWeight($priority) { $this->data['priority'] = $priority; @@ -424,11 +425,31 @@ class ElggMenuItem { * Get the priority of the menu item * * @return int + * @deprecated */ public function getWeight() { return $this->data['priority']; } + /** + * Set the priority of the menu item + * + * @param int $priority The smaller numbers mean higher priority (1 before 100) + * @return void + */ + public function setPriority($priority) { + $this->data['priority'] = $priority; + } + + /** + * Get the priority of the menu item + * + * @return int + */ + public function getPriority() { + return $this->data['priority']; + } + /** * Set the section identifier * -- cgit v1.2.3 From 6ee02beb269d4eac6d24d163fd8b9fbbd0bdab14 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 15 Nov 2011 18:51:45 -0500 Subject: Fixes #4090 removes double assignment - thanks to andres.fortier --- engine/lib/relationships.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 929d3841d..3578f0cb8 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -123,7 +123,7 @@ function check_entity_relationship($guid_one, $relationship, $guid_two) { AND relationship='$relationship' AND guid_two=$guid_two limit 1"; - $row = $row = get_data_row($query); + $row = get_data_row($query); if ($row) { return $row; } -- cgit v1.2.3 From ed682b22e5a14673090bc9e48ee8c0ecebaadef9 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 15 Nov 2011 18:55:04 -0500 Subject: Fixes #4089 corrects documentation of ElggRelationship constructor --- engine/classes/ElggRelationship.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggRelationship.php b/engine/classes/ElggRelationship.php index a0826689d..2d9a32cbd 100644 --- a/engine/classes/ElggRelationship.php +++ b/engine/classes/ElggRelationship.php @@ -10,9 +10,9 @@ class ElggRelationship extends ElggData implements { /** - * Construct a new site object, optionally from a given id value or row. + * Create a relationship object, optionally from a given id value or row. * - * @param mixed $id ElggRelationship id + * @param mixed $id ElggRelationship id, database row, or null for new relationship */ function __construct($id = null) { $this->initializeAttributes(); -- cgit v1.2.3 From fbbed3deaa0090173d398587cfea4af144d062a2 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 15 Nov 2011 20:03:52 -0500 Subject: atleast renaming the ui js libs --- engine/lib/elgglib.php | 8 +-- js/lib/autocomplete.js | 14 ------ js/lib/avatar_cropper.js | 76 ---------------------------- js/lib/friends_picker.js | 91 ---------------------------------- js/lib/ui.autocomplete.js | 14 ++++++ js/lib/ui.avatar_cropper.js | 76 ++++++++++++++++++++++++++++ js/lib/ui.friends_picker.js | 91 ++++++++++++++++++++++++++++++++++ js/lib/ui.userpicker.js | 117 ++++++++++++++++++++++++++++++++++++++++++++ js/lib/userpicker.js | 117 -------------------------------------------- 9 files changed, 302 insertions(+), 302 deletions(-) delete mode 100644 js/lib/autocomplete.js delete mode 100644 js/lib/avatar_cropper.js delete mode 100644 js/lib/friends_picker.js create mode 100644 js/lib/ui.autocomplete.js create mode 100644 js/lib/ui.avatar_cropper.js create mode 100644 js/lib/ui.friends_picker.js create mode 100644 js/lib/ui.userpicker.js delete mode 100644 js/lib/userpicker.js (limited to 'engine') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 47ca157e1..08b346960 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -2048,12 +2048,12 @@ function elgg_init() { elgg_register_page_handler('css', 'elgg_css_page_handler'); elgg_register_page_handler('ajax', 'elgg_ajax_page_handler'); - elgg_register_js('elgg.autocomplete', 'js/lib/autocomplete.js'); + elgg_register_js('elgg.autocomplete', 'js/lib/ui.autocomplete.js'); elgg_register_js('jquery.ui.autocomplete.html', 'vendors/jquery/jquery.ui.autocomplete.html.js'); - elgg_register_js('elgg.userpicker', 'js/lib/userpicker.js'); - elgg_register_js('elgg.friendspicker', 'js/lib/friends_picker.js'); + elgg_register_js('elgg.userpicker', 'js/lib/ui.userpicker.js'); + elgg_register_js('elgg.friendspicker', 'js/lib/ui.friends_picker.js'); elgg_register_js('jquery.easing', 'vendors/jquery/jquery.easing.1.3.packed.js'); - elgg_register_js('elgg.avatar_cropper', 'js/lib/avatar_cropper.js'); + elgg_register_js('elgg.avatar_cropper', 'js/lib/ui.avatar_cropper.js'); elgg_register_js('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect-0.9.8/scripts/jquery.imgareaselect.min.js'); elgg_register_css('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect-0.9.8/css/imgareaselect-deprecated.css'); diff --git a/js/lib/autocomplete.js b/js/lib/autocomplete.js deleted file mode 100644 index 46d72d146..000000000 --- a/js/lib/autocomplete.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * - */ -elgg.provide('elgg.autocomplete'); - -elgg.autocomplete.init = function() { - $('.elgg-input-autocomplete').autocomplete({ - source: elgg.autocomplete.url, //gets set by input/autocomplete view - minLength: 2, - html: "html" - }) -}; - -elgg.register_hook_handler('init', 'system', elgg.autocomplete.init); \ No newline at end of file diff --git a/js/lib/avatar_cropper.js b/js/lib/avatar_cropper.js deleted file mode 100644 index fc32a0832..000000000 --- a/js/lib/avatar_cropper.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Avatar cropping - */ - -elgg.provide('elgg.avatarCropper'); - -/** - * Register the avatar cropper. - * - * If the hidden inputs have the coordinates from a previous cropping, begin - * the selection and preview with that displayed. - */ -elgg.avatarCropper.init = function() { - var params = { - selectionOpacity: 0, - aspectRatio: '1:1', - onSelectEnd: elgg.avatarCropper.selectChange, - onSelectChange: elgg.avatarCropper.preview - }; - - if ($('input[name=x2]').val()) { - params.x1 = $('input[name=x1]').val(); - params.x2 = $('input[name=x2]').val(); - params.y1 = $('input[name=y1]').val(); - params.y2 = $('input[name=y2]').val(); - } - - $('#user-avatar-cropper').imgAreaSelect(params); - - if ($('input[name=x2]').val()) { - var ias = $('#user-avatar-cropper').imgAreaSelect({instance: true}); - var selection = ias.getSelection(); - elgg.avatarCropper.preview($('#user-avatar-cropper'), selection); - } -}; - -/** - * Handler for changing select area. - * - * @param {Object} reference to the image - * @param {Object} imgareaselect selection object - * @return void - */ -elgg.avatarCropper.preview = function(img, selection) { - // catch for the first click on the image - if (selection.width == 0 || selection.height == 0) { - return; - } - - var origWidth = $("#user-avatar-cropper").width(); - var origHeight = $("#user-avatar-cropper").height(); - var scaleX = 100 / selection.width; - var scaleY = 100 / selection.height; - $('#user-avatar-preview > img').css({ - width: Math.round(scaleX * origWidth) + 'px', - height: Math.round(scaleY * origHeight) + 'px', - marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', - marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' - }); -}; - -/** - * Handler for updating the form inputs after select ends - * - * @param {Object} reference to the image - * @param {Object} imgareaselect selection object - * @return void - */ -elgg.avatarCropper.selectChange = function(img, selection) { - $('input[name=x1]').val(selection.x1); - $('input[name=x2]').val(selection.x2); - $('input[name=y1]').val(selection.y1); - $('input[name=y2]').val(selection.y2); -}; - -elgg.register_hook_handler('init', 'system', elgg.avatarCropper.init); \ No newline at end of file diff --git a/js/lib/friends_picker.js b/js/lib/friends_picker.js deleted file mode 100644 index 9257c40fc..000000000 --- a/js/lib/friends_picker.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - elgg friendsPicker plugin - adapted from Niall Doherty's excellent Coda-Slider - http://www.ndoherty.com/coda-slider - */ - - -jQuery.fn.friendsPicker = function(iterator) { - - var settings; - settings = $.extend({ easeFunc: "easeOutExpo", easeTime: 1000, toolTip: false }, settings); - - return this.each(function() { - - var container = $(this); - container.addClass("friends-picker"); - // set panelwidth manually as it's hidden initially - adjust this value for different themes/pagewidths - var panelWidth = 730; - - // count the panels in the container - var panelCount = container.find("div.panel").size(); - // calculate the width of all the panels lined up end-to-end - var friendsPicker_containerWidth = panelWidth*panelCount; - // specify width for the friendsPicker_container - container.find("div.friends-picker-container").css("width" , friendsPicker_containerWidth); - - // global variables for container.each function below - var friendsPickerNavigationWidth = 0; - var currentPanel = 1; - - // generate appropriate nav for each container - container.each(function(i) { - // generate Left and Right arrows - $(this).before("
Left<\/div>"); - $(this).after("
Right<\/div>"); - - // generate a-z tabs - $(this).before("
    <\/ul><\/div>"); - $(this).find("div.panel").each(function(individualTabItemNumber) { - $("div#friends-picker-navigation" + iterator + " ul").append("
  • " + $(this).attr("title") + "<\/a><\/li>"); - }); - - // tabs navigation - $("div#friends-picker-navigation" + iterator + " a").each(function(individualTabItemNumber) { - // calc friendsPickerNavigationWidth by summing width of each li - friendsPickerNavigationWidth += $(this).parent().width(); - // set-up individual tab clicks - $(this).bind("click", function() { - $(this).addClass("current").parent().parent().find("a").not($(this)).removeClass("current"); - var distanceToMoveFriendsPicker_container = - (panelWidth*individualTabItemNumber); - currentPanel = individualTabItemNumber + 1; - $(this).parent().parent().parent().next().find("div.friends-picker-container").animate({ left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc); - }); - }); - - // Right arow click function - $("div#friends-picker-navigation-r" + iterator + " a").click(function() { - if (currentPanel == panelCount) { - var distanceToMoveFriendsPicker_container = 0; - currentPanel = 1; - $(this).parent().parent().find("div.friends-picker-navigation a.current").removeClass("current").parent().parent().find("a:eq(0)").addClass("current"); - } else { - var distanceToMoveFriendsPicker_container = - (panelWidth*currentPanel); - currentPanel += 1; - $(this).parent().parent().find("div.friends-picker-navigation a.current").removeClass("current").parent().next().find("a").addClass("current"); - }; - $(this).parent().parent().find("div.friends-picker-container").animate({ left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc); - return false; - }); - - // Left arrow click function - $("div#friends-picker-navigation-l" + iterator + " a").click(function() { - if (currentPanel == 1) { - var distanceToMoveFriendsPicker_container = - (panelWidth*(panelCount - 1)); - currentPanel = panelCount; - $(this).parent().parent().find("div.friends-picker-navigation a.current").removeClass("current").parent().parent().find("li:last a").addClass("current"); - } else { - currentPanel -= 1; - var distanceToMoveFriendsPicker_container = - (panelWidth*(currentPanel - 1)); - $(this).parent().parent().find("div.friends-picker-navigation a.current").removeClass("current").parent().prev().find("a").addClass("current"); - }; - $(this).parent().parent().find("div.friends-picker-container").animate({ left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc); - return false; - }); - - // apply 'current' class to currently selected tab link - $("div#friends-picker-navigation" + iterator + " a:eq(0)").addClass("current"); - }); - - $("div#friends-picker-navigation" + iterator).append("
    "); - }); -}; \ No newline at end of file diff --git a/js/lib/ui.autocomplete.js b/js/lib/ui.autocomplete.js new file mode 100644 index 000000000..46d72d146 --- /dev/null +++ b/js/lib/ui.autocomplete.js @@ -0,0 +1,14 @@ +/** + * + */ +elgg.provide('elgg.autocomplete'); + +elgg.autocomplete.init = function() { + $('.elgg-input-autocomplete').autocomplete({ + source: elgg.autocomplete.url, //gets set by input/autocomplete view + minLength: 2, + html: "html" + }) +}; + +elgg.register_hook_handler('init', 'system', elgg.autocomplete.init); \ No newline at end of file diff --git a/js/lib/ui.avatar_cropper.js b/js/lib/ui.avatar_cropper.js new file mode 100644 index 000000000..fc32a0832 --- /dev/null +++ b/js/lib/ui.avatar_cropper.js @@ -0,0 +1,76 @@ +/** + * Avatar cropping + */ + +elgg.provide('elgg.avatarCropper'); + +/** + * Register the avatar cropper. + * + * If the hidden inputs have the coordinates from a previous cropping, begin + * the selection and preview with that displayed. + */ +elgg.avatarCropper.init = function() { + var params = { + selectionOpacity: 0, + aspectRatio: '1:1', + onSelectEnd: elgg.avatarCropper.selectChange, + onSelectChange: elgg.avatarCropper.preview + }; + + if ($('input[name=x2]').val()) { + params.x1 = $('input[name=x1]').val(); + params.x2 = $('input[name=x2]').val(); + params.y1 = $('input[name=y1]').val(); + params.y2 = $('input[name=y2]').val(); + } + + $('#user-avatar-cropper').imgAreaSelect(params); + + if ($('input[name=x2]').val()) { + var ias = $('#user-avatar-cropper').imgAreaSelect({instance: true}); + var selection = ias.getSelection(); + elgg.avatarCropper.preview($('#user-avatar-cropper'), selection); + } +}; + +/** + * Handler for changing select area. + * + * @param {Object} reference to the image + * @param {Object} imgareaselect selection object + * @return void + */ +elgg.avatarCropper.preview = function(img, selection) { + // catch for the first click on the image + if (selection.width == 0 || selection.height == 0) { + return; + } + + var origWidth = $("#user-avatar-cropper").width(); + var origHeight = $("#user-avatar-cropper").height(); + var scaleX = 100 / selection.width; + var scaleY = 100 / selection.height; + $('#user-avatar-preview > img').css({ + width: Math.round(scaleX * origWidth) + 'px', + height: Math.round(scaleY * origHeight) + 'px', + marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', + marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' + }); +}; + +/** + * Handler for updating the form inputs after select ends + * + * @param {Object} reference to the image + * @param {Object} imgareaselect selection object + * @return void + */ +elgg.avatarCropper.selectChange = function(img, selection) { + $('input[name=x1]').val(selection.x1); + $('input[name=x2]').val(selection.x2); + $('input[name=y1]').val(selection.y1); + $('input[name=y2]').val(selection.y2); +}; + +elgg.register_hook_handler('init', 'system', elgg.avatarCropper.init); \ No newline at end of file diff --git a/js/lib/ui.friends_picker.js b/js/lib/ui.friends_picker.js new file mode 100644 index 000000000..9257c40fc --- /dev/null +++ b/js/lib/ui.friends_picker.js @@ -0,0 +1,91 @@ +/* + elgg friendsPicker plugin + adapted from Niall Doherty's excellent Coda-Slider - http://www.ndoherty.com/coda-slider + */ + + +jQuery.fn.friendsPicker = function(iterator) { + + var settings; + settings = $.extend({ easeFunc: "easeOutExpo", easeTime: 1000, toolTip: false }, settings); + + return this.each(function() { + + var container = $(this); + container.addClass("friends-picker"); + // set panelwidth manually as it's hidden initially - adjust this value for different themes/pagewidths + var panelWidth = 730; + + // count the panels in the container + var panelCount = container.find("div.panel").size(); + // calculate the width of all the panels lined up end-to-end + var friendsPicker_containerWidth = panelWidth*panelCount; + // specify width for the friendsPicker_container + container.find("div.friends-picker-container").css("width" , friendsPicker_containerWidth); + + // global variables for container.each function below + var friendsPickerNavigationWidth = 0; + var currentPanel = 1; + + // generate appropriate nav for each container + container.each(function(i) { + // generate Left and Right arrows + $(this).before("
    Left<\/div>"); + $(this).after("
    Right<\/div>"); + + // generate a-z tabs + $(this).before("
      <\/ul><\/div>"); + $(this).find("div.panel").each(function(individualTabItemNumber) { + $("div#friends-picker-navigation" + iterator + " ul").append("
    • " + $(this).attr("title") + "<\/a><\/li>"); + }); + + // tabs navigation + $("div#friends-picker-navigation" + iterator + " a").each(function(individualTabItemNumber) { + // calc friendsPickerNavigationWidth by summing width of each li + friendsPickerNavigationWidth += $(this).parent().width(); + // set-up individual tab clicks + $(this).bind("click", function() { + $(this).addClass("current").parent().parent().find("a").not($(this)).removeClass("current"); + var distanceToMoveFriendsPicker_container = - (panelWidth*individualTabItemNumber); + currentPanel = individualTabItemNumber + 1; + $(this).parent().parent().parent().next().find("div.friends-picker-container").animate({ left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc); + }); + }); + + // Right arow click function + $("div#friends-picker-navigation-r" + iterator + " a").click(function() { + if (currentPanel == panelCount) { + var distanceToMoveFriendsPicker_container = 0; + currentPanel = 1; + $(this).parent().parent().find("div.friends-picker-navigation a.current").removeClass("current").parent().parent().find("a:eq(0)").addClass("current"); + } else { + var distanceToMoveFriendsPicker_container = - (panelWidth*currentPanel); + currentPanel += 1; + $(this).parent().parent().find("div.friends-picker-navigation a.current").removeClass("current").parent().next().find("a").addClass("current"); + }; + $(this).parent().parent().find("div.friends-picker-container").animate({ left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc); + return false; + }); + + // Left arrow click function + $("div#friends-picker-navigation-l" + iterator + " a").click(function() { + if (currentPanel == 1) { + var distanceToMoveFriendsPicker_container = - (panelWidth*(panelCount - 1)); + currentPanel = panelCount; + $(this).parent().parent().find("div.friends-picker-navigation a.current").removeClass("current").parent().parent().find("li:last a").addClass("current"); + } else { + currentPanel -= 1; + var distanceToMoveFriendsPicker_container = - (panelWidth*(currentPanel - 1)); + $(this).parent().parent().find("div.friends-picker-navigation a.current").removeClass("current").parent().prev().find("a").addClass("current"); + }; + $(this).parent().parent().find("div.friends-picker-container").animate({ left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc); + return false; + }); + + // apply 'current' class to currently selected tab link + $("div#friends-picker-navigation" + iterator + " a:eq(0)").addClass("current"); + }); + + $("div#friends-picker-navigation" + iterator).append("
      "); + }); +}; \ No newline at end of file diff --git a/js/lib/ui.userpicker.js b/js/lib/ui.userpicker.js new file mode 100644 index 000000000..8287ba91c --- /dev/null +++ b/js/lib/ui.userpicker.js @@ -0,0 +1,117 @@ +elgg.provide('elgg.userpicker'); + +/** + * Userpicker initialization + * + * The userpicker is an autocomplete library for selecting multiple users or + * friends. It works in concert with the view input/userpicker. + * + * @return void + */ +elgg.userpicker.init = function() { + + // binding autocomplete. + // doing this as an each so we can pass this to functions. + $('.elgg-input-user-picker').each(function() { + + $(this).autocomplete({ + source: function(request, response) { + + var params = elgg.userpicker.getSearchParams(this); + + elgg.get('livesearch', { + data: params, + dataType: 'json', + success: function(data) { + response(data); + } + }); + }, + minLength: 2, + html: "html", + select: elgg.userpicker.addUser + }) + }); + + $('.elgg-userpicker-remove').live('click', elgg.userpicker.removeUser); +}; + +/** + * Adds a user to the select user list + * + * elgg.userpicker.userList is defined in the input/userpicker view + * + * @param {Object} event + * @param {Object} ui The object returned by the autocomplete endpoint + * @return void + */ +elgg.userpicker.addUser = function(event, ui) { + var info = ui.item; + + // do not allow users to be added multiple times + if (!(info.guid in elgg.userpicker.userList)) { + elgg.userpicker.userList[info.guid] = true; + var users = $(this).siblings('.elgg-user-picker-list'); + var li = ''; + li += elgg.userpicker.viewUser(info); + $('
    • ').html(li).appendTo(users); + } + + $(this).val(''); + event.preventDefault(); +}; + +/** + * Remove a user from the selected user list + * + * @param {Object} event + * @return void + */ +elgg.userpicker.removeUser = function(event) { + var item = $(this).closest('.elgg-user-picker-list > li'); + + var guid = item.find('[name="members[]"]').val(); + delete elgg.userpicker.userList[guid]; + + item.remove(); + event.preventDefault(); +}; + +/** + * Render the list item for insertion into the selected user list + * + * The html in this method has to remain synced with the input/userpicker view + * + * @param {Object} info The object returned by the autocomplete endpoint + * @return string + */ +elgg.userpicker.viewUser = function(info) { + + var deleteLink = "X"; + + var html = "
      "; + html += "
      " + info.icon + "
      "; + html += "
      " + deleteLink + "
      "; + html += "
      " + info.name + "
      "; + html += "'; - li += elgg.userpicker.viewUser(info); - $('
    • ').html(li).appendTo(users); - } - - $(this).val(''); - event.preventDefault(); -}; - -/** - * Remove a user from the selected user list - * - * @param {Object} event - * @return void - */ -elgg.userpicker.removeUser = function(event) { - var item = $(this).closest('.elgg-user-picker-list > li'); - - var guid = item.find('[name="members[]"]').val(); - delete elgg.userpicker.userList[guid]; - - item.remove(); - event.preventDefault(); -}; - -/** - * Render the list item for insertion into the selected user list - * - * The html in this method has to remain synced with the input/userpicker view - * - * @param {Object} info The object returned by the autocomplete endpoint - * @return string - */ -elgg.userpicker.viewUser = function(info) { - - var deleteLink = "X"; - - var html = "
      "; - html += "
      " + info.icon + "
      "; - html += "
      " + deleteLink + "
      "; - html += "
      " + info.name + "
      "; - html += " Date: Thu, 17 Nov 2011 07:49:25 -0500 Subject: Fixes #4094, #4095 fixes casting issues in unit tests - thanks to andres.fortier --- engine/tests/objects/entities.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php index c13b4c731..e010a3fa7 100644 --- a/engine/tests/objects/entities.php +++ b/engine/tests/objects/entities.php @@ -89,21 +89,21 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { $this->assertFalse(isset($this->entity->non_existent)); // create metadata - $this->assertTrue($this->entity->non_existent = 'testing'); + $this->entity->existent = 'testing'; + $this->assertIdentical($this->entity->existent, 'testing'); // check metadata set - $this->assertTrue(isset($this->entity->non_existent)); - $this->assertIdentical($this->entity->non_existent, 'testing'); - $this->assertIdentical($this->entity->getMetaData('non_existent'), 'testing'); + $this->assertTrue(isset($this->entity->existent)); + $this->assertIdentical($this->entity->getMetaData('existent'), 'testing'); // check internal metadata array $metadata = $this->entity->expose_metadata(); - $this->assertIdentical($metadata['non_existent'], 'testing'); + $this->assertIdentical($metadata['existent'], 'testing'); } public function testElggEnityGetAndSetAnnotations() { $this->assertFalse(array_key_exists('non_existent', $this->entity->expose_annotations())); - $this->assertFalse($this->entity->getAnnotations('non_existent')); + $this->assertIdentical($this->entity->getAnnotations('non_existent'), array()); // set and check temp annotation $this->assertTrue($this->entity->annotate('non_existent', 'testing')); -- cgit v1.2.3 From 1dc08335584dac4630fd7fdf638bb6c6e0d85cb3 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 17 Nov 2011 22:18:42 -0500 Subject: Fixes #4120 metadata tests now check for the correct types --- engine/tests/api/metadata.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/tests/api/metadata.php b/engine/tests/api/metadata.php index 7897b8d47..f5b615ca8 100644 --- a/engine/tests/api/metadata.php +++ b/engine/tests/api/metadata.php @@ -58,11 +58,11 @@ class ElggCoreMetadataAPITest extends ElggCoreUnitTest { $this->create_metastring('tested'); // create_metadata returns id of metadata on success - $this->assertTrue(create_metadata($this->object->guid, 'metaUnitTest', 'tested')); + $this->assertNotEqual(false, create_metadata($this->object->guid, 'metaUnitTest', 'tested')); // check value with improper case $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'Tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE); - $this->assertFalse(elgg_get_entities_from_metadata($options)); + $this->assertIdentical(array(), elgg_get_entities_from_metadata($options)); // compare forced case with ignored case $options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE); -- cgit v1.2.3 From d792a0987ef0c3f292c038effded241793b32b73 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 18 Nov 2011 06:25:25 -0500 Subject: Fixes #4114 checking type for acl test --- engine/tests/api/access_collections.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php index 0c37fa779..7875b1409 100644 --- a/engine/tests/api/access_collections.php +++ b/engine/tests/api/access_collections.php @@ -76,7 +76,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest { $q = "SELECT * FROM {$this->dbPrefix}access_collections WHERE id = $acl_id"; $data = get_data($q); - $this->assertFalse($data); + $this->assertIdentical(array(), $data); } } -- cgit v1.2.3 From e1b2cf3b9499f0a5a649e4695f7a26d3a3bf6ddb Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 18 Nov 2011 06:33:17 -0500 Subject: Fixes #4104, #4105 fixed casting in testElggEntityMetadata() --- engine/tests/objects/entities.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'engine') diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php index e010a3fa7..06bc80a4a 100644 --- a/engine/tests/objects/entities.php +++ b/engine/tests/objects/entities.php @@ -230,24 +230,26 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { // let's delete a non-existent metadata $this->assertFalse($this->entity->deleteMetadata('important')); - // let's add the meatadata - $this->assertTrue($this->entity->important = 'indeed!'); - $this->assertTrue($this->entity->less_important = 'true, too!'); + // let's add the metadata + $this->entity->important = 'indeed!'; + $this->assertIdentical('indeed!', $this->entity->important); + $this->entity->less_important = 'true, too!'; + $this->assertIdentical('true, too!', $this->entity->less_important); $this->save_entity(); // test deleting incorrectly // @link http://trac.elgg.org/ticket/2273 - $this->assertFalse($this->entity->deleteMetadata('impotent')); + $this->assertNull($this->entity->deleteMetadata('impotent')); $this->assertEqual($this->entity->important, 'indeed!'); // get rid of one metadata $this->assertEqual($this->entity->important, 'indeed!'); $this->assertTrue($this->entity->deleteMetadata('important')); - $this->assertEqual($this->entity->important, ''); + $this->assertNull($this->entity->important); // get rid of all metadata $this->assertTrue($this->entity->deleteMetadata()); - $this->assertEqual($this->entity->less_important, ''); + $this->assertNull($this->entity->less_important); // clean up database $this->assertTrue($this->entity->delete()); -- cgit v1.2.3 From 51e2a993373b9f39c1c2b7f308dd308d320feb0a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 18 Nov 2011 06:42:45 -0500 Subject: Fixes #4108 delete() returns bool now and updated unit tests --- engine/lib/entities.php | 2 +- engine/tests/objects/entities.php | 2 +- engine/tests/objects/sites.php | 6 ++++-- engine/tests/objects/users.php | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index fd2b0e9f9..d8db88462 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1563,7 +1563,7 @@ function delete_entity($guid, $recursive = true) { } } - return $res; + return (bool)$res; } } } diff --git a/engine/tests/objects/entities.php b/engine/tests/objects/entities.php index 06bc80a4a..1772f7c1a 100644 --- a/engine/tests/objects/entities.php +++ b/engine/tests/objects/entities.php @@ -178,7 +178,7 @@ class ElggCoreEntityTest extends ElggCoreUnitTest { $this->AssertEqual($this->entity->get('non_existent'), 'testing'); // clean up with delete - $this->assertTrue($this->entity->delete()); + $this->assertIdentical(true, $this->entity->delete()); } public function testElggEntityDisableAndEnable() { diff --git a/engine/tests/objects/sites.php b/engine/tests/objects/sites.php index e5acbb3f9..a05074c59 100644 --- a/engine/tests/objects/sites.php +++ b/engine/tests/objects/sites.php @@ -66,8 +66,10 @@ class ElggCoreSiteTest extends ElggCoreUnitTest { } public function testElggSiteSaveAndDelete() { - $this->assertTrue($this->site->save()); - $this->assertTrue($this->site->delete()); + $guid = $this->site->save(); + $this->assertIsA($guid, 'int'); + $this->assertTrue($guid > 0); + $this->assertIdentical(true, $this->site->delete()); } } diff --git a/engine/tests/objects/users.php b/engine/tests/objects/users.php index d1533c3d2..901d76ac0 100644 --- a/engine/tests/objects/users.php +++ b/engine/tests/objects/users.php @@ -138,7 +138,7 @@ class ElggCoreUserTest extends ElggCoreUnitTest { $guid = $this->user->save(); // delete object - $this->assertTrue($this->user->delete()); + $this->assertIdentical(true, $this->user->delete()); // check GUID not in database $this->assertFalse($this->fetchUser($guid)); -- cgit v1.2.3 From a77a8f5c4a1e76aa9beb18a2b3c938b3082fa4a8 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 18 Nov 2011 06:46:03 -0500 Subject: Fixes #4109 remove inaccurate comment due to copy & paste --- engine/tests/api/metastrings.php | 6 ------ engine/tests/objects/sites.php | 3 --- engine/tests/objects/users.php | 3 --- engine/tests/test_skeleton.php | 3 --- 4 files changed, 15 deletions(-) (limited to 'engine') diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index 9b5d7ee4e..0a008c6ce 100644 --- a/engine/tests/api/metastrings.php +++ b/engine/tests/api/metastrings.php @@ -68,9 +68,6 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { parent::__destruct(); } - /** - * A basic test that will be called and fail. - */ public function testDeleteByID() { $db_prefix = elgg_get_config('dbprefix'); $annotations = $this->createAnnotations(1); @@ -101,9 +98,6 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { } } - /** - * A basic test that will be called and fail. - */ public function testEnableDisableByID() { $db_prefix = elgg_get_config('dbprefix'); $annotations = $this->createAnnotations(1); diff --git a/engine/tests/objects/sites.php b/engine/tests/objects/sites.php index a05074c59..a01a661e3 100644 --- a/engine/tests/objects/sites.php +++ b/engine/tests/objects/sites.php @@ -36,9 +36,6 @@ class ElggCoreSiteTest extends ElggCoreUnitTest { parent::__destruct(); } - /** - * A basic test that will be called and fail. - */ public function testElggSiteConstructor() { $attributes = array(); $attributes['guid'] = NULL; diff --git a/engine/tests/objects/users.php b/engine/tests/objects/users.php index 901d76ac0..a3573acb6 100644 --- a/engine/tests/objects/users.php +++ b/engine/tests/objects/users.php @@ -41,9 +41,6 @@ class ElggCoreUserTest extends ElggCoreUnitTest { parent::__destruct(); } - /** - * A basic test that will be called and fail. - */ public function testElggUserConstructor() { $attributes = array(); $attributes['guid'] = NULL; diff --git a/engine/tests/test_skeleton.php b/engine/tests/test_skeleton.php index e5ff557e5..5a5de89bb 100644 --- a/engine/tests/test_skeleton.php +++ b/engine/tests/test_skeleton.php @@ -49,9 +49,6 @@ class ElggCoreSkeletonTest extends ElggCoreUnitTest { parent::__destruct(); } - /** - * A basic test that will be called and fail. - */ public function testFailure() { $this->assertTrue(FALSE); } -- cgit v1.2.3 From 597641b401a73d6d5cd7f35f052095105bd2fb22 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 17:15:02 -0500 Subject: Fixes #4112 get_user_by_username() returns false if no user --- engine/lib/users.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engine') diff --git a/engine/lib/users.php b/engine/lib/users.php index 9cb8ddfa7..29fa4db2f 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -565,6 +565,8 @@ function get_user_by_username($username) { $entity = get_data_row($query, 'entity_row_to_elggstar'); if ($entity) { $USERNAME_TO_GUID_MAP_CACHE[$username] = $entity->guid; + } else { + $entity = false; } return $entity; -- cgit v1.2.3 From 3a9198cc650ce3d55fa6227de21b63d327c4e62f Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 17:35:32 -0500 Subject: Fixes #4122, #4123, #4124 testing for empty arrays and added some documentation for the sanity of future developers --- engine/tests/api/entity_getter_functions.php | 63 ++++++++++++++++++---------- 1 file changed, 41 insertions(+), 22 deletions(-) (limited to 'engine') diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index e7906d3c8..a548a8e52 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -175,9 +175,10 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } /** + * Get a mix of valid and invalid types * - * @param unknown_type $num - * @return unknown_type + * @param int $num + * @return array */ public function getRandomMixedTypes($num = 2) { $have_valid = $have_invalid = false; @@ -196,8 +197,8 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { * Get random mix of valid and invalid subtypes for types given. * * @param array $types - * @param unknown_type $num - * @return unknown_type + * @param int $num + * @return array */ public function getRandomMixedSubtypes(array $types, $num = 2) { $types_c = count($types); @@ -230,8 +231,8 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { /** * Creates random annotations on $entity * - * @param unknown_type $entity - * @param unknown_type $max + * @param ElggEntity $entity + * @param int $max */ public function createRandomAnnotations($entity, $max = 1) { $annotations = array(); @@ -563,7 +564,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { * TYPE_SUBTYPE_PAIRS ***************************/ - + /** + * Valid type, valid subtype pairs + */ public function testElggAPIGettersTSPValidTypeValidSubtype() { $type_num = 1; $subtype_num = 1; @@ -586,6 +589,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } + /** + * Valid type, multiple valid subtypes + */ public function testElggAPIGettersTSPValidTypeValidPluralSubtype() { $type_num = 1; $subtype_num = 3; @@ -608,6 +614,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } + /** + * Valid type, both valid and invalid subtypes + */ public function testElggAPIGettersTSPValidTypeMixedPluralSubtype() { $type_num = 1; $valid_subtype_num = 2; @@ -635,9 +644,6 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } - - - /**************************** * FALSE-RETURNING TESTS **************************** @@ -652,8 +658,8 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { */ - /* - * Test invalid types. + /** + * Test invalid types with singular 'type'. */ public function testElggApiGettersInvalidTypeUsingType() { $type_arr = $this->getRandomInvalids(); @@ -667,7 +673,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $this->assertFalse($es); } - + /** + * Test invalid types with plural 'types'. + */ public function testElggApiGettersInvalidTypeUsingTypesAsString() { $type_arr = $this->getRandomInvalids(); $type = $type_arr[0]; @@ -680,8 +688,11 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $this->assertFalse($es); } + /** + * Test invalid types with plural 'types' and an array of a single type + */ public function testElggApiGettersInvalidTypeUsingTypesAsArray() { - $type_arr = $this->getRandomInvalids(); + $type_arr = $this->getRandomInvalids(1); $options = array( 'types' => $type_arr @@ -691,6 +702,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $this->assertFalse($es); } + /** + * Test invalid types with plural 'types' and an array of a two types + */ public function testElggApiGettersInvalidTypes() { $type_arr = $this->getRandomInvalids(2); @@ -1053,7 +1067,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); $e->delete(); } @@ -1081,7 +1095,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); $e->delete(); } @@ -1214,7 +1228,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } - function testElggApiGettersEntityMetadatavalueInvalidSingle() { + function testElggApiGettersEntityMetadataValueInvalidSingle() { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; $md_name = 'test_metadata_name_' . rand(); @@ -1235,7 +1249,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); $e->delete(); } @@ -1263,7 +1277,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); $e->delete(); } @@ -1641,6 +1655,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } + /** + * Name value pair with valid name and invalid value + */ function testElggApiGettersEntityMetadataNVPValidNInvalidV() { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; @@ -1676,7 +1693,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); foreach ($guids as $guid) { if ($e = get_entity($guid)) { @@ -1685,7 +1702,9 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { } } - + /** + * Name value pair with invalid name and valid value + */ function testElggApiGettersEntityMetadataNVPInvalidNValidV() { $subtypes = $this->getRandomValidSubtypes(array('object'), 1); $subtype = $subtypes[0]; @@ -1721,7 +1740,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $entities = elgg_get_entities_from_metadata($options); - $this->assertFalse($entities); + $this->assertIdentical(array(), $entities); foreach ($guids as $guid) { if ($e = get_entity($guid)) { -- cgit v1.2.3 From afba00a6f029366be6ce0972042832dd3b9adaf8 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 17:39:55 -0500 Subject: Fixes #4125 checking count correctly --- engine/tests/api/entity_getter_functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index a548a8e52..7b977da61 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -2102,7 +2102,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $es = elgg_get_entities_from_relationship($options); $this->assertTrue(is_array($es)); - $this->assertTrue(count($es), 1); + $this->assertIdentical(count($es), 1); foreach ($es as $e) { $this->assertEqual($guids[1], $e->guid); @@ -2134,7 +2134,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $es = elgg_get_entities_from_relationship($options); $this->assertTrue(is_array($es)); - $this->assertTrue(count($es), 1); + $this->assertIdentical(count($es), 1); foreach ($es as $e) { $this->assertEqual($guids[1], $e->guid); @@ -2170,7 +2170,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { $es = elgg_get_entities_from_relationship($options); $this->assertTrue(is_array($es)); - $this->assertTrue(count($es), 1); + $this->assertIdentical(count($es), 1); foreach ($es as $e) { $this->assertEqual($guids[1], $e->guid); -- cgit v1.2.3 From 3d975e028c3d5bde2ee8a5c9e09d7650b8f3c505 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 17:41:58 -0500 Subject: Fixes #4113 returning a bool from delete_access_collection() --- engine/lib/access.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/lib/access.php b/engine/lib/access.php index 97f744fb9..ba3820f46 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -610,8 +610,7 @@ function delete_access_collection($collection_id) { WHERE id = {$collection_id}"; $result = delete_data($q); - - return $result; + return (bool)$result; } /** -- cgit v1.2.3 From 15f02eea51f0f0eb92e427b627324d58af166e5e Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 17:44:45 -0500 Subject: Fixes #4115 returning bool from remove_user_from_access_collection() --- engine/lib/access.php | 2 +- engine/tests/api/access_collections.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/lib/access.php b/engine/lib/access.php index ba3820f46..08b9283cd 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -717,7 +717,7 @@ function remove_user_from_access_collection($user_guid, $collection_id) { WHERE access_collection_id = {$collection_id} AND user_guid = {$user_guid}"; - return delete_data($q); + return (bool)delete_data($q); } /** diff --git a/engine/tests/api/access_collections.php b/engine/tests/api/access_collections.php index 7875b1409..bea995a6e 100644 --- a/engine/tests/api/access_collections.php +++ b/engine/tests/api/access_collections.php @@ -88,7 +88,7 @@ class ElggCoreAccessCollectionsTest extends ElggCoreUnitTest { if ($result) { $result = remove_user_from_access_collection($this->user->guid, $acl_id); - $this->assertTrue($result); + $this->assertIdentical(true, $result); } delete_access_collection($acl_id); -- cgit v1.2.3 From 30630b3a25e37430d966af6e6af933b7d000ab1a Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 17:50:36 -0500 Subject: Fixes #4118 returning bool from leave group functions --- engine/classes/ElggGroup.php | 6 +++--- engine/lib/relationships.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggGroup.php b/engine/classes/ElggGroup.php index 49ba27204..5c16e978f 100644 --- a/engine/classes/ElggGroup.php +++ b/engine/classes/ElggGroup.php @@ -309,7 +309,7 @@ class ElggGroup extends ElggEntity * * @param ElggUser $user User * - * @return void + * @return bool */ public function leave(ElggUser $user) { return leave_group($this->getGUID(), $user->getGUID()); @@ -322,7 +322,7 @@ class ElggGroup extends ElggEntity * * @param int $guid GUID of an ElggGroup entity * - * @return true + * @return bool */ protected function load($guid) { // Test to see if we have the generic stuff @@ -340,7 +340,7 @@ class ElggGroup extends ElggEntity $row = get_group_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 3578f0cb8..5b7080b56 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -158,7 +158,7 @@ function remove_entity_relationship($guid_one, $relationship, $guid_two) { and relationship='$relationship' and guid_two=$guid_two"; - return delete_data($query); + return (bool)delete_data($query); } else { return false; } -- cgit v1.2.3 From c872edbb476cf0a0c742c6e7a987096e15464f00 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 17:53:29 -0500 Subject: Fixes #4126 fixed test for checking relationship existence --- engine/tests/api/entity_getter_functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/tests/api/entity_getter_functions.php b/engine/tests/api/entity_getter_functions.php index 7b977da61..9db248de9 100644 --- a/engine/tests/api/entity_getter_functions.php +++ b/engine/tests/api/entity_getter_functions.php @@ -2597,7 +2597,7 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest { foreach ($fan_entities as $fan_entity) { $this->assertTrue(in_array($fan_entity->guid, $relationships[$e->guid])); - $this->assertTrue(check_entity_relationship($fan_entity->guid, $relationship_name, $e->guid)); + $this->assertNotIdentical(false, check_entity_relationship($fan_entity->guid, $relationship_name, $e->guid)); } } } -- cgit v1.2.3 From ff907019418cd1635cba8b1c225827a20eedfe2c Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 17:59:50 -0500 Subject: Fixes #4129 fixed priority list tests --- engine/tests/api/helpers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index f48f91faf..8896fc33f 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -351,7 +351,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $test_elements = $pl->getElements(); // make sure it's gone. - $this->assertTrue(2, count($test_elements)); + $this->assertEqual(2, count($test_elements)); $this->assertIdentical($elements[0], $test_elements[0]); $this->assertIdentical($elements[2], $test_elements[2]); } @@ -369,7 +369,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $pl->add($element, $priority); } - $this->assertTrue($pl->move($elements[-5], 10)); + $this->assertEqual($pl->move($elements[-5], 10), 10); // check it's at the new place $this->assertIdentical($elements[-5], $pl->getElement(10)); -- cgit v1.2.3 From f3b50d11966eb75c648e317ab11045913e28e56a Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 18:02:39 -0500 Subject: Fixes #4131 elgg_delete_metastring_based_object_by_id() should return a bool --- engine/lib/metastrings.php | 2 +- engine/tests/api/metastrings.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 9dccec700..9fe9b4bff 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -810,7 +810,7 @@ function elgg_delete_metastring_based_object_by_id($id, $type) { } if (($obj->canEdit()) && (elgg_trigger_event('delete', $type, $obj))) { - return delete_data("DELETE from $table where id=$id"); + return (bool)delete_data("DELETE from $table where id=$id"); } } diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index 0a008c6ce..f6870d34b 100644 --- a/engine/tests/api/metastrings.php +++ b/engine/tests/api/metastrings.php @@ -80,7 +80,7 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { $test = get_data($q); $this->assertEqual($test[0]->id, $id); - $this->assertTrue(elgg_delete_metastring_based_object_by_id($id, $type)); + $this->assertIdentical(true, elgg_delete_metastring_based_object_by_id($id, $type)); $this->assertFalse(get_data($q)); } } -- cgit v1.2.3 From 079a7bd1cf925b2b624d0af491347f997e863d0b Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 18:05:36 -0500 Subject: Fixes #4132 fixed metastring delete by id test --- engine/tests/api/metastrings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index f6870d34b..a96388217 100644 --- a/engine/tests/api/metastrings.php +++ b/engine/tests/api/metastrings.php @@ -81,7 +81,7 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { $this->assertEqual($test[0]->id, $id); $this->assertIdentical(true, elgg_delete_metastring_based_object_by_id($id, $type)); - $this->assertFalse(get_data($q)); + $this->assertIdentical(array(), get_data($q)); } } -- cgit v1.2.3 From 4a5856e451b95bc85a2f3e80d76aebbd37ec39b1 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 18:24:27 -0500 Subject: Fixes #4133 updated type in plugin manifest test --- engine/classes/ElggPluginManifest.php | 2 +- engine/tests/api/plugins.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index eacc16455..7592eb667 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -553,7 +553,7 @@ class ElggPluginManifest { } /** - * Returns the admin interface to use. + * Should this plugin be activated when Elgg is installed * * @return bool */ diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php index a0faaff0e..ac38f34ea 100644 --- a/engine/tests/api/plugins.php +++ b/engine/tests/api/plugins.php @@ -105,7 +105,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => 1.0), ), - 'activate_on_install' => true + // string because we are reading from a file + 'activate_on_install' => 'true', ); $this->assertEqual($this->manifest18->getManifest(), $manifest_array); -- cgit v1.2.3 From af8415b62ef7eede3666e6a050b5f1e292d7d54e Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 21:31:21 -0500 Subject: Fixes #4134 improved plugin manifest tests by using assertIdentical more --- engine/tests/api/plugins.php | 46 +++++++++++++------------- engine/tests/test_files/plugin_18/manifest.xml | 4 +-- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'engine') diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php index ac38f34ea..8ecb0a46c 100644 --- a/engine/tests/api/plugins.php +++ b/engine/tests/api/plugins.php @@ -93,23 +93,23 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { ), 'conflicts' => array( - array('type' => 'plugin', 'name' => 'profile_api', 'version' => 1.0) + array('type' => 'plugin', 'name' => 'profile_api', 'version' => '1.0') ), 'provides' => array( - array('type' => 'plugin', 'name' => 'profile_api', 'version' => 1.3), - array('type' => 'php_extension', 'name' => 'big_math', 'version' => 1.0) + array('type' => 'plugin', 'name' => 'profile_api', 'version' => '1.3'), + array('type' => 'php_extension', 'name' => 'big_math', 'version' => '1.0') ), 'suggests' => array( - array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => 1.0), + array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => '1.0'), ), // string because we are reading from a file 'activate_on_install' => 'true', ); - $this->assertEqual($this->manifest18->getManifest(), $manifest_array); + $this->assertIdentical($this->manifest18->getManifest(), $manifest_array); } public function testElggPluginManifest17() { @@ -124,7 +124,7 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { 'name' => 'Plugin Test 17', ); - $this->assertEqual($this->manifest17->getManifest(), $manifest_array); + $this->assertIdentical($this->manifest17->getManifest(), $manifest_array); } @@ -181,7 +181,7 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('type' => 'elgg_version', 'version' => '3009030802', 'comparison' => 'lt'), array('type' => 'elgg_release', 'version' => '1.8-svn', 'comparison' => 'ge'), array('type' => 'php_extension', 'name' => 'gd', 'version' => '', 'comparison' => '='), - array('type' => 'php_ini', 'name' => 'short_open_tag', 'value' => 'off', 'comparison' => '='), + array('type' => 'php_ini', 'name' => 'short_open_tag', 'value' => 0, 'comparison' => '='), array('type' => 'php_extension', 'name' => 'made_up', 'version' => '1.0', 'comparison' => '='), array('type' => 'plugin', 'name' => 'fake_plugin', 'version' => '1.0', 'comparison' => 'ge'), array('type' => 'plugin', 'name' => 'profile', 'version' => '1.0', 'comparison' => 'ge'), @@ -189,13 +189,13 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('type' => 'priority', 'priority' => 'after', 'plugin' => 'profile'), ); - $this->assertEqual($this->package18->getManifest()->getRequires(), $requires); + $this->assertIdentical($this->package18->getManifest()->getRequires(), $requires); $requires = array( array('type' => 'elgg_version', 'version' => '2009030702', 'comparison' => 'ge') ); - $this->assertEqual($this->package17->getManifest()->getRequires(), $requires); + $this->assertIdentical($this->package17->getManifest()->getRequires(), $requires); } public function testElggPluginManifestGetSuggests() { @@ -203,11 +203,11 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => '1.0', 'comparison' => 'ge'), ); - $this->assertEqual($this->package18->getManifest()->getSuggests(), $suggests); + $this->assertIdentical($this->package18->getManifest()->getSuggests(), $suggests); $suggests = array(); - $this->assertEqual($this->package17->getManifest()->getSuggests(), $suggests); + $this->assertIdentical($this->package17->getManifest()->getSuggests(), $suggests); } public function testElggPluginManifestGetDescription() { @@ -220,8 +220,8 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { 'Admin', 'ServiceAPI' ); - $this->assertEqual($this->package18->getManifest()->getCategories(), $categories); - $this->assertEqual($this->package17->getManifest()->getCategories(), array()); + $this->assertIdentical($this->package18->getManifest()->getCategories(), $categories); + $this->assertIdentical($this->package17->getManifest()->getCategories(), array()); } public function testElggPluginManifestGetScreenshots() { @@ -230,25 +230,25 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('description' => 'Fun things to do 2', 'path' => 'graphics/plugin_ss2.png'), ); - $this->assertEqual($this->package18->getManifest()->getScreenshots(), $screenshots); - $this->assertEqual($this->package17->getManifest()->getScreenshots(), array()); + $this->assertIdentical($this->package18->getManifest()->getScreenshots(), $screenshots); + $this->assertIdentical($this->package17->getManifest()->getScreenshots(), array()); } public function testElggPluginManifestGetProvides() { $provides = array( - array('type' => 'plugin', 'name' => 'profile_api', 'version' => 1.3), - array('type' => 'php_extension', 'name' => 'big_math', 'version' => 1.0), - array('type' => 'plugin', 'name' => 'plugin_18', 'version' => 1.0) + array('type' => 'plugin', 'name' => 'profile_api', 'version' => '1.3'), + array('type' => 'php_extension', 'name' => 'big_math', 'version' => '1.0'), + array('type' => 'plugin', 'name' => 'plugin_18', 'version' => '1.0') ); - $this->assertEqual($this->package18->getManifest()->getProvides(), $provides); + $this->assertIdentical($this->package18->getManifest()->getProvides(), $provides); $provides = array( array('type' => 'plugin', 'name' => 'plugin_17', 'version' => '1.0') ); - $this->assertEqual($this->package17->getManifest()->getProvides(), $provides); + $this->assertIdentical($this->package17->getManifest()->getProvides(), $provides); } public function testElggPluginManifestGetConflicts() { @@ -261,12 +261,12 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { ) ); - $this->assertEqual($this->manifest18->getConflicts(), $conflicts); - $this->assertEqual($this->manifest17->getConflicts(), array()); + $this->assertIdentical($this->manifest18->getConflicts(), $conflicts); + $this->assertIdentical($this->manifest17->getConflicts(), array()); } public function testElggPluginManifestGetActivateOnInstall() { - $this->assertEqual($this->manifest18->getActivateOnInstall(), true); + $this->assertIdentical($this->manifest18->getActivateOnInstall(), true); } // ElggPluginPackage diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml index e0776ffc1..9654b6422 100644 --- a/engine/tests/test_files/plugin_18/manifest.xml +++ b/engine/tests/test_files/plugin_18/manifest.xml @@ -34,8 +34,6 @@ ServiceAPI - true - php_extension gd @@ -102,4 +100,6 @@ 1.0 + true + -- cgit v1.2.3 From 0aacda8b1fa77999f4e00d73e9fd1c416d75f920 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 21:32:11 -0500 Subject: Fixes #4128 better test of null passed to registering external files --- engine/tests/api/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index 8896fc33f..77205138d 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -127,7 +127,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $this->assertIdentical('http://test1.com', $item->url); // send a bad url - $result = @elgg_register_js('bad'); + $result = elgg_register_js('bad', null); $this->assertFalse($result); } -- cgit v1.2.3 From 52f2f64c6bdd79bb8eca3a8c0bd8108e012d9336 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 21:57:52 -0500 Subject: Fixes #4111 guid is now an int --- engine/classes/ElggEntity.php | 3 +++ engine/classes/ElggGroup.php | 3 +++ engine/classes/ElggObject.php | 5 ++++- engine/classes/ElggSite.php | 5 ++++- engine/classes/ElggUser.php | 5 ++++- 5 files changed, 18 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index fdf2a80ea..df87082fe 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -1335,6 +1335,9 @@ abstract class ElggEntity extends ElggData implements $this->attributes['tables_loaded']++; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + // Cache object handle if ($this->attributes['guid']) { cache_entity($this); diff --git a/engine/classes/ElggGroup.php b/engine/classes/ElggGroup.php index 5c16e978f..0190e5eac 100644 --- a/engine/classes/ElggGroup.php +++ b/engine/classes/ElggGroup.php @@ -349,6 +349,9 @@ class ElggGroup extends ElggEntity $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/ElggObject.php b/engine/classes/ElggObject.php index caccfb038..0b8340697 100644 --- a/engine/classes/ElggObject.php +++ b/engine/classes/ElggObject.php @@ -110,7 +110,7 @@ class ElggObject extends ElggEntity { $row = get_object_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -119,6 +119,9 @@ class ElggObject extends ElggEntity { $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 16b80b9d3..5c44d4076 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -128,7 +128,7 @@ class ElggSite extends ElggEntity { $row = get_site_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -137,6 +137,9 @@ class ElggSite extends ElggEntity { $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index 75ac008f6..a1c7147a5 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -114,7 +114,7 @@ class ElggUser extends ElggEntity $row = get_user_entity_as_row($guid); if (($row) && (!$this->isFullyLoaded())) { // If $row isn't a cached copy then increment the counter - $this->attributes['tables_loaded'] ++; + $this->attributes['tables_loaded']++; } // Now put these into the attributes array as core values @@ -123,6 +123,9 @@ class ElggUser extends ElggEntity $this->attributes[$key] = $value; } + // guid needs to be an int http://trac.elgg.org/ticket/4111 + $this->attributes['guid'] = (int)$this->attributes['guid']; + return true; } -- cgit v1.2.3 From 75c00c55dd9cc2de4d97f829d9b47c99eb4ba287 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 18 Nov 2011 22:40:04 -0500 Subject: Fixes #3792 admin can edit settings again --- engine/lib/user_settings.php | 4 ++-- engine/lib/users.php | 5 +++++ languages/en.php | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/lib/user_settings.php b/engine/lib/user_settings.php index 1e2d6db10..c71670357 100644 --- a/engine/lib/user_settings.php +++ b/engine/lib/user_settings.php @@ -265,8 +265,8 @@ function elgg_set_user_default_access() { * @access private */ function usersettings_pagesetup() { - if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) { - $user = elgg_get_logged_in_user_entity(); + if (elgg_get_context() == "settings") { + $user = elgg_get_page_owner_entity(); $params = array( 'name' => '1_account', diff --git a/engine/lib/users.php b/engine/lib/users.php index 29fa4db2f..3a86c1faa 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1283,6 +1283,11 @@ function elgg_user_hover_menu($hook, $type, $return, $params) { $item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url); $item->setSection('admin'); $return[] = $item; + + $url = "settings/user/$user->username"; + $item = new ElggMenuItem('settings:edit', elgg_echo('settings:edit'), $url); + $item->setSection('admin'); + $return[] = $item; } return $return; diff --git a/languages/en.php b/languages/en.php index 5964580ad..af97e112d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -481,6 +481,7 @@ $english = array( 'account' => "Account", 'settings' => "Settings", 'tools' => "Tools", + 'settings:edit' => 'Edit settings', 'register' => "Register", 'registerok' => "You have successfully registered for %s.", -- cgit v1.2.3 From ddd7872bdfb68369d0e0e1b0401a8640b08bfc7c Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 23 Nov 2011 11:09:42 -0500 Subject: Refs #4143 adds a unit test for type/subtype where sql generation --- engine/lib/river.php | 12 ++++++++++++ pages/river.php | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/river.php b/engine/lib/river.php index 466eca253..309aeb30f 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -610,6 +610,16 @@ function elgg_river_page_handler($page) { return true; } +/** + * Register river unit tests + * @access private + */ +function elgg_river_test($hook, $type, $value) { + global $CONFIG; + $value[] = $CONFIG->path . 'engine/tests/api/river.php'; + return $value; +} + /** * Initialize river library * @access private @@ -620,6 +630,8 @@ function elgg_river_init() { elgg_register_menu_item('site', $item); elgg_register_widget_type('river_widget', elgg_echo('river:widget:title'), elgg_echo('river:widget:description')); + + elgg_register_plugin_hook_handler('unit_test', 'system', 'elgg_river_test'); } elgg_register_event_handler('init', 'system', 'elgg_river_init'); diff --git a/pages/river.php b/pages/river.php index 5770084ab..601faf16f 100644 --- a/pages/river.php +++ b/pages/river.php @@ -7,7 +7,6 @@ $options = array(); $page_type = preg_replace('[\W]', '', get_input('page_type', 'all')); $type = preg_replace('[\W]', '', get_input('type', 'all')); -$active_section = $subtype = preg_replace('[\W]', '', get_input('subtype', '')); if ($subtype) { $selector = "type=$type&subtype=$subtype"; -- cgit v1.2.3 From 583e52700ca5c7ed1d0dd58054dbd08208c0c158 Mon Sep 17 00:00:00 2001 From: Danny Navarro Date: Thu, 17 Nov 2011 14:17:24 +0100 Subject: Refs #3496 improving type/subtype handling for the river --- engine/lib/river.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'engine') diff --git a/engine/lib/river.php b/engine/lib/river.php index 309aeb30f..02d52dea1 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -447,7 +447,8 @@ function elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs return ''; } - $wheres = array(); + $types_wheres = array(); + $subtypes_wheres = array(); // if no pairs, use types and subtypes if (!is_array($pairs)) { @@ -457,7 +458,7 @@ function elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs } foreach ($types as $type) { $type = sanitise_string($type); - $wheres[] = "({$table}.type = '$type')"; + $types_wheres[] = "({$table}.type = '$type')"; } } @@ -467,13 +468,20 @@ function elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs } foreach ($subtypes as $subtype) { $subtype = sanitise_string($subtype); - $wheres[] = "({$table}.subtype = '$subtype')"; + $subtypes_wheres[] = "({$table}.subtype = '$subtype')"; } } - if (is_array($wheres) && count($wheres)) { - $wheres = array(implode(' OR ', $wheres)); + if (is_array($types_wheres) && count($types_wheres)) { + $types_wheres = array(implode(' OR ', $types_wheres)); } + + if (is_array($subtypes_wheres) && count($subtypes_wheres)) { + $subtypes_wheres = array(implode(' OR ', $subtypes_wheres)); + } + + $wheres = array(implode(' AND ', array_merge($types_wheres, $subtypes_wheres))); + } else { // using type/subtype pairs foreach ($pairs as $paired_type => $paired_subtypes) { -- cgit v1.2.3 From 3d9b7cc539d390043f1c28d1776dc97e591f5d87 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 25 Nov 2011 13:49:17 -0500 Subject: added a better message for php libraries that don't exist on disk --- engine/lib/elgglib.php | 5 ++++- languages/en.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 08b346960..57d602450 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -107,7 +107,10 @@ function elgg_load_library($name) { } if (!include_once($CONFIG->libraries[$name])) { - $error = elgg_echo('InvalidParameterException:LibraryNotRegistered', array($name)); + $error = elgg_echo('InvalidParameterException:LibraryNotFound', array( + $name, + $CONFIG->libraries[$name]) + ); throw new InvalidParameterException($error); } } diff --git a/languages/en.php b/languages/en.php index 1576ed73d..036ca8883 100644 --- a/languages/en.php +++ b/languages/en.php @@ -167,6 +167,7 @@ $english = array( 'InvalidParameterException:DoesNotBelongOrRefer' => "Does not belong to entity or refer to entity.", 'InvalidParameterException:MissingParameter' => "Missing parameter, you need to provide a GUID.", 'InvalidParameterException:LibraryNotRegistered' => '%s is not a registered library', + 'InvalidParameterException:LibraryNotFound' => 'Could not load the %s library from %s', 'APIException:ApiResultUnknown' => "API Result is of an unknown type, this should never happen.", 'ConfigurationException:NoSiteID' => "No site ID has been specified.", -- cgit v1.2.3 From 3a0043a94076ff8c3f0dc4ac3e195763cb3fc2b5 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 27 Nov 2011 18:37:33 -0500 Subject: fixed some documentation related to subtypes --- engine/lib/entities.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'engine') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index d8db88462..f7ae108ed 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -124,8 +124,6 @@ function retrieve_cached_entity_row($guid) { * @internal Subtypes are stored in the entity_subtypes table. There is a foreign * key in the entities table. * - * @todo Move to a nicer place? - * * @param string $type Type * @param string $subtype Subtype * @@ -144,7 +142,7 @@ function get_subtype_id($type, $subtype) { return FALSE; } - // Todo: cache here? Or is looping less efficient that going to the db each time? + // @todo use the cache before hitting database $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where type='$type' and subtype='$subtype'"); @@ -163,8 +161,6 @@ function get_subtype_id($type, $subtype) { /** * Return string name for a given subtype ID. * - * @todo Move to a nicer place? - * * @param int $subtype_id Subtype ID * * @return string Subtype name @@ -199,11 +195,11 @@ function get_subtype_from_id($subtype_id) { } /** - * Return a classname for a registered type and subtype. + * Return the class name for a registered type and subtype. * * Entities can be registered to always be loaded as a certain class - * with {@link register_entity_subtype()}. This function returns - * the class name if found, and NULL if not. + * with add_subtype() or update_subtype(). This function returns the class + * name if found and NULL if not. * * @param string $type The type * @param string $subtype The subtype @@ -219,7 +215,7 @@ function get_subtype_class($type, $subtype) { $type = sanitise_string($type); $subtype = sanitise_string($subtype); - // Todo: cache here? Or is looping less efficient that going to the db each time? + // @todo use the cache before going to the database $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where type='$type' and subtype='$subtype'"); @@ -236,7 +232,7 @@ function get_subtype_class($type, $subtype) { } /** - * Returns the classname for a subtype id. + * Returns the class name for a subtype id. * * @param int $subtype_id The subtype id * @@ -279,6 +275,9 @@ function get_subtype_class_from_id($subtype_id) { * it will be loaded as that class automatically when retrieved from the database with * {@link get_entity()}. * + * @warning This function cannot be used to change the class for a type-subtype pair. + * Use update_subtype() for that. + * * @param string $type The type you're subtyping (site, user, object, or group) * @param string $subtype The subtype * @param string $class Optional class name for the object -- cgit v1.2.3 From 6ca01c470d695c8ae309ea3475899c14cc34dd73 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 28 Nov 2011 20:41:59 -0500 Subject: forgot this unit test from a previous commit --- engine/tests/api/river.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 engine/tests/api/river.php (limited to 'engine') diff --git a/engine/tests/api/river.php b/engine/tests/api/river.php new file mode 100644 index 000000000..55ddbfeec --- /dev/null +++ b/engine/tests/api/river.php @@ -0,0 +1,21 @@ +assertIdentical($result, "((rv.type = 'object') AND (rv.subtype = 'blog'))"); + + $types = array('object'); + $subtypes = array('blog', 'file'); + $result = elgg_get_river_type_subtype_where_sql('rv', $types, $subtypes, null); + $this->assertIdentical($result, "((rv.type = 'object') AND ((rv.subtype = 'blog') OR (rv.subtype = 'file')))"); + } +} -- cgit v1.2.3 From 6cc08f83225237d0cd57e0a5c0ebec0a8327aa30 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 28 Nov 2011 21:24:42 -0500 Subject: Fixes #3496 finished up this ticket by updating unit test and using more parantheses to make it clear how the OR/AND gets applied --- engine/lib/river.php | 5 +++-- engine/tests/api/river.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/lib/river.php b/engine/lib/river.php index 02d52dea1..421813441 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -207,6 +207,8 @@ function elgg_delete_river(array $options = array()) { /** * Get river items * + * @note If using types and subtypes in a query, they are joined with an AND. + * * @param array $options * ids => INT|ARR River item id(s) * subject_guids => INT|ARR Subject guid(s) @@ -430,7 +432,6 @@ function elgg_river_get_access_sql() { * * @internal This is a simplified version of elgg_get_entity_type_subtype_where_sql() * which could be used for all queries once the subtypes have been denormalized. - * FYI: It allows types and subtypes to not be paired. * * @param string $table 'rv' * @param NULL|array $types Array of types or NULL if none. @@ -477,7 +478,7 @@ function elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs } if (is_array($subtypes_wheres) && count($subtypes_wheres)) { - $subtypes_wheres = array(implode(' OR ', $subtypes_wheres)); + $subtypes_wheres = array('(' . implode(' OR ', $subtypes_wheres) . ')'); } $wheres = array(implode(' AND ', array_merge($types_wheres, $subtypes_wheres))); diff --git a/engine/tests/api/river.php b/engine/tests/api/river.php index 55ddbfeec..6931b9f41 100644 --- a/engine/tests/api/river.php +++ b/engine/tests/api/river.php @@ -11,7 +11,7 @@ class ElggCoreRiverAPITest extends ElggCoreUnitTest { $types = array('object'); $subtypes = array('blog'); $result = elgg_get_river_type_subtype_where_sql('rv', $types, $subtypes, null); - $this->assertIdentical($result, "((rv.type = 'object') AND (rv.subtype = 'blog'))"); + $this->assertIdentical($result, "((rv.type = 'object') AND ((rv.subtype = 'blog')))"); $types = array('object'); $subtypes = array('blog', 'file'); -- cgit v1.2.3 From e57ad78561dd4e80eb3621475aaade030c0fbdd0 Mon Sep 17 00:00:00 2001 From: Jeff Tilson Date: Fri, 25 Nov 2011 18:11:12 -0500 Subject: Need to call elgg_register_simplecache_view('css/lightbox') to register the lightbox CSS with simplecache --- engine/lib/views.php | 1 + 1 file changed, 1 insertion(+) (limited to 'engine') diff --git a/engine/lib/views.php b/engine/lib/views.php index 0f806b8be..d3c9ff551 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1602,6 +1602,7 @@ function elgg_views_boot() { elgg_load_js('elgg'); elgg_register_simplecache_view('js/lightbox'); + elgg_register_simplecache_view('css/lightbox'); $lightbox_js_url = elgg_get_simplecache_url('js', 'lightbox'); elgg_register_js('lightbox', $lightbox_js_url); $lightbox_css_url = elgg_get_simplecache_url('css', 'lightbox'); -- cgit v1.2.3 From 7c17e93023ffc8d785b810af7551301cbd7f0457 Mon Sep 17 00:00:00 2001 From: Janek Lasocki-Biczysko Date: Tue, 22 Nov 2011 12:10:10 +0000 Subject: Fixes #1995 (memcache: incorrect check for get() return value) --- engine/classes/ElggMemcache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggMemcache.php b/engine/classes/ElggMemcache.php index 1fd3be0d1..a54c29723 100644 --- a/engine/classes/ElggMemcache.php +++ b/engine/classes/ElggMemcache.php @@ -161,7 +161,7 @@ class ElggMemcache extends ElggSharedMemoryCache { } $result = $this->memcache->set($key, $data, null, $expires); - if (!$result) { + if ($result === false) { elgg_log("MEMCACHE: FAILED TO SAVE $key", 'ERROR'); } @@ -181,7 +181,7 @@ class ElggMemcache extends ElggSharedMemoryCache { $key = $this->_makeMemcacheKey($key); $result = $this->memcache->get($key); - if (!$result) { + if ($result === false) { elgg_log("MEMCACHE: FAILED TO LOAD $key", 'ERROR'); } -- cgit v1.2.3 From 8e7dfcc5146f1cb22e684a9cdb635bbac184d6a1 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 3 Dec 2011 20:04:01 -0500 Subject: Refs #4176 added elgg_list_registered_entities() fix to 1.8 branch --- engine/lib/entities.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'engine') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index f7ae108ed..dbb5ee695 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -2147,8 +2147,13 @@ function elgg_list_registered_entities(array $options = array()) { } } - $count = elgg_get_entities(array_merge(array('count' => TRUE), $options)); - $entities = elgg_get_entities($options); + if (!empty($options['type_subtype_pairs'])) { + $count = elgg_get_entities(array_merge(array('count' => TRUE), $options)); + $entities = elgg_get_entities($options); + } else { + $count = 0; + $entities = array(); + } return elgg_view_entity_list($entities, $count, $options['offset'], $options['limit'], $options['full_view'], $options['list_type_toggle'], $options['pagination']); -- cgit v1.2.3