summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Config.php29
-rw-r--r--classes/User.php1
2 files changed, 30 insertions, 0 deletions
diff --git a/classes/Config.php b/classes/Config.php
index 92f237d7f..390d75381 100644
--- a/classes/Config.php
+++ b/classes/Config.php
@@ -120,6 +120,35 @@ class Config extends Memcached_DataObject
return $result;
}
+ function &pkeyGet($kv)
+ {
+ return Memcached_DataObject::pkeyGet('Config', $kv);
+ }
+
+ static function save($section, $setting, $value)
+ {
+ $result = null;
+
+ $config = Config::pkeyGet(array('section' => $section,
+ 'setting' => $setting));
+
+ if (!empty($config)) {
+ $orig = clone($config);
+ $config->value = $value;
+ $result = $config->update($orig);
+ } else {
+ $config = new Config();
+
+ $config->section = $section;
+ $config->setting = $setting;
+ $config->value = $value;
+
+ $result = $config->insert();
+ }
+
+ return $result;
+ }
+
function _blowSettingsCache()
{
$c = self::memcache();
diff --git a/classes/User.php b/classes/User.php
index c529b82e0..7267ec2d7 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -710,6 +710,7 @@ class User extends Memcached_DataObject
break;
case Right::CONFIGURESITE:
$result = $this->hasRole(User_role::ADMINISTRATOR);
+ break;
default:
$result = false;
break;