Even more rewrites/fixes from EL branch (please report any broken part after you...
[mailer.git] / inc / modules / admin / what-del_user.php
index ed7682ebadd17a2a5d91a2cfaa041a45438d32e1..17973ef9d844f3b3da4e9a5dadf92e9395e4e704 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 09/28/2003 *
- * ===============                              Last change: 06/10/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 09/28/2003 *
+ * ===================                          Last change: 06/10/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-del_user.php                                *
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Mitglieder loeschen                              *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $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                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  ************************************************************************/
 
 // 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
 
 // Display only title when no form was submitted
-ADD_DESCR("admin", __FILE__);
+addMenuDescription('admin', __FILE__);
 
 // User exists..
-if ((IS_FORM_SENT()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('reason'))))) {
-       // Delete users account
-       $result_user = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
-               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result_user) == 1) {
-               // Free memory
-               SQL_FREERESULT($result_user);
-
+if ((isFormSent()) || ((isFormSent('del')) && (isPostRequestParameterSet(('reason'))))) {
+       // Is the account there?
+       if (fetchUserData(getRequestParameter('userid'))) {
                // Delete user account
-               DELETE_USER_ACCOUNT(bigintval(REQUEST_GET('uid')), REQUEST_POST('reason'));
-               LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_green\">".ADMIN_DEL_COMPLETED."</div>");
+               deleteUserAccount(getRequestParameter('userid'), postRequestParameter('reason'));
+
+               // Output message
+               loadTemplate('admin_settings_saved', false, getMessage('ADMIN_DEL_COMPLETED'));
        } else {
                // Account does not exists!
-               LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
+               loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . getMaskedMessage('ADMIN_MEMBER_404', bigintval(getRequestParameter('userid'))) . '</div>');
        }
-} elseif (REQUEST_ISSET_POST(('no'))) {
+} elseif (isPostRequestParameterSet('no')) {
        // Do not delete him...
-       LOAD_URL("modules.php?module=admin&amp;what=list_user&amp;uid=".REQUEST_GET('uid'));
-} elseif (!REQUEST_ISSET_GET(('uid'))) {
+       redirectToUrl(adminCreateUserLink(getRequestParameter('userid')));
+} elseif (!isGetRequestParameterSet('userid')) {
        // Output selection form with all confirmed user accounts listed
-       ADD_MEMBER_SELECTION_BOX();
+       addMemberSelectionBox();
 } else {
        // Realy want to delete?
-       $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__);
-       if (SQL_NUMROWS($result) == 1) {
-               // Load data
-               list ($email, $sname, $fname) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
-
-               // Transfer data to constants for the template
-               define('__EMAIL', CREATE_EMAIL_LINK($email, "user_data"));
-               define('__SNAME', $sname);
-               define('__FNAME', $fname);
-               define('__UID'  , REQUEST_GET('uid'));
+       if (fetchUserData(getRequestParameter('userid'))) {
+               // Prepare content
+               $content = array(
+                       'email'   => generateEmailLink(getUserData('email'), 'user_data'),
+                       'surname' => getUserData('surname'),
+                       'family'  => getUserData('family'),
+                       'header'  => getMaskedMessage('ADMIN_HEADER_DEL_ACCOUNT', bigintval(getRequestParameter('userid'))),
+                       'text'    => getMaskedMessage('ADMIN_TEXT_DEL_ACCOUNT', bigintval(getRequestParameter('userid'))),
+                       'userid'  => bigintval(getRequestParameter('userid'))
+               );
 
                // Display form
-               LOAD_TEMPLATE("admin_del_user");
+               loadTemplate('admin_del_user', false, $content);
        } else {
                // Account does not exists!
-               LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
+               loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . getMaskedMessage('ADMIN_MEMBER_404', bigintval(getRequestParameter('userid'))) . '</div>');
        }
 }
 
-//
+// [EOF]
 ?>