- // Edit payout types
- if ((isGetRequestParameterSet('ok')) && (getRequestParameter('ok') == 'ok')) {
- // Init SQLs
- initSqls();
-
- // Edit entries
- foreach (postRequestParameter('sel') as $id => $sel) {
- // Secure id
- $id = bigintval($id);
-
- // Edit only if something is entered
- if ((isPostRequestParameterSet('title', $id)) && (postRequestParameter('rate', $id) > 0)) {
- // Update entry
- addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_payout_types` SET
- type='%s',
- rate=%s,
- min_points=%s,
- allow_url='%s'
+ // Make payouts configurable
+ $display = false; //Suppress any other outputs
+ $OUT = '';
+ foreach (postRequestElement('sel') as $id => $sel) {
+ // Load data
+ $result = SQL_QUERY_ESC("SELECT `id`,`type`,`rate`,`min_points`,`allow_url` FROM `{?_MYSQL_PREFIX?}_payout_types` WHERE `id`=%s LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
+ $content = SQL_FETCHARRAY($result);
+ SQL_FREERESULT($result);
+
+ // Prepare data for the row template
+ $content['allow_url'] = addSelectionBox('yn', $content['allow_url'], 'allow_url[' . $content['id'] . ']');
+
+ // Load row template and switch color
+ $OUT .= loadTemplate('admin_edit_payouts_row', true, $content);
+ } // END - foreach
+
+ // Load main template
+ loadTemplate('admin_edit_payouts', false, $OUT);
+} elseif ((isFormSent('do_edit')) && (ifPostContainsSelections())) {
+ // Change them now
+ // Init SQLs
+ initSqls();
+
+ // Edit entries
+ foreach (postRequestElement('sel') as $id => $sel) {
+ // Secure id
+ $id = bigintval($id);
+
+ // Edit only if something is entered
+ if ((isPostRequestElementSet('type', $id)) && (postRequestElement('rate', $id) > 0)) {
+ // Update entry
+ addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_payout_types` SET
+ `type`='%s',
+ `rate`=%s,
+ `min_points`=%s,
+ `allow_url`='%s'