]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/sponsor_functions.php
Added more config wrappers
[mailer.git] / inc / libs / sponsor_functions.php
index 3e5909476677b783bf26173550e8b80e698556aa..b60e222682f0fbf7eb3c80e2ff23a0aeb0a9e961 100644 (file)
@@ -43,10 +43,10 @@ if (!defined('__SECURITY')) {
 //
 function handleSponsorRequest ($postData, $update=false, $messageArray = array(), $RET_STATUS=false) {
        // Init a lot variables
-       $SAVE = true;
-       $UPDATE = false;
-       $skip = false;
-       $ALREADY = false;
+       $SAVE = TRUE;
+       $UPDATE = FALSE;
+       $skip = FALSE;
+       $ALREADY = FALSE;
        $ret = 'unused';
 
        // Skip these entries
@@ -66,10 +66,10 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                                // Check only posted input entries not the submit button
                                switch ($k) {
                                        case 'email':
-                                               $ALREADY = false;
+                                               $ALREADY = FALSE;
                                                if (!isEmailValid($v)) {
                                                        // Email address is not valid
-                                                       $SAVE = false;
+                                                       $SAVE = FALSE;
                                                } else {
                                                        // Add a new sponsor or update his data?
                                                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE email='%s' LIMIT 1",
@@ -80,10 +80,10 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                                                                // Yes, he is!
                                                                if ((getWhat() == 'add_sponsor') || ($update)) {
                                                                        // Already found
-                                                                       $ALREADY = true;
+                                                                       $ALREADY = TRUE;
                                                                } else {
                                                                        // Update his data
-                                                                       $UPDATE = true;
+                                                                       $UPDATE = TRUE;
                                                                }
                                                        }
 
@@ -103,7 +103,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                                        case 'url':
                                                if (!isUrlValid($v)) {
                                                        // Don't save the URL
-                                                       $SAVE = false;
+                                                       $SAVE = FALSE;
                                                } // END - if
                                                break;
 
@@ -113,7 +113,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                                                break;
                                } // END - switch
 
-                               if ((!empty($k)) && ($skip == false)) {
+                               if ((!empty($k)) && ($skip == FALSE)) {
                                        // Add data
                                        array_push($DATA['keys']  , $k);
                                        array_push($DATA['values'], $v);
@@ -122,7 +122,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                } // END - foreach
 
                // Save sponsor?
-               if ($SAVE === true) {
+               if ($SAVE === TRUE) {
                        // Default is no force even when a guest want to abuse this force switch
                        if ((empty($postData['force'])) || (!isAdmin())) $postData['force'] = '0';
 
@@ -144,10 +144,10 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                                // Generate message
                                $message = getMessageFromIndexedArray('{--ADMIN_SPONSOR_UPDATED--}', 'updated', $messageArray);
                                $ret = 'updated';
-                       } elseif (($ALREADY === false) || (($postData['force'] == 1) && (isAdmin()))) {
+                       } elseif (($ALREADY === FALSE) || (($postData['force'] == 1) && (isAdmin()))) {
                                // Add new sponsor, first add more data
                                array_push($DATA['keys'], 'status');
-                               if (($update === true) && (isAdmin()) && (getWhat() == 'add_sponsor')) {
+                               if (($update === TRUE) && (isAdmin()) && (getWhat() == 'add_sponsor')) {
                                        // Only allowed for admin
                                        array_push($DATA['values'], 'PENDING');
 
@@ -174,7 +174,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                                unset($DATA['values'][$key]);
 
                                // Implode all data into strings
-                               $keyArray   = implode('`,`'  , $DATA['keys']);
+                               $keyArray   = implode('`, `'  , $DATA['keys']);
                                $valueArray = str_repeat("%s', '", count($DATA['values']) - 1);
 
                                // Generate string
@@ -183,7 +183,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                                // Generate message
                                $message = getMessageFromIndexedArray('{--ADMIN_SPONSOR_ADDED--}', 'added', $messageArray);
                                $ret = 'added';
-                       } elseif (($update === true) && (isAdmin())) {
+                       } elseif (($update === TRUE) && (isAdmin())) {
                                // Add all data as hidden data
                                $OUT = '';
                                foreach ($postData as $k => $v) {
@@ -198,7 +198,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
                                $content['email']  = $postData['email'];
 
                                // Ask for adding a sponsor with same email address
-                               loadTemplate('admin_add_sponsor_already', false, $content);
+                               loadTemplate('admin_add_sponsor_already', FALSE, $content);
                                return;
                        } else {
                                // Already added!
@@ -243,7 +243,7 @@ function translateSponsorStatus ($status) {
 // Search for an email address in the database
 function isSponsorRegisteredWithEmail ($email) {
        // Is there already the provided email address in database?
-       $ret = (countSumTotalData($email, 'sponsor_data', 'id', 'email', true) == 1);
+       $ret = (countSumTotalData($email, 'sponsor_data', 'id', 'email', TRUE) == 1);
 
        // Return result
        return $ret;
@@ -252,7 +252,7 @@ function isSponsorRegisteredWithEmail ($email) {
 // Wether the current user is a sponsor
 function isSponsor () {
        // Failed is default
-       $ret = false;
+       $ret = FALSE;
 
        // Determine it
        $ret = (
@@ -307,17 +307,17 @@ ORDER BY
                                        if ($current == $content2['sub_what']) $content2['sub_title'] = '<strong>' . $content2['sub_title'] . '</strong>';
 
                                        // Load row template
-                                       $SUB .= loadTemplate('sponsor_what', true, $content2);
+                                       $SUB .= loadTemplate('sponsor_what', TRUE, $content2);
                                } // END - while
 
                                // Prepare data for the main template
                                $content['menu'] = $SUB;
 
                                // Load menu template
-                               $OUT .= loadTemplate('sponsor_action', true, $content);
+                               $OUT .= loadTemplate('sponsor_action', TRUE, $content);
                        } else {
                                // No sub menus active
-                               $OUT .= displayMessage('{--SPONSOR_NO_SUB_MENUS_ACTIVE--}', true);
+                               $OUT .= displayMessage('{--SPONSOR_NO_SUB_MENUS_ACTIVE--}', TRUE);
                        }
 
                        // Free memory
@@ -325,7 +325,7 @@ ORDER BY
                } // END - while
        } else {
                // No main menus active
-               $OUT .= displayMessage('{--SPONSOR_NO_MAIN_MENUS_ACTIVE--}', true);
+               $OUT .= displayMessage('{--SPONSOR_NO_MAIN_MENUS_ACTIVE--}', TRUE);
        }
 
        // Free memory
@@ -347,7 +347,7 @@ function addSponsorContent ($what) {
                loadIncludeOnce($INC);
        } else {
                // File not found
-               $GLOBALS['sponsor_output'] .= displayMessage('{%message,SPONSOR_CONTENT_404=' . $what . '%}', true);
+               $GLOBALS['sponsor_output'] .= displayMessage('{%message,SPONSOR_CONTENT_404=' . $what . '%}', TRUE);
        }
 
        // Return content
@@ -357,7 +357,7 @@ function addSponsorContent ($what) {
 //
 function updateSponsorLogin () {
        // Failed by default
-       $login = false;
+       $login = FALSE;
 
        // Is sponsor?
        if (isSponsor()) {
@@ -385,7 +385,7 @@ LIMIT 1",
 
 // Saves sponsor's data
 function saveSponsorData ($postData, $content) {
-       $EMAIL = false;
+       $EMAIL = FALSE;
 
        // Unsecure data which we don't want
        $UNSAFE = array('password', 'id', 'remote_addr', 'sponsor_created', 'last_online', 'status', 'ref_count',
@@ -427,7 +427,7 @@ function saveSponsorData ($postData, $content) {
        if ((!empty($content['email'])) && (!empty($postData['email']))) {
                if ($content['email'] != $postData['email']) {
                        // Change email address
-                       $EMAIL = true;
+                       $EMAIL = TRUE;
 
                        // Okay, has changed then add status with UNCONFIRMED and new hash code
                        $sql .= " `status`='EMAIL',`hash`='%s',";
@@ -451,7 +451,7 @@ function saveSponsorData ($postData, $content) {
        // Saving data was completed... ufff...
        switch (getWhat()) {
                case 'account': // Change account data
-                       if ($EMAIL === true) {
+                       if ($EMAIL === TRUE) {
                                $message = '{--SPONSOR_ACCOUNT_EMAIL_CHANGED--}';
                                $templ   = 'admin_sponsor_change_email';
                                $subject    = '{--ADMIN_SPONSOR_ACC_EMAIL_SUBJECT--}';
@@ -503,7 +503,7 @@ function saveSponsorData ($postData, $content) {
                                                $email_msg = loadEmailTemplate('sponsor_change_data', $content);
                                                sendEmail($content['email'], '{--SPONSOR_ACC_DATA_SUBJECT--}', $email_msg);
 
-                                               if ($EMAIL === true) {
+                                               if ($EMAIL === TRUE) {
                                                        // Add hash code to content array
                                                        $content['hash'] = $HASH;
 
@@ -565,7 +565,7 @@ function doProcessSponsorFormRequest ($messageArray = array()) {
        $message = '';
 
        // Handle the request
-       $status = handleSponsorRequest(postRequestArray(), true, $messageArray, true);
+       $status = handleSponsorRequest(postRequestArray(), TRUE, $messageArray, TRUE);
 
        // Check the status of the registration process
        switch ($status) {
@@ -672,15 +672,15 @@ function fetchSponsorData ($sponsor_id, $column = 'id') {
                        reportBug(__FUNCTION__, __LINE__, 'Sponsor id ' . $sponsor_id . ' is invalid.');
                } elseif (isSponsorDataValid()) {
                        // Use cache, so it is fine
-                       return true;
+                       return TRUE;
                }
        } elseif (isSponsorDataValid()) {
                // Use cache, so it is fine
-               return true;
+               return TRUE;
        }
 
        // By default none was found
-       $found = false;
+       $found = FALSE;
 
        // Extra statements
        $ADD = '';
@@ -768,7 +768,7 @@ function getFetchedSponsorData ($keyColumn, $sponsor_id, $valueColumn) {
 // in, but you should use isMember() if you want to find that out.
 function isSponsorDataValid () {
        // Sponsor id should not be zero so abort here
-       if (!isCurrentSponsorIdSet()) return false;
+       if (!isCurrentSponsorIdSet()) return FALSE;
 
        // Is it cached?
        if (!isset($GLOBALS['is_sponsor_data_valid'][getCurrentSponsorId()])) {