X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_user.php;h=ce84588bad234c8522f61b612152a6f4bf5621e7;hb=2142149f3f72f1a2476f95a87937c044d63bbaf2;hp=0ab0267cdbce1fd9957d61ff5b9b875ca6d7a9cd;hpb=d0ab0382dd73638f0bc13a1a3d6f117ec11a203e;p=mailer.git
diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php
index 0ab0267cdb..ce84588bad 100644
--- a/inc/modules/admin/what-list_user.php
+++ b/inc/modules/admin/what-list_user.php
@@ -32,8 +32,7 @@
************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
-{
+if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
} elseif ((!EXT_IS_ACTIVE("user")) || (GET_EXT_VERSION("user") == "")) {
@@ -43,15 +42,14 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
}
// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+ADD_DESCR("admin", __FILE__);
// Init title with "all accounts"
$listHeader = ADMIN_ALL_ACCOUNTS;
if (!empty($_GET['mode'])) {
// Set title according to the "mode"
- $eval = sprintf("\$listHeader = ADMIN_LIST_%s_ACCOUNTS;", strtoupper(SQL_ESCAPE($_GET['mode'])));
- eval($eval);
-}
+ $listHeader = constant(sprintf("ADMIN_LIST_%s_ACCOUNTS", strtoupper(SQL_ESCAPE($_GET['mode']))));
+} // END - if
// Remember it
define('__TITLE', $listHeader);
@@ -64,20 +62,18 @@ if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; }
if (empty($_GET['page'])) { $_GET['page'] = "1"; }
// Set base URL
-$BASE = " 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."";
- if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&what=list_user\">".$DATA[13]."");
+ if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."]";
+ if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&what=list_user\">".$DATA[13]."]");
if (empty($DATA[17])) $DATA[17] = "---";
- if ($REFS > 0) $REFS = $BASE."&what=list_refs&u_id=".$uid."\">".$REFS."";
- if ($CATS > 0) $CATS = $BASE."&what=list_cats&u_id=".$uid."\">".$CATS."";
+ if ($REFS > 0) $REFS = $BASE."&what=list_refs&u_id=".$uid."\">".$REFS."]";
+ if ($CATS > 0) $CATS = $BASE."&what=list_cats&u_id=".$uid."\">".$CATS."]";
// Prepare data for template
define('_BIRTHDAY', MAKE_DATETIME(mktime(0, 0, 0, $DATA[9], $DATA[8], $DATA[10]), "3"));
@@ -98,12 +94,12 @@ WHERE userid=%d LIMIT 1",
define('_CATS' , $CATS);
define('_LINKS', $LINKS);
define('_ADMIN_LINKS', MEMBER_ACTION_LINKS($uid, $DATA[14]));
- $DATA[0] = TRANSLATE_SEX($DATA[0]);
+ $DATA[0] = TRANSLATE_GENDER($DATA[0]);
$DATA[28] = CREATE_EMAIL_LINK($DATA[7], "user_data");
$DATA[14] = TRANSLATE_STATUS($DATA[14]);
$DATA[16] = MAKE_DATETIME($DATA[16], "0");
$DATA[20] = TRANSLATE_COMMA($DATA[20]);
- if ($DATA[21] > 0) $DATA[21] = $BASE."&what=email_details&u_id=".$uid."\">".$DATA[21]."";
+ if ($DATA[21] > 0) $DATA[21] = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($DATA[21])."]";
$DATA[22] = MAKE_DATETIME($DATA[22], "0");
$DATA[23] = MAKE_DATETIME($DATA[23], "0");
$DATA[24] = MAKE_DATETIME($DATA[24], "0");
@@ -119,43 +115,44 @@ WHERE userid=%d LIMIT 1",
// Template laden
LOAD_TEMPLATE("admin_user_details", false, $uid);
- }
- else
- {
+ } else {
// Account does not exists!
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.$uid.ADMIN_MEMBER_404_2);
}
-}
- else
-{
- $WHERE = "";
- if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter'])))
- {
+} else {
+ $whereStatement = "";
+ if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter']))) {
// List only persons w
- $WHERE = " WHERE family LIKE '".$_GET['letter']."%'";
- }
+ $whereStatement = " WHERE family LIKE '".$_GET['letter']."%'";
+ } // END - if
if ($_GET['sortby'] == "family_name") $_GET['sortby'] = "family";
// Parse the mode parameter
if (isset($_GET['mode'])) {
// Is a WHERE statement already there?
- if (!empty($WHERE)) {
+ if (!empty($whereStatement)) {
// Then append the status column
- $WHERE .= sprintf(" AND status='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['mode']))));
+ $whereStatement .= sprintf(" AND status='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['mode']))));
} else {
// Start a new one
- $WHERE = sprintf(" WHERE status='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['mode']))));
+ $whereStatement = sprintf(" WHERE status='%s'", SQL_ESCAPE(strip_tags(strtoupper($_GET['mode']))));
}
- }
+ } // END - if
- $SQL = "SELECT userid, sex, surname, family, email, REMOTE_ADDR, refid, status".$MORE." FROM "._MYSQL_PREFIX."_user_data".$WHERE." ORDER BY ".$_GET['sortby'];
+ $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 ".$_GET['sortby'];
$result_master = SQL_QUERY($SQL, __FILE__, __LINE__);
// Calculate page count (0.5 fixes a bug with page count)
- $PAGES = round(SQL_NUMROWS($result_master) / $CONFIG['user_limit'] + 0.5);
+ if ($_CONFIG['user_limit'] == 0) {
+ $_CONFIG['user_limit'] = 100;
+ LOAD_TEMPLATE("admin_settings_saved", false, EXTENSION_WARNING_USER_LIMIT);
+ } // END - if
+
+ // Activate the extension please!
+ $PAGES = round(SQL_NUMROWS($result_master) / $_CONFIG['user_limit'] + 0.5);
if (empty($_GET['page'])) $_GET['page'] = "1";
- if (empty($_GET['offset'])) $_GET['offset'] = $CONFIG['user_limit'];
+ if (empty($_GET['offset'])) $_GET['offset'] = $_CONFIG['user_limit'];
// Add limitation to SQL string and run him again
$SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];
@@ -165,8 +162,7 @@ WHERE userid=%d LIMIT 1",
$user_count = SQL_NUMROWS($result_user);
SQL_FREERESULT($result_user);
- if (SQL_NUMROWS($result_master) > 0)
- {
+ if (SQL_NUMROWS($result_master) > 0) {
// Free memory
SQL_FREERESULT($result_master);
@@ -174,17 +170,22 @@ WHERE userid=%d LIMIT 1",
define('__COLSPAN1' , $colspan);
define('__COLSPAN2' , ($colspan + 2));
define('__USER_CNT' , $user_count);
- define('__ALPHA_SORT', alpha($_GET['sortby'], $colspan, true));
- define('__SORT_LINKS', SortLinks($_GET['letter'], $_GET['sortby'], $colspan, true));
- if ($PAGES > 1)
- {
- define('__PAGE_NAV', ADD_PAGENAV($PAGES, $CONFIG['user_limit'], true, $colspan, true));
+
+ if ((function_exists('alpha')) && (function_exists('SortLinks'))) {
+ define('__ALPHA_SORT', alpha($_GET['sortby'], $colspan, true));
+ define('__SORT_LINKS', SortLinks($_GET['letter'], $_GET['sortby'], $colspan, true));
+ } else {
+ define('__ALPHA_SORT', "");
+ define('__SORT_LINKS', "");
}
- else
- {
+
+ if ($PAGES > 1) {
+ define('__PAGE_NAV', ADD_PAGENAV($PAGES, $_CONFIG['user_limit'], true, $colspan, true));
+ } else {
// No page navigation is required
define('__PAGE_NAV', "");
}
+
// Column with nickname when nickname extension is present
if (EXT_IS_ACTIVE("nickname"))
{
@@ -198,35 +199,49 @@ WHERE userid=%d LIMIT 1",
}
$SW = 2; $OUT = "";
- while (list($uid, $sex, $sname, $fname, $email, $IP, $ref, $status, $nick) = SQL_FETCHROW($result))
- {
+ while (list($uid, $gender, $sname, $fname, $email, $IP, $ref, $status, $emails_sent, $mails_confirmed, $emails_received, $nick) = SQL_FETCHROW($result)) {
if ($ref > 0) $ref = ADMIN_USER_PROFILE_LINK($ref);
- $LINKS = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_links", "id", "userid", true));
- if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."";
+ $LINKS = GET_TOTAL_DATA($uid, "user_links", "id", "userid", true);
+ $SENT = $emails_sent;
+ if ($emails_sent > 0) $SENT = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($emails_sent)."]";
+ if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".TRANSLATE_COMMA($LINKS)."]";
// Add nickname
if (empty($nick) || $nick == $uid) $nick = "---";
+ // Calculate total points
+ $pointsTotal = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");
+
+ // Clickrate
+ $clickRate = 0;
+ if ($emails_received > 0) {
+ $clickRate = $mails_confirmed / $emails_received * 100;
+ } // END - if
+
// Transfer data to array
$content = array(
'sw' => $SW,
'uid' => ADMIN_USER_PROFILE_LINK($uid),
- 'sex' => TRANSLATE_SEX($sex),
+ 'gender' => TRANSLATE_GENDER($gender),
'sname' => $sname,
'fname' => $fname,
- 'email' => "".stripslashes($email)."",
+ 'email' => "[".$email."]",
'addr' => $IP,
'ref' => $ref,
'status' => TRANSLATE_STATUS($status),
'links' => $LINKS,
'nick' => $nick,
- 'alinks' => MEMBER_ACTION_LINKS($uid, $status)
+ 'alinks' => MEMBER_ACTION_LINKS($uid, $status),
+ 'points' => TRANSLATE_COMMA($pointsTotal),
+ 'sent' => $SENT,
+ 'rate' => TRANSLATE_COMMA($clickRate),
+ 'locked' => TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "locked_points"))
);
// Load row template and switch colors
$OUT .= LOAD_TEMPLATE("admin_list_user_row", true, $content);
$SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
@@ -238,9 +253,7 @@ WHERE userid=%d LIMIT 1",
// Free some memory
SQL_FREERESULT($result_master);
- }
- else
- {
+ } else {
// No one as registered so far! :-(
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_NONE_REGISTERED);
}