Renamed all SQL-related functions to camel-case notation
[mailer.git] / inc / modules / guest / what-sponsor_login.php
index d43c9bb5dff07ff80790e4c1ce07481f9ea2ed0c..ad7071fb79034cf9f4fbcc6ee1d6da1bec28e443 100644 (file)
@@ -63,7 +63,7 @@ if (isGetRequestElementSet('do')) {
 // Check if hash for confirmation of email address is given...
 if (isGetRequestElementSet('hash')) {
        // Lookup sponsor
-       $result = SQL_QUERY_ESC("SELECT
+       $result = sqlQueryEscaped("SELECT
        `id`, `status`, `gender`, `surname`, `family`,
        `company`, `position`, `tax_ident`,
        `street_nr1`, `street_nr2`, `country`, `zip`, `city`, `email`, `phone`, `fax`, `cell`,
@@ -76,14 +76,14 @@ WHERE
                `status`='EMAIL'
        )
 LIMIT 1", array(getRequestElement('hash')), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 1) {
+       if (sqlNumRows($result) == 1) {
                // Sponsor found, load his data...
-               $data = SQL_FETCHARRAY($result);
+               $data = sqlFetchArray($result);
 
                // Unconfirmed account or changed email address?
                if ($data['status'] == 'UNCONFIRMED') {
                        // Set account to pending
-                       SQL_QUERY_ESC("UPDATE
+                       sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_sponsor_data`
 SET
        `status`='PENDING',
@@ -99,7 +99,7 @@ LIMIT 1",
                                ), __FILE__, __LINE__);
 
                        // Check on success
-                       if (!SQL_HASZEROAFFECTED()) {
+                       if (!ifSqlHasZeroAffectedRows()) {
                                // Prepare mail and send it to the sponsor
                                $message = loadEmailTemplate('sponsor_pending', $data);
                                sendEmail($data['email'], '{--SPONSOR_ACCOUNT_PENDING_SUBJECT--}', $message);
@@ -115,7 +115,7 @@ LIMIT 1",
                        }
                } elseif ($data['status'] == 'EMAIL') {
                        // Changed email adress need to be confirmed
-                       SQL_QUERY_ESC("UPDATE
+                       sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_sponsor_data`
 SET
        `status`='CONFIRMED',
@@ -128,7 +128,7 @@ LIMIT 1",
                                array(bigintval($data['id']), getRequestElement('hash')), __FILE__, __LINE__);
 
                        // Check on success
-                       if (!SQL_HASZEROAFFECTED()) {
+                       if (!ifSqlHasZeroAffectedRows()) {
                                // Sponsor account is unlocked again
                                displayMessage('{--SPONSOR_ACCOUNT_IS_CONFIRMED_AGAIN--}');
                        } else {
@@ -145,7 +145,7 @@ LIMIT 1",
        }
 
        // Free memory
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 } elseif ($mode == 'activate') {
        // Send activation link again
        if (isFormSent('login')) {
@@ -155,7 +155,7 @@ LIMIT 1",
 
        if (isFormSent('login')) {
                // Check email
-               $result = SQL_QUERY_ESC("SELECT
+               $result = sqlQueryEscaped("SELECT
        `id`,
        `hash`,
        `status`,
@@ -173,9 +173,9 @@ LIMIT 1",
                array(postRequestElement('email')), __FILE__, __LINE__);
 
                // Entry found?
-               if (SQL_NUMROWS($result) == 1) {
+               if (sqlNumRows($result) == 1) {
                        // Unconfirmed sponsor account found so let's load the requested data
-                       $data = SQL_FETCHARRAY($result);
+                       $data = sqlFetchArray($result);
 
                        // Translate some data
                        $data['sponsor_created'] = generateDateTime($data['sponsor_created']);
@@ -198,7 +198,7 @@ LIMIT 1",
                }
 
                // Free memory
-               SQL_FREERESULT($result);
+               sqlFreeResult($result);
        } else {
                // Load form
                loadTemplate('guest_sponsor_activate');
@@ -212,7 +212,7 @@ LIMIT 1",
 
        if (isFormSent('login')) {
                // Check email
-               $result = SQL_QUERY_ESC("SELECT
+               $result = sqlQueryEscaped("SELECT
        `id`,
        `hash`,
        `remote_addr`,
@@ -230,9 +230,9 @@ LIMIT 1",
                array(postRequestElement('email'), bigintval(postRequestElement('id'))), __FILE__, __LINE__);
 
                // Entry found?
-               if (SQL_NUMROWS($result) == 1) {
+               if (sqlNumRows($result) == 1) {
                        // Unconfirmed sponsor account found so let's load the requested data
-                       $content = SQL_FETCHARRAY($result);
+                       $content = sqlFetchArray($result);
 
                        // Generate password/translate some data
                        $content['password']        = generatePassword();
@@ -243,7 +243,7 @@ LIMIT 1",
                        sendEmail(postRequestElement('email'), '{--SPONSOR_LOST_PASSWORD_SUBJECT--}', $message_sponsor);
 
                        // Update password
-                       SQL_QUERY_ESC("UPDATE
+                       sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_sponsor_data`
 SET
        `password`='%s'
@@ -260,14 +260,14 @@ LIMIT 1",
                }
 
                // Free memory
-               SQL_FREERESULT($result);
+               sqlFreeResult($result);
        } else {
                // Load form
                loadTemplate('guest_sponsor_lost');
        }
 } elseif (isFormSent('login')) {
        // Check status and login data ...
-       $result = SQL_QUERY_ESC("SELECT
+       $result = sqlQueryEscaped("SELECT
        `status`
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
@@ -280,9 +280,9 @@ LIMIT 1",
                md5(postRequestElement('password'))
        ), __FILE__, __LINE__);
 
-       if (SQL_NUMROWS($result) == 1) {
+       if (sqlNumRows($result) == 1) {
                // Okay, first login data check passed, now has he/she an approved (CONFIRMED) account?
-               list($status) = SQL_FETCHROW($result);
+               list($status) = sqlFetchRow($result);
                if ($status == 'CONFIRMED') {
                        // Is confirmed so both is fine and we can continue with login procedure
                        $login = ((setSession('sponsor_id'  , bigintval(postRequestElement('sponsor_id')))) &&
@@ -315,7 +315,7 @@ LIMIT 1",
        }
 
        // Free memory
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 } else {
        // Login formular and other links
        loadTemplate('guest_sponsor_login');