// Is the 'sub' parameter set?
if (REQUEST_ISSET_GET('sub')) {
// Yes, then do some sanity-checks
- switch (REQUEST_GET('sub'))
- {
- case "points":
+ switch (REQUEST_GET('sub')) {
+ case 'points':
if ((!REQUEST_ISSET_POST(('points_register'))) || (!REQUEST_ISSET_POST(('points_ref')))) {
REQUEST_UNSET_POST('ok');
}
break;
- case "ref":
+ case 'ref':
if (REQUEST_ISSET_GET('do')) {
if (((!REQUEST_ISSET_POST(('lvl'))) || (!REQUEST_ISSET_POST(('perc')))) && (REQUEST_GET('do') == 'add')) {
REQUEST_UNSET_POST('ok');
}
} else {
// Display overview
- REQUEST_SET_GET('sub', "overview");
+ REQUEST_SET_GET('sub', 'overview');
}
-if (IS_FORM_SENT()) {
+if (isFormSent()) {
INIT_SQLS();
- switch (REQUEST_GET('sub'))
- {
- case "points":
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_config` SET points_register='".REQUEST_POST('points_register')."', points_ref='".REQUEST_POST('points_ref')."' WHERE config=0 LIMIT 1");
+ switch (REQUEST_GET('sub')) {
+ case 'points':
+ updateConfiguration(array('points_register', 'points_ref'), array(REQUEST_POST('points_register'), REQUEST_POST('points_ref')));
break;
- case "ref":
+ case 'ref':
switch (REQUEST_GET('do'))
{
case 'add':
$id = bigintval($id);
// Revert german commata
- REQUEST_SET_POST(array('perc', $id), convertCommaToDot(REQUEST_POST('perc', $id)));
+ REQUEST_SET_POST('perc', array($id => convertCommaToDot(REQUEST_POST('perc', $id))));
// Update entry
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refdepths` SET level='%s', percents='%s' WHERE `id`=%s LIMIT 1",
case "settings":
$REF = bigintval(REQUEST_POST('ref_payout'));
- ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_config` SET
-allow_direct_pay='%s',
-reg_points_mode='%s',
-ref_payout='%s'
-WHERE config=0 LIMIT 1",
- REQUEST_POST('allow_direct_pay'),
- REQUEST_POST('reg_points_mode'),
- $REF
- ));
+ updateConfiguration(
+ array('allow_direct_pay', 'reg_points_mode', 'ref_payout'),
+ array(REQUEST_POST('allow_direct_pay'), REQUEST_POST('reg_points_mode'), $REF)
+ );
if ((getConfig('ref_payout') == 0) && (REQUEST_POST('ref_payout') > 0)) {
// Update account's ref_payout for "must-confirm"
- ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=(%s - mails_confirmed)
-WHERE mails_confirmed < %s", $REF, $REF));
+ ADD_SQL(sprintf("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `ref_payout`=(%s - `mails_confirmed`)
+WHERE `mails_confirmed` < %s", $REF, $REF));
} elseif ((getConfig('ref_payout') > 0) && (REQUEST_POST('ref_payout') == 0)) {
// Update account's ref_payout for "not-must-confirm"
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=0 WHERE ref_payout > 0");
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET points=points+locked_points WHERE locked_points>0");
- ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET locked_points=0 WHERE locked_points>0");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `ref_payout`=0 WHERE `ref_payout` > 0");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET `points`=`points`+`locked_points` WHERE `locked_points` > 0");
+ ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_user_points` SET `locked_points`=0 WHERE `locked_points` > 0");
}
break;
}
LOAD_TEMPLATE("admin_points_edit");
} else {
// Referal levels
- $result = SQL_QUERY("SELECT id, level, percents FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY level", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT `id`, `level`, `percents` FROM `{!_MYSQL_PREFIX!}_refdepths` ORDER BY `level` ASC", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Make referal levels editable and deletable
$OUT = ''; $SW = 2;
);
// Load row template and switch color
- $OUT .= LOAD_TEMPLATE("admin_points_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_points_row', true, $content);
$SW = 3 - $SW;
}
define('__LEVEL_ROWS', $OUT);
// Load main template
- LOAD_TEMPLATE("admin_points");
+ LOAD_TEMPLATE('admin_points');
}
// Form for adding new referal levels
- LOAD_TEMPLATE("admin_add_reflvl");
+ LOAD_TEMPLATE('admin_add_reflvl');
}
-} elseif (REQUEST_GET('sub') == "points") {
+} elseif (REQUEST_GET('sub') == 'points') {
// First points for registration and other fixed points including new add-mode for one-time referal bonus...
define('P_REG_VALUE', getConfig('points_register'));
define('P_REF_VALUE', getConfig('points_ref'));
// Load templates
- LOAD_TEMPLATE("admin_config_sub_points");
+ LOAD_TEMPLATE('admin_config_sub_points');
} else {
// Display selection box
- LOAD_TEMPLATE("admin_config_points");
+ LOAD_TEMPLATE('admin_config_points');
}
//