X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-lock_user.php;h=bf998d8863acf4d0b97d7d1a335b13dfe86e7492;hb=eb301334eb0960dd060cc0d59e6021260a41f835;hp=bfd2f3b8b9826982c68234bc005d48927df4533a;hpb=f577a47a8149d34039aa3c4921c35a38fcb2f2a3;p=mailer.git diff --git a/inc/modules/admin/what-lock_user.php b/inc/modules/admin/what-lock_user.php index bfd2f3b8b9..bf998d8863 100644 --- a/inc/modules/admin/what-lock_user.php +++ b/inc/modules/admin/what-lock_user.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 * @@ -37,133 +37,140 @@ ************************************************************************/ // Some security stuff... -if ((!defined('__SECURITY')) || (!IS_ADMIN())) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; - require($INC); +if ((!defined('__SECURITY')) || (!isAdmin())) { + die(); } // END - if // Add description as navigation point -ADD_DESCR('admin', __FILE__); +addMenuDescription('admin', __FILE__); // Is a userid set? -if (REQUEST_ISSET_GET('uid')) { +if (isGetRequestElementSet('userid')) { // Load user's data - $result_user = SQL_QUERY_ESC("SELECT status, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); + $result_user = SQL_QUERY_ESC("SELECT status, gender, surname, family, email FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1", + array(bigintval(getRequestElement('userid'))), __FILE__, __LINE__); $ACT = false; if (SQL_NUMROWS($result_user) == 1) { // User found - list($status, $gender, $sname, $fname, $email) = SQL_FETCHROW($result_user); + list($status, $gender, $surname, $family, $email) = SQL_FETCHROW($result_user); // Free result SQL_FREERESULT($result_user); // Is a lock reason set? - if ((REQUEST_ISSET_POST(('lock'))) && ($status != 'LOCKED')) { + if ((isPostRequestElementSet('lock')) && ($status != 'LOCKED')) { // Ok, lock the account! - if (GET_EXT_VERSION('user') >= '0.3.5') { + if (getExtensionVersion('user') >= '0.3.5') { // Lock with reason - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='LOCKED',lock_reason='%s',lock_timestamp=NOW() WHERE userid=%s LIMIT 1", - array(REQUEST_POST('reason'), bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='LOCKED',lock_reason='%s',lock_timestamp=NOW() WHERE `userid`=%s LIMIT 1", + array(postRequestElement('reason'), bigintval(getRequestElement('userid'))), __FILE__, __LINE__); } else { // Lock with no lock reason saved - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='LOCKED' WHERE userid=%s LIMIT 1", - array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='LOCKED' WHERE `userid`=%s LIMIT 1", + array(bigintval(getRequestElement('userid'))), __FILE__, __LINE__); } // Entry updated? if (SQL_AFFECTEDROWS() == 1) { // Send an email to the user! In later version you can optionally switch this feature off - $msg = LOAD_EMAIL_TEMPLATE("lock-user", array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid'))); + $message = loadEmailTemplate('lock-user', array('text' => postRequestElement('reason')), bigintval(getRequestElement('userid'))); // Send away... - sendEmail(bigintval(REQUEST_GET('uid')), ADMIN_LOCKED_SUBJ, $msg); + sendEmail(bigintval(getRequestElement('userid')), ADMIN_LOCKED_SUBJ, $message); } // END - if // Prepare message - $message = sprintf(getMessage('USER_ACCOUNT_LOCKED'), REQUEST_GET('uid')); + $message = sprintf(getMessage('USER_ACCOUNT_LOCKED'), getRequestElement('userid')); $ACT = true; - } elseif ((REQUEST_ISSET_POST(('unlock'))) && ($status == 'LOCKED')) { + } elseif ((isPostRequestElementSet(('unlock'))) && ($status == 'LOCKED')) { // Ok, unlock the account! - if (GET_EXT_VERSION('user') >= '0.3.5') { + if (getExtensionVersion('user') >= '0.3.5') { // Reset lock reason as well - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED',lock_reason='',lock_timestamp='0000-00-00 00:00' WHERE userid=%s LIMIT 1", - array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE + `{?_MYSQL_PREFIX?}_user_data` +SET + `status`='CONFIRMED', + `lock_reason`='', + `lock_timestamp`='0000-00-00 00:00' +WHERE + `userid`=%s +LIMIT 1", + array(bigintval(getRequestElement('userid'))), __FILE__, __LINE__); } else { // No lock reason to reset - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED' WHERE userid=%s LIMIT 1", - array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='CONFIRMED' WHERE `userid`=%s LIMIT 1", + array(bigintval(getRequestElement('userid'))), __FILE__, __LINE__); } // Entry updated? if (SQL_AFFECTEDROWS() == 1) { // Send an email to the user! In later version you can optionally switch this feature off - $msg = LOAD_EMAIL_TEMPLATE("unlock-user", array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid'))); + $message = loadEmailTemplate('unlock-user', array('text' => postRequestElement('reason')), bigintval(getRequestElement('userid'))); // Send away... - sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $msg); - if (EXT_IS_ACTIVE('rallye')) { - RALLYE_AUTOADD_USER(REQUEST_GET('uid')); + sendEmail(bigintval(getRequestElement('userid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $message); + if (isExtensionActive('rallye')) { + addUserToReferalRallye(getRequestElement('userid')); } // END - if } // END - if // Prepare message - $message = sprintf(getMessage('USER_ACCOUNT_UNLOCKED'), REQUEST_GET('uid')); + $message = sprintf(getMessage('USER_ACCOUNT_UNLOCKED'), getRequestElement('userid')); $ACT = true; - } elseif (REQUEST_ISSET_POST('del')) { + } elseif (isPostRequestElementSet('del')) { // Delete the account $ACT = true; - loadIncludeOnce("inc/modules/admin/what-del_user.php"); - } elseif (REQUEST_ISSET_POST('no')) { + loadIncludeOnce('inc/modules/admin/what-del_user.php'); + } elseif (isPostRequestElementSet('no')) { // Do not lock him... - $URL = ADMIN_CREATE_USERID_LINK(REQUEST_GET('uid')); + $URL = adminCreateUserLink(getRequestElement('userid')); } else { - $result = SQL_QUERY_ESC("SELECT email, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); + // Load user data we need + $result = SQL_QUERY_ESC("SELECT `email`, `surname`, `family` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1", + array(bigintval(getRequestElement('userid'))), __FILE__, __LINE__); // Entry found? if (SQL_NUMROWS($result) == 1) { // Load data - list ($email, $sname, $fname) = SQL_FETCHROW($result); - - // Free result - SQL_FREERESULT($result); + $DATA = SQL_FETCHARRAY($result); // Transfer data to constants for the template // @TODO Rewrite these all constants - define('__EMAIL', generateMemberEmailLink($email, 'user_data')); - define('__SNAME', $sname); - define('__FNAME', $fname); - define('__UID' , bigintval(REQUEST_GET('uid'))); + $content['email'] = generateEmailLink($DATA['email'], 'user_data'); + $content['surname'] = $DATA['surname']; + $content['fname'] = $DATA['family']; + $content['userid'] = bigintval(getRequestElement('userid')); // Realy want to lock? - switch ($status) - { + switch ($status) { case 'CONFIRMED': // Yes, lock him down... ;-) - define('__OK_VALUE' , 'lock'); - define('__HEADER_VALUE', sprintf(getMessage('ADMIN_HEADER_LOCK_ACCOUNT'), constant('__UID'))); - define('__TEXT_VALUE' , sprintf(getMessage('ADMIN_TEXT_LOCK_ACCOUNT'), constant('__UID'))); + $content['ok'] = 'lock'; + $content['header'] = sprintf(getMessage('ADMIN_HEADER_LOCK_ACCOUNT'), $content['userid']); + $content['text'] = sprintf(getMessage('ADMIN_TEXT_LOCK_ACCOUNT'), $content['userid']); break; case 'LOCKED': // Unlock the user - define('__OK_VALUE' , 'unlock'); - define('__HEADER_VALUE', sprintf(getMessage('ADMIN_HEADER_UNLOCK_ACCOUNT'), constant('__UID'))); - define('__TEXT_VALUE' , sprintf(getMessage('ADMIN_TEXT_UNLOCK_ACCOUNT'), constant('__UID'))); + $content['ok'] = $lock; + $content['header'] = sprintf(getMessage('ADMIN_HEADER_UNLOCK_ACCOUNT'), $content['userid']); + $content['text'] = sprintf(getMessage('ADMIN_TEXT_UNLOCK_ACCOUNT'), $content['userid']); break; case 'UNCONFIRMED': // Unconfirmed accounts cannot be unlocked! - define('__OK_VALUE' , 'del'); - define('__HEADER_VALUE', sprintf(getMessage('ADMIN_HEADER_DEL_ACCOUNT'), constant('__UID'))); - define('__TEXT_VALUE' , sprintf(getMessage('ADMIN_TEXT_DEL_ACCOUNT'), constant('__UID'))); + $content['ok'] = 'del'; + $content['header'] = sprintf(getMessage('ADMIN_HEADER_DEL_ACCOUNT'), $content['userid']); + $content['text'] = sprintf(getMessage('ADMIN_TEXT_DEL_ACCOUNT'), $content['userid']); break; } // Output form - LOAD_TEMPLATE('admin_lock_user'); + loadTemplate('admin_lock_user', false, $content); } else { // Account does not exists! - LOAD_TEMPLATE('admin_settings_saved', false, "