X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Fautopurge_functions.php;h=baa71aa6cba9fbdd5deb8a216f3cbc3b0ac88c3b;hp=726b9ea3681f77f3f7ef1bc8d5c6811bec87414a;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=414570c5081d337bb6c28dcf521bd8bca02f69e7 diff --git a/inc/libs/autopurge_functions.php b/inc/libs/autopurge_functions.php index 726b9ea368..baa71aa6cb 100644 --- a/inc/libs/autopurge_functions.php +++ b/inc/libs/autopurge_functions.php @@ -1,7 +1,7 @@ $points), $userid); + sendEmail($userid, '{--MEMBER_AUTOPURGE_SUBJECT--}', $message); +} + +// ---------------------------------------------------------------------------- +// Wrapper for configuration entries +// ---------------------------------------------------------------------------- + +// Checks whether auto-purging is enabled +function isAutoPurgingActive () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getConfig('auto_purge_active') == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Wrapper for 'autopurge_inactive +function getAutopurgeInactive () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getConfig('autopurge_inactive') == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// Checks whether purging of inactive accounts is enabled +function isAutopurgeInactiveEnabled () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = (getAutopurgeInactive() == 'Y'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; } -function AUTOPURGE_ADD_POINTS($uid, $points) { - // Check if he has locked points or not - $result = SQL_QUERY_ESC("SELECT ref_payout FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval($uid)), __FUNCTION__, __LINE__); - list($payout) = SQL_FETCHROW($result); - SQL_FREERESULT($result); - - if (($payout > 0) && (!empty($payout))) { - // Yes, he has. - $target = "locked_points"; - } elseif ($payout == "0") { - // No, he has not - $target = "points"; - } - - // Add points... - if (empty($payout)) { - // ... to jackpot account - ADD_JACKPOT($points); - if (empty($jackpot)) $jackpot = 0; - $jackpot += $points; - } else { - // .. to user's account - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET %s=%s+%s WHERE userid=%s AND ref_depth=0 LIMIT 1", - array($target, $target, $points, bigintval($uid)), __FUNCTION__, __LINE__); - - // Update mediadata as well - if ((GET_EXT_VERSION("mediadata") >= "0.0.4") && ($target == "points")) { - // Update database - MEDIA_UPDATE_ENTRY(array("total_points"), "add", $points); - } - - // Send out mail to user - $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_points", TRANSLATE_COMMA($points), $uid); - SEND_EMAIL($uid, AUTOPURGE_MEMBER_SUBJECT, $msg); - } +// "Getter" for ap_inactive_time +function getApInactiveTime () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('ap_inactive_time'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for auto_purge +function getAutoPurge () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('auto_purge'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for ap_dm_timeout +function getApDmTimeout () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('ap_dm_timeout'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for ap_tasks_time +function getApTasksTime () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('ap_tasks_time'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; +} + +// "Getter" for ap_unconfirmed_time +function getApUnconfirmedTime () { + // Is there cache? + if (!isset($GLOBALS[__FUNCTION__])) { + // Determine it + $GLOBALS[__FUNCTION__] = getConfig('ap_unconfirmed_time'); + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__]; } -// +// [EOF] ?>