$value) {
addSql("UPDATE `{?_MYSQL_PREFIX?}_payments` SET `time`='" . $value . "', `payment`='".postRequestParameter('payment', $id)."', price='".postRequestParameter('price', $id)."', mail_title='".postRequestParameter('mail_title', $id)."' WHERE `id`='".$id."' LIMIT 1");
} // END - foreach
break;
case 'delete':
foreach (postRequestParameter('id') as $id => $value) {
addSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=" . bigintval($id) . " LIMIT 1");
} // END - foreach
break;
} // END - switch
// Save settings
if (countSqls() > 0) {
// Run all queries
runFilterChain('run_sqls');
$content = '{--SETTINGS_SAVED--}';
} else {
// Nothing has changed!
$content = '{--SETTINGS_NOT_SAVED--}';
}
// Output template
loadTemplate('admin_settings_saved', false, $content);
} elseif ((isFormSent('delete')) && (ifPostContainsSelections())) {
// Delete entries here
$OUT = '';
foreach (postRequestParameter('sel') as $id => $value) {
$result = SQL_QUERY_ESC("SELECT `id`, `time`, `mail_title` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
$content = SQL_FETCHARRAY($result);
// Free result
SQL_FREERESULT($result);
// Load row template and switch colors
$OUT .= loadTemplate('admin_delete_payments_row', true, $content);
} // END - foreach
// Load main template
loadTemplate('admin_delete_payments', false, $OUT);
} elseif ((isFormSent('edit')) && (ifPostContainsSelections())) {
// Edit entries
$OUT = '';
foreach (postRequestParameter('sel') as $id => $value) {
$result = SQL_QUERY_ESC("SELECT `id`, `time`, `payment`, `mail_title`, `price` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
$content = SQL_FETCHARRAY($result);
// Free result
SQL_FREERESULT($result);
// Load row template and switch colors
$OUT .= loadTemplate('admin_edit_payments_row', true, $content);
} // END - foreach
// Load main template
loadTemplate('admin_edit_payments', false, $OUT);
} else {
// Referal levels
$result = SQL_QUERY("SELECT `id`, `time`, `payment`, `mail_title`, `price` FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `time` ASC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Make referal levels editable and deletable
$OUT = '';
// List already existing categories for editing
while ($content = SQL_FETCHARRAY($result)) {
// Load row template and switch colors
$OUT .= loadTemplate('admin_list_payments_row', true, $content);
} // END - switch
// Free memory
SQL_FREERESULT($result);
// Load main template
loadTemplate('admin_list_payments', false, $OUT);
} // END - if
// Form for adding new referal levels
loadTemplate('admin_add_payment');
}
// [EOF]
?>