aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-03 04:42:50 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-03 04:42:50 +0000
commit9cb00366281d1c9f85e4c7a0462802fd246ef0f5 (patch)
tree62f9a57345d24bc4ed83b327c4d67dec6d6ab8db /engine/lib/entities.php
parent8cd8747bc2b7869c3eb861f11a13086f25b3c4a5 (diff)
downloadelgg-9cb00366281d1c9f85e4c7a0462802fd246ef0f5.tar.gz
elgg-9cb00366281d1c9f85e4c7a0462802fd246ef0f5.tar.bz2
Fixes #2050: Added subtype parameter to can_write_to_container functions and hooks
git-svn-id: http://code.elgg.org/elgg/trunk@7221 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index d497fe466..5a5643da4 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -444,9 +444,7 @@ function update_entity($guid, $owner_guid, $access_id, $container_guid = null) {
* @return bool
* @link http://docs.elgg.org/DataModel/Containers
*/
-function can_write_to_container($user_guid = 0, $container_guid = 0, $entity_type = 'all') {
- global $CONFIG;
-
+function can_write_to_container($user_guid = 0, $container_guid = 0, $type = 'all', $subtype = 'all') {
$user_guid = (int)$user_guid;
$user = get_entity($user_guid);
if (!$user) {
@@ -482,8 +480,8 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $entity_typ
}
// See if anyone else has anything to say
- return trigger_plugin_hook('container_permissions_check', $entity_type,
- array('container' => $container, 'user' => $user), $return);
+ return trigger_plugin_hook('container_permissions_check', $type,
+ array('container' => $container, 'user' => $user, 'subtype' => $subtype), $return);
}
/**
@@ -515,7 +513,7 @@ $container_guid = 0) {
global $CONFIG;
$type = sanitise_string($type);
- $subtype = add_subtype($type, $subtype);
+ $subtype_id = add_subtype($type, $subtype);
$owner_guid = (int)$owner_guid;
$access_id = (int)$access_id;
$time = time();
@@ -528,11 +526,11 @@ $container_guid = 0) {
}
$user = get_loggedin_user();
- if (!can_write_to_container($user->guid, $owner_guid, $type)) {
+ if (!can_write_to_container($user->guid, $owner_guid, $type, $subtype)) {
return false;
}
if ($owner_guid != $container_guid) {
- if (!can_write_to_container($user->guid, $container_guid, $type)) {
+ if (!can_write_to_container($user->guid, $container_guid, $type, $subtype)) {
return false;
}
}
@@ -544,7 +542,7 @@ $container_guid = 0) {
(type, subtype, owner_guid, site_guid, container_guid,
access_id, time_created, time_updated, last_action)
values
- ('$type',$subtype, $owner_guid, $site_guid, $container_guid,
+ ('$type',$subtype_id, $owner_guid, $site_guid, $container_guid,
$access_id, $time, $time, $time)");
}