]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_sponsor_pay.php
Several double->single convertions, fix for missing constant '_MYSQL_PREFIX' which...
[mailer.git] / inc / modules / admin / what-list_sponsor_pay.php
index 5c16740bff83d36d94c34c8633045ec221acc2a5..dbf1afe7a696f2d378ce5c3ca79edddc4d891314 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Auflisten/Aendern/Loeschen aller Buchungspakete  *
  * -------------------------------------------------------------------- *
- * $Revision:: 856                                                    $ *
- * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author:: stelzi                                                   $ *
+ * $Author::                                                          $ *
  * Needs to be in all Files and every File needs "svn propset           *
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
 
 // 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__);
 
-$MSG = "";
+$message = '';
 
-if (REQUEST_ISSET_POST(('add'))) {
+if (REQUEST_ISSET_POST('add')) {
        // Check input variables
-       if (!REQUEST_ISSET_POST(('pay_name'))) REQUEST_UNSET_POST(('add'));
-       if ((round(REQUEST_POST('pay_rate')) == 0) || (!REQUEST_ISSET_POST(('pay_rate')))) REQUEST_UNSET_POST(('add'));
+       if (!REQUEST_ISSET_POST(('pay_name'))) REQUEST_UNSET_POST('add');
+       if ((round(REQUEST_POST('pay_rate')) == 0) || (!REQUEST_ISSET_POST(('pay_rate')))) REQUEST_UNSET_POST('add');
 
        REQUEST_SET_POST('pay_min_count', bigintval(REQUEST_POST('pay_min_count')));
 
-       if ((REQUEST_POST('pay_min_count') == 0) || (!REQUEST_ISSET_POST(('pay_min_count')))) REQUEST_UNSET_POST(('add'));
-       if (!REQUEST_ISSET_POST(('pay_currency'))) REQUEST_UNSET_POST(('add'));
+       if ((REQUEST_POST('pay_min_count') == 0) || (!REQUEST_ISSET_POST(('pay_min_count')))) REQUEST_UNSET_POST('add');
+       if (!REQUEST_ISSET_POST(('pay_currency'))) REQUEST_UNSET_POST('add');
 
-} elseif ((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('del')) || (REQUEST_ISSET_POST(('change'))) || (REQUEST_ISSET_POST(('remove')))) {
+} elseif ((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('del')) || (REQUEST_ISSET_POST('change')) || (REQUEST_ISSET_POST('remove'))) {
        // Check if at least one entry was selected
-       if (!REQUEST_ISSET_POST(('id'))) {
+       if (!REQUEST_ISSET_POST('id')) {
                // Nothing selected for editing / deleting???
                REQUEST_UNSET_POST('edit');
                REQUEST_UNSET_POST('del');
-               REQUEST_UNSET_POST(('change'));
-               REQUEST_UNSET_POST(('remove'));
-       } elseif (REQUEST_ISSET_POST(('change'))) {
+               REQUEST_UNSET_POST('change');
+               REQUEST_UNSET_POST('remove');
+       } elseif (REQUEST_ISSET_POST('change')) {
                // Change entries here...
                foreach (REQUEST_POST('id') as $id => $sel) {
                        // Secure ID
@@ -73,69 +73,69 @@ if (REQUEST_ISSET_POST(('add'))) {
 
                        // Save entry
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_paytypes`
-SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE id='%s' LIMIT 1",
-                               array(
-                                       REQUEST_POST('name', $id),
-                                       REQUEST_POST('rate', $id),
-                                       bigintval(REQUEST_POST('min', $id)),
-                                       REQUEST_POST('curr', $id),
-                                       $id
-                               ), __FILE__, __LINE__);
+SET pay_name='%s', pay_rate='%s', pay_min_count='%s', pay_currency='%s' WHERE `id`='%s' LIMIT 1",
+                       array(
+                       REQUEST_POST('name', $id),
+                       REQUEST_POST('rate', $id),
+                       bigintval(REQUEST_POST('min', $id)),
+                       REQUEST_POST('curr', $id),
+                       $id
+                       ), __FILE__, __LINE__);
                }
 
                // Generate message
-               $MSG = getMessage('SPONSOR_PAY_ENTRIES_CHANGED');
-       } elseif (REQUEST_ISSET_POST(('remove'))) {
+               $message = getMessage('SPONSOR_PAY_ENTRIES_CHANGED');
+       } elseif (REQUEST_ISSET_POST('remove')) {
                // Remove entries here...
                foreach (REQUEST_POST('id') as $id => $sel) {
                        // Remove entry
-                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE id='%s' LIMIT 1",
-                               array(bigintval($id)), __FILE__, __LINE__);
+                       SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1",
+                       array(bigintval($id)), __FILE__, __LINE__);
                }
 
                // Generate message
-               $MSG = getMessage('SPONSOR_PAY_ENTRIES_REMOVED');
+               $message = getMessage('SPONSOR_PAY_ENTRIES_REMOVED');
        }
 
-       if (!empty($MSG)) {
+       if (!empty($message)) {
                // Output message
-               LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
+               LOAD_TEMPLATE('admin_settings_saved', false, $message);
        }
 }
 
-if (REQUEST_ISSET_POST(('add'))) {
+if (REQUEST_ISSET_POST('add')) {
        // Check if entry with same name does exists
-       $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE pay_name='%s' LIMIT 1",
-               array(REQUEST_POST('pay_name')), __FILE__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE pay_name='%s' LIMIT 1",
+       array(REQUEST_POST('pay_name')), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // No entry found so add this line
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_sponsor_paytypes` (pay_name, pay_rate, pay_min_count, pay_currency) VALUES ('%s','%s','%s','%s')",
-                       array(
-                               htmlspecialchars(REQUEST_POST('pay_name')),
-                               REVERT_COMMA(REQUEST_POST('pay_rate')),
-                               bigintval(REQUEST_POST('pay_min_count')),
-                               htmlspecialchars(REQUEST_POST('pay_currency'))
-                       ), __FILE__, __LINE__);
+               array(
+               htmlspecialchars(REQUEST_POST('pay_name')),
+               convertCommaToDot(REQUEST_POST('pay_rate')),
+               bigintval(REQUEST_POST('pay_min_count')),
+               htmlspecialchars(REQUEST_POST('pay_currency'))
+               ), __FILE__, __LINE__);
 
                // Payment type added!
-               $MSG = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ADDED'), REQUEST_POST('pay_name'));
+               $message = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ADDED'), REQUEST_POST('pay_name'));
        } else {
                // Free memory
                SQL_FREERESULT($result);
 
                // Entry does already exists
-               $MSG = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ALREADY'), REQUEST_POST('pay_name'));
+               $message = sprintf(getMessage('ADMIN_SPONSOR_PAYTYPE_ALREADY'), REQUEST_POST('pay_name'));
        }
 
        // Output message
-       LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
+       LOAD_TEMPLATE('admin_settings_saved', false, $message);
 } elseif ((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST('del'))) {
        // Load all data
-       $OUT = ""; $SW = 2;
+       $OUT = ''; $SW = 2;
        foreach (REQUEST_POST('id') as $id => $sel) {
                // Load entry
-               $result = SQL_QUERY_ESC("SELECT pay_name, pay_rate, pay_min_count, pay_currency FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE id='%s' LIMIT 1",
-                array(bigintval($id)), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT pay_name, pay_rate, pay_min_count, pay_currency FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` WHERE `id`='%s' LIMIT 1",
+               array(bigintval($id)), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load data
                        list($name, $rate, $min, $curr) = SQL_FETCHROW($result);
@@ -146,7 +146,7 @@ if (REQUEST_ISSET_POST(('add'))) {
                                'id'   => bigintval($id),
                                'sw'   => bigintval($SW),
                                'name' => htmlspecialchars($name),
-                               'rate' => TRANSLATE_COMMA($rate),
+                               'rate' => translateComma($rate),
                                'min'  => bigintval($min),
                                'curr' => htmlspecialchars($curr)
                        );
@@ -181,12 +181,12 @@ if (REQUEST_ISSET_POST(('add'))) {
 } else {
        // Load all payment types
        $result = SQL_QUERY("SELECT id, pay_name, pay_rate, pay_min_count, pay_currency FROM `{!_MYSQL_PREFIX!}_sponsor_paytypes` ORDER BY pay_name",
-        __FILE__, __LINE__);
+       __FILE__, __LINE__);
 
        // Do we have some paytypes setup?
        if (SQL_NUMROWS($result) > 0) {
                // Prepare variables for listing
-               $OUT = ""; $SW = 2;
+               $OUT = ''; $SW = 2;
 
                // List alle found payment types
                while ($content = SQL_FETCHARRAY($result)) {
@@ -195,7 +195,7 @@ if (REQUEST_ISSET_POST(('add'))) {
                                'sw'       => $SW,
                                'id'       => $content['id'],
                                'name'     => $content['pay_name'],
-                               'rate'     => TRANSLATE_COMMA($content['pay_rate']),
+                               'rate'     => translateComma($content['pay_rate']),
                                'min'      => $content['pay_min_count'],
                                'currency' => $content['pay_currency']
                        );
@@ -217,7 +217,7 @@ if (REQUEST_ISSET_POST(('add'))) {
                define('__LIST_CONTENT', LOAD_TEMPLATE("admin_list_sponsor_pay", true));
        } else {
                // Noting setup so far!
-               define('__LIST_CONTENT', LOAD_TEMPLATE("admin_settings_saved", true, getMessage('ADMIN_SPONSOR_NO_PAYTYPES')));
+               define('__LIST_CONTENT', LOAD_TEMPLATE('admin_settings_saved', true, getMessage('ADMIN_SPONSOR_NO_PAYTYPES')));
        }
 
        // Add new payment types here