`funcoins_amount` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000 COMMENT 'Transfered amount',
`funcoins_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Booking timestamp',
`funcoins_type` ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED' COMMENT 'Transaction type',
-`fucoins_tan` VARCHAR(255) NULL DEFAULT NULL COMMENT 'TAN from API',
+`funcoins_tan` VARCHAR(255) NULL DEFAULT NULL COMMENT 'TAN from API',
`funcoins_api_response` TINYTEXT COMMENT 'Clear text API response (only for debugging)',
`funcoins_api_status` INT(4) NULL DEFAULT NULL COMMENT 'Status code from API',
PRIMARY KEY (`id`),
// Admin menu
addAdminMenuSql('funcoins', NULL, 'FunCoins-Management', 'Konfiguration zur FuCo-Ex² einstellen, Auszahlungen auflisten usw..', 15);
addAdminMenuSql('funcoins', 'config_funcoins', 'FuCo-Ex²-Einstellungen', 'Konfiguration zur FuCo-Ex² einstellen.', 1);
- addAdminMenuSql('funcoins', 'list_funcoins', 'Anfragen auflisten', 'Listet alle FunCoinsein- und -auszahlungsanfragen Ihrer Mitglieder und Sponsoren auf.', 2);
+ addAdminMenuSql('funcoins', 'list_funcoins', 'Anfragen auflisten', 'Listet alle FunCoins-Ein- und -Auszahlungsanfragen Ihrer Mitglieder und Sponsoren auf.', 2);
// Member menu
addMemberMenuSql('main', 'funcoins', 'FunCoins-Ein-/Auszahlungen', 11);
// Is the extension ext-sql_patches installed and at least 0.3.6?
if ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && (isExtensionInstalledAndNewer('other', '0.2.5'))) {
// Generate random number
- setConfigEntry('RAND_NUMBER', generateRandomCode(10, mt_rand(10000, 32766), getMemberId(), ''));
+ setConfigEntry('RAND_NUMBER', generateRandomCode(10, mt_rand(10000, 99999), getMemberId(), ''));
} else {
// Generate *WEAK* code
setConfigEntry('RAND_NUMBER', mt_rand(1000000, 9999999));
}
// Create number from hash
- $rcode = hexdec(substr($saltedHash, 8, 9)) / abs(getRandNo() - $a + sqrt(getConfig('_ADD'))) / pi();
+ $rcode = hexdec(substr($saltedHash, getSaltLength(), 9)) / abs(getRandNo() - $a + sqrt(getConfig('_ADD'))) / pi();
// At least 10 numbers shall be secure enought!
if (isExtensionActive('other')) {
$len = 10;
} // END - if
- // Cut off requested counts of number
- $return = substr(str_replace('.', '', $rcode), 0, $len);
+ // Cut off requested counts of number, but skip first digit (which is mostly a zero)
+ $return = substr($rcode, (strpos($rcode, '.') + 1), $len);
// Done building code
return $return;
$WHATs[] = 'list_payouts';
$DESCRs[] = '{--ADMIN_TASK_LIST_PAYOUTS_ALL--}';
$TITLEs[] = '{--ADMIN_TASK_LIST_PAYOUTS_ALL_TITLE--}';
- }
+ } // END - if
if (isExtensionActive('wernis')) {
// List new wernis requests
$WHATs[] = 'list_wernis';
$DESCRs[] = '{--ADMIN_TASK_LIST_WERNIS_ALL--}';
$TITLEs[] = '{--ADMIN_TASK_LIST_WERNIS_ALL_TITLE--}';
- }
+ } // END - if
if (isExtensionActive('primera')) {
// List new primera requests
$WHATs[] = 'list_primera';
$DESCRs[] = '{--ADMIN_TASK_LIST_PRIMERA_ALL--}';
$TITLEs[] = '{--ADMIN_TASK_LIST_PRIMERA_ALL_TITLE--}';
- }
+ } // END - if
if (isExtensionActive('holiday')) {
// List holiday requests
$WHATs[] = 'list_holiday';
$DESCRs[] = '{--ADMIN_TASK_LIST_HOLIDAYS--}';
$TITLEs[] = '{--ADMIN_TASK_LIST_HOLIDAYS_TITLE--}';
- }
+ } // END - if
if (isExtensionInstalledAndNewer('bonus', '0.8.7')) {
// List all notifications
// Take fees and factor
function WERNIS_TAKE_FEE ($points, $mode) {
// Payout or withdraw are allowed modes!
- //* DEBUG: */ debugOutput('mode='.$mode.',points='.$points);
+ //* DEBUG: */ debugOutput('mode=' . $mode . ',points=' . $points);
if (!in_array($mode, array('payout', 'withdraw'))) {
// Log error and abort
- logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . getMemberId() . ',mode=' . $mode . ',points=' . $points);
+ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . getMemberId() . ',mode=' . $mode . ',points=' . $points . ' - unknown mode detected.');
return false;
} // END - if
// Check for entries
$result = SQL_QUERY('SELECT
- `id`, `userid`, `wernis_account`, `wernis_amount`, `wernis_timestamp`, `wernis_type`, `wernis_api_message`, `wernis_api_status`
+ `id`,
+ `userid`,
+ `wernis_account`,
+ `wernis_amount`,
+ `wernis_timestamp`,
+ `wernis_type`,
+ `wernis_api_message`,
+ `wernis_api_status`
FROM
`{?_MYSQL_PREFIX?}_user_wernis`
ORDER BY
redirectOnUninstalledExtension('mailid');
// Init
-$userId = '0';
-$bonusId = '0';
-$mailId = '0';
+$userId = '0';
+$bonusId = '0';
+$mailId = '0';
// Secure all data
if (isGetRequestParameterSet('userid')) $userId = bigintval(getRequestParameter('userid'));