aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-16 18:00:07 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-16 18:00:07 +0000
commit0eb11397722ff6dcf9edfa22933993160f12ca1c (patch)
tree64fd7ff7c1ff5b04eefc203c8ce67cc6cb280ff0 /engine/lib
parent86d9ed090b0889e84098c8819cee638e0ca9e876 (diff)
downloadelgg-0eb11397722ff6dcf9edfa22933993160f12ca1c.tar.gz
elgg-0eb11397722ff6dcf9edfa22933993160f12ca1c.tar.bz2
CLOSED - #30: $CONFIG is not populated from elggconfig or datalists
http://trac.elgg.org/elgg/ticket/30 git-svn-id: https://code.elgg.org/elgg/trunk@937 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/configuration.php36
1 files changed, 32 insertions, 4 deletions
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index 04257de42..48eeeebfc 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -30,7 +30,7 @@
if ($site_guid == 0)
$site_guid = (int) $CONFIG->site_id;
$CONFIG->$name = $value;
- $value = serialize($value);
+ $value = sanitise_string(serialize($value));
return insert_data("insert into {$CONFIG->dbprefix}config set name = '{$name}', value = '{$value}', site_guid = {$site_guid}");
}
@@ -59,6 +59,33 @@
}
return false;
+ }
+
+ /**
+ * Gets all the configuration details in the config database for a given site.
+ *
+ * @param int $site_guid Optionally, the GUID of the site (current site is assumed by default)
+ */
+ function get_all_config($site_guid = 0)
+ {
+ global $CONFIG;
+
+ $site_guid = (int) $site_guid;
+
+ if ($site_guid == 0)
+ $site_guid = (int) $CONFIG->site_id;
+
+ if ($result = get_data("select * from {$CONFIG->dbprefix}config where site_guid = {$site_guid}")) {
+ foreach ($result as $r)
+ {
+ $name = $r->name;
+ $value = $r->value;
+ $CONFIG->$name = unserialize($value);
+ }
+
+ return true;
+ }
+ return false;
}
/**
@@ -101,9 +128,7 @@
if (empty($CONFIG->sitename))
$CONFIG->sitename = "New Elgg site";
-
- if (empty($CONFIG->debug))
- $CONFIG->debug = false;
+
}
@@ -129,6 +154,9 @@
$CONFIG->sitename = $CONFIG->site->name;
}
$CONFIG->url = $CONFIG->wwwroot;
+
+ // Load default settings from database
+ get_all_config();
return true;