Even more rewrites/fixes from EL branch (please report any broken part after you...
[mailer.git] / inc / libs / sponsor_functions.php
index ee59586..983a46b 100644 (file)
@@ -162,14 +162,14 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
                                }
 
                                // Implode all data into strings
-                               $KEYS   = implode("`, `"  , $DATA['keys']);
-                               $valueS = str_repeat("%s', '", count($DATA['values']) - 1);
+                               $keyArray   = implode("`, `"  , $DATA['keys']);
+                               $valueArray = str_repeat("%s', '", count($DATA['values']) - 1);
 
                                // Generate string
-                               $sql = "INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_data` (`".$KEYS."`) VALUES ('".$valueS."%s')";
+                               $sql = "INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_data` (`" . $keyArray . "`) VALUES ('" . $valueArray . "%s')";
 
                                // Generate message
-                               $message = getMessageFromIndexedArray(getMessage('ADMIN_SPONSOR_ADDED'), "added", $messageArray);
+                               $message = getMessageFromIndexedArray(getMessage('ADMIN_SPONSOR_ADDED'), 'added', $messageArray);
                                $ret = 'added';
                        } elseif (($update === true) && (isAdmin())) {
                                // Add all data as hidden data
@@ -439,8 +439,7 @@ function saveSponsorData ($postData, $content) {
        $DATA[] = getSession('sponsorpass');
 
        // Saving data was completed... ufff...
-       switch (getWhat())
-       {
+       switch (getWhat()) {
                case 'account': // Change account data
                        if ($EMAIL === true) {
                                $message   = getMessage('SPONSOR_ACCOUNT_EMAIL_CHANGED');
@@ -469,9 +468,11 @@ function saveSponsorData ($postData, $content) {
                        $message = getMaskedMessage('SPONSOR_UNKNOWN_WHAT', getWhat());
                        $templ = ''; $subj = '';
                        break;
-       }
+       } // END - switch
 
+       // Has an entry updated?
        if (SQL_AFFECTEDROWS() == 1) {
+               // Template and subject are set?
                if (!empty($templ) && !empty($subj)) {
                        // Run SQL command and check for success
                        $result = SQL_QUERY_ESC($sql, $DATA, __FUNCTION__, __LINE__);
@@ -479,7 +480,7 @@ function saveSponsorData ($postData, $content) {
                        // Add all data to content
                        $content['new_data'] = $postData;
 
-                       // Change some data
+                       // Translate some data
                        if (isset($content['gender']))             $content['gender']                  = translateGender($content['gender']);
                        if (isset($content['new_data']['gender'])) $content['new_data']['gender']      = translateGender($content['new_data']['gender']);
                        if (isset($content['receive_warnings']))   $content['new_data']['receive']     = translateYesNo($content['new_data']['receive_warnings']);