************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
-}
- elseif (!IS_MEMBER())
-{
+} elseif (!IS_MEMBER()) {
LOAD_URL("modules.php?module=index");
-}
- elseif ((!EXT_IS_ACTIVE("nickname")) && (!IS_ADMIN()))
-{
- ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "nickname");
+} elseif ((!EXT_IS_ACTIVE("nickname")) && (!IS_ADMIN())) {
+ addFatalMessage(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "nickname");
return;
}
// Add description as navigation point
-ADD_DESCR("member", basename(__FILE__));
+ADD_DESCR("member", __FILE__);
$VALID = false;
-if (isset($_POST['ok']))
-{
+if (isset($_POST['ok'])) {
// Nickname was submitted so let's check if it is not already in use
- if (!empty($_POST['nickname']))
- {
+ if (!empty($_POST['nickname'])) {
// Check if nickname is valid
$PATTERN = "[".__NICKNAME_PATTERN."]{".__NICKNAME_LENGTH.",}";
- if (ereg($PATTERN, $_POST['nickname'], $array))
- {
+ if (ereg($PATTERN, $_POST['nickname'], $array)) {
// Entered nickname is valid?
if ($array[0] == $_POST['nickname']) $VALID = true;
- }
- }
-}
+ } // END - if
+ } // END - if
+} // END - if
-if ($VALID)
-{
+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($_POST['nickname'], $GLOBALS['userid']), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 0)
- {
+ $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND userid != '%s' LIMIT 1",
+ array($_POST['nickname'], $GLOBALS['userid']), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 0) {
// Nickname not in use, so set it now
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET nickname='%s' WHERE userid=%s LIMIT 1",
- array($_POST['nickname'], $GLOBALS['userid']), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nickname='%s' WHERE userid=%s LIMIT 1",
+ array($_POST['nickname'], $GLOBALS['userid']), __FILE__, __LINE__);
$content = NICKNAME_SAVED;
- }
- else
- {
+ } else {
// Free result
SQL_FREERESULT($result);
// Load template
LOAD_TEMPLATE("admin_settings_saved", false, $content);
-}
- else
-{
+} else {
// Load current nickname
define('__NICKNAME', NICKNAME_GET_NICK($GLOBALS['userid']));
// Do we have already submit the form?
- if (!empty($_POST['nickname']))
- {
- OUTPUT_HTML("<STRONG class=\"member_failed\">".NICKNAME_IS_INVALID."</STRONG><P></P>");
- }
+ if (!empty($_POST['nickname'])) {
+ LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"member_failed\">".NICKNAME_IS_INVALID."</div");
+ } // END - if
// Load Template
LOAD_TEMPLATE("member_nickname_form");
}
+
//
?>