- // Update cache file
- if (GET_EXT_VERSION("cache") >= "0.1.2")
- {
- if ($CACHE->cache_file("refdepths", true)) $CACHE->cache_destroy();
- }
- break;
-
- case "settings":
- $REF = bigintval($_POST['ref_payout']);
- $SQL[] = sprintf("UPDATE "._MYSQL_PREFIX."_config SET
-allow_direct_pay='%s',
-reg_points_mode='%s',
-ref_payout='%d'
-WHERE config='0' LIMIT 1",
- $_POST['allow_direct_pay'],
- $_POST['reg_points_mode'],
- $REF
- );
- if (($CONFIG['ref_payout'] == 0) && ($_POST['ref_payout'] > 0))
- {
- // Update account's ref_payout for "must-confirm"
- $SQL[] = sprintf("UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=(%d - mails_confirmed)
-WHERE mails_confirmed < %d", $REF, $REF);
- }
- elseif (($CONFIG['ref_payout'] > 0) && ($_POST['ref_payout'] == 0))
- {
- // Update account's ref_payout for "not-must-confirm"
- $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_data SET ref_payout=0 WHERE ref_payout > 0";
- $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_points SET points=points+locked_points WHERE locked_points>0";
- $SQL[] = "UPDATE "._MYSQL_PREFIX."_user_points SET locked_points=0 WHERE locked_points>0";
- }
- break;
+ case 'settings':
+ $REF = bigintval(postRequestElement('ref_payout'));
+ updateConfiguration(
+ array('allow_direct_pay', 'reg_points_mode', 'ref_payout'),
+ array(postRequestElement('allow_direct_pay'), postRequestElement('reg_points_mode'), $REF)
+ );
+ if ((getConfig('ref_payout') == 0) && (postRequestElement('ref_payout') > 0)) {
+ // Update account's ref_payout for "must-confirm"
+ addSql(sprintf("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_payout`=(%s - `mails_confirmed`)
+WHERE `mails_confirmed` < %s", $REF, $REF));
+ } elseif ((getConfig('ref_payout') > 0) && (postRequestElement('ref_payout') == 0)) {
+ // Update account's ref_payout for "not-must-confirm"
+ addSql("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_payout`=0 WHERE `ref_payout` > 0");
+ addSql("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `points`=`points`+`locked_points` WHERE `locked_points` > 0");
+ addSql("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `locked_points`=0 WHERE `locked_points` > 0");
+ }
+ break;