]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-mydata.php
Continued with ext-blacklist:
[mailer.git] / inc / modules / member / what-mydata.php
index 3b76993684c5ef3a94acecfb3d92c8dfee580b39..270d746505598f81015eef939c8a6e350de12fe5 100644 (file)
@@ -79,12 +79,10 @@ switch ($mode) {
                        $content['change'] = loadTemplate('member_mydata_button', TRUE);
                }
 
-               $content['birth_day']   = str_pad($content['birth_day']  , 2, '0', STR_PAD_LEFT);
-               $content['birth_month'] = str_pad($content['birth_month'], 2, '0', STR_PAD_LEFT);
-
+               // @TODO Move this to a function (for better EL code)
                switch (getLanguage()) {
-                       case 'de': $content['dob'] = $content['birth_day']   . '.' . $content['birth_month'] . '.' . $content['birth_year']; break;
-                       default  : $content['dob'] = $content['birth_month'] . '-' . $content['birth_day']   . '-' . $content['birth_year']; break;
+                       case 'de': $content['dob'] = '{%pipe,padLeftZero=' . $content['birth_day']   . '%}.{%pipe,padLeftZero=' . $content['birth_month'] . '%}.' . $content['birth_year']; break;
+                       default  : $content['dob'] = '{%pipe,padLeftZero=' . $content['birth_month'] . '%}-{%pipe,padLeftZero=' . $content['birth_day']   . '%}-' . $content['birth_year']; break;
                } // END - switch
 
                if (isExtensionActive('country')) {
@@ -99,7 +97,7 @@ switch ($mode) {
        case 'edit': // Edit data
                if (isExtensionActive('country', TRUE)) {
                        // New way
-                       $result = SQL_QUERY_ESC("SELECT
+                       $result = SQL_QUERY_ESC('SELECT
        `surname`,
        `family`,
        `street_nr`,
@@ -118,11 +116,11 @@ FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
        `userid`=%s
-LIMIT 1",
+LIMIT 1',
                        array(getMemberId()), __FILE__, __LINE__);
                } else {
                        // Old way
-                       $result = SQL_QUERY_ESC("SELECT
+                       $result = SQL_QUERY_ESC('SELECT
        `surname`,
        `family`,
        `street_nr`,
@@ -141,7 +139,7 @@ FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
        `userid`=%s
-LIMIT 1",
+LIMIT 1',
                                array(getMemberId()), __FILE__, __LINE__);
                }
 
@@ -167,24 +165,24 @@ LIMIT 1",
                        switch (getLanguage()) {
                                case 'de': // German date format
                                        // Day
-                                       $content['dob'] .= addSelectionBox('day', $content['birth_day']);
+                                       $content['dob'] .= addSelectionBox('da', $content['birth_day']);
 
                                        // Month
-                                       $content['dob'] .= addSelectionBox('month', $content['birth_month']);
+                                       $content['dob'] .= addSelectionBox('mo', $content['birth_month']);
 
                                        // Year
-                                       $content['dob'] .= addSelectionBox('year', $content['birth_year']);
+                                       $content['dob'] .= addSelectionBox('ye', $content['birth_year']);
                                        break;
 
                                default: // Default is the US date format... :)
                                        // Month
-                                       $content['dob'] .= addSelectionBox('month', $content['birth_month']);
+                                       $content['dob'] .= addSelectionBox('mo', $content['birth_month']);
 
                                        // Day
-                                       $content['dob'] .= addSelectionBox('day', $content['birth_day']);
+                                       $content['dob'] .= addSelectionBox('da', $content['birth_day']);
 
                                        // Year
-                                       $content['dob'] .= addSelectionBox('year', $content['birth_year']);
+                                       $content['dob'] .= addSelectionBox('ye', $content['birth_year']);
                                        break;
                        } // END - if
 
@@ -192,7 +190,7 @@ LIMIT 1",
 
                        if (isExtensionActive('country')) {
                                // Init WHERE statement
-                               $whereStatement = "WHERE `is_active`='Y'";
+                               $whereStatement = " WHERE `is_active`='Y'";
                                if (isAdmin()) $whereStatement = '';
 
                                // Generate selection box
@@ -226,7 +224,7 @@ LIMIT 1",
                } elseif ((!isEmailValid(postRequestElement('email'))) && (!isAdmin())) {
                        // Invalid email address!
                        displayMessage('{--INVALID_EMAIL_ENTERED--}');
-               } elseif ((isEmailTaken(postRequestElement('email'))) && (isCheckDoubleEmailEnabled()) && (!isAdmin())) {
+               } elseif ((isExtensionInstalledAndNewer('other', '0.3.0')) && (isCheckDoubleEmailEnabled()) && (!isAdmin()) && (isEmailTaken(postRequestElement('email')))) {
                        // Email address is already registered
                        displayMessage('{--MEMBER_EMAIL_IS_ALREADY_REGISTERED--}');
                } else {
@@ -239,13 +237,29 @@ LIMIT 1",
 
                                // Did the user changed the password?
                                if ($hash != $content['password']) {
+                                       // Yes
                                        $AND = ",`password`='" . $hash . "'";
                                        $mode = 'password';
                                } // END - if
 
-                               // Or did he changed his password?
+                               // Or did he changed his email address?
                                if (postRequestElement('email') != $content['email']) {
-                                       // Jupp
+                                       // Yes, but is it maybe blacklisted?
+                                       $filterData = array(
+                                               'init_done'   => TRUE,
+                                               'post_data'   => postRequestArray(),
+                                               'blacklisted' => '',
+                                               'message'     => '{--PRE_UPDATE_USER_DATA_FAILED--}',
+                                       );
+                                       $filterData = runFilterChain('pre_update_user_data', $filterData);
+
+                                       // Is it blacklisted?
+                                       if ($filterData['init_done'] === FALSE) {
+                                               // Found something blacklisted
+                                               displayMessage($filterData['message']);
+                                               return;
+                                       } // END - if
+
                                        if ($mode == 'normal') {
                                                $mode = 'email';
                                        } else {