]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-edit_sponsor.php
Renamed function so it might be more understandable
[mailer.git] / inc / modules / admin / what-edit_sponsor.php
index 785222427f0287a0882b37a4388f6c3c219d4515..36be4046f3a172bd95623032443f2a26b5a32496 100644 (file)
@@ -14,8 +14,6 @@
  * $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 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
-addMenuDescription('admin', __FILE__);
+addYouAreHereLink('admin', __FILE__);
 
 if ((isGetRequestParameterSet('id')) && (isGetRequestParameterSet('mode'))) {
        // Check for selected sponsor
        $result_main = SQL_QUERY_ESC("SELECT
-       `company`, `position`, `gender`, `surname`, `family`,
+       `id`, `company`, `position`, `gender`, `surname`, `family`,
        `street_nr1`, `street_nr2`, `zip`, `city`, `country`,
        `phone`, `fax`, `cell`, `email`, `url`, `tax_ident`,
        `receive_warnings`, `warning_interval`
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
 WHERE
-       `id`='%s'
+       `id`=%s
 LIMIT 1",
                array(bigintval(getRequestParameter('id'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_main) == 1) {
@@ -63,9 +61,6 @@ LIMIT 1",
                $content = SQL_FETCHARRAY($result_main);
 
                // Prepare all data for the template
-               //  Sponsor's id
-               $content['id'] = bigintval(getRequestParameter('id'));
-
                // Init gender
                foreach (array('m', 'f', 'c') as $gender) {
                        $content['gender_' . $gender] = '';
@@ -92,11 +87,11 @@ LIMIT 1",
                                                $points = bigintval(convertCommaToDot(postRequestParameter('points')));
 
                                                // Add points to account
-                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `points_amount`=`points_amount`+%s WHERE `id`='%s' LIMIT 1",
+                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `points_amount`=`points_amount`+%s WHERE `id`=%s LIMIT 1",
                                                        array($points, bigintval(getRequestParameter('id'))), __FILE__, __LINE__);
 
                                                // Remember points /reason for the template
-                                               $content['points'] = translateComma($points);
+                                               $content['points'] = $points;
                                                $content['reason'] = secureString(postRequestParameter('reason'));
 
                                                // Send email
@@ -105,7 +100,7 @@ LIMIT 1",
                                                $message = '{--ADMIN_SPONSOR_POINTS_ADDED--}';
                                        } else {
                                                // No points entered to add!
-                                               $message = '{--ADMIN_SPONSPOR_NO_POINTS_TO_ADD--}';
+                                               $message = '{--ADMIN_SPONSOR_NO_POINTS_TO_ADD--}';
                                        }
                                        break;
 
@@ -115,11 +110,11 @@ LIMIT 1",
                                                $points = bigintval(convertCommaToDot(postRequestParameter('points')));
 
                                                // Add points to account
-                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `points_used`=`points_used`+%s WHERE `id`='%s' LIMIT 1",
+                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `points_used`=`points_used`+%s WHERE `id`=%s LIMIT 1",
                                                        array($points, bigintval(getRequestParameter('id'))), __FILE__, __LINE__);
 
                                                // Remember points /reason for the template
-                                               $content['points'] = translateComma($points);
+                                               $content['points'] = $points;
                                                $content['reason'] = secureString(postRequestParameter('reason'));
 
                                                // Send email
@@ -128,7 +123,7 @@ LIMIT 1",
                                                $message = '{--ADMIN_SPONSOR_POINTS_SUBTRACTED--}';
                                        } else {
                                                // No points entered to add!
-                                               $message = '{--ADMIN_SPONSPOR_NO_POINTS_TO_SUBTRACT--}';
+                                               $message = '{--ADMIN_SPONSOR_NO_POINTS_TO_SUBTRACT--}';
                                        }
                                        break;
 
@@ -146,11 +141,11 @@ LIMIT 1",
                                        convertSelectionsToTimestamp(postRequestArray(), $DATA, $id, $skip);
 
                                        // Save the sponsor
-                                       handlSponsorRequest(postRequestArray());
+                                       handleSponsorRequest(postRequestArray());
 
                                        // Convert some data for the email template
-                                       postRequestParameter('gender'          , translateGender(postRequestParameter('gender')));
-                                       postRequestParameter('warning_interval', createFancyTime(postRequestParameter('warning_interval')));
+                                       postRequestParameter('gender'          , '{%pipe,translateComma=' . postRequestParameter('gender') . '%}');
+                                       postRequestParameter('warning_interval', '{%pipe,createFancyTime=' . postRequestParameter('warning_interval') . '%}');
 
                                        if ($PASS === false) setPostRequestParameter('pass1', '{--SPONSOR_PASS_UNCHANGED--}');
 
@@ -169,12 +164,12 @@ LIMIT 1",
                                // Output message
                                loadTemplate('admin_settings_saved', false, $message);
                        } // END - if
-               } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", getConfig('PATH'), getLanguage(), $TPL))) {
+               } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", getPath(), getLanguage(), $TPL))) {
                        // Create mailto link
-                       $content['contact'] = '<a href="' . generateEmailLink($content['email'], 'sponsor_data') . '">' . $content['surname'] . ' ' . $content['family'] . '</a>';
+                       $content['contact'] = '<a href="' . generateSponsorEmailLink($content['email'], 'sponsor_data') . '">' . $content['surname'] . ' ' . $content['family'] . '</a>';
 
                        // Load mode template
-                       loadTemplate($TPL);
+                       loadTemplate($TPL, false, $content);
                } else {
                        // Template not found!
                        loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_SPONSOR_MODUS_TPL_404', getRequestParameter('mode')));