-ADD_DESCR("admin", basename(__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);
-}
-
-// Remember it
-define('__TITLE', $listHeader);
-
-$MORE = ", userid"; $colspan = "4"; // 27
-if (EXT_IS_ACTIVE("nickname")) { $MORE = ", nickname"; }
-
-if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2; }
-if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; }
-if (empty($_GET['page'])) { $_GET['page'] = "1"; }
-
-// Set base URL
-$BASE = "<A href=\"".URL."/modules.php?module=admin";
-
-if (!empty($_GET['u_id']))
-{
- // Secure the user ID
- $uid = bigintval($_GET['u_id']);
-
- // Does the account exists? 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
- $result = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails, receive_mails, refid, status, REMOTE_ADDR, last_online, last_module, ref_clicks, total_logins, used_points, emails_sent, joined, last_update, last_profile_sent, notified, ref_payout".$MORE."
-FROM "._MYSQL_PREFIX."_user_data
-WHERE userid=%s LIMIT 1",
- array($uid), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
- // Account found!
- $DATA = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- $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);
-
- if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."</A>";
- if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&what=list_user\">".$DATA[13]."</A>");
- if (empty($DATA[17])) $DATA[17] = "---";
- if ($REFS > 0) $REFS = $BASE."&what=list_refs&u_id=".$uid."\">".$REFS."</A></STRONG>";
- if ($CATS > 0) $CATS = $BASE."&what=list_cats&u_id=".$uid."\">".$CATS."</A>";
+addYouAreHereLink('admin', __FILE__);
+
+// Init variables
+$moreColumns = '';
+
+// Add lock reason?
+if (isExtensionInstalledAndNewer('user', '0.3.5')) {
+ // Add them...
+ $moreColumns .= ', UNIX_TIMESTAMP(`lock_timestamp`) AS `lock_timestamp`';
+} // END - if
+
+// Is the extension 'country' installed?
+if (isExtensionActive('country')) {
+ // Add country code
+ $moreColumns .= ',`country_code`';
+} // END - if
+
+// Init unset data
+if (!isGetRequestElementSet('letter')) { setGetRequestElement('letter', ''); }
+if (!isGetRequestElementSet('sortby')) { setGetRequestElement('sortby', 'userid'); }
+if (!isGetRequestElementSet('page')) { setGetRequestElement('page' , 1); }
+
+// Set base HTML
+$base = '[<a href="{%url=modules.php?module=admin';
+
+if (isGetRequestElementSet('userid')) {
+ // Secure the user id
+ $userid = bigintval(getRequestElement('userid'));
+
+ // Does the account exists?
+ $result_user = SQL_QUERY_ESC('SELECT
+ `userid`,
+ `country`,
+ `email`,
+ `birth_day`,
+ `birth_month`,
+ `birth_year`,
+ `last_online`,
+ `used_points`,
+ `emails_sent`,
+ `joined`,
+ `last_update`,
+ `last_profile_sent`,
+ `notified`,
+ `emails_received`,
+ `mails_confirmed`
+ ' . $moreColumns . '
+FROM
+ `{?_MYSQL_PREFIX?}_user_data`
+WHERE
+ `userid`=%s
+LIMIT 1',
+ array($userid), __FILE__, __LINE__);
+
+ // User found?
+ if (SQL_NUMROWS($result_user) == 1) {
+ // Account found
+ $content = SQL_FETCHARRAY($result_user);
+
+ // Get count/sum of refs, selected categories, unconfirmed mails
+ // @TODO Refacture these old link generation to functions
+ $content['refs'] = countSumTotalData($userid, 'refsystem', 'counter');
+ $content['cats'] = countSumTotalData($userid, 'user_cats', 'id', 'userid', TRUE);
+ $content['links'] = getTotalUnconfirmedMails($userid);
+
+ // Add links to the numbers
+ if ($content['links'] > 0) {
+ $content['links'] = $base . '&what=list_links&userid=' . $userid . '%}">' . $content['links'] . '</a>]';
+ } // END - if
+ if ($content['refs'] > 0) {
+ $content['refs'] = $base . '&what=list_refs&userid=' . $userid . '%}">{%pipe,translateComma=' . $content['refs'] . '%}</a>]';
+ } // END - if
+ if ($content['cats'] > 0) {
+ $content['cats'] = $base . '&what=list_user_cats&userid=' . $userid . '%}">{%pipe,translateComma=' . $content['cats'] . '%}</a>]';
+ } // END - if
+
+ // Calculate timestamp for birthday
+ // @TODO Refacture birth_foo to avoid uni* timetstamps as older members cannot be greeded correctly
+ $stamp = mktime(0, 0, 0, $content['birth_month'], $content['birth_day'], $content['birth_year']);
+
+ // Is this above zero?
+ if ($stamp > 0) {
+ // Then use it
+ $content['birthday'] = generateDateTime($stamp, '2');
+ } else {
+ // Zero or below so set zero!
+ $content['birthday'] = generateDateTime(0, '2');
+ }