2 /************************************************************************
3 * MXChange v0.2.1 Start: 01/19/2006 *
4 * ================ Last change: 01/19/2006 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_norefs.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Show all members w/o a referal *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Alle Mitgliederaccounts ohne Werber auflisten *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38 } elseif ((!EXT_IS_ACTIVE("user")) || (GET_EXT_VERSION("user") == "")) {
40 ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "user"));
44 // Add description as navigation point
45 ADD_DESCR("admin", __FILE__);
47 $MORE = ", userid"; $colspan = "4"; // 27
48 if (EXT_IS_ACTIVE("nickname")) { $MORE = ", nickname"; }
50 if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2; }
51 if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; }
52 if (empty($_GET['page'])) { $_GET['page'] = "1"; }
55 $BASE = "[<A href=\"".URL."/modules.php?module=admin";
57 $whereStatement = " WHERE refid=0";
58 if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter']))) {
59 // List only persons w
60 $whereStatement = " WHERE refid=0 AND family LIKE '".$_GET['letter']."%'";
64 if ($_GET['sortby'] == "family_name") $_GET['sortby'] = "family";
67 $SQL = "SELECT userid, gender, surname, family, email, REMOTE_ADDR, refid, status, emails_sent, mails_confirmed, emails_received".$MORE."
68 FROM "._MYSQL_PREFIX."_user_data
70 ORDER BY ".SQL_ESCAPE($_GET['sortby']);
73 $result_master = SQL_QUERY($SQL, __FILE__, __LINE__);
75 // Calculate page count (0.5 fixes a bug with page count)
76 $PAGES = round(SQL_NUMROWS($result_master) / $_CONFIG['user_limit'] + 0.5);
78 if (empty($_GET['page'])) $_GET['page'] = "1";
79 if (empty($_GET['offset'])) $_GET['offset'] = $_CONFIG['user_limit'];
81 // Add limitation to SQL string and run him again
82 $SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];
83 $result = SQL_QUERY($SQL, __FILE__, __LINE__);
85 $result_user = SQL_QUERY("SELECT emails_sent FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED'", __FILE__, __LINE__);
86 $user_count = SQL_NUMROWS($result_user);
87 SQL_FREERESULT($result_user);
89 if (SQL_NUMROWS($result_master) > 0)
91 // We have some (new?) registrations!
92 define('__COLSPAN1' , $colspan);
93 define('__COLSPAN2' , ($colspan + 2));
94 define('__USER_CNT' , $user_count);
95 define('__ALPHA_SORT', alpha($_GET['sortby'], $colspan, true));
96 define('__SORT_LINKS', SortLinks($_GET['letter'], $_GET['sortby'], $colspan, true));
97 define('__TITLE' , ADMIN_LIST_NOREFS_ACCOUNTS);
101 define('__PAGE_NAV', ADD_PAGENAV($PAGES, $_CONFIG['user_limit'], true, $colspan, true));
103 // No page navigation is required
104 define('__PAGE_NAV', "");
107 // Column with nickname when nickname extension is present
108 if (EXT_IS_ACTIVE("nickname")) {
109 // Nickname extension found
110 define('__NICKNAME_TH', " <TD class=\"admin_title bottom2\" align=\"center\">".NICKNAME."</TD>");
113 define('__NICKNAME_TH', "");
117 while (list($uid, $gender, $sname, $fname, $email, $IP, $ref, $status, $emails_sent, $mails_confirmed, $emails_received, $nick) = SQL_FETCHROW($result)) {
118 // Get unconfirmed emails
119 $LINKS = GET_TOTAL_DATA($uid, "user_links", "id", "userid", true);
121 // Set link to unconfirmed emails
124 $LINKS = TRANSLATE_COMMA($LINKS);
127 $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."</A>]";
131 if ((empty($nick)) || ($uid == $nick)) $nick = "---";
134 $SENT = $emails_sent;
135 if ($emails_sent > 0) $SENT = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($emails_sent)."</A>]";
137 // Calculate total points
138 $pointsTotal = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points");
142 if ($emails_received > 0) {
143 $clickRate = $mails_confirmed / $emails_received * 100;
146 // Transfer data to array
149 'uid' => ADMIN_USER_PROFILE_LINK($uid),
150 'gender' => TRANSLATE_GENDER($gender),
153 'email' => "[<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>]",
156 'status' => TRANSLATE_STATUS($status),
158 'alinks' => MEMBER_ACTION_LINKS($uid, $status),
160 'points' => TRANSLATE_COMMA($pointsTotal),
162 'rate' => TRANSLATE_COMMA($clickRate),
163 'locked' => TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "locked_points"))
166 // Load row template and switch colors
167 $OUT .= LOAD_TEMPLATE("admin_list_user_row", true, $content);
172 SQL_FREERESULT($result);
174 define('__USER_ROWS', $OUT);
176 // Load main template
177 LOAD_TEMPLATE("admin_list_user");
180 SQL_FREERESULT($result_master);
182 // No one as registered so far! :-(
183 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_ACCOUNT_NOREFS_404);
187 SQL_FREERESULT($result_master);