]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-edit_sponsor.php
mailer project continued:
[mailer.git] / inc / modules / admin / what-edit_sponsor.php
index 88258c3180de4eeb607cee8191085300ca726374..8dff51a427e9c2bdca78fe76b3fd0c7695dea0b5 100644 (file)
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
 
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
-       die();
+       exit();
 } // END - if
 
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
-if ((isGetRequestParameterSet('id')) && (isGetRequestParameterSet('mode'))) {
+if ((isGetRequestElementSet('id')) && (isGetRequestElementSet('do'))) {
        // Check for selected sponsor
        $result_main = SQL_QUERY_ESC("SELECT
        `id`,`company`,`position`,`gender`,`surname`,`family`,
@@ -55,7 +55,7 @@ FROM
 WHERE
        `id`=%s
 LIMIT 1",
-               array(bigintval(getRequestParameter('id'))), __FILE__, __LINE__);
+               array(bigintval(getRequestElement('id'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_main) == 1) {
                // Load sponsor details
                $content = SQL_FETCHARRAY($result_main);
@@ -65,25 +65,25 @@ LIMIT 1",
                $content['warning_interval'] = createTimeSelections($content['warning_interval'], 'warning_interval', 'MWDh');
 
                // Init variables here
-               $TPL = sprintf("admin_edit_sponsor_%s", getRequestParameter('mode'));
+               $TPL = sprintf("admin_edit_sponsor_%s", getRequestElement('do'));
                initSqls();
 
                // Sponsor was found
                if ((isFormSent()) || (isFormSent('edit'))) {
                        // Perform action on mode
-                       switch (getRequestParameter('mode')) {
+                       switch (getRequestElement('do')) {
                                case 'add_points': // Add points
-                                       if (bigintval(postRequestParameter('points')) > 0) {
+                                       if (bigintval(postRequestElement('points')) > 0) {
                                                // Replace german decimal comma with computer's decimal dot
-                                               $points = bigintval(convertCommaToDot(postRequestParameter('points')));
+                                               $points = bigintval(convertCommaToDot(postRequestElement('points')));
 
                                                // Add points to account
                                                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__);
+                                                       array($points, bigintval(getRequestElement('id'))), __FILE__, __LINE__);
 
                                                // Remember points /reason for the template
                                                $content['points'] = $points;
-                                               $content['reason'] = postRequestParameter('reason');
+                                               $content['reason'] = postRequestElement('reason');
 
                                                // Send email
                                                $message = loadEmailTemplate('sponsor_add_points', $content);
@@ -96,17 +96,17 @@ LIMIT 1",
                                        break;
 
                                case 'sub_points': // Subtract points
-                                       if (bigintval(postRequestParameter('points')) > 0) {
+                                       if (bigintval(postRequestElement('points')) > 0) {
                                                // Replace german decimal comma with computer's decimal dot
-                                               $points = bigintval(convertCommaToDot(postRequestParameter('points')));
+                                               $points = bigintval(convertCommaToDot(postRequestElement('points')));
 
                                                // Add points to account
                                                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__);
+                                                       array($points, bigintval(getRequestElement('id'))), __FILE__, __LINE__);
 
                                                // Remember points /reason for the template
                                                $content['points'] = $points;
-                                               $content['reason'] = postRequestParameter('reason');
+                                               $content['reason'] = postRequestElement('reason');
 
                                                // Send email
                                                $message = loadEmailTemplate('sponsor_sub_points', $content);
@@ -120,34 +120,33 @@ LIMIT 1",
 
                                case 'edit': // Edit sponsor account
                                        $PASS = true;
-                                       if ((postRequestParameter('pass1') != postRequestParameter('pass2')) || ((!isPostRequestParameterSet('pass1')) && (!isPostRequestParameterSet('pass1')))) {
+                                       if ((postRequestElement('pass1') != postRequestElement('pass2')) || ((!isPostRequestElementSet('pass1')) && (!isPostRequestElementSet('pass1')))) {
                                                // Remove passwords
-                                               unsetPostRequestParameter('pass1');
-                                               unsetPostRequestParameter('pass2');
+                                               unsetPostRequestElement('pass1');
+                                               unsetPostRequestElement('pass2');
                                                $PASS = false;
                                        } // END - if
 
                                        // Convert time selection
-                                       $DATA = array(); $id = 'warning_interval_ye'; $skip = false;
-                                       convertSelectionsToEpocheTime(postRequestArray(), $DATA, $id, $skip);
+                                       convertSelectionsToEpocheTimeInPostData('warning_interval_ye');
 
                                        // Save the sponsor
                                        handleSponsorRequest(postRequestArray());
 
                                        // Convert some data for the email template
-                                       postRequestParameter('gender'          , '{%pipe,translateComma=' . postRequestParameter('gender') . '%}');
-                                       postRequestParameter('warning_interval', '{%pipe,createFancyTime=' . postRequestParameter('warning_interval') . '%}');
+                                       postRequestElement('gender'          , '{%pipe,translateGender=' . postRequestElement('gender') . '%}');
+                                       postRequestElement('warning_interval', '{%pipe,createFancyTime=' . postRequestElement('warning_interval') . '%}');
 
-                                       if ($PASS === false) setPostRequestParameter('pass1', '{--SPONSOR_PASS_UNCHANGED--}');
+                                       if ($PASS === false) setPostRequestElement('pass1', '{--SPONSOR_PASS_UNCHANGED--}');
 
                                        // Load email template and send the mail away
                                        $message = loadEmailTemplate('admin_sponsor_edit', postRequestArray(), false);
-                                       sendEmail(postRequestParameter('email'), '{--ADMIN_SPONSOR_EDIT_SUBJECT--}', $message);
+                                       sendEmail(postRequestElement('email'), '{--ADMIN_SPONSOR_EDIT_SUBJECT--}', $message);
                                        break;
 
                                default: // Unknown mode
-                                       logDebugMessage(__FILE__, __LINE__, sprintf("Unknown mode %s detected.", getRequestParameter('mode')));
-                                       $message = '{%message,ADMIN_SPONSOR_INVALID_MODE=' . getRequestParameter('mode') . '%}';
+                                       logDebugMessage(__FILE__, __LINE__, sprintf("Unknown mode %s detected.", getRequestElement('do')));
+                                       $message = '{%message,ADMIN_SPONSOR_INVALID_MODE=' . getRequestElement('do') . '%}';
                                        break;
                        }
 
@@ -163,11 +162,11 @@ LIMIT 1",
                        loadTemplate($TPL, false, $content);
                } else {
                        // Template not found
-                       displayMessage('{%message,ADMIN_SPONSOR_MODUS_TPL_404', getRequestParameter('mode') . '%}');
+                       displayMessage('{%message,ADMIN_SPONSOR_MODUS_TPL_404', getRequestElement('do') . '%}');
                }
        } else {
                // Sponsor not found
-               displayMessage('{%message,ADMIN_SPONSOR_404=' . bigintval(getRequestParameter('id')) . '%}');
+               displayMessage('{%message,ADMIN_SPONSOR_404=' . bigintval(getRequestElement('id')) . '%}');
        }
 
        // Free result