aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/elgglib.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-24 13:19:32 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-24 13:19:32 +0000
commitb3bf72d0faa76ffe3bb62141fca55d4decec19cf (patch)
tree086cac64141d03456a8542536a35c4e32fc2f6b6 /engine/lib/elgglib.php
parent1c71016e6db14f52988522f3c47388eba86bc7ab (diff)
downloadelgg-b3bf72d0faa76ffe3bb62141fca55d4decec19cf.tar.gz
elgg-b3bf72d0faa76ffe3bb62141fca55d4decec19cf.tar.bz2
The beginnings of a db upgrade system. See lib/version.php, /version.php and the datalist functions in elgglib.php.
git-svn-id: https://code.elgg.org/elgg/trunk@519 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r--engine/lib/elgglib.php41
1 files changed, 40 insertions, 1 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 2f9396da1..78afe49ce 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -812,12 +812,51 @@
*/
function __elgg_php_exception_handler($exception) {
-
+
error_log("*** FATAL EXCEPTION *** : " . $exception);
$body = elgg_view("messages/exceptions/exception",array('object' => $exception));
echo page_draw("We've encountered a problem.", $body);
}
+
+ /**
+ * Data lists
+ */
+
+ /**
+ * Get the value of a particular piece of data in the datalist
+ *
+ * @param string $name The name of the datalist
+ * @return string|false Depending on success
+ */
+ function datalist_get($name) {
+
+ global $CONFIG;
+ $name = sanitise_string($name);
+ if ($row = get_data_row("select value from {$CONFIG->prefix}datalists where name = '{$name}'")) {
+ return $row->value;
+ }
+ return false;
+
+ }
+
+ /**
+ * Sets the value for a system-wide piece of data (overwriting a previous value if it exists)
+ *
+ * @param string $name The name of the datalist
+ * @param string $value The new value
+ * @return true
+ */
+ function datalist_set($name, $value) {
+
+ global $CONFIG;
+ $name = sanitise_string($name);
+ $value = sanitise_string($value);
+ delete_data("delete from {$CONFIG->prefix}datalists where name = '{$name}'");
+ insert_data("insert into {$CONFIG->prefix}datalists set name = '{$name}', value = '{$value}'");
+ return true;
+
+ }
?> \ No newline at end of file