]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/sponsor/account.php
More rewrites/fixes (not all is fixed) for ext-sponsor
[mailer.git] / inc / modules / sponsor / account.php
index 12803bad83b17ad4db51c4d382b3b1f127dfa865..76889dc415ab0d92a76f80d66cf690575c6974b6 100644 (file)
@@ -50,13 +50,21 @@ if (!defined('__SECURITY')) {
 }
 
 // Data for the formular
-$result = SQL_QUERY_ESC("SELECT `company`, `position`, `tax_ident`,
-`gender`, `surname`, `family`, `street_nr1`, `street_nr2`, `zip`, `city`, `country`,
-`phone`, `fax`, `cell`, `email`, `url`,
-`status`, `receive_warnings`
-FROM `{?_MYSQL_PREFIX?}_sponsor_data`
-WHERE `id`='%s' AND `password`='%s' LIMIT 1",
-       array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
+$result = SQL_QUERY_ESC("SELECT
+       `id`, `company`, `position`, `tax_ident`,
+       `gender`, `surname`, `family`, `street_nr1`, `street_nr2`, `zip`, `city`, `country`,
+       `phone`, `fax`, `cell`, `email`, `url`,
+       `status`, `receive_warnings`
+FROM
+       `{?_MYSQL_PREFIX?}_sponsor_data`
+WHERE
+       `id`=%s AND
+       `password`='%s'
+LIMIT 1",
+       array(
+               bigintval(getSession('sponsor_id')),
+               getSession('sponsorpass')
+       ), __FILE__, __LINE__);
 
 // Entry found?
 if (SQL_NUMROWS($result) == 1) {
@@ -93,7 +101,7 @@ if (SQL_NUMROWS($result) == 1) {
                                        // Change current password
                                        $PASS_AND  = ", `password`='%s'";
                                        $PASS_DATA = md5(postRequestParameter('pass1'));
-                               }
+                               } // END - if
 
                                // Unsecure data which we don't want here
                                $UNSAFE = array('receive_warnings', 'warning_interval');
@@ -101,7 +109,7 @@ if (SQL_NUMROWS($result) == 1) {
                                // Remove all (maybe spoofed) unsafe data from array
                                foreach ($UNSAFE as $remove) {
                                        unsetPostRequestParameter($remove);
-                               }
+                               } // END - foreach
 
                                // Set last change timestamp
                                setPostRequestParameter('last_change', 'UNIX_TIMESTAMP()');
@@ -112,10 +120,10 @@ if (SQL_NUMROWS($result) == 1) {
 
                        if (!empty($message)) {
                                // Output message
-                               $OUT = loadTemplate('admin_settings_saved', true, $message);
+                               $GLOBALS['sponsor_output'] = loadTemplate('admin_settings_saved', true, $message);
                        } else {
                                // No message generated
-                               $OUT = loadTemplate('admin_settings_saved', true, '{--SPONSOR_NO_MESSAGE_GENERATED--}');
+                               $GLOBALS['sponsor_output'] = loadTemplate('admin_settings_saved', true, '{--SPONSOR_NO_MESSAGE_GENERATED--}');
                        }
                } else {
                        // Init gender
@@ -127,16 +135,16 @@ if (SQL_NUMROWS($result) == 1) {
                        $content['gender_' . strtolower($content['gender'])] = ' selected="selected"';
 
                        // Output formular
-                       $OUT = loadTemplate('sponsor_account_form', true, $content);
+                       $GLOBALS['sponsor_output'] = loadTemplate('sponsor_account_form', true, $content);
                }
        } else {
                // Locked or so?
                $STATUS = sponsorTranslateUserStatus($content['status']);
-               $OUT = loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_ACCOUNT_FAILED', $STATUS));
+               $GLOBALS['sponsor_output'] = loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_ACCOUNT_FAILED', $STATUS));
        }
 } else {
        // Sponsor account not found!
-       $OUT = loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_ACCOUNT_404', getSession('sponsorid')));
+       $GLOBALS['sponsor_output'] = loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_ACCOUNT_404', getSession('sponsor_id')));
 }
 
 // Free memory