aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/admin/site/update_basic.php9
-rw-r--r--actions/systemsettings/install.php8
-rw-r--r--engine/lib/configuration.php30
-rw-r--r--languages/en.php4
-rw-r--r--views/default/input/checkboxes.php3
-rw-r--r--views/default/settings/system.php8
6 files changed, 54 insertions, 8 deletions
diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php
index 25500067a..830df9ad1 100644
--- a/actions/admin/site/update_basic.php
+++ b/actions/admin/site/update_basic.php
@@ -29,7 +29,14 @@
datalist_set('path',get_input('path'));
datalist_set('dataroot',get_input('dataroot'));
- set_config('language', get_input('language'), $site->getGUID());
+ set_config('language', get_input('language'), $site->getGUID());
+
+ $debug = get_input('debug');
+ if ($debug)
+ set_config('debug', 1, $site->getGUID());
+ else
+ unset_config('debug', $site->getGUID());
+
system_message(elgg_echo("admin:configuration:success"));
diff --git a/actions/systemsettings/install.php b/actions/systemsettings/install.php
index 06a40e167..30f501f36 100644
--- a/actions/systemsettings/install.php
+++ b/actions/systemsettings/install.php
@@ -33,7 +33,13 @@
datalist_set('default_site',$site->getGUID());
- set_config('language', get_input('language'), $site->getGUID());
+ set_config('language', get_input('language'), $site->getGUID());
+
+ $debug = get_input('debug');
+ if ($debug)
+ set_config('debug', 1, $site->getGUID());
+ else
+ unset_config('debug', $site->getGUID());
system_message(elgg_echo("installation:configuration:success"));
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}");
}
diff --git a/languages/en.php b/languages/en.php
index 12d4d8c2f..0e359c561 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -349,7 +349,9 @@ Alternatively, you can enter your database settings below and we will try and do
'wwwroot' => "The site URL, followed by a trailing slash:",
'path' => "The full path to your site root on your disk, followed by a trailing slash:",
'dataroot' => "The full path to the directory where uploaded files will be stored, followed by a trailing slash:",
- 'language' => "Please enter the default language code for your site, e.g. 'en' for English, 'fr' for French, 'ru' for Russian:",
+ 'language' => "The default language code for your site, e.g. 'en' for English, 'fr' for French, 'ru' for Russian:",
+ 'debug' => "Debug mode provides extra information which can be used to diagnose faults, however it can slow your system down so should only be used if you are having problems:",
+ 'debug:label' => "Turn on debug mode",
/**
* Welcome
diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php
index 3addef0f6..1a10b8a62 100644
--- a/views/default/input/checkboxes.php
+++ b/views/default/input/checkboxes.php
@@ -19,7 +19,8 @@
*/
foreach($vars['options'] as $option) {
- if (!in_array($option,$vars['value'])) {
+ //if (!in_array($option,$vars['value'])) {
+ if ($option != $vars['value']) {
$selected = "";
} else {
$selected = "checked = \"checked\"";
diff --git a/views/default/settings/system.php b/views/default/settings/system.php
index ba3e614ee..c956da0d4 100644
--- a/views/default/settings/system.php
+++ b/views/default/settings/system.php
@@ -41,7 +41,13 @@
}
-?>
+?>
+ <p>
+ <?php echo elgg_echo('debug'); ?><br />
+ <?php
+ echo elgg_view("input/checkboxes", array('options' => array(elgg_echo('debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('debug:label') : "") ));
+ ?>
+ </p>
<p>
<input type="hidden" name="settings" value="go" />
<input type="submit" value="<?php echo elgg_echo("save"); ?>" />