X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-nickname.php;h=bcda07e5be41281cef866149b85c223d2a13d6d9;hb=e6d0294f587cab6b74f689ecdf2ebb3cf2b09e25;hp=0895810e901f86500772b1a05a0ddb4619c32324;hpb=a84b517e5ce0d1601ca09082aad89f9b673bc202;p=mailer.git diff --git a/inc/modules/member/what-nickname.php b/inc/modules/member/what-nickname.php index 0895810e90..bcda07e5be 100644 --- a/inc/modules/member/what-nickname.php +++ b/inc/modules/member/what-nickname.php @@ -17,7 +17,7 @@ * Needs to be in all Files and every File needs "svn propset * * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * - * Copyright (c) 2003 - 2008 by Roland Haeder * + * Copyright (c) 2003 - 2009 by Roland Haeder * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -38,39 +38,41 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; - require($INC); -} elseif (!IS_MEMBER()) { - redirectToUrl('modules.php?module=index'); -} elseif ((!EXT_IS_ACTIVE('nickname')) && (!IS_ADMIN())) { - addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'nickname')); - return; + die(); +} elseif (!isMember()) { + redirectToIndexMemberOnlyModule(); } // Add description as navigation point -ADD_DESCR('member', __FILE__); +addMenuDescription('member', __FILE__); + +if ((!isExtensionActive('nickname')) && (!isAdmin())) { + loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('nickname')); + return; +} // END - if + $isValid = false; -if (IS_FORM_SENT()) { +if (isFormSent()) { // Nickname was submitted so let's check if it is not already in use - if (REQUEST_ISSET_POST(('nickname'))) { + if (isPostRequestElementSet('nickname')) { // Check if nickname is valid - $PATTERN = "[".getConfig('nickname_pattern')."]{".getConfig('nickname_length').",}"; - if (ereg($PATTERN, REQUEST_POST('nickname'), $array)) { + $PATTERN = '[' . getConfig('nickname_pattern') . ']{' . getConfig('nickname_len') . ',}'; + if (ereg($PATTERN, postRequestElement('nickname'), $array)) { // Entered nickname is valid? - if ($array[0] == REQUEST_POST('nickname')) $isValid = true; + $isValid = ($array[0] == postRequestElement('nickname')); } // END - if } // END - if } // END - if 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(REQUEST_POST('nickname'), getUserId()), __FILE__, __LINE__); + // 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(postRequestElement('nickname'), getUserId()), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 0) { // 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(REQUEST_POST('nickname'), getUserId()), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `nickname`='%s' WHERE `userid`=%s LIMIT 1", + array(postRequestElement('nickname'), getUserId()), __FILE__, __LINE__); $content = getMessage('NICKNAME_SAVED'); } else { // Free result @@ -81,18 +83,15 @@ if ($isValid === true) { } // Load template - LOAD_TEMPLATE('admin_settings_saved', false, $content); + loadTemplate('admin_settings_saved', false, $content); } else { - // Load current nickname - define('__NICKNAME', NICKNAME_GET_NICK(getUserId())); - // Do we have already submit the form? - if (REQUEST_ISSET_POST(('nickname'))) { - LOAD_TEMPLATE('admin_settings_saved', false, "