]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-payments.php
A lot while() conditions rewritten to SQL_FETCHARRAY(), see bug #107, @TODO tags...
[mailer.git] / inc / modules / admin / what-payments.php
index d3a8c4f4b8261bfd1ff2382881f58b2ee8c7192c..94c42935270953c74195586f779f4639d26a8203 100644 (file)
@@ -75,7 +75,7 @@ if (IS_FORM_SENT()) {
        // Save settings
        if (COUNT_SQLS() > 0) {
                // Run all queries
-               RUN_FILTER('run_sqls', array('dry_run' => false));
+               runFilterChain('run_sqls');
                $content = "<span class=\"admin_failed\">".SETTINGS_SAVED."</span>";
        } else {
                // Nothing has changed!
@@ -84,9 +84,9 @@ if (IS_FORM_SENT()) {
 
        // Output template
        LOAD_TEMPLATE("admin_settings_saved", false, $content);
-} elseif ((REQUEST_ISSET_POST(('del'))) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Delete entries here
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value) {
                $result = SQL_QUERY_ESC("SELECT time, mail_title FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
                        array(bigintval($id)), __FILE__, __LINE__);
@@ -109,9 +109,9 @@ if (IS_FORM_SENT()) {
 
        // Load main template
        LOAD_TEMPLATE("admin_del_payments");
-} elseif ((REQUEST_ISSET_POST(('edit'))) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
+} elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Edit entries
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value) {
                $result = SQL_QUERY_ESC("SELECT time, payment, mail_title, price FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
                 array(bigintval($id)), __FILE__, __LINE__);
@@ -141,21 +141,19 @@ if (IS_FORM_SENT()) {
        $result = SQL_QUERY("SELECT id, time, payment, mail_title, price FROM `{!_MYSQL_PREFIX!}_payments` ORDER BY time", __FILE__, __LINE__);
        if (SQL_NUMROWS($result) > 0) {
                // Make referal levels editable and deletable
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
 
                // List already existing categories for editing
-               while (list($id, $time, $pay, $title, $price) = SQL_FETCHROW($result)) {
-                       $pay   = TRANSLATE_COMMA($pay);
-                       $price = TRANSLATE_COMMA($price);
-
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare array for the row template
+                       // @TODO Rewritings: title->mail_title, pay->payment in template
                        $content = array(
                                'sw'    => $SW,
-                               'id'    => $id,
-                               'time'  => $time,
-                               'title' => $title,
-                               'pay'   => $pay,
-                               'price' => $price,
+                               'id'    => $content['id'],
+                               'time'  => $content['time'],
+                               'title' => $content['mail_title'],
+                               'pay'   => TRANSLATE_COMMA($content['payment']),
+                               'price' => TRANSLATE_COMMA($content['price'])
                        );
 
                        // Load row template and switch colors