break;
default:
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown mode %s detected.", $mode));
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown mode %s detected.", $mode));
$content = MEMBER_UNKNOWN_MODE.": ".$mode."\n\n";
break;
}
break;
default:
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unsupported module %s detected.", $mod));
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unsupported module %s detected.", $mod));
$content = "<STRONG><SPAN class=\"member_failed\">".UNKNOWN_MODULE."</SPAN></STRONG>";
break;
}
*
* Dynamic referal system, can also send mails!
*
+ * subject = Subject line, write in lower-case letters and underscore is allowed
* uid = Referal ID wich should receive...
* points = ... xxx points
* send_notify = shall I send the referal an email or not?
* add_mode = Add points only to $uid or also refs? (WARNING! Changing "ref" to "direct"
* for default value will cause no referal will get points ever!!!)
*/
-function ADD_POINTS_REFSYSTEM ($uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
+function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
global $DEPTH, $_CONFIG, $DATA, $cacheArray;
return;
} // END - if
+ // Add booking record if extension is installed
+ if (EXT_IS_ACTIVE("booking")) {
+ // Add record
+ ADD_BOOKING_RECORD($subject, $uid, $points, "add");
+ } // END - if
+
// Count up referal depth
if (!isset($DEPTH)) {
// Initialialize referal system
if (($ref > 0) && ($points > 0) && ($ref != $uid) && ($add_mode == "ref")) {
// Then let's credit him here...
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},points={$points} - ADVANCE!<br />\n";
- ADD_POINTS_REFSYSTEM($ref, $points, $send_notify, $ref, $locked);
+ ADD_POINTS_REFSYSTEM(sprintf("%s_ref:%s", $subject, $DEPTH), $ref, $points, $send_notify, $ref, $locked);
} // END - if
} // END - if
} // END - if
// Return status
return $ret;
}
+
// Subtract points from database and mediadata cache
-function SUB_POINTS ($uid, $points) {
+function SUB_POINTS ($subject, $uid, $points) {
// Add points to used points
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `used_points`=`used_points`+%s WHERE userid=%s LIMIT 1",
array($points, bigintval($uid)), __FILE__, __LINE__);
+ // Insert booking record
+ 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="") {
// Do we have multiple entries?
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]));
// Rebuild cache
REBUILD_CACHE("config", "config");
}
+
// Creates a new task for updated extension
function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $subject, $notes) {
// Check if task is not there
// Free memory
SQL_FREERESULT($result);
}
+
// Creates a new task for newly installed extension
function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
// Not installed and do we have created a task for the admin?