Browse Source

Upload files to 'classes'

Stortebeker 7 months ago
parent
commit
bc83b3ade3

+ 0
- 0
classes/artist.class.php View File


+ 0
- 0
classes/artists.class.php View File


+ 23
- 14
classes/autoenable.class.php View File

@@ -11,10 +11,10 @@ class AutoEnable {
11 11
     const CACHE_KEY_NAME = 'num_enable_requests';
12 12
 
13 13
     // The default request rejected message
14
-    const REJECTED_MESSAGE = "Your request to re-enable your account has been rejected.<br />This may be because a request is already pending for your username, or because a recent request was denied.<br /><br />You are encouraged to discuss this with staff by visiting %s on %s";
14
+    const REJECTED_MESSAGE = "Your request to re-enable your account has been rejected.<br>This may be because a request is already pending for your username, or because a recent request was denied.<br><br>You are encouraged to discuss this with staff by visiting %s on %s";
15 15
 
16 16
     // The default request received message
17
-    const RECEIVED_MESSAGE = "Your request to re-enable your account has been received. You can expect a reply message in your email within 48 hours.<br />If you do not receive an email after 48 hours have passed, please visit us on IRC for assistance.";
17
+    const RECEIVED_MESSAGE = "Your request to re-enable your account has been received. Most requests are responded to within minutes. Remember to check your spam.<br>If you do not receive an email after 48 hours have passed, please visit us on IRC for assistance.";
18 18
 
19 19
     /**
20 20
      * Handle a new enable request
@@ -31,7 +31,7 @@ class AutoEnable {
31 31
 
32 32
         // Get the user's ID
33 33
         G::$DB->query("
34
-                SELECT um.ID
34
+                SELECT um.ID, ui.BanReason
35 35
                 FROM users_main AS um
36 36
                 JOIN users_info ui ON ui.UserID = um.ID
37 37
                 WHERE um.Username = '$Username'
@@ -39,7 +39,7 @@ class AutoEnable {
39 39
 
40 40
         if (G::$DB->has_results()) {
41 41
             // Make sure the user can make another request
42
-            list($UserID) = G::$DB->next_record();
42
+            list($UserID, $BanReason) = G::$DB->next_record();
43 43
             G::$DB->query("
44 44
             SELECT 1 FROM users_enable_requests
45 45
             WHERE UserID = '$UserID'
@@ -51,9 +51,8 @@ class AutoEnable {
51 51
                     OR
52 52
                     (
53 53
                       Timestamp > NOW() - INTERVAL 2 MONTH
54
-                        AND
55
-                          (Outcome = '".self::DENIED."'
56
-                             OR Outcome = '".self::DISCARDED."')
54
+                      AND
55
+                      Outcome = '".self::DENIED."'
57 56
                     )
58 57
                   )");
59 58
         }
@@ -75,12 +74,16 @@ class AutoEnable {
75 74
                 (UserID, Email, IP, UserAgent, Timestamp)
76 75
                 VALUES (?, ?, ?, ?, NOW())",
77 76
                 $UserID, Crypto::encrypt($Email), Crypto::encrypt($IP), $UserAgent);
77
+            $RequestID = G::$DB->inserted_id();
78 78
 
79 79
             // Cache the number of requests for the modbar
80 80
             G::$Cache->increment_value(self::CACHE_KEY_NAME);
81 81
             setcookie('username', '', time() - 60 * 60, '/', '', false);
82 82
             $Output = self::RECEIVED_MESSAGE;
83 83
             Tools::update_user_notes($UserID, sqltime() . " - Enable request " . G::$DB->inserted_id() . " received from $IP\n\n");
84
+            if ($BanReason == 3) {
85
+              //self::handle_requests([$RequestID], self::APPROVED, "Automatically approved (inactivity)");
86
+            }
84 87
         }
85 88
 
86 89
         return $Output;
@@ -140,8 +143,8 @@ class AutoEnable {
140 143
                     $Token = db_string(Users::make_secret());
141 144
                     G::$DB->query("
142 145
                         UPDATE users_enable_requests
143
-                        SET Token = '$Token'
144
-                        WHERE ID = '$ID'");
146
+                        SET Token = ?
147
+                        WHERE ID = ?", $Token, $ID);
145 148
                     $TPL->set('TOKEN', $Token);
146 149
                 }
147 150
 
@@ -159,11 +162,17 @@ class AutoEnable {
159 162
         }
160 163
 
161 164
         // User notes stuff
165
+        $StaffID = G::$LoggedUser['ID'] ?? 0;
162 166
         G::$DB->query("
163 167
             SELECT Username
164 168
             FROM users_main
165
-            WHERE ID = '" . G::$LoggedUser['ID'] . "'");
166
-        list($StaffUser) = G::$DB->next_record();
169
+            WHERE ID = ?", $StaffID);
170
+        if (G::$DB->has_results()) {
171
+          list($StaffUser) = G::$DB->next_record();
172
+        } else {
173
+          $StaffUser = "System";
174
+          $StaffID = 0;
175
+        }
167 176
 
168 177
         foreach ($UserInfo as $User) {
169 178
             list($ID, $UserID) = $User;
@@ -176,9 +185,9 @@ class AutoEnable {
176 185
         G::$DB->query("
177 186
                 UPDATE users_enable_requests
178 187
                 SET HandledTimestamp = NOW(),
179
-                    CheckedBy = '".G::$LoggedUser['ID']."',
180
-                    Outcome = '$Status'
181
-                WHERE ID IN (".implode(',', $IDs).")");
188
+                    CheckedBy = ?,
189
+                    Outcome = ?
190
+                WHERE ID IN (".implode(',', $IDs).")", $StaffID, $Status);
182 191
         G::$Cache->decrement_value(self::CACHE_KEY_NAME, count($IDs));
183 192
     }
184 193
 

+ 0
- 0
classes/badges.class.php View File


+ 0
- 0
classes/bencode.class.php View File


Loading…
Cancel
Save