-$result_mem = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `status`='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__);
-
-$display = true;
-if ((isFormSent('edit')) && (countPostSelection() > 0)) {
- // 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'
+$result_mem = sqlQuery("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `status`='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__);
+
+$display = TRUE;
+if ((isFormSent('edit')) && (ifPostContainsSelections())) {
+ // Make payouts configurable
+ $display = FALSE; //Suppress any other outputs
+ $OUT = '';
+ foreach (postRequestElement('sel') as $id => $sel) {
+ // Load data
+ $result = sqlQueryEscaped("SELECT `id`, `type`, `rate`, `min_points`, `allow_url` FROM `{?_MYSQL_PREFIX?}_payout_types` WHERE `id`=%s LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
+ $content = sqlFetchArray($result);
+ sqlFreeResult($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(sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_payout_types` SET
+ `type`='%s',
+ `rate`=%s,
+ `min_points`=%s,
+ `allow_url`='%s'