X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_refs.php;h=4e01e4a6bdc2ad3f6b76e77a61810f99ea4f1c2a;hb=64ad7e20acdc9b16363e25cecc3e7f2a0f435a37;hp=8783448eb4f6fb090cba6329a9d67ea629539723;hpb=354f798ee2045cdfb7fcb6af529a296a1fc9979e;p=mailer.git
diff --git a/inc/modules/admin/what-list_refs.php b/inc/modules/admin/what-list_refs.php
index 8783448eb4..4e01e4a6bd 100644
--- a/inc/modules/admin/what-list_refs.php
+++ b/inc/modules/admin/what-list_refs.php
@@ -1,7 +1,7 @@
0) {
+ if (!SQL_HASZERONUMS($result_levels)) {
// List all ref levels or entries if no refback is installed
- $OUT = ''; $SW = 2;
+ $OUT = '';
while ($levels = SQL_FETCHARRAY($result_levels)) {
- // Insert more data
- $levels['sw'] = $SW;
-
// Is the refback still active? ;-)
if (isExtensionActive('refback')) {
// Load all refs of this user
$result_refs = SQL_QUERY_ESC("SELECT `refid` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid`=%s AND `level`='%s' ORDER BY refid ASC",
array($userid, $levels['level']), __FILE__, __LINE__);
- //* DEBUG: */ outputHtml($userid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs)."
");
+ //* DEBUG: */ debugOutput($userid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs));
// Do we have levels?
- if (SQL_NUMROWS($result_refs) > 0) {
+ if (!SQL_HASZERONUMS($result_refs)) {
// Count entries
$menge = countSumTotalData($userid, 'user_data', 'userid', 'refid', true);
$menge_lck = countSumTotalData($userid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
@@ -100,37 +94,30 @@ ORDER BY
$levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($userid), $menge, $menge_lck);
// Init variables
- $OUT_REFS = ''; $SW = 2;
+ $OUT_REFS = '';
// Load all refs
while ($content = SQL_FETCHARRAY($result_refs)) {
- // Query for data
- $result_user = SQL_QUERY_ESC("SELECT `userid`, `gender`, `surname`, `family`, `email`, `status`, `joined` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
- array($content['refid']), __FILE__, __LINE__);
-
// Is the data there?
- if (SQL_NUMROWS($result_user) == 1) {
- // Load data
- $data = SQL_FETCHARRAY($result_user);
-
+ if (fetchUserData($content['refid'])) {
// Check for referals
- $refs_cnt = countSumTotalData($data['userid'], 'refsystem', 'counter');
+ $refs_cnt = countSumTotalData(getUserData('userid'), 'user_refs', 'id', 'userid', true);
// Prepare data for the template
+ // @TODO Try to rewrite some to EL
$content = array(
- 'sw' => $SW,
- 'u_link' => generateUserProfileLink($data['userid']),
- 'gender' => translateGender($data['gender']),
+ 'userid' => getUserData('userid'),
+ 'gender' => getUserData('gender'),
'refs_link' => 0,
- 'surname' => $data['surname'],
- 'family' => $data['family'],
- 'email' => "[".$data['email']."]",
- 'status' => translateUserStatus($data['status']),
- 'registered' => generateDateTime($data['joined'], 3),
+ 'surname' => getUserData('surname'),
+ 'family' => getUserData('family'),
+ 'email' => '[' . getUserData('email') . ']',
+ 'status' => getUserData('status'),
+ 'registered' => generateDateTime(getUserData('joined'), 3),
);
// Check if referal count is larger 0 and update link
- if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($data['userid'], $refs_cnt, "list_refs");
+ if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink(getUserData('userid'), $refs_cnt, 'list_refs');
// Load template for level one
$OUT_REFS .= loadTemplate('admin_list_refs_row', true, $content);
@@ -139,14 +126,8 @@ ORDER BY
$OUT_REFS = loadTemplate('admin_list_refs_nodata', true, $content);
}
- // Free result
- SQL_FREERESULT($result_user);
-
// Add content
$levels['rows'] = $OUT_REFS;
-
- // Switch colors
- $SW = 3 - $SW;
} // END - while
} else {
// Output info message
@@ -167,14 +148,13 @@ ORDER BY
// Prepare data for the template
$content = array(
- 'sw' => $SW,
- 'u_link' => generateUserProfileLink($levels['userid']),
- 'gender' => translateGender($levels['gender']),
+ 'userid' => $levels['userid'],
+ 'gender' => $levels['gender'],
'refs_link' => 0,
'surname' => $levels['surname'],
'family' => $levels['family'],
- 'email' => "[".$levels['email']."]",
- 'status' => translateUserStatus($levels['status']),
+ 'email' => '[' . $levels['email'] . ']',
+ 'status' => $levels['status'],
'registered' => generateDateTime($levels['joined'], 3),
);
@@ -183,16 +163,13 @@ ORDER BY
// Load template for level one
$OUT .= loadTemplate('admin_list_refs_row', true, $content);
-
- // Switch colors
- $SW = 3 - $SW;
}
} // END - while
// Prepare content
$content = array(
- 'rows' => $OUT,
- 'userid' => generateUserProfileLink(getRequestElement('userid'))
+ 'rows' => $OUT,
+ 'userid' => getRequestParameter('userid')
);
// Load main template
@@ -203,21 +180,18 @@ ORDER BY
}
} elseif (isExtensionActive('refback')) {
// No levels found, very bad!
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_REF_LEVELS'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_NO_REFERAL_LEVELS--}');
} else {
// No refs made so far
- loadTemplate('admin_settings_saved', false, getMessage('USER_REF_404'));
+ loadTemplate('admin_settings_saved', false, '{--USER_REFERAL_404--}');
}
// Free result
SQL_FREERESULT($result_levels);
} else {
// User not found
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_MEMBER_404'), getRequestElement('userid')));
+ loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_MEMBER_404', getRequestParameter('userid')));
}
-
- // Free memory
- SQL_FREERESULT($result_user);
} else {
// Output selection form with all confirmed user accounts listed
addMemberSelectionBox();