X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_user.php;h=d2a24f5073829bda93dd0b76c2de9f00899e40b3;hp=6775e97209972c7d54f860fac7260a9ca2c3d1bc;hb=f928ad2bed60fa256d0641eaf6d2c027a2944688;hpb=5b8d588fdbfa375fa859ca80a9b9e1735a13300e diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index 6775e97209..d2a24f5073 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -42,7 +42,7 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { require($INC); } elseif ((!EXT_IS_ACTIVE('user')) || (GET_EXT_VERSION('user') == '')) { // Missing extension! - addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'user')); + addFatalMessage(__FILE__, __LINE__, generateExtensionInactiveNotInstalledMessage('user')); return; } @@ -54,9 +54,9 @@ $listHeader = getMessage('ADMIN_ALL_ACCOUNTS'); if (REQUEST_ISSET_GET(('status'))) { // Set title according to the 'status' $listHeader = getMessage(sprintf("ADMIN_LIST_STATUS_%s_ACCOUNTS", strtoupper(REQUEST_GET(('status'))))); -} elseif (REQUEST_ISSET_GET(('mode'))) { +} elseif (REQUEST_ISSET_GET('mode')) { // Set title according to the "mode" - $listHeader = getMessage(sprintf("ADMIN_LIST_MODE_%s_ACCOUNTS", strtoupper(REQUEST_GET(('mode'))))); + $listHeader = getMessage(sprintf("ADMIN_LIST_MODE_%s_ACCOUNTS", strtoupper(REQUEST_GET('mode')))); } // Remember it @@ -89,9 +89,9 @@ if (EXT_IS_ACTIVE('country')) { $MORE .= ", country"; } -// Init unset data (bad that we change $_GET here!) -if (!REQUEST_ISSET_GET(('letter'))) { REQUEST_SET_GET('letter', getMessage('_ALL2')); } -if (!REQUEST_ISSET_GET(('sortby'))) { REQUEST_SET_GET('sortby', 'userid'); } +// Init unset data +if (!REQUEST_ISSET_GET('letter')) { REQUEST_SET_GET('letter', getMessage('_ALL2')); } +if (!REQUEST_ISSET_GET('sortby')) { REQUEST_SET_GET('sortby', 'userid'); } if (!REQUEST_ISSET_GET('page')) { REQUEST_SET_GET('page' , '1'); } // Set base URL @@ -112,9 +112,9 @@ LIMIT 1", $DATA = SQL_FETCHARRAY($result_user); // Get count/sum of refs, selected categories, unconfirmed mails - $REFS = GET_TOTAL_DATA($uid, "refsystem", "counter"); - $CATS = GET_TOTAL_DATA($uid, "user_cats", 'id', 'userid', true); - $LINKS = GET_TOTAL_DATA($uid, "user_links", 'id', 'userid', true); + $REFS = GET_TOTAL_DATA($uid, 'refsystem', 'counter'); + $CATS = GET_TOTAL_DATA($uid, 'user_cats', 'id', 'userid', true); + $LINKS = GET_TOTAL_DATA($uid, 'user_links', 'id', 'userid', true); // Add links to the numbers if ($LINKS > 0) $LINKS = $base."&what=list_links&uid=".$uid."\">".$LINKS."]"; @@ -141,7 +141,7 @@ LIMIT 1", define('_LINKS', $LINKS); define('_ADMIN_LINKS', generateMemberAdminActionLinks($uid, $DATA['status'])); $DATA['gender'] = translateGender($DATA['gender']); - $DATA['email_link'] = generateMemberEmailLink($DATA['email'], "user_data"); + $DATA['email_link'] = generateEmailLink($DATA['email'], 'user_data'); $DATA['status'] = translateUserStatus($DATA['status']); $DATA['last_online'] = generateDateTime($DATA['last_online'], '0'); $DATA['used_points'] = translateComma($DATA['used_points']); @@ -149,8 +149,8 @@ LIMIT 1", $DATA['joined'] = generateDateTime($DATA['joined'], '0'); $DATA['last_update'] = generateDateTime($DATA['last_update'], '0'); $DATA['last_profile_sent'] = generateDateTime($DATA['last_profile_sent'], '0'); - $DATA['total'] = translateComma(GET_TOTAL_DATA($uid, "user_points", "points")); - $DATA['locked'] = translateComma(GET_TOTAL_DATA($uid, "user_points", "locked_points")); + $DATA['total'] = translateComma(GET_TOTAL_DATA($uid, 'user_points', 'points')); + $DATA['locked'] = translateComma(GET_TOTAL_DATA($uid, 'user_points', 'locked_points')); $DATA['lock_timestamp'] = generateDateTime($DATA['lock_timestamp'], '2'); // Is the lock reason not set? @@ -192,7 +192,7 @@ LIMIT 1", } // Load user-details template - LOAD_TEMPLATE("admin_user_details", false, $uid); + LOAD_TEMPLATE('admin_user_details', false, $uid); } else { // Account does not exist! LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_MEMBER_404'), $uid)); @@ -202,11 +202,11 @@ LIMIT 1", SQL_FREERESULT($result_user); } else { $whereStatement = ''; - if ((REQUEST_GET('letter') != getMessage('_ALL2')) && (REQUEST_GET('letter') != getMessage('_OTHERS')) && (REQUEST_ISSET_GET(('letter')))) { + if ((REQUEST_GET('letter') != getMessage('_ALL2')) && (REQUEST_GET('letter') != getMessage('_OTHERS')) && (REQUEST_ISSET_GET('letter'))) { // List only persons w - $whereStatement = " WHERE family LIKE '".REQUEST_GET('letter')."%'"; + $whereStatement = " WHERE family LIKE '".REQUEST_GET('letter') . "%'"; } // END - if - if (REQUEST_GET('sortby') == "family_name") REQUEST_SET_GET('sortby', "family"); + if (REQUEST_GET('sortby') == 'family_name') REQUEST_SET_GET('sortby', 'family'); // Parse the status or mode parameter if (REQUEST_ISSET_GET(('status'))) { @@ -218,27 +218,31 @@ LIMIT 1", // Start a new one $whereStatement = sprintf(" WHERE `status`='%s'", SQL_ESCAPE(strip_tags(strtoupper(REQUEST_GET('status'))))); } - } elseif (REQUEST_ISSET_GET(('mode'))) { + } elseif (REQUEST_ISSET_GET('mode')) { // Choose what we need to list switch (REQUEST_GET('mode')) { case "norefs": // Users w/o refs if (!empty($whereStatement)) { // Add AND statement - $whereStatement .= " AND refid=0"; + $whereStatement .= " AND `refid`=0"; } else { // Add WHERE statement - $whereStatement = " WHERE refid=0"; + $whereStatement = " WHERE `refid`=0"; } break; default: // Invalid list mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid list mode %s detected.", REQUEST_GET(('mode')))); + DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid list mode %s detected.", REQUEST_GET('mode'))); break; } } // END = if + // Generate master query string + $sql = sprintf("SELECT `userid`, `gender`, `surname`, `family`, `email`, `REMOTE_ADDR`, `refid`, `status`, `emails_sent`, `mails_confirmed`, `emails_received`".$MORE." FROM `{!_MYSQL_PREFIX!}_user_data`".$whereStatement." ORDER BY `%s` ASC", + REQUEST_GET('sortby') + ); + // Prepare SQL and run it - $sql = "SELECT userid, gender, surname, family, email, REMOTE_ADDR, refid, status, emails_sent, mails_confirmed, emails_received".$MORE." FROM `{!_MYSQL_PREFIX!}_user_data`".$whereStatement." ORDER BY ".REQUEST_GET(('sortby')); $result_master = SQL_QUERY($sql, __FILE__, __LINE__); // Calculate page count (0.5 fixes a bug with page count) @@ -257,7 +261,7 @@ LIMIT 1", $sql .= " LIMIT ".(REQUEST_GET('offset') * REQUEST_GET('page') - REQUEST_GET('offset')).", ".REQUEST_GET('offset'); $result = SQL_QUERY($sql, __FILE__, __LINE__); - $result_user = SQL_QUERY("SELECT emails_sent FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED'", __FILE__, __LINE__); + $result_user = SQL_QUERY("SELECT `emails_sent` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED'", __FILE__, __LINE__); $user_count = SQL_NUMROWS($result_user); SQL_FREERESULT($result_user); @@ -298,7 +302,7 @@ LIMIT 1", if ($content['refid'] > 0) $content['refid'] = generateUserProfileLink($content['refid']); // Get number of unconfirmed mails - $LINKS = GET_TOTAL_DATA($content['userid'], "user_links", 'id', 'userid', true); + $LINKS = GET_TOTAL_DATA($content['userid'], 'user_links', 'id', 'userid', true); if ($LINKS > 0) $LINKS = $base."&what=list_links&uid=".$content['userid']."\">".translateComma($LINKS)."]"; // Set link to sent mails if present @@ -308,7 +312,7 @@ LIMIT 1", if (empty($content['nickname']) || $content['nickname'] == $content['userid']) $content['nickname'] = '---'; // Calculate total points - $pointsTotal = GET_TOTAL_DATA($content['userid'], "user_points", "points") - GET_TOTAL_DATA($content['userid'], "user_data", "used_points"); + $pointsTotal = GET_TOTAL_DATA($content['userid'], 'user_points', 'points') - GET_TOTAL_DATA($content['userid'], 'user_data', 'used_points'); // Clickrate $clickRate = 0; @@ -320,15 +324,20 @@ LIMIT 1", $content['sw'] = $SW; $content['uid'] = generateUserProfileLink($content['userid']); $content['gender'] = translateGender($content['gender']); - $content['email'] = "[".$content['email']."]"; + $content['email'] = "[".$content['email']."]"; $content['addr'] = $content['REMOTE_ADDR']; $content['links'] = $LINKS; $content['alinks'] = generateMemberAdminActionLinks($content['userid'], $content['status']); $content['points'] = translateComma($pointsTotal); $content['rate'] = translateComma($clickRate); - $content['locked'] = translateComma(GET_TOTAL_DATA($content['userid'], "user_points", "locked_points")); + $content['locked'] = translateComma(GET_TOTAL_DATA($content['userid'], 'user_points', 'locked_points')); $content['lock_timestamp'] = generateDateTime($content['lock_timestamp'], '2'); $content['status'] = translateUserStatus($content['status']); + $content['refs'] = 0; + + // Get total refs + $refs = GET_TOTAL_DATA($content['userid'], 'refsystem', 'counter'); + if ($refs > 0) $content['refs'] = $base."&what=list_refs&uid=".$content['userid']."\">".$refs."]"; // Is the lock reason not set? if (!isset($content['lock_reason'])) $content['lock_reason'] = '---'; @@ -344,7 +353,7 @@ LIMIT 1", } // Load row template and switch colors - $OUT .= LOAD_TEMPLATE("admin_list_user_row", true, $content); + $OUT .= LOAD_TEMPLATE('admin_list_user_row', true, $content); $SW = 3 - $SW; } // END - while @@ -354,7 +363,7 @@ LIMIT 1", define('__USER_ROWS', $OUT); // Load main template - LOAD_TEMPLATE("admin_list_user"); + LOAD_TEMPLATE('admin_list_user'); // Free some memory SQL_FREERESULT($result_master); @@ -364,5 +373,5 @@ LIMIT 1", } } -// +// [EOF] ?>