X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-edit_user.php;h=1288289943c50d535668c31e6dd8e84df7677040;hp=683a836cee32394781efd0fbce7aab2d47a97ae1;hb=64c8349613addc3da2242c5cd6b99d64e3fb5f8e;hpb=50b91687d7e7201f6c596a9ad40e8ff35c995074 diff --git a/inc/modules/admin/what-edit_user.php b/inc/modules/admin/what-edit_user.php index 683a836cee..1288289943 100644 --- a/inc/modules/admin/what-edit_user.php +++ b/inc/modules/admin/what-edit_user.php @@ -17,7 +17,9 @@ * 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 * + * @TODO Add support for ext-country * + * -------------------------------------------------------------------- * + * 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,49 +39,52 @@ ************************************************************************/ // 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__); // Fix a notice $result_main = false; -if (REQUEST_ISSET_GET('uid')) { - // 0 1 2 3 4 5 6 7 8 9 10 11 - $result_main = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails -FROM `{!_MYSQL_PREFIX!}_user_data` -WHERE userid=%s +if (isGetRequestElementSet('userid')) { + // Load user entry + $result_main = SQL_QUERY_ESC("SELECT + `userid`, `gender`, `surname`, `family`, `street_nr`, `zip`, `city`, `country`, + `email`, + `birth_day`, `birth_month`, `birth_year`, + `max_mails` +FROM + `{?_MYSQL_PREFIX?}_user_data` +WHERE + `userid`=%s LIMIT 1", - array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); -} + array( + bigintval(getRequestElement('userid')) + ), __FILE__, __LINE__); +} // END - if -if ((SQL_NUMROWS($result_main) == 1) || (!REQUEST_ISSET_GET('uid'))) -{ +if ((SQL_NUMROWS($result_main) == 1) || (!isGetRequestElementSet('userid'))) { // User found - if (!REQUEST_ISSET_GET('uid')) - { + if (!isGetRequestElementSet('userid')) { // Output selection form with all confirmed user accounts listed - ADD_MEMBER_SELECTION_BOX(); - } - elseif (REQUEST_ISSET_POST('edit')) - { + addMemberSelectionBox(); + } elseif (isPostRequestElementSet('edit')) { // Ok, change the account... - $PASS = false; $add = ''; - if ((!REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass2'))) { + $updateUser = false; $add = ''; + if ((!isPostRequestElementSet('pass1')) && (!isPostRequestElementSet('pass2'))) { // Don't change the password - $PASS = true; - } elseif ((REQUEST_POST('pass1') == REQUEST_POST('pass2'))) { + $updateUser = true; + } elseif ((postRequestElement('pass1') == postRequestElement('pass2'))) { // Change the password - $PASS = true; - $add = ", `password`='" . generateHash(REQUEST_POST('pass1')) . "'"; + $updateUser = true; + $add = ", `password`='" . generateHash(postRequestElement('pass1')) . "'"; } - if ($PASS) { + if ($updateUser === true) { // We have to add the following things: birthday and max receive mails - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `gender`='%s', `surname`='%s', `family`='%s', @@ -89,17 +94,17 @@ if ((SQL_NUMROWS($result_main) == 1) || (!REQUEST_ISSET_GET('uid'))) `city`='%s', `email`='%s' ".$add." -WHERE userid=%s LIMIT 1", +WHERE `userid`=%s LIMIT 1", array( - substr(REQUEST_POST('gender'), 0, 1), - REQUEST_POST('surname'), - REQUEST_POST('family'), - REQUEST_POST('street_nr'), - REQUEST_POST('country'), - bigintval(REQUEST_POST('zip')), - REQUEST_POST('city'), - REQUEST_POST('email'), - bigintval(REQUEST_GET('uid')), + substr(postRequestElement('gender'), 0, 1), + postRequestElement('surname'), + postRequestElement('family'), + postRequestElement('street_nr'), + postRequestElement('country'), + bigintval(postRequestElement('zip')), + postRequestElement('city'), + postRequestElement('email'), + bigintval(getRequestElement('userid')), ), __FILE__, __LINE__); $content = getMessage('USER_ACCOUNT_SAVED'); } else { @@ -108,46 +113,29 @@ WHERE userid=%s LIMIT 1", } // Load template - LOAD_TEMPLATE('admin_settings_saved', false, $content); + loadTemplate('admin_settings_saved', false, $content); } else { - // Display form to edit - list($gender, $surname, $family, $street, $zip, $city, $country, $email, $bday, $bmonth, $byear, $max) = SQL_FETCHROW($result_main); + // Load entry + $content = SQL_FETCHARRAY($result_main); - // Transfer data to constants for the template - switch ($gender) { - case 'M': - define('_GENDER_M', ' selected="selected"'); - define('_GENDER_F', ''); - define('_GENDER_C', ''); - break; - - case 'F': - define('_GENDER_M', ''); - define('_GENDER_F', ' selected="selected"'); - define('_GENDER_C', ''); - break; - - case 'C': - define('_GENDER_M', ''); - define('_GENDER_F', ''); - define('_GENDER_C', ' selected="selected"'); - break; - } + // Init entries + foreach (array('gender_m','gender_f','gender_c') as $entry) { + $content[$entry] = ''; + } // END - foreach - define('_SURNAME', $surname); define('_FAMILY', $family); define('_CITY' , $city); - define('_STREET' , $street); define('_ZIP' , $zip); define('_MAX_MAILS', $max); - define('_COUNTRY', $country); define('_EMAIL' , $email); + // Prepare selections + $content['gender_' . strtolower($content['gender'])] = ' selected="selected"'; // Load template - LOAD_TEMPLATE('admin_edit_user', false, bigintval(REQUEST_GET('uid'))); + loadTemplate('admin_edit_user', false, $content); } } else { // Account does not exists! - LOAD_TEMPLATE('admin_settings_saved', false, "
".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."
"); + loadTemplate('admin_settings_saved', false, "
".sprintf(getMessage('ADMIN_MEMBER_404'), getRequestElement('userid'))."
"); } // Free the result SQL_FREERESULT($result_main); -// +// [EOF] ?>