pjc 5 years ago
parent
commit
f2e6e12876
2 changed files with 122 additions and 87 deletions
  1. 1
    1
      sections/register/index.php
  2. 121
    86
      sections/user/invite.php

+ 1
- 1
sections/register/index.php View File

97
         FROM users_main
97
         FROM users_main
98
         LIMIT 1");
98
         LIMIT 1");
99
             $UserCount = $DB->record_count();
99
             $UserCount = $DB->record_count();
100
-            if ($UserCount =0= 0) {
100
+            if ($UserCount === 0) {
101
                 $NewInstall = true;
101
                 $NewInstall = true;
102
                 $Class = SYSOP;
102
                 $Class = SYSOP;
103
                 $Enabled = '1';
103
                 $Enabled = '1';

+ 121
- 86
sections/user/invite.php View File

1
-<?
1
+<?php
2
 if (isset($_GET['userid']) && check_perms('users_view_invites')) {
2
 if (isset($_GET['userid']) && check_perms('users_view_invites')) {
3
-  if (!is_number($_GET['userid'])) {
4
-    error(403);
5
-  }
3
+    if (!is_number($_GET['userid'])) {
4
+        error(403);
5
+    }
6
 
6
 
7
-  $UserID=$_GET['userid'];
8
-  $Sneaky = true;
7
+    $UserID=$_GET['userid'];
8
+    $Sneaky = true;
9
 } else {
9
 } else {
10
-  if (!$UserCount = $Cache->get_value('stats_user_count')) {
11
-    $DB->query("
10
+    if (!$UserCount = $Cache->get_value('stats_user_count')) {
11
+        $DB->query("
12
       SELECT COUNT(ID)
12
       SELECT COUNT(ID)
13
       FROM users_main
13
       FROM users_main
14
       WHERE Enabled = '1'");
14
       WHERE Enabled = '1'");
15
-    list($UserCount) = $DB->next_record();
16
-    $Cache->cache_value('stats_user_count', $UserCount, 0);
17
-  }
15
+        list($UserCount) = $DB->next_record();
16
+        $Cache->cache_value('stats_user_count', $UserCount, 0);
17
+    }
18
 
18
 
19
-  $UserID = $LoggedUser['ID'];
20
-  $Sneaky = false;
19
+    $UserID = $LoggedUser['ID'];
20
+    $Sneaky = false;
21
 }
21
 }
22
 
22
 
23
 list($UserID, $Username, $PermissionID) = array_values(Users::user_info($UserID));
23
 list($UserID, $Username, $PermissionID) = array_values(Users::user_info($UserID));
24
 
24
 
25
-
26
 $DB->query("
25
 $DB->query("
27
   SELECT InviteKey, Email, Expires
26
   SELECT InviteKey, Email, Expires
28
   FROM invites
27
   FROM invites
33
 $OrderWays = array('username', 'email', 'joined', 'lastseen', 'uploaded', 'downloaded', 'ratio');
32
 $OrderWays = array('username', 'email', 'joined', 'lastseen', 'uploaded', 'downloaded', 'ratio');
34
 
33
 
35
 if (empty($_GET['order'])) {
34
 if (empty($_GET['order'])) {
36
-  $CurrentOrder = 'id';
37
-  $CurrentSort = 'desc';
38
-  $NewSort = 'asc';
35
+    $CurrentOrder = 'id';
36
+    $CurrentSort = 'desc';
37
+    $NewSort = 'asc';
39
 } else {
38
 } 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');
39
+    if (in_array($_GET['order'], $OrderWays)) {
40
+        $CurrentOrder = $_GET['order'];
41
+        if ($_GET['sort'] === 'asc' || $_GET['sort'] === 'desc') {
42
+            $CurrentSort = $_GET['sort'];
43
+            $NewSort = ($_GET['sort'] === 'asc' ? 'desc' : 'asc');
44
+        } else {
45
+            error(404);
46
+        }
45
     } else {
47
     } else {
46
-      error(404);
48
+        error(404);
47
     }
49
     }
48
-  } else {
49
-    error(404);
50
-  }
51
 }
50
 }
52
 
51
 
53
 switch ($CurrentOrder) {
52
 switch ($CurrentOrder) {
96
 
95
 
97
 $JSIncludes = '';
96
 $JSIncludes = '';
98
 if (check_perms('users_mod') || check_perms('admin_advanced_user_search')) {
97
 if (check_perms('users_mod') || check_perms('admin_advanced_user_search')) {
99
-  $JSIncludes = 'invites';
98
+    $JSIncludes = 'invites';
100
 }
99
 }
101
 
100
 
102
 View::show_header('Invites', $JSIncludes);
101
 View::show_header('Invites', $JSIncludes);
103
 ?>
102
 ?>
104
 <div class="thin">
103
 <div class="thin">
105
   <div class="header">
104
   <div class="header">
106
-    <h2><?=Users::format_username($UserID, false, false, false)?> &gt; Invites</h2>
105
+    <h2><?=Users::format_username($UserID, false, false, false)?>
106
+      &gt; Invites</h2>
107
     <div class="linkbox">
107
     <div class="linkbox">
108
-      <a href="user.php?action=invitetree<? if ($Sneaky) { echo '&amp;userid='.$UserID; } ?>" class="brackets">Invite tree</a>
108
+      <a href="user.php?action=invitetree<?php if ($Sneaky) {
109
+    echo '&amp;userid='.$UserID;
110
+} ?>" class="brackets">Invite tree</a>
109
     </div>
111
     </div>
110
   </div>
112
   </div>
111
-<? if ($UserCount >= USER_LIMIT && !check_perms('site_can_invite_always')) { ?>
113
+  <?php if ($UserCount >= USER_LIMIT && !check_perms('site_can_invite_always')) { ?>
112
   <div class="box pad notice">
114
   <div class="box pad notice">
113
     <p>Because the user limit has been reached you are unable to send invites at this time.</p>
115
     <p>Because the user limit has been reached you are unable to send invites at this time.</p>
114
   </div>
116
   </div>
115
-<? }
117
+  <?php }
116
 
118
 
117
 /*
119
 /*
118
   Users cannot send invites if they:
120
   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
121
+    - Are on ratio watch
122
+    - Have disabled leeching
123
+    - Have disabled invites
124
+    - Have no invites (Unless have unlimited)
125
+    - Cannot 'invite always' and the user limit is reached
124
 */
126
 */
125
 
127
 
126
 $DB->query("
128
 $DB->query("
134
   && $CanLeech
136
   && $CanLeech
135
   && empty($LoggedUser['DisableInvites'])
137
   && empty($LoggedUser['DisableInvites'])
136
   && ($LoggedUser['Invites'] > 0 || check_perms('site_send_unlimited_invites'))
138
   && ($LoggedUser['Invites'] > 0 || check_perms('site_send_unlimited_invites'))
137
-  && ($UserCount <= USER_LIMIT || USER_LIMIT == 0 || check_perms('site_can_invite_always'))
139
+  && ($UserCount <= USER_LIMIT || USER_LIMIT === 0 || check_perms('site_can_invite_always'))
138
   ) { ?>
140
   ) { ?>
139
   <div class="box pad">
141
   <div class="box pad">
140
     <p>Do not trade or sell invites under any circumstances.</p>
142
     <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>
143
+    <p>You may invite anyone so long as you and they both lack malicious intent, but keep in mind that you are
144
+      responsible for anyone you invite. If you invite someone you don't know well and they surprise you by breaking the
145
+      rules or being a generally poor user, you will likely end up punished for it. For that reason, we stongly
146
+      recommend you only invite people you personally know and trust.
147
+      <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>
148
+      <p><em>Do not send an invite if you have not read or do not understand the information above.</em></p>
144
   </div>
149
   </div>
145
   <div class="box box2">
150
   <div class="box box2">
146
     <form class="send_form pad" name="invite" action="user.php" method="post">
151
     <form class="send_form pad" name="invite" action="user.php" method="post">
147
       <input type="hidden" name="action" value="take_invite" />
152
       <input type="hidden" name="action" value="take_invite" />
148
-      <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
153
+      <input type="hidden" name="auth"
154
+        value="<?=$LoggedUser['AuthKey']?>" />
149
       <div class="field_div">
155
       <div class="field_div">
150
-        <div class="label">Email address:</div>
156
+        <div class="label"><strong>Email Address</strong></div>
151
         <div class="input">
157
         <div class="input">
152
           <input type="email" name="email" size="60" />
158
           <input type="email" name="email" size="60" />
153
           <input type="submit" value="Invite" />
159
           <input type="submit" value="Invite" />
154
         </div>
160
         </div>
155
       </div>
161
       </div>
156
-<?  if (check_perms('users_invite_notes')) { ?>
162
+      <?php  if (check_perms('users_invite_notes')) { ?>
157
       <div class="field_div">
163
       <div class="field_div">
158
-        <div class="label">Staff Note:</div>
164
+        <div class="label"><strong>Staff Note</strong></div>
159
         <div class="input">
165
         <div class="input">
160
           <input type="text" name="reason" size="60" maxlength="255" />
166
           <input type="text" name="reason" size="60" maxlength="255" />
161
         </div>
167
         </div>
162
       </div>
168
       </div>
163
-<?  } ?>
169
+      <?php  } ?>
164
     </form>
170
     </form>
165
   </div>
171
   </div>
166
 
172
 
167
-<?
173
+  <?php
168
 } elseif (!empty($LoggedUser['DisableInvites'])) { ?>
174
 } elseif (!empty($LoggedUser['DisableInvites'])) { ?>
169
   <div class="box pad" style="text-align: center;">
175
   <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>
176
+    <strong class="important_text">Your invites have been disabled. Please read <a
177
+        href="wiki.php?action=article&amp;name=cantinvite">this article</a> for more information.</strong>
171
   </div>
178
   </div>
172
-<?
179
+  <?php
173
 } elseif ($LoggedUser['RatioWatch'] || !$CanLeech) { ?>
180
 } elseif ($LoggedUser['RatioWatch'] || !$CanLeech) { ?>
174
   <div class="box pad" style="text-align: center;">
181
   <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>
182
+    <strong class="important_text">You may not send invites while on Ratio Watch or while your leeching privileges are
183
+      disabled. Please read <a href="wiki.php?action=article&amp;name=cantinvite">this article</a> for more
184
+      information.</strong>
176
   </div>
185
   </div>
177
-<?
186
+  <?php
178
 }
187
 }
179
 
188
 
180
 if (!empty($Pending)) {
189
 if (!empty($Pending)) {
181
-?>
182
-  <h3>Pending invites</h3>
190
+    ?>
191
+  <h3>Pending Invites</h3>
183
   <div class="box">
192
   <div class="box">
184
     <table width="100%">
193
     <table width="100%">
185
       <tr class="colhead">
194
       <tr class="colhead">
186
-        <td>Email address</td>
187
-        <td>Expires in</td>
188
-        <td>Delete invite</td>
195
+        <td>Email Address</td>
196
+        <td>Expires In</td>
197
+        <td>Delete Invite</td>
189
       </tr>
198
       </tr>
190
-<?
199
+      <?php
191
   foreach ($Pending as $Invite) {
200
   foreach ($Pending as $Invite) {
192
-    list($InviteKey, $Email, $Expires) = $Invite;
193
-    $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
194
-?>
201
+      list($InviteKey, $Email, $Expires) = $Invite;
202
+      $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]'; ?>
195
       <tr class="row">
203
       <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>
204
+        <td><?=display_str($Email)?>
205
+        </td>
206
+        <td><?=time_diff($Expires)?>
207
+        </td>
208
+        <td><a
209
+            href="user.php?action=delete_invite&amp;invite=<?=$InviteKey?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
210
+            onclick="return confirm('Are you sure you want to delete this invite?');">Delete invite</a></td>
199
       </tr>
211
       </tr>
200
-<?  } ?>
212
+      <?php
213
+  } ?>
201
     </table>
214
     </table>
202
   </div>
215
   </div>
203
-<?
216
+  <?php
204
 }
217
 }
205
-
206
 ?>
218
 ?>
207
-  <h3>Invitee list</h3>
219
+
220
+  <h3>Invitee List</h3>
208
   <div class="box">
221
   <div class="box">
209
-    <table width="100%", class="invite_table">
222
+    <table width="100%" , class="invite_table">
210
       <tr class="colhead">
223
       <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>
224
+        <td><a
225
+            href="user.php?action=invite&amp;order=username&amp;sort=<?=(($CurrentOrder == 'username') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Username</a>
226
+        </td>
227
+        <td><a
228
+            href="user.php?action=invite&amp;order=email&amp;sort=<?=(($CurrentOrder == 'email') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Email</a>
229
+        </td>
230
+        <td><a
231
+            href="user.php?action=invite&amp;order=joined&amp;sort=<?=(($CurrentOrder == 'joined') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Joined</a>
232
+        </td>
233
+        <td><a
234
+            href="user.php?action=invite&amp;order=lastseen&amp;sort=<?=(($CurrentOrder == 'lastseen') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Last
235
+            Seen</a></td>
236
+        <td><a
237
+            href="user.php?action=invite&amp;order=uploaded&amp;sort=<?=(($CurrentOrder == 'uploaded') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Uploaded</a>
238
+        </td>
239
+        <td><a
240
+            href="user.php?action=invite&amp;order=downloaded&amp;sort=<?=(($CurrentOrder == 'downloaded') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Downloaded</a>
241
+        </td>
242
+        <td><a
243
+            href="user.php?action=invite&amp;order=ratio&amp;sort=<?=(($CurrentOrder == 'ratio') ? $NewSort : 'desc')?>&amp;<?=$CurrentURL ?>">Ratio</a>
244
+        </td>
218
       </tr>
245
       </tr>
219
-<?
246
+      <?php
220
   foreach ($Invited as $User) {
247
   foreach ($Invited as $User) {
221
-    list($ID, $Email, $Uploaded, $Downloaded, $JoinDate, $LastAccess) = $User;
222
-    $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]'
248
+      list($ID, $Email, $Uploaded, $Downloaded, $JoinDate, $LastAccess) = $User;
249
+      $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]'
223
 ?>
250
 ?>
224
       <tr class="row">
251
       <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>
252
+        <td><?=Users::format_username($ID, true, true, true, true)?>
253
+        </td>
254
+        <td><?=display_str($Email)?>
255
+        </td>
256
+        <td><?=time_diff($JoinDate, 1)?>
257
+        </td>
258
+        <td><?=time_diff($LastAccess, 1); ?>
259
+        </td>
260
+        <td><?=Format::get_size($Uploaded)?>
261
+        </td>
262
+        <td><?=Format::get_size($Downloaded)?>
263
+        </td>
264
+        <td><?=Format::get_ratio_html($Uploaded, $Downloaded)?>
265
+        </td>
232
       </tr>
266
       </tr>
233
-<?  } ?>
267
+      <?php
268
+  } ?>
234
     </table>
269
     </table>
235
   </div>
270
   </div>
236
 </div>
271
 </div>
237
-<? View::show_footer(); ?>
272
+<?php View::show_footer();

Loading…
Cancel
Save