Unlock of booked URLs in surfbar added, fix for URL-encoded links in loader module
[mailer.git] / inc / modules / admin / what-list_norefs.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 01/19/2006 *
4  * ================                             Last change: 01/19/2006 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_norefs.php                             *
8  * -------------------------------------------------------------------- *
9  * Short description : Show all members w/o a referral                  *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Alle Mitgliederaccounts ohne Werber auflisten    *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
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.                                  *
22  *                                                                      *
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.                         *
27  *                                                                      *
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,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 } elseif ((!EXT_IS_ACTIVE("user")) || (GET_EXT_VERSION("user") == "")) {
39         // Not active!
40         ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "user"));
41         return;
42 }
43
44 // Add description as navigation point
45 ADD_DESCR("admin", basename(__FILE__));
46
47 OPEN_TABLE("100%", "admin_content admin_content_align", "");
48
49 $MORE = ", userid"; $colspan = "4"; //                 27
50 if (EXT_IS_ACTIVE("nickname")) { $MORE = ", nickname"; }
51
52 if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2;    }
53 if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; }
54 if (empty($_GET['page']))   { $_GET['page']   = "1";      }
55
56 // Set base URL
57 $BASE = "<A href=\"".URL."/modules.php?module=admin";
58
59 $whereStatement = " WHERE refid='0'";
60 if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter'])))
61 {
62         // List only persons w
63         $whereStatement = " WHERE refid='0' AND family LIKE '".$_GET['letter']."%'";
64 }
65 if ($_GET['sortby'] == "family_name") $_GET['sortby'] = "family";
66 $SQL = "SELECT userid, sex, surname, family, email, REMOTE_ADDR, refid, status".$MORE." FROM "._MYSQL_PREFIX."_user_data".$whereStatement." ORDER BY ".$_GET['sortby'];
67 $result_master = SQL_QUERY($SQL, __FILE__, __LINE__);
68
69 // Calculate page count (0.5 fixes a bug with page count)
70 $PAGES = round(SQL_NUMROWS($result_master) / $_CONFIG['user_limit'] + 0.5);
71
72 if (empty($_GET['page']))   $_GET['page']   = "1";
73 if (empty($_GET['offset'])) $_GET['offset'] = $_CONFIG['user_limit'];
74
75 // Add limitation to SQL string and run him again
76 $SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];
77 $result = SQL_QUERY($SQL, __FILE__, __LINE__);
78
79 $result_user = SQL_QUERY("SELECT emails_sent FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED'", __FILE__, __LINE__);
80 $user_count = SQL_NUMROWS($result_user);
81 SQL_FREERESULT($result_user);
82
83 if (SQL_NUMROWS($result_master) > 0)
84 {
85         // Free memory
86         SQL_FREERESULT($result_master);
87
88         // We have some (new?) registrations!
89         define('__COLSPAN1'  , $colspan);
90         define('__COLSPAN2'  , ($colspan + 2));
91         define('__USER_CNT'  , $user_count);
92         define('__ALPHA_SORT', alpha($_GET['sortby'], $colspan, true));
93         define('__SORT_LINKS', SortLinks($_GET['letter'], $_GET['sortby'], $colspan, true));
94         if ($PAGES > 1)
95         {
96                 define('__PAGE_NAV', ADD_PAGENAV($PAGES, $_CONFIG['user_limit'], true, $colspan, true));
97         }
98          else
99         {
100                 // No page navigation is required
101                 define('__PAGE_NAV', "");
102         }
103
104         // Column with nickname when nickname extension is present
105         if (EXT_IS_ACTIVE("nickname"))
106         {
107                 // Nickname extension found
108                 define('__NICKNAME_TH', "  <TD class=\"admin_title bottom2\" align=\"center\">".NICKNAME."</TD>");
109         }
110          else
111         {
112                 // Not found
113                 define('__NICKNAME_TH', "");
114         }
115
116         $SW = 2; $OUT = "";
117         while (list($uid, $sex, $sname, $fname, $email, $IP, $ref, $status, $nick) = SQL_FETCHROW($result))
118         {
119                 if ($ref > 0) $ref = ADMIN_USER_PROFILE_LINK($ref);
120                 $LINKS = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_links", "id", "userid", true));
121                 if ($LINKS > 0) $LINKS = $BASE."&amp;what=list_links&amp;u_id=".$uid."\">".$LINKS."</A>";
122
123                 // Add nickname
124                 if ((empty($nick)) || ($uid == $nick)) $nick = "---";
125
126                 // Transfer data to array
127                 $content = array(
128                         'sw'     => $SW,
129                         'uid'    => ADMIN_USER_PROFILE_LINK($uid),
130                         'sex'    => TRANSLATE_SEX($sex),
131                         'sname'  => $sname,
132                         'fname'  => $fname,
133                         'email'  => "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>",
134                         'addr'   => $IP,
135                         'ref'    => $ref,
136                         'status' => TRANSLATE_STATUS($status),
137                         'links'  => $LINKS,
138                         'nick'   => $nick
139                 );
140
141                 // Load row template and switch colors
142                 $OUT .= LOAD_TEMPLATE("admin_list_user_row", true, $content);
143                 $SW = 3 - $SW;
144         }
145
146         // Free memory
147         SQL_FREERESULT($result);
148
149         define('__USER_ROWS', $OUT);
150
151         // Load main template
152         LOAD_TEMPLATE("admin_list_user");
153
154         // Free some memory
155         SQL_FREERESULT($result_master);
156 }
157  else
158 {
159         // No one as registered so far! :-(
160         LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_ACCOUNT_NOREFS_404);
161 }
162
163 CLOSE_TABLE();
164 //
165 ?>