X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-nickname.php;h=bcda07e5be41281cef866149b85c223d2a13d6d9;hb=e6d0294f587cab6b74f689ecdf2ebb3cf2b09e25;hp=ea5105ccf18521542ca5f8d488b052cd3238a310;hpb=21a24662ddc70624c27c607e3904aab23e893898;p=mailer.git diff --git a/inc/modules/member/what-nickname.php b/inc/modules/member/what-nickname.php index ea5105ccf1..bcda07e5be 100644 --- a/inc/modules/member/what-nickname.php +++ b/inc/modules/member/what-nickname.php @@ -10,14 +10,14 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Nickname anstelle der ID * * -------------------------------------------------------------------- * - * $Revision:: 856 $ * - * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009) $ * + * $Revision:: $ * + * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * - * $Author:: stelzi $ * + * $Author:: $ * * 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,61 +38,60 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; - require($INC); -} elseif (!IS_MEMBER()) { - LOAD_URL("modules.php?module=index"); -} elseif ((!EXT_IS_ACTIVE("nickname")) && (!IS_ADMIN())) { - addFatalMessage(__FILE__, __LINE__, getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "nickname"); - return; + die(); +} elseif (!isMember()) { + redirectToIndexMemberOnlyModule(); } // Add description as navigation point -ADD_DESCR("member", __FILE__); -$VALID = false; +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')) $VALID = true; + $isValid = ($array[0] == postRequestElement('nickname')); } // END - if } // END - if } // END - if -if ($VALID) { - // 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'), $GLOBALS['userid']), __FILE__, __LINE__); +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(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'), $GLOBALS['userid']), __FILE__, __LINE__); - $content = NICKNAME_SAVED; + 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 SQL_FREERESULT($result); // Nickname already in use! - $content = NICKNAME_ALREADY_IN_USE; + $content = getMessage('NICKNAME_ALREADY_IN_USE'); } // Load template - LOAD_TEMPLATE("admin_settings_saved", false, $content); + loadTemplate('admin_settings_saved', false, $content); } else { - // Load current nickname - define('__NICKNAME', NICKNAME_GET_NICK($GLOBALS['userid'])); - // Do we have already submit the form? - if (REQUEST_ISSET_POST(('nickname'))) { - LOAD_TEMPLATE("admin_settings_saved", false, "