aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-06-25 12:36:53 -0400
committerBrett Profitt <brett.profitt@gmail.com>2011-06-25 20:03:58 -0400
commit5f4db01d382159858a1d37c5fd1708d9165b1911 (patch)
tree135c5c6b259c076bc8b29613eb9ed9a9de7e7c97
parentfe1003bbbbcd577c5059b5d8822ffe710e195e0b (diff)
downloadelgg-5f4db01d382159858a1d37c5fd1708d9165b1911.tar.gz
elgg-5f4db01d382159858a1d37c5fd1708d9165b1911.tar.bz2
datalist_get() was incorrectly setting escaped values in the cache.
-rw-r--r--engine/lib/configuration.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index cbc083bd0..b756d2e70 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -282,8 +282,8 @@ function datalist_set($name, $value) {
return false;
}
- $name = sanitise_string($name);
- $value = sanitise_string($value);
+ $sanitised_name = sanitise_string($name);
+ $sanitised_value = sanitise_string($value);
// If memcache is available then invalidate the cached copy
static $datalist_memcache;
@@ -295,13 +295,16 @@ function datalist_set($name, $value) {
$datalist_memcache->delete($name);
}
- insert_data("INSERT into {$CONFIG->dbprefix}datalists"
- . " set name = '{$name}', value = '{$value}'"
- . " ON DUPLICATE KEY UPDATE value='{$value}'");
-
- $DATALIST_CACHE[$name] = $value;
+ $success = insert_data("INSERT into {$CONFIG->dbprefix}datalists"
+ . " set name = '{$sanitised_name}', value = '{$sanitised_value}'"
+ . " ON DUPLICATE KEY UPDATE value='{$sanitised_value}'");
- return true;
+ if ($success) {
+ $DATALIST_CACHE[$name] = $value;
+ return true;
+ } else {
+ return false;
+ }
}
/**