- // @TODO Rewrite this to a filter
- if (EXT_IS_ACTIVE('booking')) {
- // Add record
- ADD_BOOKING_RECORD($subject, $uid, $points, 'sub');
- } // END - if
-
- // Update mediadata as well
- if (GET_EXT_VERSION('mediadata') >= '0.0.4') {
- // Update database
- MEDIA_UPDATE_ENTRY(array('total_points'), 'sub', $points);
- } // END - if
-}
-
-// 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 $_CONFIG 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 $_CONFIG 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: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):entries={$entries},affectedRows={$affectedRows}<br />\n";
-
- // Rebuild cache
- rebuildCacheFiles('config', 'config');
-}
-
-// Prepares an SQL statement part for HTML mail and/or holiday depency
-// @TODO Can this be rewritten to a filter?
-function PREPARE_SQL_HTML_HOLIDAY ($mode) {
- // Exclude no users by default
- $MORE = '';
-
- // HTML mail?
- if ($mode == 'html') $MORE = " AND `html`='Y'";
- if (GET_EXT_VERSION('holiday') >= '0.1.3') {
- // Add something for the holiday extension
- $MORE .= " AND `holiday_active`='N'";
- } // END - if
-
- // Return result
- return $MORE;