Browse Source

Switch to Apollo's invite page which provides invite link for users to copy

ElectraHeart 7 years ago
parent
commit
ef3f7b8f40
1 changed files with 183 additions and 180 deletions
  1. 183
    180
      sections/user/invite.php

+ 183
- 180
sections/user/invite.php View File

1
 <?
1
 <?
2
+
2
 if (isset($_GET['userid']) && check_perms('users_view_invites')) {
3
 if (isset($_GET['userid']) && check_perms('users_view_invites')) {
3
-  if (!is_number($_GET['userid'])) {
4
-    error(403);
5
-  }
4
+	if (!is_number($_GET['userid'])) {
5
+		error(403);
6
+	}
6
 
7
 
7
-  $UserID=$_GET['userid'];
8
-  $Sneaky = true;
8
+	$UserID=$_GET['userid'];
9
+	$Sneaky = true;
9
 } else {
10
 } else {
10
-  if (!$UserCount = $Cache->get_value('stats_user_count')) {
11
-    $DB->query("
12
-      SELECT COUNT(ID)
13
-      FROM users_main
14
-      WHERE Enabled = '1'");
15
-    list($UserCount) = $DB->next_record();
16
-    $Cache->cache_value('stats_user_count', $UserCount, 0);
17
-  }
18
-
19
-  $UserID = $LoggedUser['ID'];
20
-  $Sneaky = false;
11
+	if (!$UserCount = $Cache->get_value('stats_user_count')) {
12
+		$DB->query("
13
+			SELECT COUNT(ID)
14
+			FROM users_main
15
+			WHERE Enabled = '1'");
16
+		list($UserCount) = $DB->next_record();
17
+		$Cache->cache_value('stats_user_count', $UserCount, 0);
18
+	}
19
+
20
+	$UserID = $LoggedUser['ID'];
21
+	$Sneaky = false;
21
 }
22
 }
22
 
23
 
23
 list($UserID, $Username, $PermissionID) = array_values(Users::user_info($UserID));
24
 list($UserID, $Username, $PermissionID) = array_values(Users::user_info($UserID));
24
 
25
 
25
 
26
 
26
 $DB->query("
27
 $DB->query("
27
-  SELECT InviteKey, Email, Expires
28
-  FROM invites
29
-  WHERE InviterID = '$UserID'
30
-  ORDER BY Expires");
31
-$Pending = $DB->to_array();
28
+	SELECT InviteKey, Email, Expires
29
+	FROM invites
30
+	WHERE InviterID = '$UserID'
31
+	ORDER BY Expires");
32
+$Pending = 	$DB->to_array();
32
 
33
 
33
-$OrderWays = array('username', 'email', 'joined', 'lastseen', 'uploaded', 'downloaded', 'ratio');
34
+$OrderWays = array('username', 'email',	'joined', 'lastseen', 'uploaded', 'downloaded', 'ratio');
34
 
35
 
35
 if (empty($_GET['order'])) {
36
 if (empty($_GET['order'])) {
36
-  $CurrentOrder = 'id';
37
-  $CurrentSort = 'desc';
38
-  $NewSort = 'asc';
37
+	$CurrentOrder = 'id';
38
+	$CurrentSort = 'asc';
39
+	$NewSort = 'desc';
39
 } else {
40
 } else {
40
-  if (in_array($_GET['order'], $OrderWays)) {
41
-    $CurrentOrder = $_GET['order'];
42
-    if ($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
43
-      $CurrentSort = $_GET['sort'];
44
-      $NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc');
45
-    } else {
46
-      error(404);
47
-    }
48
-  } else {
49
-    error(404);
50
-  }
41
+	if (in_array($_GET['order'], $OrderWays)) {
42
+		$CurrentOrder = $_GET['order'];
43
+		if ($_GET['sort'] == 'asc' || $_GET['sort'] == 'desc') {
44
+			$CurrentSort = $_GET['sort'];
45
+			$NewSort = ($_GET['sort'] == 'asc' ? 'desc' : 'asc');
46
+		} else {
47
+			error(404);
48
+		}
49
+	} else {
50
+		error(404);
51
+	}
51
 }
52
 }
52
 
53
 
53
 switch ($CurrentOrder) {
54
 switch ($CurrentOrder) {
54
-  case 'username':
55
-    $OrderBy = "um.Username";
56
-    break;
57
-  case 'email':
58
-    $OrderBy = "um.Email";
59
-    break;
60
-  case 'joined':
61
-    $OrderBy = "ui.JoinDate";
62
-    break;
63
-  case 'lastseen':
64
-    $OrderBy = "um.LastAccess";
65
-    break;
66
-  case 'uploaded':
67
-    $OrderBy = "um.Uploaded";
68
-    break;
69
-  case 'downloaded':
70
-    $OrderBy = "um.Downloaded";
71
-    break;
72
-  case 'ratio':
73
-    $OrderBy = "(um.Uploaded / um.Downloaded)";
74
-    break;
75
-  default:
76
-    $OrderBy = "um.ID";
77
-    break;
55
+	case 'username':
56
+		$OrderBy = "um.Username";
57
+		break;
58
+	case 'email':
59
+		$OrderBy = "um.Email";
60
+		break;
61
+	case 'joined':
62
+		$OrderBy = "ui.JoinDate";
63
+		break;
64
+	case 'lastseen':
65
+		$OrderBy = "um.LastAccess";
66
+		break;
67
+	case 'uploaded':
68
+		$OrderBy = "um.Uploaded";
69
+		break;
70
+	case 'downloaded':
71
+		$OrderBy = "um.Downloaded";
72
+		break;
73
+	case 'ratio':
74
+		$OrderBy = "(um.Uploaded / um.Downloaded)";
75
+		break;
76
+	default:
77
+		$OrderBy = "um.ID";
78
+		break;
78
 }
79
 }
79
 
80
 
80
 $CurrentURL = Format::get_url(array('action', 'order', 'sort'));
81
 $CurrentURL = Format::get_url(array('action', 'order', 'sort'));
81
 
82
 
82
 $DB->query("
83
 $DB->query("
83
-  SELECT
84
-    ID,
85
-    Email,
86
-    Uploaded,
87
-    Downloaded,
88
-    JoinDate,
89
-    LastAccess
90
-  FROM users_main AS um
91
-    LEFT JOIN users_info AS ui ON ui.UserID = um.ID
92
-  WHERE ui.Inviter = '$UserID'
93
-  ORDER BY $OrderBy $CurrentSort");
84
+	SELECT
85
+		ID,
86
+		Email,
87
+		Uploaded,
88
+		Downloaded,
89
+		JoinDate,
90
+		LastAccess
91
+	FROM users_main AS um
92
+		LEFT JOIN users_info AS ui ON ui.UserID = um.ID
93
+	WHERE ui.Inviter = '$UserID'
94
+	ORDER BY $OrderBy $CurrentSort");
94
 
95
 
95
 $Invited = $DB->to_array();
96
 $Invited = $DB->to_array();
96
 
97
 
97
-$JSIncludes = '';
98
-if (check_perms('users_mod') || check_perms('admin_advanced_user_search')) {
99
-  $JSIncludes = 'invites';
100
-}
98
+View::show_header('Invites');
101
 
99
 
102
-View::show_header('Invites', $JSIncludes);
103
 ?>
100
 ?>
104
 <div class="thin">
101
 <div class="thin">
105
-  <div class="header">
106
-    <h2><?=Users::format_username($UserID, false, false, false)?> &gt; Invites</h2>
107
-    <div class="linkbox">
108
-      <a href="user.php?action=invitetree<? if ($Sneaky) { echo '&amp;userid='.$UserID; } ?>" class="brackets">Invite tree</a>
109
-    </div>
110
-  </div>
102
+	<div class="header">
103
+		<h2><?=Users::format_username($UserID, false, false, false)?> &gt; Invites</h2>
104
+		<div class="linkbox">
105
+			<a href="user.php?action=invitetree<? if ($Sneaky) { echo '&amp;userid='.$UserID; } ?>" class="brackets">Invite tree</a>
106
+		</div>
107
+	</div>
111
 <? if ($UserCount >= USER_LIMIT && !check_perms('site_can_invite_always')) { ?>
108
 <? if ($UserCount >= USER_LIMIT && !check_perms('site_can_invite_always')) { ?>
112
-  <div class="box pad notice">
113
-    <p>Because the user limit has been reached you are unable to send invites at this time.</p>
114
-  </div>
109
+	<div class="box pad notice">
110
+		<p>Because the user limit has been reached you are unable to send invites at this time.</p>
111
+	</div>
115
 <? }
112
 <? }
116
 
113
 
117
 /*
114
 /*
118
-  Users cannot send invites if they:
119
-    -Are on ratio watch
120
-    -Have disabled leeching
121
-    -Have disabled invites
122
-    -Have no invites (Unless have unlimited)
123
-    -Cannot 'invite always' and the user limit is reached
115
+	Users cannot send invites if they:
116
+		-Are on ratio watch
117
+		-Have disabled leeching
118
+		-Have disabled invites
119
+		-Have no invites (Unless have unlimited)
120
+		-Cannot 'invite always' and the user limit is reached
124
 */
121
 */
125
 
122
 
126
 $DB->query("
123
 $DB->query("
127
-  SELECT can_leech
128
-  FROM users_main
129
-  WHERE ID = $UserID");
124
+	SELECT can_leech
125
+	FROM users_main
126
+	WHERE ID = $UserID");
130
 list($CanLeech) = $DB->next_record();
127
 list($CanLeech) = $DB->next_record();
131
 
128
 
132
-if (!$Sneaky
133
-  && !$LoggedUser['RatioWatch']
134
-  && $CanLeech
135
-  && empty($LoggedUser['DisableInvites'])
136
-  && ($LoggedUser['Invites'] > 0 || check_perms('site_send_unlimited_invites'))
137
-  && ($UserCount <= USER_LIMIT || USER_LIMIT == 0 || check_perms('site_can_invite_always'))
138
-  ) { ?>
139
-  <div class="box pad">
140
-    <p>Do not trade or sell invites under any circumstances.</p>
141
-    <p>You may invite anyone so long as you and they both lack malicious intent, but keep in mind that you are responsible for anyone you invite. If you invite someone you don't know well and they surprise you by breaking the rules or being a generally poor user, you will likely end up punished for it. For that reason, we stongly recommend you only invite people you personally know and trust.
142
-    <p>Do not send an invite to anyone who has previously had a <?=SITE_NAME?> account. Please direct them to <?=BOT_DISABLED_CHAN?> on <?=BOT_SERVER?> if they wish to reactivate their account.</p>
143
-    <p><em>Do not send an invite if you have not read or do not understand the information above.</em></p>
144
-  </div>
145
-  <div class="box box2">
146
-    <form class="send_form pad" name="invite" action="user.php" method="post">
147
-      <input type="hidden" name="action" value="take_invite" />
148
-      <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
149
-      <div class="field_div">
150
-        <div class="label">Email address:</div>
151
-        <div class="input">
152
-          <input type="email" name="email" size="60" />
153
-          <input type="submit" value="Invite" />
154
-        </div>
155
-      </div>
156
-<?  if (check_perms('users_invite_notes')) { ?>
157
-      <div class="field_div">
158
-        <div class="label">Staff Note:</div>
159
-        <div class="input">
160
-          <input type="text" name="reason" size="60" maxlength="255" />
161
-        </div>
162
-      </div>
163
-<?  } ?>
164
-    </form>
165
-  </div>
129
+
130
+	if (!$Sneaky
131
+		&& !$LoggedUser['RatioWatch']
132
+		&& $CanLeech
133
+		&& empty($LoggedUser['DisableInvites'])
134
+		&& ($LoggedUser['Invites'] > 0 || check_perms('site_send_unlimited_invites'))
135
+		&& ($UserCount <= USER_LIMIT || USER_LIMIT == 0 || check_perms('site_can_invite_always'))
136
+	) { ?>
137
+	<div class="box pad">
138
+		<p>Please note that selling, trading, or publicly giving away our invitations&#8202;&mdash;&#8202;or responding to public invite requests&#8202;&mdash;&#8202;is strictly forbidden, and may result in you and your entire invite tree being banned.</p>
139
+		<p>Do not send an invite to anyone who has previously had an <?=SITE_NAME?> account. Please direct them to <?=BOT_DISABLED_CHAN?> on <?=BOT_SERVER?> if they wish to reactivate their account.</p>
140
+		<p>Remember that you are responsible for ALL invitees, and your account and/or privileges may be disabled due to your invitees' actions. You should know and trust the person you're inviting. If you aren't familiar enough with the user to trust them, do not invite them.</p>
141
+		<p><em>Do not send an invite if you have not read or do not understand the information above.</em></p>
142
+	</div>
143
+	<div class="box box2">
144
+		<form class="send_form pad" name="invite" action="user.php" method="post">
145
+			<input type="hidden" name="action" value="take_invite" />
146
+			<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
147
+			<div class="field_div">
148
+				<div class="label">Email address:</div>
149
+				<div class="input">
150
+					<input type="email" name="email" size="60" />
151
+					<input type="submit" value="Invite" />
152
+				</div>
153
+			</div>
154
+<?	if (check_perms('users_invite_notes')) { ?>
155
+			<div class="field_div">
156
+				<div class="label">Staff Note:</div>
157
+				<div class="input">
158
+					<input type="text" name="reason" size="60" maxlength="255" />
159
+				</div>
160
+			</div>
161
+<?	} ?>
162
+		</form>
163
+	</div>
166
 
164
 
167
 <?
165
 <?
168
 } elseif (!empty($LoggedUser['DisableInvites'])) { ?>
166
 } elseif (!empty($LoggedUser['DisableInvites'])) { ?>
169
-  <div class="box pad" style="text-align: center;">
170
-    <strong class="important_text">Your invites have been disabled. Please read <a href="wiki.php?action=article&amp;name=cantinvite">this article</a> for more information.</strong>
171
-  </div>
167
+	<div class="box pad" style="text-align: center;">
168
+		<strong class="important_text">Your invites have been disabled. Please read <a href="wiki.php?action=article&amp;id=116">this article</a> for more information.</strong>
169
+	</div>
172
 <?
170
 <?
173
 } elseif ($LoggedUser['RatioWatch'] || !$CanLeech) { ?>
171
 } elseif ($LoggedUser['RatioWatch'] || !$CanLeech) { ?>
174
-  <div class="box pad" style="text-align: center;">
175
-    <strong class="important_text">You may not send invites while on Ratio Watch or while your leeching privileges are disabled. Please read <a href="wiki.php?action=article&amp;name=cantinvite">this article</a> for more information.</strong>
176
-  </div>
172
+	<div class="box pad" style="text-align: center;">
173
+		<strong class="important_text">You may not send invites while on Ratio Watch or while your leeching privileges are disabled. Please read <a href="wiki.php?action=article&amp;id=116">this article</a> for more information.</strong>
174
+	</div>
177
 <?
175
 <?
178
 }
176
 }
179
 
177
 
180
 if (!empty($Pending)) {
178
 if (!empty($Pending)) {
181
 ?>
179
 ?>
182
-  <h3>Pending invites</h3>
183
-  <div class="box">
184
-    <table width="100%">
185
-      <tr class="colhead">
186
-        <td>Email address</td>
187
-        <td>Expires in</td>
188
-        <td>Delete invite</td>
189
-      </tr>
180
+	<h3>Pending invites</h3>
181
+	<div class="box pad">
182
+		<table width="100%">
183
+			<tr class="colhead">
184
+				<td>Email address</td>
185
+				<td>Expires in</td>
186
+				<td>Invite link</td>
187
+				<td>Delete invite</td>
188
+			</tr>
190
 <?
189
 <?
191
-  foreach ($Pending as $Invite) {
192
-    list($InviteKey, $Email, $Expires) = $Invite;
193
-    $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
190
+	$Row = 'a';
191
+	foreach ($Pending as $Invite) {
192
+		list($InviteKey, $Email, $Expires) = $Invite;
193
+		$Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
194
+		$Row = $Row === 'a' ? 'b' : 'a';
194
 ?>
195
 ?>
195
-      <tr class="row">
196
-        <td><?=display_str($Email)?></td>
197
-        <td><?=time_diff($Expires)?></td>
198
-        <td><a href="user.php?action=delete_invite&amp;invite=<?=$InviteKey?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Are you sure you want to delete this invite?');">Delete invite</a></td>
199
-      </tr>
200
-<?  } ?>
201
-    </table>
202
-  </div>
196
+			<tr class="row<?=$Row?>">
197
+				<td><?=display_str($Email)?></td>
198
+				<td><?=time_diff($Expires)?></td>
199
+				<td><a href="register.php?invite=<?=$InviteKey?>">Invite link</a></td>
200
+				<td><a href="user.php?action=delete_invite&amp;invite=<?=$InviteKey?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Are you sure you want to delete this invite?');">Delete invite</a></td>
201
+			</tr>
202
+<?	} ?>
203
+		</table>
204
+	</div>
203
 <?
205
 <?
204
 }
206
 }
205
 
207
 
206
 ?>
208
 ?>
207
-  <h3>Invitee list</h3>
208
-  <div class="box">
209
-    <table width="100%", class="invite_table">
210
-      <tr class="colhead">
211
-        <td><a href="user.php?action=invite&amp;order=username&amp;sort=<?=(($CurrentOrder == 'username') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Username</a></td>
212
-        <td><a href="user.php?action=invite&amp;order=email&amp;sort=<?=(($CurrentOrder == 'email') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Email</a></td>
213
-        <td><a href="user.php?action=invite&amp;order=joined&amp;sort=<?=(($CurrentOrder == 'joined') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Joined</a></td>
214
-        <td><a href="user.php?action=invite&amp;order=lastseen&amp;sort=<?=(($CurrentOrder == 'lastseen') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Last Seen</a></td>
215
-        <td><a href="user.php?action=invite&amp;order=uploaded&amp;sort=<?=(($CurrentOrder == 'uploaded') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Uploaded</a></td>
216
-        <td><a href="user.php?action=invite&amp;order=downloaded&amp;sort=<?=(($CurrentOrder == 'downloaded') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Downloaded</a></td>
217
-        <td><a href="user.php?action=invite&amp;order=ratio&amp;sort=<?=(($CurrentOrder == 'ratio') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Ratio</a></td>
218
-      </tr>
209
+	<h3>Invitee list</h3>
210
+	<div class="box pad">
211
+		<table width="100%">
212
+			<tr class="colhead">
213
+				<td><a href="user.php?action=invite&amp;order=username&amp;sort=<?=(($CurrentOrder == 'username') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Username</a></td>
214
+				<td><a href="user.php?action=invite&amp;order=email&amp;sort=<?=(($CurrentOrder == 'email') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Email</a></td>
215
+				<td><a href="user.php?action=invite&amp;order=joined&amp;sort=<?=(($CurrentOrder == 'joined') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Joined</a></td>
216
+				<td><a href="user.php?action=invite&amp;order=lastseen&amp;sort=<?=(($CurrentOrder == 'lastseen') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Last Seen</a></td>
217
+				<td><a href="user.php?action=invite&amp;order=uploaded&amp;sort=<?=(($CurrentOrder == 'uploaded') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Uploaded</a></td>
218
+				<td><a href="user.php?action=invite&amp;order=downloaded&amp;sort=<?=(($CurrentOrder == 'downloaded') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Downloaded</a></td>
219
+				<td><a href="user.php?action=invite&amp;order=ratio&amp;sort=<?=(($CurrentOrder == 'ratio') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Ratio</a></td>
220
+			</tr>
219
 <?
221
 <?
220
-  foreach ($Invited as $User) {
221
-    list($ID, $Email, $Uploaded, $Downloaded, $JoinDate, $LastAccess) = $User;
222
-    $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]'
222
+	$Row = 'a';
223
+	foreach ($Invited as $User) {
224
+		list($ID, $Email, $Uploaded, $Downloaded, $JoinDate, $LastAccess) = $User;
225
+		$Row = $Row === 'a' ? 'b' : 'a';
223
 ?>
226
 ?>
224
-      <tr class="row">
225
-        <td><?=Users::format_username($ID, true, true, true, true)?></td>
226
-        <td><?=display_str($Email)?></td>
227
-        <td><?=time_diff($JoinDate, 1)?></td>
228
-        <td><?=time_diff($LastAccess, 1);?></td>
229
-        <td><?=Format::get_size($Uploaded)?></td>
230
-        <td><?=Format::get_size($Downloaded)?></td>
231
-        <td><?=Format::get_ratio_html($Uploaded, $Downloaded)?></td>
232
-      </tr>
233
-<?  } ?>
234
-    </table>
235
-  </div>
227
+			<tr class="row<?=$Row?>">
228
+				<td><?=Users::format_username($ID, true, true, true, true)?></td>
229
+				<td><?=display_str($Email)?></td>
230
+				<td><?=time_diff($JoinDate, 1)?></td>
231
+				<td><?=time_diff($LastAccess, 1);?></td>
232
+				<td><?=Format::get_size($Uploaded)?></td>
233
+				<td><?=Format::get_size($Downloaded)?></td>
234
+				<td><?=Format::get_ratio_html($Uploaded, $Downloaded)?></td>
235
+			</tr>
236
+<?	} ?>
237
+		</table>
238
+	</div>
236
 </div>
239
 </div>
237
 <? View::show_footer(); ?>
240
 <? View::show_footer(); ?>

Loading…
Cancel
Save