+// Update config entries
+function updateConfiguration ($entries, $values, $updateMode='') {
+ // Do not update config in CSS mode
+ if ((getOutputMode() == '1') || (getOutputMode() == -1)) {
+ return;
+ } // END - if
+
+ // Do we have multiple entries?
+ if (is_array($entries)) {
+ // Walk through all
+ $all = '';
+ foreach ($entries as $idx => $entry) {
+ // Update mode set?
+ if (!empty($updateMode)) {
+ // Update entry
+ // @TODO Find a way for updating configuration here
+ $all .= sprintf("`%s`=%s%s%s,", $entry, $entry, $updateMode, (float)$values[$idx]);
+ } else {
+ // Check if string or number
+ if (($values[$idx] + 0) === $values[$idx]) {
+ // Number detected
+ $all .= sprintf("`%s`=%s,", $entry, (float)$values[$idx]);
+ } elseif ($values[$idx] == 'UNIX_TIMESTAMP()') {
+ // Function UNIX_TIMESTAMP() detected
+ $all .= sprintf("`%s`=%s,", $entry, $values[$idx]);
+ } else {
+ // String detected
+ $all .= sprintf("`%s`='%s',", $entry, SQL_ESCAPE($values[$idx]));
+ }
+ }
+
+ // Set it in config as well
+ setConfigEntry($entry, $values[$idx]);
+ } // END - foreach
+
+ // Remove last comma
+ $entries = substr($all, 0, -1);
+ } elseif (!empty($updateMode)) {
+ // Update mode set
+ // @TODO Find a way for updating configuration here
+ $entries .= sprintf("=%s%s%s", $entries, $updateMode, (float)$values);
+ } else {
+ // Set it in config first
+ setConfigEntry($entries, $values);
+
+ // Regular entry to update
+ $entries .= sprintf("='%s'", SQL_ESCAPE($values));
+ }
+
+ // Run database update
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "entries={$entries}");
+ SQL_QUERY("UPDATE `{!_MYSQL_PREFIX!}_config` SET ".$entries." WHERE `config`=0 LIMIT 1", __FUNCTION__, __LINE__);
+
+ // Get affected rows
+ $affectedRows = SQL_AFFECTEDROWS();
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):entries={$entries},affectedRows={$affectedRows}<br />");
+
+ // Rebuild cache
+ rebuildCacheFiles('config', 'config');
+}
+