]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-payments.php
Even more rewritten
[mailer.git] / inc / modules / admin / what-payments.php
index 0b2c08ff71482498812ecb34444dbfb04392aae5..a6c05990a720d276486ca83ec1a7cf86659756cb 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Verguetungen fuer bestaetigte Mails              *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
 
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
 }
 
 // Add description as navigation point
-ADD_DESCR("admin", __FILE__);
+ADD_DESCR('admin', __FILE__);
 
-if (((!REQUEST_ISSET_POST(('t_wait'))) || (!REQUEST_ISSET_POST(('payment')))) && (REQUEST_ISSET_GET(('do'))) && (REQUEST_GET('do') == "add")) {
+if (((!REQUEST_ISSET_POST(('t_wait'))) || (!REQUEST_ISSET_POST(('payment')))) && (REQUEST_ISSET_GET('do')) && (REQUEST_GET('do') == 'add')) {
        REQUEST_UNSET_POST('ok');
 }
 
 if (IS_FORM_SENT()) {
        switch (REQUEST_GET('do')) {
-       case "add":
+       case 'add':
                ADD_SQL("INSERT INTO `{!_MYSQL_PREFIX!}_payments` (time, payment, mail_title, price) VALUES ('".REQUEST_POST('t_wait')."','".REQUEST_POST('payment')."','".REQUEST_POST('title')."','".REQUEST_POST('price')."')");
                $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_payments` WHERE time='%s' LIMIT 1",
                        array(REQUEST_POST('t_wait')), __FILE__, __LINE__);
@@ -83,10 +88,10 @@ if (IS_FORM_SENT()) {
        }
 
        // Output template
-       LOAD_TEMPLATE("admin_settings_saved", false, $content);
+       LOAD_TEMPLATE('admin_settings_saved', false, $content);
 } 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__);
@@ -111,7 +116,7 @@ if (IS_FORM_SENT()) {
        LOAD_TEMPLATE("admin_del_payments");
 } 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 +146,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