]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/guest/what-sponsor_login.php
New naming convention applied to many functions, see #118 for details
[mailer.git] / inc / modules / guest / what-sponsor_login.php
index 037f146eee79373b47254ef9452b78c0006388d5..192a4b4b225e377422114efeed6c33b35c22c502 100644 (file)
@@ -72,25 +72,25 @@ LIMIT 1", array(REQUEST_GET('hash')), __FILE__, __LINE__);
                $SPONSOR = SQL_FETCHARRAY($result);
 
                // Translate gender and comma
-               $SPONSOR['gender']  = TRANSLATE_GENDER($SPONSOR['gender']);
-               $SPONSOR['points'] = TRANSLATE_COMMA($SPONSOR['points']);
-               $SPONSOR['pay']    = TRANSLATE_COMMA($SPONSOR['pay']);
+               $SPONSOR['gender']  = translateGender($SPONSOR['gender']);
+               $SPONSOR['points'] = translateComma($SPONSOR['points']);
+               $SPONSOR['pay']    = translateComma($SPONSOR['pay']);
 
                // Unconfirmed account or changed email address?
                if ($SPONSOR['status'] == 'UNCONFIRMED') {
                        // Set account to pending
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='PENDING'
-WHERE id='%s' AND hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
+WHERE `id`='%s' AND hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
                                array(bigintval($SPONSOR['id']), REQUEST_GET('hash')), __FILE__, __LINE__);
 
                        // Check on success
                        if (SQL_AFFECTEDROWS() == 1) {
                                // Prepare mail and send it to the sponsor
                                $message = LOAD_EMAIL_TEMPLATE('sponsor_pending', $SPONSOR);
-                               SEND_EMAIL($SPONSOR['email'], getMessage('SPONSOR_ACCOUNT_PENDING_SUBJ'), $message);
+                               sendEmail($SPONSOR['email'], getMessage('SPONSOR_ACCOUNT_PENDING_SUBJ'), $message);
 
                                // Send email to admin
-                               SEND_ADMIN_NOTIFICATION(getMessage('ADMIN_NEW_SPONSOR'), 'admin_sponsor_pending', $SPONSOR);
+                               sendAdminNotification(getMessage('ADMIN_NEW_SPONSOR'), 'admin_sponsor_pending', $SPONSOR);
 
                                // Sponsor account set to pending
                                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSOR_ACCOUNT_IS_PENDING'));
@@ -101,7 +101,7 @@ WHERE id='%s' AND hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
                } elseif ($SPONSOR['status'] == 'EMAIL') {
                        // Changed email adress need to be confirmed
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='CONFIRMED'
-WHERE id='%s' AND hash='%s' AND `status`='EMAIL' LIMIT 1",
+WHERE `id`='%s' AND hash='%s' AND `status`='EMAIL' LIMIT 1",
                                array(bigintval($SPONSOR['id']), REQUEST_GET('hash')), __FILE__, __LINE__);
 
                        // Check on success 
@@ -143,8 +143,8 @@ WHERE email='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1",
                        $SPONSOR = SQL_FETCHARRAY($result);
 
                        // Translate some data
-                       $SPONSOR['gender']           = TRANSLATE_GENDER($SPONSOR['gender']);
-                       $SPONSOR['sponsor_created'] = MAKE_DATETIME($SPONSOR['sponsor_created']);
+                       $SPONSOR['gender']           = translateGender($SPONSOR['gender']);
+                       $SPONSOR['sponsor_created'] = generateDateTime($SPONSOR['sponsor_created']);
 
                        // Prepare email and send it to the sponsor
                        if ($SPONSOR['status'] == 'UNCONFIRMED') {
@@ -154,7 +154,7 @@ WHERE email='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1",
                                // Confirmed email address
                                $msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_email', $SPONSOR);
                        }
-                       SEND_EMAIL(REQUEST_POST('email'), SPONSOR_ACTIVATION_LINK_SUBJ, $msg_sponsor);
+                       sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $msg_sponsor);
 
                        // Output message
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSOR_ACTIVATION_LINK_SENT'));
@@ -189,19 +189,19 @@ WHERE email='%s' AND id='%s' AND `status`='CONFIRMED' LIMIT 1",
                        $SPONSOR = SQL_FETCHARRAY($result);
 
                        // Translate some data
-                       $SPONSOR['gender']           = TRANSLATE_GENDER($SPONSOR['gender']);
-                       $SPONSOR['sponsor_created'] = MAKE_DATETIME($SPONSOR['sponsor_created']);
+                       $SPONSOR['gender']           = translateGender($SPONSOR['gender']);
+                       $SPONSOR['sponsor_created'] = generateDateTime($SPONSOR['sponsor_created']);
 
                        // Generate password
-                       $SPONSOR['password']        = GEN_PASS();
+                       $SPONSOR['password']        = generatePassword();
 
                        // Prepare email and send it to the sponsor
                        $msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_lost', $SPONSOR);
-                       SEND_EMAIL(REQUEST_POST('email'), SPONSOR_LOST_PASSWORD_SUBJ, $msg_sponsor);
+                       sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_LOST_PASSWORD_SUBJ'), $msg_sponsor);
 
                        // Update password
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET password='%s'
-WHERE id='%s' LIMIT 1",
+WHERE `id`='%s' LIMIT 1",
                                array(md5($SPONSOR['password']), bigintval($SPONSOR['id'])), __FILE__, __LINE__);
 
                        // Output message
@@ -220,7 +220,7 @@ WHERE id='%s' LIMIT 1",
 } elseif (IS_FORM_SENT()) {
        // Check status and login data ...
        $result = SQL_QUERY_ESC("SELECT status FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE id='%s' AND password='%s' LIMIT 1",
+WHERE `id`='%s' AND password='%s' LIMIT 1",
                array(bigintval(REQUEST_POST('sponsorid')), md5(REQUEST_POST('pass'))), __FILE__, __LINE__);
 
        if (SQL_NUMROWS($result) == 1) {
@@ -228,13 +228,13 @@ WHERE id='%s' AND password='%s' LIMIT 1",
                list($status) = SQL_FETCHROW($result);
                if ($status == 'CONFIRMED') {
                        // Is confirmed so both is fine and we can continue with login procedure
-                       $login = ((set_session('sponsorid'  , bigintval(REQUEST_POST('sponsorid')))) &&
-                                 (set_session('sponsorpass', md5(REQUEST_POST('pass'))           ))
+                       $login = ((setSession('sponsorid'  , bigintval(REQUEST_POST('sponsorid')))) &&
+                                 (setSession('sponsorpass', md5(REQUEST_POST('pass'))           ))
                        );
 
                        if ($login === true) {
                                // Cookie setup successfull so we can forward to sponsor area
-                               LOAD_URL('modules.php?module=sponsor');
+                               redirectToUrl('modules.php?module=sponsor');
                        } else {
                                // Cookie setup failed!
                                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSPOR_COOKIE_SETUP_FAILED'));