]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/guest/what-sponsor_reg.php
Numerous ext-sponsor fixes and HTML rewrites (sorry for lame description)
[mailer.git] / inc / modules / guest / what-sponsor_reg.php
index 28673055b3ba89b077fdba28637d042dc9a9789b..7e8f5c997b3a14fb0a75bd58293329fd25414ac9 100644 (file)
@@ -207,9 +207,13 @@ if ((isFormSent()) && (count($FORM_ERRORS) == 0)) {
        );
 
        // Calulate points
-       $result = SQL_QUERY_ESC("SELECT (`pay_rate` * `pay_min_count`) AS points, `pay_min_count` AS pay, `pay_currency` AS curr
-FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes`
-WHERE `id`='%s' LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT
+       (`pay_rate` * `pay_min_count`) AS points, `pay_min_count` AS pay, `pay_currency` AS curr
+FROM
+       `{?_MYSQL_PREFIX?}_sponsor_paytypes`
+WHERE
+       `id`=%s
+LIMIT 1",
                array(postRequestParameter('pay_type')), __FILE__, __LINE__);
        list($points, $pay, $curr) = SQL_FETCHROW($result);
 
@@ -223,7 +227,7 @@ WHERE `id`='%s' LIMIT 1",
        postRequestParameter('last_curr'    , $curr);
 
        // Register sponsor but never ever update here!
-       $STATUS = handlSponsorRequest(postRequestArray(), true, $messageArray, true);
+       $STATUS = handleSponsorRequest(postRequestArray(), true, $messageArray, true);
 
        // Check the status of the registration process
        switch ($STATUS) {
@@ -241,7 +245,6 @@ WHERE `id`='%s' LIMIT 1",
                                $content['email']     = secureString(postRequestParameter('email'));
                                $content['surname']   = secureString(postRequestParameter('surname'));
                                $content['family']    = secureString(postRequestParameter('family'));
-                               $content['gender']    = translateGender(postRequestParameter('gender'));
                                $content['timestamp'] = generateDateTime(time(), 0);
                                $content['password']  = secureString(postRequestParameter('pass1'));
 
@@ -284,32 +287,30 @@ WHERE `id`='%s' LIMIT 1",
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_paytypes`
 ORDER BY 
-       pay_name` ASC', __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) > 0) {
+       `pay_name` ASC', __FILE__, __LINE__);
+       if (!SQL_HASZERONUMS($result)) {
                // Load all types...
-               // @TODO Swap this HTML code to templates
-               $OUT = '<table border="0" cellspacing="0" cellpadding="0" width="300" class="left right top">';
+               $OUT = '';
                while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare content for output
                        $content['res'] = translateComma($content['pay_rate'] * $content['pay_min_count']);
 
                        // Load row template and switch color
-                       $OUT .= loadTemplate('guest_sponsor_payment_row', false, $content);
+                       $OUT .= loadTemplate('guest_sponsor_payment_row', true, $content);
                } // END - while
-               $OUT .= '</table>';
 
                // Remember the list in table
-               $content['payment_list'] = $OUT;
+               $content['payment_list'] = loadTemplate('guest_sponsor_payment', true, $OUT);
 
                // Init a lot array elements
-               foreach (array('company','position','tax_ident','gender_m','gender_f','gender_c','surname','family','street_nr1','street_nr2','country','zip','city','phone','fix','cell','email','url','rec_y','rec_n','form_errors','refid') as $entry) {
+               foreach (array('company','position','tax_ident','gender_m','gender_f','gender_c','surname','family','street_nr1','street_nr2','country','zip','city','phone','fax','cell','email','url','receive_warnings_y','receive_warnings_n','form_errors','refid') as $entry) {
                        $content[$entry]   = '';
                } // END - foreach
 
                // Check for invalid entries
                if (count($FORM_ERRORS) > 0) {
                        // Some found... :-(
-                       foreach (array('company','position','tax_ident','surname','family','street_nr1','street_nr2','country','zip','city','phone','fix','cell','email','url') as $entry) {
+                       foreach (array('company','position','tax_ident','surname','family','street_nr1','street_nr2','country','zip','city','phone','fax','cell','email','url') as $entry) {
                                $content[$entry]    = secureString(postRequestParameter($entry));
                        } // END - foreach
 
@@ -322,11 +323,11 @@ ORDER BY
                        $content['gender_' . strtolower(postRequestParameter('gender'))] = ' selected="selected"';
 
                        // Init receive selection
-                       $content['rec_y'] = '';
-                       $content['rec_n'] = '';
+                       $content['receive_warnings_y'] = '';
+                       $content['receive_warnings_n'] = '';
 
                        // Check for receive_warnings
-                       $content['rec_' . strtolower(postRequestParameter('receive_warnings'))] = ' selected="selected"';
+                       $content['receive_warnings_' . strtolower(postRequestParameter('receive_warnings'))] = ' selected="selected"';
                        $OUT = '';
 
                        // Errors found?