+// Gets the matching what name from module
+function getWhatFromModule ($modCheck) {
+ // Is the request element set?
+ if (REQUEST_ISSET_GET('what')) {
+ // Then return this!
+ return REQUEST_GET('what');
+ } // END - if
+
+ // Default is empty
+ $wht = '';
+
+ //* DEBUG: */ echo __LINE__.'!'.$modCheck."!<br />\n";
+ switch ($modCheck) {
+ case 'admin':
+ $wht = 'overview';
+ break;
+
+ case 'login':
+ case 'index':
+ $wht = 'welcome';
+ if (($modCheck == 'index') && (getConfig('index_home') != '')) $wht = getConfig('index_home');
+ break;
+
+ default:
+ $wht = '';
+ break;
+ } // END - switch
+
+ // Return what value
+ return $wht;
+}
+
+// Subtract points from database and mediadata cache
+function SUB_POINTS ($subject, $uid, $points) {
+ // Add points to used points
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `used_points`=`used_points`+%s WHERE userid=%s LIMIT 1",
+ array($points, bigintval($uid)), __FUNCTION__, __LINE__);
+
+ // Insert booking record
+ // @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));