]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-sub_points.php
New function fetchUserData() introduced to API, total rewrite (not all)
[mailer.git] / inc / modules / admin / what-sub_points.php
index 243d3497819764ff9d3814880ec405d53ed777bc..2414889a9c4a3986ac7f9714d744f8ed280c8410 100644 (file)
@@ -51,7 +51,7 @@ if (getRequestElement('userid') == 'all') {
        // Is the form sent?
        if ((isFormSent()) && (postRequestElement('points') > 0)) {
                $result_main = SQL_QUERY("SELECT userid, email FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status`='CONFIRMED' ORDER BY `userid` ASC",
-               __FILE__, __LINE__);
+                       __FILE__, __LINE__);
                while ($content = merge_array($content, SQL_FETCHARRAY($result_main))) {
                        // Ok, add points to used points and send an email to him...
                        subtractPoints('admin_all', $content['userid'], postRequestElement('points'));
@@ -76,11 +76,9 @@ if (getRequestElement('userid') == 'all') {
        }
 } elseif (isGetRequestElementSet('userid')) {
        // User id found in URL so we use this give him some credits
-       $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
-               array(bigintval(getRequestElement('userid'))),__FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 1) {
+       if (fetchUserData(getRequestElement('userid'))) {
                // Selected user does exist
-               $content = SQL_FETCHARRAY($result);
+               $content = getUserDataArray();
 
                if ((isFormSent()) && (isPostRequestElementSet(('points')))) {
                        // Ok, add to used points and send an email to him...
@@ -108,9 +106,6 @@ if (getRequestElement('userid') == 'all') {
                // User not found!
                loadTemplate('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), getRequestElement('userid'))."</div>");
        }
-
-       // Free result
-       SQL_FREERESULT($result);
 } else {
        // Output selection form with all confirmed user accounts listed
        addMemberSelectionBox(0, true);