Rewrote 'we' word a little, rewrote mail order to use SQL_INSERTID() instead of anoth...
[mailer.git] / inc / modules / member / what-nickname.php
index c8aa1b0d903628cc4973f87101798ddf79ed4dfe..5cb477c76767c6155c30bd90d4542eb0bffdb5c9 100644 (file)
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -37,7 +37,7 @@
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       die();
+       exit();
 } elseif (!isMember()) {
        redirectToIndexMemberOnlyModule();
 }
@@ -54,11 +54,11 @@ $isValid = false;
 
 if (isFormSent()) {
        // Nickname was submitted so let's check if it is not already in use
-       if (isPostRequestParameterSet('nickname')) {
+       if (isPostRequestElementSet('nickname')) {
                // Check if nickname is valid
-               if (preg_match('/[' . getConfig('nickname_pattern') . ']{' . getConfig('nickname_len') . ',}/', postRequestParameter('nickname'), $array)) {
+               if (preg_match('/[' . getConfig('nickname_pattern') . ']{' . getConfig('nickname_len') . ',}/', postRequestElement('nickname'), $array)) {
                        // Entered nickname is valid?
-                       $isValid = (($array[0] == postRequestParameter('nickname')) && (isNicknameUsed(postRequestParameter('nickname'))));
+                       $isValid = (($array[0] == postRequestElement('nickname')) && (isNicknameUsed(postRequestElement('nickname'))));
                } // END - if
        } // END - if
 } // END - if
@@ -69,24 +69,30 @@ if ($isValid === true) {
 
        // Look for nickname in database (we only need just one entry so don't worry about the "LIMIT 1" !)
        $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `nickname`='%s' AND `userid` != %s LIMIT 1",
-               array(postRequestParameter('nickname'), getMemberId()), __FILE__, __LINE__);
+               array(
+                       postRequestElement('nickname'),
+                       getMemberId()
+               ), __FILE__, __LINE__);
 
        // Is it not in use?
        if (SQL_HASZERONUMS($result)) {
-               // Nickname not in use, so set it now
-               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `nickname`='%s' WHERE `userid`=%s LIMIT 1",
-                       array(postRequestParameter('nickname'), getMemberId()), __FILE__, __LINE__);
-
                // Prepare array
                $filterData = array(
                        'history_subject' => 'NICKNAME_CHANGED',
                        'history_userid'  => getMemberId(),
-                       'history_value'   => postRequestParameter('nickname')
+                       'history_value'   => postRequestElement('nickname')
                );
 
                // Run filter chain
                runFilterChain('add_history_entry', $filterData);
 
+               // Nickname not in use, so set it now
+               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `nickname`='%s' WHERE `userid`=%s LIMIT 1",
+                       array(
+                               postRequestElement('nickname'),
+                               getMemberId()
+                       ), __FILE__, __LINE__);
+
                // Change message
                $content = '{--MEMBER_NICKNAME_SAVED--}';
        } // END - if
@@ -97,8 +103,8 @@ if ($isValid === true) {
        // Load template
        displayMessage($content);
 } else {
-       // Do we have already submit the form?
-       if (isPostRequestParameterSet('nickname')) {
+       // Is there already submit the form?
+       if (isPostRequestElementSet('nickname')) {
                loadTemplate('admin_settings_unsaved', false, '{--MEMBER_NICKNAME_IS_INVALID--}');
        } // END - if