aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/private_settings.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/private_settings.php')
-rw-r--r--engine/lib/private_settings.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/engine/lib/private_settings.php b/engine/lib/private_settings.php
index 0d86b93a1..d21ee45e6 100644
--- a/engine/lib/private_settings.php
+++ b/engine/lib/private_settings.php
@@ -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}')