]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
set_private_setting() checks if the guid is a real entity.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 2 Jan 2011 21:07:43 +0000 (21:07 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 2 Jan 2011 21:07:43 +0000 (21:07 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7813 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/private_settings.php

index 0d86b93a156a4ac60e4b8515a668c669ef7bffcc..d21ee45e697cc5e8a368dd7d8cacf257ed17e8ac 100644 (file)
@@ -228,7 +228,7 @@ function elgg_get_entities_from_private_settings(array $options = array()) {
                }
 
                $options['wheres'] = array_merge($options['wheres'], $clauses['wheres']);
-               
+
                // merge joins to pass to get_entities()
                if (isset($options['joins']) && !is_array($options['joins'])) {
                        $options['joins'] = array($options['joins']);
@@ -322,7 +322,7 @@ $pairs = NULL, $pair_operator = 'AND') {
        if (is_array($pairs)) {
                // join counter for incremental joins in pairs
                $i = 1;
-               
+
                // check if this is an array of pairs or just a single pair.
                if (isset($pairs['name']) || isset($pairs['value'])) {
                        $pairs = array($pairs);
@@ -405,7 +405,7 @@ $pairs = NULL, $pair_operator = 'AND') {
        if ($where) {
                $return['wheres'][] = "($where)";
        }
-       
+
        return $return;
 }
 
@@ -495,6 +495,11 @@ function set_private_setting($entity_guid, $name, $value) {
        $name = sanitise_string($name);
        $value = sanitise_string($value);
 
+       $entity = get_entity($entity_guid);
+       if (!$entity instanceof ElggEntity) {
+               return false;
+       }
+
        $result = insert_data("INSERT into {$CONFIG->dbprefix}private_settings
                (entity_guid, name, value) VALUES
                ($entity_guid, '{$name}', '{$value}')