// Is the 'bonus' extension installed and activated?
if (isExtensionActive('bonus', true)) {
// Check for bonus campaigns
- $result = SQL_QUERY_ESC("SELECT `id`, `points` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='SEND' AND timestamp <= %s ORDER BY `id`",
+ $result = SQL_QUERY_ESC("SELECT `id`, `points` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='SEND' AND `timestamp` <= %s ORDER BY `id` ASC",
array(bigintval($PURGE)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Start deleting procedure
// Add points from deleted accounts to jackpot, but here just add to notify mail
if ($admin_points > 0) {
// Send mail to admin
- sendAdminNotification(getMessage('AUTOPURGE_ADMIN_SUBJECT'), 'admin_autopurge_points', translateComma($admin_points), 0);
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_SUBJECT'), 'admin_autopurge_points', translateComma($admin_points));
} // END - if
// Run all SQLs here
$useridsContent = str_replace(', ', "\n", substr($useridsContent, 0, -2));
// Send mail notification to admin
- sendAdminNotification(getMessage('AUTOPURGE_ADMIN_INACTIVE_SUBJECT'), 'admin_autopurge_inactive', $useridsContent, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_INACTIVE_SUBJECT'), 'admin_autopurge_inactive', $useridsContent);
} // END - if
// Free memory
// Send mail notification to admin
if (getConfig('ap_in_notify') == 'Y') {
- sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DELETE_SUBJECT'), 'admin_autopurge_delete', $useridsContent, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DELETE_SUBJECT'), 'admin_autopurge_delete', $useridsContent);
} // END - if
} // END - if
// Do we have deleted mails and the admin want's to receive a notification
if (($deletedStats > 0) && (getConfig('ap_dm_notify') == 'Y')) {
// Send out email to admin
- sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT'), 'admin_autopurge_del_mails', $deletedStats, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_DEL_MAILS_SUBJECT'), 'admin_autopurge_del_mails', $deletedStats);
} // END - if
//
return false;
} // END - if
-// Check version (must be > 0.0)
-if ((isExtensionInstalledAndNewer('task') > '0.0') && (getConfig('autopurge_tasks') == 'Y')) {
+// Check version (must be >= 0.1.9)
+if ((isExtensionInstalledAndNewer('task', '0.1.9')) && (getConfig('autopurge_tasks') == 'Y')) {
// Purge deleted tasks (no notification to admin)
SQL_QUERY("DELETE LOW_PRIORITY
FROM
// Do we need to send a notification?
if (($deletedTasks > 0) && (getConfig('ap_tasks_notify') == 'Y')) {
// Send out email to admin
- sendAdminNotification(getMessage('AUTOPURGE_ADMIN_TASKS_SUBJECT'), 'admin_autopurge_tsks', $deletedTasks, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_TASKS_SUBJECT'), 'admin_autopurge_tsks', $deletedTasks);
} // END - if
} // END - if
// Send mail notification to admin
if (getConfig('ap_un_notify') == 'Y') {
- sendAdminNotification(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), 'admin_autopurge_unconfirmed', $userids, '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), 'admin_autopurge_unconfirmed', $userids);
} // END - if
} // END - if
// Notify the admin
sendAdminNotification(
- getMessage('ADMIN_SUBJECT_EXTENSION_DEACTIVATED'),
+ getMessage('ADMIN_SUBJECT_EXTENSION_DEACTIVATED'),
'admin_ext_deactivated',
array('ext_name' => $ext_name)
);
break;
case 'update': // Update an extension
- switch (getCurrentExtensionVersion())
- {
+ switch (getCurrentExtensionVersion()) {
case '0.1.0': // SQL queries for v0.1
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD autopurge_inactive ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD autopurge_unconfirmed ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_inactive_since BIGINT(20) UNSIGNED NOT NULL DEFAULT '2592000'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_inactive_time BIGINT(20) UNSIGNED NOT NULL DEFAULT '25200'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `autopurge_inactive` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `autopurge_unconfirmed` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_inactive_since` BIGINT(20) UNSIGNED NOT NULL DEFAULT '2592000'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_inactive_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT '25200'");
addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_unconfirmed_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT '432000'");
addAdminMenuSql('setup','config_autopurge','Auto-Löschung','Automatisch inaktive oder nicht bestätigte Accounts löschen.',12);
addAdminMenuSql('user','list_autopurge','Inaktive finden','Lassen Sie sich vor dem täglichen Reset anzeigen, welche Mitglieder als inaktiv erkannt werden und welche gelöscht werden.',10);
break;
case '0.1.9': // SQL queries for v0.1.9
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD autopurge_tasks ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_tasks_time BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('ONE_DAY')*7)."'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `autopurge_tasks` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_tasks_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(getConfig('ONE_DAY')*7)."'");
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Bereinigung von zu löschenden Aufgaben klappt wieder. Zeitlimit für genanntes kann eingestellt werden (Default = 7 Tage).<br /><br /><u>Bitte aktualisieren Sie auch die Admin-Templates!</u>");
break;
case '0.2.0': // SQL queries for v0.2.0
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_in_notify ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_un_notify ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_tasks_notify ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_in_notify` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_un_notify` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_tasks_notify` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Mail wird bei Löschung von Aufgaben ausgesendet.<br /><br /><u>Bitte aktualisieren Sie auch die Admin-Templates!</u>");
break;
case '0.3.3': // SQL queries for v0.3.3
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_del_mails ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_dm_notify ENUM('Y','N') NOT NULL DEFAULT 'Y'");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD ap_dm_timeout BIGINT(20) UNSIGNED NOT NULL DEFAULT '86400'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_del_mails` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_dm_notify` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+ addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `ap_dm_timeout` BIGINT(20) UNSIGNED NOT NULL DEFAULT '86400'");
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Von bereits gelöschten Mitgliedern die Mails löschen integriert.");
$content = getMessage('CANNOT_SEND_ADMIN_MAILS');
} else {
// No mail to admin
- $content = "<span class=\"member_done\">{--MYDATA_MAIL_SENT--}</span>";
+ $content = '<span class="member_done">{--MYDATA_MAIL_SENT--}</span>';
}
} // END - if
if (SQL_AFFECTEDROWS() > 0) {
// Send out email to admin
- sendAdminNotification(getMessage('AUTOPURGE_ADMIN_TURBO_SUBJECT'), 'admin_autopurge_turbo', SQL_AFFECTEDROWS(), '');
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_TURBO_SUBJECT'), 'admin_autopurge_turbo', SQL_AFFECTEDROWS());
} // END - if
}
} // END - if
// Send mail to admins
- sendAdminNotification(getMessage('HOLIDAY_ADMIN_UNLOCK_SUBJ'), 'admin_holiday_unlock', $admin, 0);
+ sendAdminNotification(getMessage('HOLIDAY_ADMIN_UNLOCK_SUBJ'), 'admin_holiday_unlock', $admin);
// Run all SQLs
runFilterChain('run_sqls');
if ($notify == 'Y') $templ = 'admin_rallye_notify';
// Send email to admin
- sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_NOTIFY', $title), $templ, $prices, 0);
+ sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_NOTIFY', $title), $templ, $prices);
// Free memory
SQL_FREERESULT($result_user);
}
// Send mail to admin
- sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_EXPIRED_SUBJ', $title), $templ, $cnt, 0);
+ sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_EXPIRED_SUBJ', $title), $templ, $cnt);
// Add task
createNewTask('{--RALLYE_ADMIN_EXPIRED--}: ' . $title, '{--RALLYE_ADMIN_EXPIRED_TEXT--}', 'RALLYE_EXPIRED');
$content['now_time'] = generateDateTime(time(), 1);
// Send mail to admin
- sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_PURGED_SUBJ', $content['title']), 'admin_rallye_purged', $content, 0);
+ sendAdminNotification(getMaskedMessage('RALLYE_ADMIN_PURGED_SUBJ', $content['title']), 'admin_rallye_purged', $content);
// Purge whole rallye
addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
// Some security stuff...
if (!defined('__SECURITY')) {
die();
-}
+} // END - if
-//
-function autoPurgeTransfers($max, $age) {
+// Purge expired transfer entries
+function autoPurgeTransfers ($max, $age) {
// First get total in-going lines
- $result = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` ORDER BY `id`", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_in` ORDER BY `id` ASC", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > $max) {
// Update overdue transfers
$remove = SQL_NUMROWS($result) - $max;
// This will make it really old, so the final removal query will find it
- $result = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_transfers_in` SET `time_trans`=0 ORDER BY `id` LIMIT ".$remove, __FUNCTION__, __LINE__);
- }
+ $result = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_transfers_in` SET `time_trans`=0 ORDER BY `id` LIMIT %s"
+ array($remove), __FUNCTION__, __LINE__);
+ } // END - if
// Second get total out-going lines
- $result = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY `id`", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY `id` ASC", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > $max) {
// Update overdue transfers
$remove = SQL_NUMROWS($result) - $max;
// This will make it really old, so the final removal query will find it
- $result = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_transfers_out` SET `time_trans`=0 ORDER BY `id` LIMIT ".$remove, __FUNCTION__, __LINE__);
- }
+ $result = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_transfers_out` SET `time_trans`=0 ORDER BY `id` LIMIT %s"
+ array($remove), __FUNCTION__, __LINE__);
+ } // END - if
// Remove old in-going transfers
- $result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE time_trans < (UNIX_TIMESTAMP() - ".$age.")", __FUNCTION__, __LINE__);
- $REMOVE = SQL_AFFECTEDROWS();
+ $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `time_trans` < (UNIX_TIMESTAMP() - %s)",
+ array($age), __FUNCTION__, __LINE__);
+ $removed = SQL_AFFECTEDROWS();
// Remove old out-going transfers
- $result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE time_trans < (UNIX_TIMESTAMP() - ".$age.")", __FUNCTION__, __LINE__);
- $REMOVE += SQL_AFFECTEDROWS();
+ $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `time_trans` < (UNIX_TIMESTAMP() - %s)",
+ array($age), __FUNCTION__, __LINE__);
+ $removed += SQL_AFFECTEDROWS();
// Only send email to admin(s) when we have removed entries
- if ($REMOVE > 0) {
- sendAdminNotification(TRANSFER_ADMIN_AUTOPURGE, "admin_transfer_ap", $REMOVE, 0);
- }
+ if ($removed > 0) {
+ sendAdminNotification(getMessage('TRANSFER_ADMIN_AUTOPURGE'), 'admin_transfer_ap', $removed);
+ } // END - if
}
-//
+
+// [EOF]
?>
}
// List all register values
-$result = SQL_QUERY("SELECT id, field_name, field_required FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id`", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT id, field_name, field_required FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC", __FILE__, __LINE__);
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
// Get language string
// Load all banking packages from DB
$result = SQL_QUERY("SELECT id, title, description, account_fee AS 'fee', package_active AS 'active', interest_plus AS 'plus', interest_minus AS 'minus'
FROM `{?_MYSQL_PREFIX?}_bank_packages`
-ORDER BY `id`", __FILE__, __LINE__);
+ORDER BY `id` ASC", __FILE__, __LINE__);
// Is there at lease one package?
if (SQL_NUMROWS($result) > 0) {
// @TODO Try to rewrite this to a filter
if (isExtensionActive('bonus')) {
// Load bonus id
- $result = SQL_QUERY_ESC("SELECT `stats_id`, `bonus_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `id`",
+ $result = SQL_QUERY_ESC("SELECT `stats_id`, `bonus_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `userid`=%s ORDER BY `id` ASC",
array(bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
} else {
// Load stats id (2nd will be ignored later! But it is needed for the same fetchrow command)
LIMIT 1", array(getRequestParameter('hash')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Sponsor found, load his data...
- $SPONSOR = SQL_FETCHARRAY($result);
+ $data = SQL_FETCHARRAY($result);
// Translate gender and comma
- $SPONSOR['gender'] = translateGender($SPONSOR['gender']);
- $SPONSOR['points'] = translateComma($SPONSOR['points']);
- $SPONSOR['pay'] = translateComma($SPONSOR['pay']);
+ $data['gender'] = translateGender($data['gender']);
+ $data['points'] = translateComma($data['points']);
+ $data['pay'] = translateComma($data['pay']);
// Unconfirmed account or changed email address?
- if ($SPONSOR['status'] == 'UNCONFIRMED') {
+ if ($data['status'] == 'UNCONFIRMED') {
// Set account to pending
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `status`='PENDING'
WHERE `id`='%s' AND hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
- array(bigintval($SPONSOR['id']), getRequestParameter('hash')), __FILE__, __LINE__);
+ array(bigintval($data['id']), getRequestParameter('hash')), __FILE__, __LINE__);
// Check on success
if (SQL_AFFECTEDROWS() == 1) {
// Prepare mail and send it to the sponsor
- $message = loadEmailTemplate('sponsor_pending', $SPONSOR);
- sendEmail($SPONSOR['email'], getMessage('SPONSOR_ACCOUNT_PENDING_SUBJ'), $message);
+ $message = loadEmailTemplate('sponsor_pending', $data);
+ sendEmail($data['email'], getMessage('SPONSOR_ACCOUNT_PENDING_SUBJ'), $message);
// Send email to admin
- sendAdminNotification(getMessage('ADMIN_NEW_SPONSOR'), 'admin_sponsor_pending', $SPONSOR);
+ sendAdminNotification(getMessage('ADMIN_NEW_SPONSOR'), 'admin_sponsor_pending', $data);
// Sponsor account set to pending
loadTemplate('admin_settings_saved', false, getMessage('SPONSOR_ACCOUNT_IS_PENDING'));
// Could not unlock account!
loadTemplate('admin_settings_saved', false, getMessage('SPONSOR_ACCOUNT_PENDING_FAILED'));
}
- } elseif ($SPONSOR['status'] == 'EMAIL') {
+ } elseif ($data['status'] == 'EMAIL') {
// Changed email adress need to be confirmed
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `status`='CONFIRMED'
-WHERE `id`='%s' AND hash='%s' AND `status`='EMAIL' LIMIT 1",
- array(bigintval($SPONSOR['id']), getRequestParameter('hash')), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE
+ `{?_MYSQL_PREFIX?}_sponsor_data`
+SET
+ `status`='CONFIRMED'
+WHERE
+ `id`='%s' AND
+ `hash`='%s' AND
+ `status`='EMAIL'
+LIMIT 1",
+ array(bigintval($data['id']), getRequestParameter('hash')), __FILE__, __LINE__);
// Check on success
if (SQL_AFFECTEDROWS() == 1) {
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Unconfirmed sponsor account found so let's load the requested data
- $SPONSOR = SQL_FETCHARRAY($result);
+ $data = SQL_FETCHARRAY($result);
// Translate some data
- $SPONSOR['gender'] = translateGender($SPONSOR['gender']);
- $SPONSOR['sponsor_created'] = generateDateTime($SPONSOR['sponsor_created']);
+ $data['gender'] = translateGender($data['gender']);
+ $data['sponsor_created'] = generateDateTime($data['sponsor_created']);
// Prepare email and send it to the sponsor
- if ($SPONSOR['status'] == 'UNCONFIRMED') {
+ if ($data['status'] == 'UNCONFIRMED') {
// Unconfirmed accounts
- $message_sponsor = loadEmailTemplate('sponsor_activate', $SPONSOR);
+ $message_sponsor = loadEmailTemplate('sponsor_activate', $data);
} else {
// Confirmed email address
- $message_sponsor = loadEmailTemplate('sponsor_email', $SPONSOR);
+ $message_sponsor = loadEmailTemplate('sponsor_email', $data);
}
sendEmail(postRequestParameter('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $message_sponsor);
$DATA = SQL_FETCHARRAY($result);
// Translate some data
- $DATA['gender'] = translateGender($DATA['gender']);
+ $DATA['gender'] = translateGender($DATA['gender']);
$DATA['sponsor_created'] = generateDateTime($DATA['sponsor_created']);
// Generate password