]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-del_user.php
Some fixes for surfbar extension (#123), double->single, misc cleanups/fixes
[mailer.git] / inc / modules / admin / what-del_user.php
index 6275cc15b0a9b8579c1e02702fc5bbf3b8667d28..926d51313ae2760217e732ec69120ec564c72202 100644 (file)
 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
-}
+} // END - if
 
 // Display only title when no form was submitted
 ADD_DESCR('admin', __FILE__);
 
 // User exists..
-if ((IS_FORM_SENT()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('reason'))))) {
+if ((isFormSent()) || ((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__);
+       array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
        if (SQL_NUMROWS($result_user) == 1) {
                // Free memory
                SQL_FREERESULT($result_user);
 
                // Delete user account
-               DELETE_USER_ACCOUNT(REQUEST_GET('uid'), REQUEST_POST('reason'));
+               deleteUserAccount(REQUEST_GET('uid'), REQUEST_POST('reason'));
 
                // Output message
                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_DEL_COMPLETED'));
@@ -63,9 +63,9 @@ if ((IS_FORM_SENT()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('re
                // Account does not exists!
                LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
        }
-} elseif (REQUEST_ISSET_POST(('no'))) {
+} elseif (REQUEST_ISSET_POST('no')) {
        // Do not delete him...
-       LOAD_URL(ADMIN_CREATE_USERID_LINK(REQUEST_GET('uid')));
+       redirectToUrl(ADMIN_CREATE_USERID_LINK(REQUEST_GET('uid')));
 } elseif (!REQUEST_ISSET_GET('uid')) {
        // Output selection form with all confirmed user accounts listed
        ADD_MEMBER_SELECTION_BOX();
@@ -73,6 +73,8 @@ if ((IS_FORM_SENT()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('re
        // 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__);
+
+       // Found a row?
        if (SQL_NUMROWS($result) == 1) {
                // Load data
                list ($email, $sname, $fname) = SQL_FETCHROW($result);
@@ -80,7 +82,7 @@ if ((IS_FORM_SENT()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('re
 
                // Prepare content
                $content = array(
-                       'email'   => CREATE_EMAIL_LINK($email, "user_data"),
+                       'email'   => generateMemberEmailLink($email, "user_data"),
                        'surname' => $sname,
                        'family'  => $fname,
                        'header'  => sprintf(getMessage('ADMIN_HEADER_DEL_ACCOUNT'), REQUEST_GET('uid')),
@@ -94,6 +96,9 @@ if ((IS_FORM_SENT()) || ((REQUEST_ISSET_POST('del')) && (REQUEST_ISSET_POST(('re
                // Account does not exists!
                LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
        }
+
+       // Free the result
+       SQL_FREERESULT($result);
 }
 
 //