aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-03 12:16:07 +0000
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-03 12:16:07 +0000
commit4c1c4d5247d3fbf50e00bf290cbb01cd09d1301a (patch)
tree9f8eae8e46f63f2da27b04cb43229c5e036aca30 /engine/lib/entities.php
parente5dd455c337385609cf1ede94a4f6262b3124f5e (diff)
downloadelgg-4c1c4d5247d3fbf50e00bf290cbb01cd09d1301a.tar.gz
elgg-4c1c4d5247d3fbf50e00bf290cbb01cd09d1301a.tar.bz2
patch number #724 applied
git-svn-id: https://code.elgg.org/elgg/trunk@2631 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php172
1 files changed, 86 insertions, 86 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 6bbec2169..bcee1dcbe 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -327,18 +327,18 @@
public function addRelationship($guid, $relationship)
{
return add_entity_relationship($this->getGUID(), $relationship, $guid);
- }
-
- function setPrivateSetting($name, $value) {
- return set_private_setting($this->getGUID(), $name, $value);
- }
-
- function getPrivateSetting($name) {
- return get_private_setting($this->getGUID(), $name);
- }
-
- function removePrivateSetting($name) {
- return remove_private_setting($this->getGUID(), $name);
+ }
+
+ function setPrivateSetting($name, $value) {
+ return set_private_setting($this->getGUID(), $name, $value);
+ }
+
+ function getPrivateSetting($name) {
+ return get_private_setting($this->getGUID(), $name);
+ }
+
+ function removePrivateSetting($name) {
+ return remove_private_setting($this->getGUID(), $name);
}
/**
@@ -624,7 +624,7 @@
return update_entity(
$this->get('guid'),
$this->get('owner_guid'),
- $this->get('access_id'),
+ $this->get('access_id'),
$this->get('container_guid')
);
}
@@ -1263,7 +1263,7 @@
*
* @param int $guid
* @param int $owner_guid
- * @param int $access_id
+ * @param int $access_id
* @param int $container_guid
*/
function update_entity($guid, $owner_guid, $access_id, $container_guid = null)
@@ -1272,8 +1272,8 @@
$guid = (int)$guid;
$owner_guid = (int)$owner_guid;
- $access_id = (int)$access_id;
- $container_guid = (int) $container_guid;
+ $access_id = (int)$access_id;
+ $container_guid = (int) $container_guid;
if (is_null($container_guid)) $container_guid = $owner_guid;
$time = time();
@@ -1324,7 +1324,7 @@
{
// If the user can edit the container, they can also write to it
- if ($container->canEdit()) return true;
+ if ($container->canEdit($user_guid)) return true;
// Basics, see if the user is a member of the group.
if ($container instanceof ElggGroup) {
@@ -1599,7 +1599,7 @@
* @param int $owner_guid The GUID of the owning user
* @param int $limit The number of entities to display per page (default: 10)
* @param true|false $fullview Whether or not to display the full view (default: true)
- * @param true|false $viewtypetoggle Whether or not to allow gallery view
+ * @param true|false $viewtypetoggle Whether or not to allow gallery view
* @param true|false $pagination Display pagination? Default: true
* @return string A viewable list of entities
*/
@@ -2007,20 +2007,20 @@
$url = trigger_plugin_hook('entity:icon:url', $entity->getType(), array('entity' => $entity, 'viewtype' => $viewtype, 'size' => $size), $url);
// Fail, so use default
- if (!$url) {
-
- $type = $entity->getType();
- $subtype = $entity->getSubtype();
-
- if (!empty($subtype)) {
- $overrideurl = elgg_view("icon/{$type}/{$subtype}/{$size}",array('entity' => $entity));
- if (!empty($overrideurl)) return $overrideurl;
- }
-
- $overrideurl = elgg_view("icon/{$type}/default/{$size}",array('entity' => $entity));
- if (!empty($overrideurl)) return $overrideurl;
-
- $url = $CONFIG->url . "_graphics/icons/default/$size.png";
+ if (!$url) {
+
+ $type = $entity->getType();
+ $subtype = $entity->getSubtype();
+
+ if (!empty($subtype)) {
+ $overrideurl = elgg_view("icon/{$type}/{$subtype}/{$size}",array('entity' => $entity));
+ if (!empty($overrideurl)) return $overrideurl;
+ }
+
+ $overrideurl = elgg_view("icon/{$type}/default/{$size}",array('entity' => $entity));
+ if (!empty($overrideurl)) return $overrideurl;
+
+ $url = $CONFIG->url . "_graphics/icons/default/$size.png";
}
return $url;
@@ -2479,26 +2479,26 @@
$total = get_data_row($query);
return $total->total;
}
- }
-
- /**
- * Gets a private setting for an entity.
- *
- * @param int $entity_guid The entity GUID
- * @param string $name The name of the setting
- * @return mixed The setting value, or false on failure
- */
- function get_private_setting($entity_guid, $name) {
-
- global $CONFIG;
- $entity_guid = (int) $entity_guid;
+ }
+
+ /**
+ * Gets a private setting for an entity.
+ *
+ * @param int $entity_guid The entity GUID
+ * @param string $name The name of the setting
+ * @return mixed The setting value, or false on failure
+ */
+ function get_private_setting($entity_guid, $name) {
+
+ global $CONFIG;
+ $entity_guid = (int) $entity_guid;
$name = sanitise_string($name);
-
- if ($setting = get_data_row("SELECT value from {$CONFIG->dbprefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}")) {
- return $setting->value;
- }
- return false;
-
+
+ if ($setting = get_data_row("SELECT value from {$CONFIG->dbprefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}")) {
+ return $setting->value;
+ }
+ return false;
+
}
/**
@@ -2522,42 +2522,42 @@
}
return false;
- }
-
- /**
- * Sets a private setting for an entity.
- *
- * @param int $entity_guid The entity GUID
- * @param string $name The name of the setting
- * @param string $value The value of the setting
- * @return mixed The setting ID, or false on failure
- */
- function set_private_setting($entity_guid, $name, $value) {
-
- global $CONFIG;
- $entity_guid = (int) $entity_guid;
- $name = sanitise_string($name);
+ }
+
+ /**
+ * Sets a private setting for an entity.
+ *
+ * @param int $entity_guid The entity GUID
+ * @param string $name The name of the setting
+ * @param string $value The value of the setting
+ * @return mixed The setting ID, or false on failure
+ */
+ function set_private_setting($entity_guid, $name, $value) {
+
+ global $CONFIG;
+ $entity_guid = (int) $entity_guid;
+ $name = sanitise_string($name);
$value = sanitise_string($value);
-
- return insert_data("INSERT into {$CONFIG->dbprefix}private_settings (entity_guid, name, value) VALUES ($entity_guid, '{$name}', '{$value}') ON DUPLICATE KEY UPDATE value='$value'");
-
- }
-
- /**
- * Deletes a private setting for an entity.
- *
- * @param int $entity_guid The Entity GUID
- * @param string $name The name of the setting
- * @return true|false depending on success
- *
- */
- function remove_private_setting($entity_guid, $name) {
-
- global $CONFIG;
- $entity_guid = (int) $entity_guid;
- $name = sanitise_string($name);
- return delete_data("DELETE from {$CONFIG->dbprefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}");
-
+
+ return insert_data("INSERT into {$CONFIG->dbprefix}private_settings (entity_guid, name, value) VALUES ($entity_guid, '{$name}', '{$value}') ON DUPLICATE KEY UPDATE value='$value'");
+
+ }
+
+ /**
+ * Deletes a private setting for an entity.
+ *
+ * @param int $entity_guid The Entity GUID
+ * @param string $name The name of the setting
+ * @return true|false depending on success
+ *
+ */
+ function remove_private_setting($entity_guid, $name) {
+
+ global $CONFIG;
+ $entity_guid = (int) $entity_guid;
+ $name = sanitise_string($name);
+ return delete_data("DELETE from {$CONFIG->dbprefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}");
+
}
/**