fooRequestElementBar() functions renamed, adding of request parameters added:
[mailer.git] / inc / libs / sponsor_functions.php
index d0eb5c8..99e8856 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 04/23/2005 *
- * ===============                              Last change: 05/18/2008 *
+ * Mailer v0.2.1-FINAL                                Start: 04/23/2005 *
+ * ===================                          Last change: 05/18/2008 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : sponsor_functions.php                            *
@@ -122,7 +122,7 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
                // Save sponsor?
                if ($SAVE === true) {
                        // Default is no force even when a guest want to abuse this force switch
-                       if ((empty($postData['force'])) || (!isAdmin())) $postData['force'] = 0;
+                       if ((empty($postData['force'])) || (!isAdmin())) $postData['force'] = '0';
 
                        // SQL and message string is empty by default
                        $sql = ''; $message = '';
@@ -137,7 +137,7 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
 
                                // Remove last ", " from SQL string
                                $sql = substr($sql, 0, -2)." WHERE `id`='%s' LIMIT 1";
-                               $DATA['values'][] = bigintval(getRequestElement('id'));
+                               $DATA['values'][] = bigintval(getRequestParameter('id'));
 
                                // Generate message
                                $message = getMessageFromIndexedArray(getMessage('ADMIN_SPONSOR_UPDATED'), 'updated', $messageArray);
@@ -175,10 +175,12 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
                                $OUT = '';
                                foreach ($postData as $k => $v) {
                                        // Do not add 'force' !
-                                       if ($k != "force") {
-                                               $OUT .= "<input type=\"hidden\" name=\"".$k."\" value=\"".stripslashes($v)."\" />\n";
-                                       }
-                               }
+                                       if ($k != 'force') {
+                                               $OUT .= '<input type="hidden" name="' . secureString($k) . '" value="' . SQL_ESCAPE($v) . '" />';
+                                       } // END - if
+                               } // END - foreach
+
+                               // Remember data
                                $content['hidden'] = $OUT;
                                $content['email']  = $postData['email'];
 
@@ -187,7 +189,7 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
                                return;
                        } else {
                                // Already added!
-                               $message = sprintf(getMessage('SPONSOR_ALREADY_FOUND'), $postData['email']);
+                               $message = getMaskedMessage('SPONSOR_ALREADY_FOUND', $postData['email']);
                                $ret = 'already';
                        }
 
@@ -222,7 +224,7 @@ function sponsorTranslateUserStatus ($status) {
        } else {
                // Not found!
                logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status));
-               $ret = sprintf(getMessage('UNKNOWN_STATUS'), $status);
+               $ret = getMaskedMessage('UNKNOWN_STATUS', $status);
        }
        return $ret;
 }
@@ -341,7 +343,7 @@ function addSponsorContent ($what) {
                loadIncludeOnce($INC);
        } else {
                // File not found!
-               $OUT .= loadTemplate('admin_settings_saved', true, sprintf(getMessage('SPONSOR_CONTENT_404'), $what));
+               $OUT .= loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_CONTENT_404', $what));
        }
 
        // Return content
@@ -463,7 +465,7 @@ function saveSponsorData ($postData, $content) {
 
                default: // Unknown sponsor what value!
                        logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown sponsor module (what) %s detected.", getWhat()));
-                       $message = sprintf(getMessage('SPONSOR_UNKNOWN_WHAT'), getWhat());
+                       $message = getMaskedMessage('SPONSOR_UNKNOWN_WHAT', getWhat());
                        $templ = ''; $subj = '';
                        break;
        }