- 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 UPDATE_CONFIG ($entries, $values, $updateMode="") {
- global $CSS;
-
- // Do not update config in CSS mode
- if (($CSS == "1") || ($CSS == -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
- $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]));
- }
- }
- } // END - foreach
-
- // Remove last comma
- $entries = substr($all, 0, -1);
- } elseif (!empty($updateMode)) {
- // Update mode set
- $entries .= sprintf("=%s%s%s", $entries, $updateMode, (float)$values);
- } else {
- // 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", __FILE__, __LINE__);
-
- // Get affected rows
- $affectedRows = SQL_AFFECTEDROWS();
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):entries={$entries},affectedRows={$affectedRows}<br />\n";
-
- // Rebuild cache
- REBUILD_CACHE("config", "config");
-}
-
-// Prepares an SQL statement part for HTML mail and/or holiday depency
-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;