aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-18 11:10:16 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-18 11:10:16 +0000
commit09fba458f79b8b1b1940405911915feade1989bf (patch)
treebd8d4de9adea9fe1300939a1e823c1e30c141976 /engine/lib
parentd5a0e61b33283eb5e0f042cfd29ab6f8bbd5ae02 (diff)
downloadelgg-09fba458f79b8b1b1940405911915feade1989bf.tar.gz
elgg-09fba458f79b8b1b1940405911915feade1989bf.tar.bz2
Fixes #17 - Debug mode toggle. Introduced unset_config() which is also called automatically by set_config(). Also modified the view input/checkboxes to set values on the checkbox.
git-svn-id: https://code.elgg.org/elgg/trunk@961 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/configuration.php30
1 files changed, 27 insertions, 3 deletions
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index acb651170..a033d679f 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -12,7 +12,26 @@
* @link http://elgg.org/
*/
-
+
+ /**
+ * Unset a config option.
+ *
+ * @param string $name The name of the field.
+ * @param int $site_guid Optionally, the GUID of the site (current site is assumed by default).
+ * @return mixed
+ */
+ function unset_config($name, $site_guid = 0)
+ {
+ global $CONFIG;
+
+ $name = mysql_real_escape_string($name);
+ $site_guid = (int) $site_guid;
+ if ($site_guid == 0)
+ $site_guid = (int) $CONFIG->site_id;
+
+ return delete_data("delete from {$CONFIG->dbprefix}config where name='$name' and site_guid=$site_guid");
+ }
+
/**
* Sets a configuration value
*
@@ -23,14 +42,19 @@
*/
function set_config($name, $value, $site_guid = 0) {
- global $CONFIG;
+ global $CONFIG;
+
+ // Unset existing
+ unset_config($name,$site_guid);
+
$name = mysql_real_escape_string($name);
$value = mysql_real_escape_string($value);
$site_guid = (int) $site_guid;
if ($site_guid == 0)
$site_guid = (int) $CONFIG->site_id;
$CONFIG->$name = $value;
- $value = sanitise_string(serialize($value));
+ $value = sanitise_string(serialize($value));
+
return insert_data("insert into {$CONFIG->dbprefix}config set name = '{$name}', value = '{$value}', site_guid = {$site_guid}");
}