Browse Source

Rename DBCrypt class to Crypto

spaghetti 7 years ago
parent
commit
53e3dca294
35 changed files with 95 additions and 95 deletions
  1. 3
    3
      classes/autoenable.class.php
  2. 2
    2
      classes/crypto.class.php
  3. 1
    1
      classes/misc.class.php
  4. 7
    7
      classes/script_start.php
  5. 1
    1
      design/privatefooter.php
  6. 1
    1
      sections/ajax/inbox/viewconv.php
  7. 1
    1
      sections/delete/delete_email.php
  8. 1
    1
      sections/delete/delete_ip.php
  9. 2
    2
      sections/delete/take_delete_email.php
  10. 2
    2
      sections/delete/take_delete_ip.php
  11. 1
    1
      sections/inbox/conversation.php
  12. 1
    1
      sections/inbox/get_post.php
  13. 8
    8
      sections/login/index.php
  14. 5
    5
      sections/register/index.php
  15. 1
    1
      sections/schedule/daily/disable_inactive_users.php
  16. 1
    1
      sections/schedule/manually/update_geodist.php
  17. 2
    2
      sections/tools/data/invite_pool.php
  18. 4
    4
      sections/tools/data/registration_log.php
  19. 2
    2
      sections/tools/managers/enable_requests.php
  20. 2
    2
      sections/tools/managers/expunge_requests.php
  21. 1
    1
      sections/tools/misc/create_user.php
  22. 4
    4
      sections/user/advancedsearch.php
  23. 1
    1
      sections/user/edit.php
  24. 2
    2
      sections/user/invite.php
  25. 1
    1
      sections/user/sessions.php
  26. 5
    5
      sections/user/take_edit.php
  27. 2
    2
      sections/user/take_invite.php
  28. 6
    6
      sections/user/takemoderate.php
  29. 4
    4
      sections/user/user.php
  30. 2
    2
      sections/userhistory/email_history.php
  31. 9
    9
      sections/userhistory/email_history2.php
  32. 4
    4
      sections/userhistory/email_history_userview.php
  33. 1
    1
      sections/userhistory/ip_history.php
  34. 4
    4
      sections/userhistory/ip_history_userview.php
  35. 1
    1
      sections/userhistory/password_history.php

+ 3
- 3
classes/autoenable.class.php View File

@@ -74,7 +74,7 @@ class AutoEnable {
74 74
                 INSERT INTO users_enable_requests
75 75
                 (UserID, Email, IP, UserAgent, Timestamp)
76 76
                 VALUES (?, ?, ?, ?, NOW())",
77
-                $UserID, DBCrypt::encrypt($Email), DBCrypt::encrypt($IP), $UserAgent);
77
+                $UserID, Crypto::encrypt($Email), Crypto::encrypt($IP), $UserAgent);
78 78
 
79 79
             // Cache the number of requests for the modbar
80 80
             G::$Cache->increment_value(self::CACHE_KEY_NAME);
@@ -132,7 +132,7 @@ class AutoEnable {
132 132
 
133 133
             foreach ($Results as $Result) {
134 134
                 list($Email, $ID, $UserID) = $Result;
135
-                $Email = DBCrypt::decrypt($Email);
135
+                $Email = Crypto::decrypt($Email);
136 136
                 $UserInfo[] = array($ID, $UserID);
137 137
 
138 138
                 if ($Status == self::APPROVED) {
@@ -264,7 +264,7 @@ class AutoEnable {
264 264
             } else {
265 265
                 // Good request, decrement cache value and enable account
266 266
                 G::$Cache->decrement_value(AutoEnable::CACHE_KEY_NAME);
267
-                $VisibleTrIP = ($Visible && DBCrypt::decrypt($IP) != '127.0.0.1') ? '1' : '0';
267
+                $VisibleTrIP = ($Visible && Crypto::decrypt($IP) != '127.0.0.1') ? '1' : '0';
268 268
                 Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $TorrentPass, 'visible' => $VisibleTrIP));
269 269
                 G::$DB->query("UPDATE users_main SET Enabled = '1', can_leech = '1' WHERE ID = '$UserID'");
270 270
                 G::$DB->query("UPDATE users_info SET BanReason = '0' WHERE UserID = '$UserID'");

classes/dbcrypt.class.php → classes/crypto.class.php View File

@@ -1,5 +1,5 @@
1 1
 <?
2
-class DBCrypt {
2
+class Crypto {
3 3
   /**
4 4
    * Encrypts input text for use in database
5 5
    *
@@ -10,7 +10,7 @@ class DBCrypt {
10 10
     if (apcu_exists('DBKEY')) {
11 11
       $iv_size = openssl_cipher_iv_length('AES-128-CBC');
12 12
       $iv = openssl_random_pseudo_bytes($iv_size);
13
-      $ret =  base64_encode($iv.openssl_encrypt($plaintext, 'AES-128-CBC', apcu_fetch('DBKEY'), OPENSSL_RAW_DATA, $iv));
13
+      $ret = base64_encode($iv.openssl_encrypt($plaintext, 'AES-128-CBC', apcu_fetch('DBKEY'), OPENSSL_RAW_DATA, $iv));
14 14
       return $ret;
15 15
     } else {
16 16
       return false;

+ 1
- 1
classes/misc.class.php View File

@@ -50,7 +50,7 @@ class Misc {
50 50
     $UnescapedSubject = $Subject;
51 51
     $UnescapedBody = $Body;
52 52
     $Subject = db_string($Subject);
53
-    $Body = DBCrypt::encrypt(substr($Body, 0, 49135)); // 49135 -> encryption -> 65536 (max length in mysql)
53
+    $Body = Crypto::encrypt(substr($Body, 0, 49135)); // 49135 -> encryption -> 65536 (max length in mysql)
54 54
     if ($ToID == 0) {
55 55
       // Don't allow users to send messages to the system
56 56
       return;

+ 7
- 7
classes/script_start.php View File

@@ -191,7 +191,7 @@ if (isset($_COOKIE['session']) && isset($_COOKIE['userid'])) {
191 191
       SET ";
192 192
     // Only update IP if we have an encryption key in memory
193 193
     if (apcu_exists('DBKEY')) {
194
-      $SessionQuery .= "IP = '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."', ";
194
+      $SessionQuery .= "IP = '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."', ";
195 195
     }
196 196
     $SessionQuery .=
197 197
        "Browser = '$Browser',
@@ -206,7 +206,7 @@ if (isset($_COOKIE['session']) && isset($_COOKIE['userid'])) {
206 206
         'SessionID' => $SessionID,
207 207
         'Browser' => $Browser,
208 208
         'OperatingSystem' => $OperatingSystem,
209
-        'IP' => (apcu_exists('DBKEY') ? DBCrypt::encrypt($_SERVER['REMOTE_ADDR']) : $UserSessions[$SessionID]['IP']),
209
+        'IP' => (apcu_exists('DBKEY') ? Crypto::encrypt($_SERVER['REMOTE_ADDR']) : $UserSessions[$SessionID]['IP']),
210 210
         'LastUpdate' => sqltime() );
211 211
     $Cache->insert_front($SessionID, $UsersSessionCache);
212 212
     $Cache->commit_transaction(0);
@@ -232,7 +232,7 @@ if (isset($_COOKIE['session']) && isset($_COOKIE['userid'])) {
232 232
 
233 233
   // IP changed
234 234
 
235
-  if (apcu_exists('DBKEY') && DBCrypt::decrypt($LoggedUser['IP']) != $_SERVER['REMOTE_ADDR'] && !check_perms('site_disable_ip_history')) {
235
+  if (apcu_exists('DBKEY') && Crypto::decrypt($LoggedUser['IP']) != $_SERVER['REMOTE_ADDR'] && !check_perms('site_disable_ip_history')) {
236 236
 
237 237
     if (Tools::site_ban_ip($_SERVER['REMOTE_ADDR'])) {
238 238
       error('Your IP address has been banned.');
@@ -246,7 +246,7 @@ if (isset($_COOKIE['session']) && isset($_COOKIE['userid'])) {
246 246
       WHERE EndTime IS NULL
247 247
         AND UserID = '$LoggedUser[ID]'");
248 248
     while (list($EncIP) = $DB->next_record()) {
249
-      if (DBCrypt::decrypt($EncIP) == $CurIP) {
249
+      if (Crypto::decrypt($EncIP) == $CurIP) {
250 250
         $CurIP = $EncIP;
251 251
         // CurIP is now the encrypted IP that was already in the database (for matching)
252 252
         break;
@@ -262,15 +262,15 @@ if (isset($_COOKIE['session']) && isset($_COOKIE['userid'])) {
262 262
       INSERT IGNORE INTO users_history_ips
263 263
         (UserID, IP, StartTime)
264 264
       VALUES
265
-        ('$LoggedUser[ID]', '".DBCrypt::encrypt($NewIP)."', NOW())");
265
+        ('$LoggedUser[ID]', '".Crypto::encrypt($NewIP)."', NOW())");
266 266
 
267 267
     $ipcc = Tools::geoip($NewIP);
268 268
     $DB->query("
269 269
       UPDATE users_main
270
-      SET IP = '".DBCrypt::encrypt($NewIP)."', ipcc = '$ipcc'
270
+      SET IP = '".Crypto::encrypt($NewIP)."', ipcc = '$ipcc'
271 271
       WHERE ID = '$LoggedUser[ID]'");
272 272
     $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
273
-    $Cache->update_row(false, array('IP' => DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])));
273
+    $Cache->update_row(false, array('IP' => Crypto::encrypt($_SERVER['REMOTE_ADDR'])));
274 274
     $Cache->commit_transaction(0);
275 275
 
276 276
 

+ 1
- 1
design/privatefooter.php View File

@@ -24,7 +24,7 @@
24 24
 <?  if (!empty($LastActive)) { ?>
25 25
   <p>
26 26
     <a href="user.php?action=sessions">
27
-      <span class="tooltip" title="Manage sessions">Last activity: </span><?=time_diff($LastActive['LastUpdate'])?><span class="tooltip" title="Manage sessions"> from <?=(apcu_exists('DBKEY')?(DBCrypt::decrypt($LastActive['IP'])):'[Encrypted]') ?></span>
27
+      <span class="tooltip" title="Manage sessions">Last activity: </span><?=time_diff($LastActive['LastUpdate'])?><span class="tooltip" title="Manage sessions"> from <?=(apcu_exists('DBKEY')?(Crypto::decrypt($LastActive['IP'])):'[Encrypted]') ?></span>
28 28
     </a>
29 29
   </p>
30 30
 <?  } ?>

+ 1
- 1
sections/ajax/inbox/viewconv.php View File

@@ -78,7 +78,7 @@ $DB->query("
78 78
 
79 79
 $JsonMessages = [];
80 80
 while (list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) {
81
-  $Body = apcu_exists('DBKEY') ? DBCrypt::decrypt($Body) : '[Encrypted]';
81
+  $Body = apcu_exists('DBKEY') ? Crypto::decrypt($Body) : '[Encrypted]';
82 82
   $JsonMessage = array(
83 83
     'messageId' => (int)$MessageID,
84 84
     'senderId' => (int)$SenderID,

+ 1
- 1
sections/delete/delete_email.php View File

@@ -24,7 +24,7 @@ View::show_header('Email Expunge Request');
24 24
   <table cellspacing="1" cellpadding="3" border="0" class="layout" width="100%">
25 25
     <tr>
26 26
       <td class="label">Email:</td>
27
-      <td><input type="text" size="30" value="<?=DBCrypt::decrypt($_GET['emails'][0])?>" disabled /></td>
27
+      <td><input type="text" size="30" value="<?=Crypto::decrypt($_GET['emails'][0])?>" disabled /></td>
28 28
     </tr>
29 29
     <tr>
30 30
       <td class="label">Reason (Optional):</td>

+ 1
- 1
sections/delete/delete_ip.php View File

@@ -24,7 +24,7 @@ View::show_header('IP Address Expunge Request');
24 24
   <table cellspacing="1" cellpadding="3" border="0" class="layout" width="100%">
25 25
     <tr>
26 26
       <td class="label">IP:</td>
27
-      <td><input type="text" size="30" value="<?=DBCrypt::decrypt($_GET['ips'][0])?>" disabled /></td>
27
+      <td><input type="text" size="30" value="<?=Crypto::decrypt($_GET['ips'][0])?>" disabled /></td>
28 28
     </tr>
29 29
     <tr>
30 30
       <td class="label">Reason (Optional):</td>

+ 2
- 2
sections/delete/take_delete_email.php View File

@@ -41,9 +41,9 @@ forEach ($EncEmails as $EncEmail) {
41 41
   }
42 42
 
43 43
   list($Curr) = $DB->next_record();
44
-  $Curr = DBCrypt::decrypt($Curr);
44
+  $Curr = Crypto::decrypt($Curr);
45 45
 
46
-  if ($Curr == DBCrypt::decrypt($EncEmail)) {
46
+  if ($Curr == Crypto::decrypt($EncEmail)) {
47 47
     error("You can't delete your current email.");
48 48
   }
49 49
 }

+ 2
- 2
sections/delete/take_delete_ip.php View File

@@ -41,9 +41,9 @@ forEach ($EncIPs as $EncIP) {
41 41
   }
42 42
 
43 43
   list($Curr) = $DB->next_record();
44
-  $Curr = DBCrypt::decrypt($Curr);
44
+  $Curr = Crypto::decrypt($Curr);
45 45
 
46
-  if ($Curr == DBCrypt::decrypt($EncIP)) {
46
+  if ($Curr == Crypto::decrypt($EncIP)) {
47 47
     error("You can't delete your current IP.");
48 48
   }
49 49
 }

+ 1
- 1
sections/inbox/conversation.php View File

@@ -83,7 +83,7 @@ $DB->query("
83 83
 <?
84 84
 
85 85
 while (list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) {
86
-  $Body = apcu_exists('DBKEY') ? DBCrypt::decrypt($Body) : '[Encrypted]';
86
+  $Body = apcu_exists('DBKEY') ? Crypto::decrypt($Body) : '[Encrypted]';
87 87
 ?>
88 88
   <div class="box vertical_space">
89 89
     <div class="head" style="overflow: hidden;">

+ 1
- 1
sections/inbox/get_post.php View File

@@ -27,7 +27,7 @@ $DB->query("
27 27
   WHERE m.ID = '$PostID'
28 28
     AND u.UserID = ".$LoggedUser['ID']);
29 29
 list($Body) = $DB->next_record(MYSQLI_NUM);
30
-$Body = apcu_exists('DBKEY') ? DBCrypt::decrypt($Body) : '[Encrypted]';
30
+$Body = apcu_exists('DBKEY') ? Crypto::decrypt($Body) : '[Encrypted]';
31 31
 
32 32
 // This gets sent to the browser, which echoes it wherever
33 33
 

+ 8
- 8
sections/login/index.php View File

@@ -52,7 +52,7 @@ if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'recover') {
52 52
       error('Database not fully decrypted. Please wait for staff to fix this and try again later');
53 53
     }
54 54
 
55
-    $Email = DBCrypt::decrypt($Email);
55
+    $Email = Crypto::decrypt($Email);
56 56
 
57 57
     if ($UserID && strtotime($Expires) > time()) {
58 58
       // If the user has requested a password change, and his key has not expired
@@ -80,7 +80,7 @@ if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'recover') {
80 80
             INSERT INTO users_history_passwords
81 81
               (UserID, ChangerIP, ChangeTime)
82 82
             VALUES
83
-              (?, ?, NOW())", $UserID, DBCrypt::encrypt($_SERVER['REMOTE_ADDR']));
83
+              (?, ?, NOW())", $UserID, Crypto::encrypt($_SERVER['REMOTE_ADDR']));
84 84
           $PassWasReset = true;
85 85
           $LoggedUser['ID'] = $UserID; // Set $LoggedUser['ID'] for logout_all_sessions() to work
86 86
           logout_all_sessions();
@@ -127,7 +127,7 @@ if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'recover') {
127 127
             Email
128 128
           FROM users_main");
129 129
         while(list($EncEmail) = $DB->next_record()) {
130
-          if (strtolower($_REQUEST['email']) == strtolower(DBCrypt::decrypt($EncEmail))) {
130
+          if (strtolower($_REQUEST['email']) == strtolower(Crypto::decrypt($EncEmail))) {
131 131
             break; // $EncEmail is now the encrypted form of the given email from the database
132 132
           }
133 133
         }
@@ -140,7 +140,7 @@ if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'recover') {
140 140
           FROM users_main
141 141
           WHERE Email = ?", $EncEmail);
142 142
         list($UserID, $Username, $Email) = $DB->next_record();
143
-        $Email = DBCrypt::decrypt($Email);
143
+        $Email = Crypto::decrypt($Email);
144 144
 
145 145
         if ($UserID) {
146 146
           // Email exists in the database
@@ -264,7 +264,7 @@ else {
264 264
                 $IPs = $DB->to_array(false, MYSQLI_NUM);
265 265
                 $QueryParts = [];
266 266
                 foreach ($IPs as $i => $IP) {
267
-                  $IPs[$i] = DBCrypt::decrypt($IP[0]);
267
+                  $IPs[$i] = Crypto::decrypt($IP[0]);
268 268
                 }
269 269
                 $IPs = array_unique($IPs);
270 270
                 if (count($IPs) > 0) { // Always allow first login
@@ -287,7 +287,7 @@ else {
287 287
                         FROM users_main
288 288
                         WHERE ID = ?", $UserID);
289 289
                       list($Username, $Email) = $DB->next_record();
290
-                      Users::auth_location($UserID, $Username, $CurrentASN, DBCrypt::decrypt($Email));
290
+                      Users::auth_location($UserID, $Username, $CurrentASN, Crypto::decrypt($Email));
291 291
                       require('newlocation.php');
292 292
                       die();
293 293
                     }
@@ -356,14 +356,14 @@ else {
356 356
                   INSERT INTO users_sessions
357 357
                     (UserID, SessionID, KeepLogged, Browser, OperatingSystem, IP, LastUpdate, FullUA)
358 358
                   VALUES
359
-                    ('$UserID', '".db_string($SessionID)."', '1', '$Browser', '$OperatingSystem', '".db_string(apcu_exists('DBKEY')?DBCrypt::encrypt($_SERVER['REMOTE_ADDR']):'0.0.0.0')."', NOW(), '".db_string($_SERVER['HTTP_USER_AGENT'])."')");
359
+                    ('$UserID', '".db_string($SessionID)."', '1', '$Browser', '$OperatingSystem', '".db_string(apcu_exists('DBKEY')?Crypto::encrypt($_SERVER['REMOTE_ADDR']):'0.0.0.0')."', NOW(), '".db_string($_SERVER['HTTP_USER_AGENT'])."')");
360 360
 
361 361
                 $Cache->begin_transaction("users_sessions_$UserID");
362 362
                 $Cache->insert_front($SessionID, [
363 363
                   'SessionID' => $SessionID,
364 364
                   'Browser' => $Browser,
365 365
                   'OperatingSystem' => $OperatingSystem,
366
-                  'IP' => (apcu_exists('DBKEY')?DBCrypt::encrypt($_SERVER['REMOTE_ADDR']):'0.0.0.0'),
366
+                  'IP' => (apcu_exists('DBKEY')?Crypto::encrypt($_SERVER['REMOTE_ADDR']):'0.0.0.0'),
367 367
                   'LastUpdate' => sqltime()
368 368
                 ]);
369 369
                 $Cache->commit_transaction(0);

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

@@ -80,7 +80,7 @@ if (!empty($_REQUEST['confirm'])) {
80 80
           $InviterID = 0;
81 81
         } else {
82 82
           list($InviterID, $InviteEmail, $InviteReason) = $DB->next_record(MYSQLI_NUM, false);
83
-          $InviteEmail = DBCrypt::decrypt($InviteEmail);
83
+          $InviteEmail = Crypto::decrypt($InviteEmail);
84 84
         }
85 85
       } else {
86 86
         $InviterID = 0;
@@ -114,7 +114,7 @@ if (!empty($_REQUEST['confirm'])) {
114 114
         INSERT INTO users_main
115 115
           (Username, Email, PassHash, torrent_pass, IP, PermissionID, Enabled, Invites, Uploaded, ipcc)
116 116
         VALUES
117
-          ('".db_string(trim($_POST['username']))."', '".DBCrypt::encrypt($_POST['email'])."', '".db_string(Users::make_sec_hash($_POST['password']))."', '".db_string($torrent_pass)."', '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."', '$Class', '$Enabled', '".STARTING_INVITES."', '1073741824', '$IPcc')");
117
+          ('".db_string(trim($_POST['username']))."', '".Crypto::encrypt($_POST['email'])."', '".db_string(Users::make_sec_hash($_POST['password']))."', '".db_string($torrent_pass)."', '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."', '$Class', '$Enabled', '".STARTING_INVITES."', '1073741824', '$IPcc')");
118 118
 
119 119
       $UserID = $DB->inserted_id();
120 120
 
@@ -150,7 +150,7 @@ if (!empty($_REQUEST['confirm'])) {
150 150
         INSERT INTO users_history_ips
151 151
           (UserID, IP, StartTime)
152 152
         VALUES
153
-          ('$UserID', '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."', NOW())");
153
+          ('$UserID', '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."', NOW())");
154 154
       $DB->query("
155 155
         INSERT INTO users_notifications_settings
156 156
           (UserID)
@@ -162,14 +162,14 @@ if (!empty($_REQUEST['confirm'])) {
162 162
         INSERT INTO users_history_emails
163 163
           (UserID, Email, Time, IP)
164 164
         VALUES
165
-          ('$UserID', '".DBCrypt::encrypt($_REQUEST['email'])."', NULL, '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."')");
165
+          ('$UserID', '".Crypto::encrypt($_REQUEST['email'])."', NULL, '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."')");
166 166
 
167 167
       if ($_REQUEST['email'] != $InviteEmail) {
168 168
         $DB->query("
169 169
           INSERT INTO users_history_emails
170 170
             (UserID, Email, Time, IP)
171 171
           VALUES
172
-            ('$UserID', '".DBCrypt::encrypt($InviteEmail)."', NOW(), '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."')");
172
+            ('$UserID', '".Crypto::encrypt($InviteEmail)."', NOW(), '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."')");
173 173
       }
174 174
 
175 175
 

+ 1
- 1
sections/schedule/daily/disable_inactive_users.php View File

@@ -17,7 +17,7 @@ if (apcu_exists('DBKEY')) {
17 17
       AND ul.UserID IS NULL
18 18
     GROUP BY um.ID");
19 19
   while (list($Username, $Email) = $DB->next_record()) {
20
-    $Email = DBCrypt::decrypt($Email);
20
+    $Email = Crypto::decrypt($Email);
21 21
     $Body = "Hi $Username,\n\nIt has been almost 4 months since you used your account at ".site_url().". This is an automated email to inform you that your account will be disabled in 10 days if you do not sign in.";
22 22
     Misc::send_email($Email, 'Your '.SITE_NAME.' account is about to be disabled', $Body);
23 23
   }

+ 1
- 1
sections/schedule/manually/update_geodist.php View File

@@ -2,7 +2,7 @@
2 2
 $IPs = [];
3 3
 $DB->query("SELECT IP FROM users_main WHERE Enabled = '1'");
4 4
 while(list($EncIP) = $DB->next_record()) {
5
-  $IPs[] = DBCrypt::decrypt($EncIP);
5
+  $IPs[] = Crypto::decrypt($EncIP);
6 6
 }
7 7
 $DB->query("CREATE TEMPORARY TABLE users_ips_decrypted (IP VARCHAR(45) NOT NULL)");
8 8
 $DB->query("INSERT INTO users_ips_decrypted (IP) VALUES('".implode("'),('", $IPs)."')");

+ 2
- 2
sections/tools/data/invite_pool.php View File

@@ -86,8 +86,8 @@ $DB->set_query_id($RS);
86 86
     </tr>
87 87
 <?
88 88
   while (list($UserID, $IP, $InviteKey, $Expires, $Email) = $DB->next_record()) {
89
-    $IP = apcu_exists('DBKEY') ? DBCrypt::decrypt($IP) : '[Encrypted]';
90
-    $Email = apcu_exists('DBKEY') ? DBCrypt::decrypt($Email) : '[Encrypted]';
89
+    $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
90
+    $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
91 91
 ?>
92 92
     <tr class="row">
93 93
       <td><?=Users::format_username($UserID, true, true, true, true)?></td>

+ 4
- 4
sections/tools/data/registration_log.php View File

@@ -109,10 +109,10 @@ if ($DB->has_results()) {
109 109
 <?
110 110
   while (list($UserID, $IP, $IPCC, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterIPCC, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses) = $DB->next_record()) {
111 111
   $RowClass = $IP === $InviterIP ? 'warning' : '';
112
-  $Email = apcu_exists('DBKEY') ? DBCrypt::decrypt($Email) : '[Encrypted]';
113
-  $IP = apcu_exists('DBKEY') ? DBCrypt::decrypt($IP) : '[Encrypted]';
114
-  $InviterEmail = apcu_exists('DBKEY') ? DBCrypt::decrypt($InviterEmail) : '[Encrypted]';
115
-  $InviterIP = apcu_exists('DBKEY') ? DBCrypt::decrypt($InviterIP) : '[Encrypted]';
112
+  $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
113
+  $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
114
+  $InviterEmail = apcu_exists('DBKEY') ? Crypto::decrypt($InviterEmail) : '[Encrypted]';
115
+  $InviterIP = apcu_exists('DBKEY') ? Crypto::decrypt($InviterIP) : '[Encrypted]';
116 116
 ?>
117 117
     <tr class="<?=$RowClass?>">
118 118
       <td><?=Users::format_username($UserID, true, true, true, true)?><br /><?=Users::format_username($InviterID, true, true, true, true)?></td>

+ 2
- 2
sections/tools/managers/enable_requests.php View File

@@ -274,9 +274,9 @@ if ($NumResults > 0) { ?>
274 274
 <?          } ?>
275 275
             </td>
276 276
             <td><?=Users::format_username($UserID)?></td>
277
-            <td><?=display_str(DBCrypt::decrypt($Email))?></td>
277
+            <td><?=display_str(Crypto::decrypt($Email))?></td>
278 278
 
279
-            <td><?=display_str(DBCrypt::decrypt($IP))?></td>
279
+            <td><?=display_str(Crypto::decrypt($IP))?></td>
280 280
 
281 281
             <td><?=display_str($UserAgent)?></td>
282 282
             <td><?=time_diff($Timestamp)?></td>

+ 2
- 2
sections/tools/managers/expunge_requests.php View File

@@ -46,7 +46,7 @@ if (isset($_GET['deny']) && isset($_GET['type']) && isset($_GET['value'])) {
46 46
         WHERE UserID = '$UserID'");
47 47
       $ToDelete = [];
48 48
       while (list($EncValue) = $DB->next_record()) {
49
-        if (DBCrypt::decrypt($Value) == DBCrypt::decrypt($EncValue)) {
49
+        if (Crypto::decrypt($Value) == Crypto::decrypt($EncValue)) {
50 50
           $ToDelete[] = $EncValue;
51 51
         }
52 52
       }
@@ -95,7 +95,7 @@ View::show_header("Expunge Requests");
95 95
     <tr>
96 96
       <td><?=Users::format_username($Request['UserID'])?></td>
97 97
       <td><?=$Request['Type']?></td>
98
-      <td><?=DBCrypt::decrypt($Request['Value'])?></td>
98
+      <td><?=Crypto::decrypt($Request['Value'])?></td>
99 99
       <td><?=display_str($Request['Reason'])?></td>
100 100
       <td><a href="tools.php?action=expunge_requests&auth=<?=$LoggedUser['AuthKey']?>&type=<?=strtolower($Request['Type'])?>&value=<?=urlencode($Request['Value'])?>&userid=<?=$Request['UserID']?>&deny=false" class="brackets">Accept</a></td>
101 101
       <td><a href="tools.php?action=expunge_requests&auth=<?=$LoggedUser['AuthKey']?>&type=<?=strtolower($Request['Type'])?>&value=<?=urlencode($Request['Value'])?>&userid=<?=$Request['UserID']?>&deny=true" class="brackets">Deny</a></td>

+ 1
- 1
sections/tools/misc/create_user.php View File

@@ -28,7 +28,7 @@ if (isset($_POST['Username'])) {
28 28
       INSERT INTO users_main
29 29
         (Username, Email, PassHash, torrent_pass, Enabled, PermissionID)
30 30
       VALUES
31
-        ('".db_string($Username)."', '".DBCrypt::encrypt($Email)."', '".db_string(Users::make_sec_hash($Password))."', '".db_string($torrent_pass)."', '1', '".USER."')");
31
+        ('".db_string($Username)."', '".Crypto::encrypt($Email)."', '".db_string(Users::make_sec_hash($Password))."', '".db_string($torrent_pass)."', '1', '".USER."')");
32 32
 
33 33
     //Increment site user count
34 34
     $Cache->increment('stats_user_count');

+ 4
- 4
sections/user/advancedsearch.php View File

@@ -804,7 +804,7 @@ if ($RunQuery) {
804 804
       $DB->query("SELECT ID, IP FROM users_main");
805 805
     }
806 806
     while(list($ID, $EncIP) = $DB->next_record()) {
807
-      $IPs[] = $ID.", '".DBCrypt::decrypt($EncIP)."'";
807
+      $IPs[] = $ID.", '".Crypto::decrypt($EncIP)."'";
808 808
     }
809 809
     $DB->query("CREATE TEMPORARY TABLE users_ips_decrypted (ID INT(10) UNSIGNED NOT NULL, IP VARCHAR(45) NOT NULL, PRIMARY KEY (ID,IP)) ENGINE=MEMORY");
810 810
     $DB->query("INSERT IGNORE INTO users_ips_decrypted (ID, IP) VALUES(".implode("),(", $IPs).")");
@@ -819,7 +819,7 @@ if ($RunQuery) {
819 819
       $DB->query("SELECT ID, Email FROM users_main");
820 820
     }
821 821
     while(list($ID, $EncEmail) = $DB->next_record()) {
822
-      $Emails[] = $ID.", '".DBCrypt::decrypt($EncEmail)."'";
822
+      $Emails[] = $ID.", '".Crypto::decrypt($EncEmail)."'";
823 823
     }
824 824
     $DB->query("CREATE TEMPORARY TABLE users_emails_decrypted (ID INT(10) UNSIGNED NOT NULL, Email VARCHAR(255) NOT NULL, PRIMARY KEY (ID,Email)) ENGINE=MEMORY");
825 825
     $DB->query("INSERT IGNORE INTO users_emails_decrypted (ID, Email) VALUES(".implode("),(", $Emails).")");
@@ -866,8 +866,8 @@ echo $Pages;
866 866
     </tr>
867 867
 <?
868 868
 while (list($UserID, $Username, $Uploaded, $Downloaded, $Snatched, $Invitees, $Class, $Email, $Enabled, $IP, $Invites, $DisableInvites, $Warned, $Donor, $JoinDate, $LastAccess) = $DB->next_record()) {
869
-  $IP = apcu_exists('DBKEY') ? DBCrypt::decrypt($IP) : '[Encrypted]';
870
-  $Email = apcu_exists('DBKEY') ? DBCrypt::decrypt($Email) : '[Encrypted]';
869
+  $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
870
+  $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
871 871
 ?>
872 872
     <tr>
873 873
       <td><?=Users::format_username($UserID, true, true, true, true)?></td>

+ 1
- 1
sections/user/edit.php View File

@@ -29,7 +29,7 @@ list($Username, $TwoFactor, $PublicKey, $Email, $IRCKey, $Paranoia, $Info, $Avat
29 29
 
30 30
 $TwoFA = new TwoFactorAuth();
31 31
 
32
-$Email = apcu_exists('DBKEY') ? DBCrypt::decrypt($Email) : '[Encrypted]';
32
+$Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
33 33
 
34 34
 if ($UserID != $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Class)) {
35 35
   error(403);

+ 2
- 2
sections/user/invite.php View File

@@ -190,7 +190,7 @@ if (!empty($Pending)) {
190 190
 <?
191 191
   foreach ($Pending as $Invite) {
192 192
     list($InviteKey, $Email, $Expires) = $Invite;
193
-    $Email = apcu_exists('DBKEY') ? DBCrypt::decrypt($Email) : '[Encrypted]';
193
+    $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
194 194
 ?>
195 195
       <tr class="row">
196 196
         <td><?=display_str($Email)?></td>
@@ -219,7 +219,7 @@ if (!empty($Pending)) {
219 219
 <?
220 220
   foreach ($Invited as $User) {
221 221
     list($ID, $Email, $Uploaded, $Downloaded, $JoinDate, $LastAccess) = $User;
222
-    $Email = apcu_exists('DBKEY') ? DBCrypt::decrypt($Email) : '[Encrypted]'
222
+    $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]'
223 223
 ?>
224 224
       <tr class="row">
225 225
         <td><?=Users::format_username($ID, true, true, true, true)?></td>

+ 1
- 1
sections/user/sessions.php View File

@@ -73,7 +73,7 @@ View::show_header($Username.' &gt; Sessions');
73 73
 <?
74 74
   foreach ($UserSessions as $Session) {
75 75
     list($ThisSessionID, $Browser, $OperatingSystem, $IP, $LastUpdate) = array_values($Session);
76
-    $IP = apcu_exists('DBKEY') ? DBCrypt::decrypt($IP) : '[Encrypted]';
76
+    $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
77 77
 ?>
78 78
       <tr class="row">
79 79
         <td class="nobr"><?=$IP?></td>

+ 5
- 5
sections/user/take_edit.php View File

@@ -149,7 +149,7 @@ function require_password($Setting = false) {
149 149
 }
150 150
 
151 151
 // Email change
152
-$CurEmail = DBCrypt::decrypt($CurEmail);
152
+$CurEmail = Crypto::decrypt($CurEmail);
153 153
 if ($CurEmail != $_POST['email']) {
154 154
 
155 155
   // Non-admins have to authenticate to change email
@@ -167,7 +167,7 @@ if ($CurEmail != $_POST['email']) {
167 167
     INSERT INTO users_history_emails
168 168
       (UserID, Email, Time, IP)
169 169
     VALUES
170
-      (?, ?, NULL, ?)", $UserID, DBCrypt::encrypt($_POST['email']), DBCrypt::encrypt($_SERVER['REMOTE_ADDR']));
170
+      (?, ?, NULL, ?)", $UserID, Crypto::encrypt($_POST['email']), Crypto::encrypt($_SERVER['REMOTE_ADDR']));
171 171
 
172 172
 }
173 173
 
@@ -300,12 +300,12 @@ $SQL = "
300 300
     i.Info = '".db_string($_POST['info'])."',
301 301
     i.InfoTitle = '".db_string($_POST['profile_title'])."',
302 302
     i.UnseededAlerts = '$UnseededAlerts',
303
-    m.Email = '".DBCrypt::encrypt($_POST['email'])."',
303
+    m.Email = '".Crypto::encrypt($_POST['email'])."',
304 304
     m.IRCKey = '".db_string($_POST['irckey'])."',
305 305
     m.Paranoia = '".db_string(json_encode($Paranoia))."'";
306 306
 
307 307
 if ($ResetPassword) {
308
-  $ChangerIP = DBCrypt::encrypt($LoggedUser['IP']);
308
+  $ChangerIP = Crypto::encrypt($LoggedUser['IP']);
309 309
   $PassHash = Users::make_sec_hash($_POST['new_pass_1']);
310 310
   $SQL.= ",m.PassHash = '".db_string($PassHash)."'";
311 311
   $DB->query("
@@ -320,7 +320,7 @@ if (isset($_POST['resetpasskey'])) {
320 320
   $UserInfo = Users::user_heavy_info($UserID);
321 321
   $OldPassKey = $UserInfo['torrent_pass'];
322 322
   $NewPassKey = Users::make_secret();
323
-  $ChangerIP = DBCrypt::encrypt($LoggedUser['IP']);
323
+  $ChangerIP = Crypto::encrypt($LoggedUser['IP']);
324 324
   $SQL .= ",m.torrent_pass = '$NewPassKey'";
325 325
   $DB->query("
326 326
     INSERT INTO users_history_passkeys

+ 2
- 2
sections/user/take_invite.php View File

@@ -70,7 +70,7 @@ foreach ($Emails as $CurEmail) {
70 70
     WHERE InviterID = ".$LoggedUser['ID']);
71 71
   if ($DB->has_results()) {
72 72
     while (list($MaybeEmail) = $DB->next_record()) {
73
-      if (DBCrypt::decrypt($MaybeEmail) == $CurEmail) {
73
+      if (Crypto::decrypt($MaybeEmail) == $CurEmail) {
74 74
         error('You already have a pending invite to that address!');
75 75
         header('Location: user.php?action=invite');
76 76
         die();
@@ -103,7 +103,7 @@ EOT;
103 103
     INSERT INTO invites
104 104
       (InviterID, InviteKey, Email, Expires, Reason)
105 105
     VALUES
106
-      ('$LoggedUser[ID]', '$InviteKey', '".DBCrypt::encrypt($CurEmail)."', '$InviteExpires', '$InviteReason')");
106
+      ('$LoggedUser[ID]', '$InviteKey', '".Crypto::encrypt($CurEmail)."', '$InviteExpires', '$InviteReason')");
107 107
 
108 108
   if (!check_perms('site_send_unlimited_invites')) {
109 109
     $DB->query("

+ 6
- 6
sections/user/takemoderate.php View File

@@ -233,7 +233,7 @@ if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
233 233
 
234 234
 if ($_POST['ResetIPHistory'] && check_perms('users_edit_reset_keys')) {
235 235
 
236
-  $GenericIP = DBCrypt::encrypt('127.0.0.1');
236
+  $GenericIP = Crypto::encrypt('127.0.0.1');
237 237
   $DB->query("
238 238
     DELETE FROM users_history_ips
239 239
     WHERE UserID = '$UserID'");
@@ -268,17 +268,17 @@ if ($_POST['ResetEmailHistory'] && check_perms('users_edit_reset_keys')) {
268 268
       INSERT INTO users_history_emails
269 269
         (UserID, Email, Time, IP)
270 270
       VALUES
271
-        ('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."', NULL, '".DBCrypt::encrypt('127.0.0.1')."')");
271
+        ('$UserID', '".Crypto::encrypt($Username.'@'.SITE_DOMAIN)."', NULL, '".Crypto::encrypt('127.0.0.1')."')");
272 272
   } else {
273 273
     $DB->query("
274 274
       INSERT INTO users_history_emails
275 275
         (UserID, Email, Time, IP)
276 276
       VALUES
277
-        ('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."', NULL, '".$Cur['IP']."')");
277
+        ('$UserID', '".Crypto::encrypt($Username.'@'.SITE_DOMAIN)."', NULL, '".$Cur['IP']."')");
278 278
   }
279 279
   $DB->query("
280 280
     UPDATE users_main
281
-    SET Email = '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."'
281
+    SET Email = '".Crypto::encrypt($Username.'@'.SITE_DOMAIN)."'
282 282
     WHERE ID = '$UserID'");
283 283
   $EditSummary[] = 'Email history cleared';
284 284
 }
@@ -696,7 +696,7 @@ if ($EnableUser != $Cur['Enabled'] && check_perms('users_disable_users')) {
696 696
     $TrackerUserUpdates = [];
697 697
   } elseif ($EnableUser == '1') {
698 698
     $Cache->increment('stats_user_count');
699
-    $VisibleTrIP = ($Visible && DBCrypt::decrypt($Cur['IP']) != '127.0.0.1') ? '1' : '0';
699
+    $VisibleTrIP = ($Visible && Crypto::decrypt($Cur['IP']) != '127.0.0.1') ? '1' : '0';
700 700
     Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP));
701 701
 
702 702
     if (($Cur['Downloaded'] == 0) || ($Cur['Uploaded'] / $Cur['Downloaded'] >= $Cur['RequiredRatio'])) {
@@ -734,7 +734,7 @@ if ($ResetPasskey == 1 && check_perms('users_edit_reset_keys')) {
734 734
     INSERT INTO users_history_passkeys
735 735
       (UserID, OldPassKey, NewPassKey, ChangerIP, ChangeTime)
736 736
     VALUES
737
-      ('$UserID', '".$Cur['torrent_pass']."', '$Passkey', '".DBCrypt::encrypt('0.0.0.0')."', NOW())");
737
+      ('$UserID', '".$Cur['torrent_pass']."', '$Passkey', '".Crypto::encrypt('0.0.0.0')."', NOW())");
738 738
   Tracker::update_tracker('change_passkey', array('oldpasskey' => $Cur['torrent_pass'], 'newpasskey' => $Passkey));
739 739
 }
740 740
 

+ 4
- 4
sections/user/user.php View File

@@ -133,7 +133,7 @@ $RequiredRatio, $Enabled, $Paranoia, $Invites, $CustomTitle, $torrent_pass,
133 133
 $DisableLeech, $JoinDate, $Info, $Avatar, $FLTokens, $BonusPoints, $IRCLines, $Donor, $Warned,
134 134
 $ForumPosts, $InviterID, $DisableInvites, $InviterName, $InfoTitle) = $DB->next_record(MYSQLI_NUM, array(9, 11));
135 135
 }
136
-$Email = apcu_exists('DBKEY') ? DBCrypt::decrypt($Email) : '[Encrypted]';
136
+$Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
137 137
 
138 138
 $DB->query("
139 139
   SELECT SUM(t.Size)
@@ -589,7 +589,7 @@ if ($ParanoiaLevel == 0) {
589 589
 <?  }
590 590
 
591 591
 if (check_perms('users_view_ips', $Class)) {
592
-  $IP = apcu_exists('DBKEY') ? DBCrypt::decrypt($IP) : '[Encrypted]';
592
+  $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
593 593
 ?>
594 594
         <li>IP: <?=Tools::display_ip($IP)?></li>
595 595
         <li>Host: <?=Tools::get_host_by_ajax($IP)?></li>
@@ -1426,8 +1426,8 @@ if (!$DisablePoints) {
1426 1426
 <?
1427 1427
       foreach ($Emails as $Email) {
1428 1428
         list($Address, $IP) = $Email;
1429
-        $IP = apcu_exists('DBKEY') ? DBCrypt::decrypt($IP) : '[Encrypted]';
1430
-        $Address = apcu_exists('DBKEY') ? DBCrypt::decrypt($Address) : '[Encrypted]';
1429
+        $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
1430
+        $Address = apcu_exists('DBKEY') ? Crypto::decrypt($Address) : '[Encrypted]';
1431 1431
 ?>
1432 1432
             <option value="<?=display_str($Address)?>"><?=display_str($Address)?> - <?=display_str($IP)?></option>
1433 1433
 <?    } ?>

+ 2
- 2
sections/userhistory/email_history.php View File

@@ -109,7 +109,7 @@ foreach ($History as $Key => $Values) {
109 109
     $Values['Time'] = $Joined;
110 110
   }
111 111
 
112
-  $ValuesIP = apcu_exists('DBKEY') ? DBCrypt::decrypt($Values['IP']) : '[Encrypted]';
112
+  $ValuesIP = apcu_exists('DBKEY') ? Crypto::decrypt($Values['IP']) : '[Encrypted]';
113 113
 ?>
114 114
   <tr class="row">
115 115
     <td><?=display_str($Values['Email'])?></td>
@@ -128,7 +128,7 @@ foreach ($History as $Key => $Values) {
128 128
             AND ue.UserID != $UserID
129 129
             AND um.ID = ue.UserID");
130 130
     while (list($UserID2, $Time, $IP) = $DB->next_record()) {
131
-      $IP = apcu_exists('DBKEY') ? DBCrypt::decrypt($IP) : '[Encrypted]';
131
+      $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
132 132
 ?>
133 133
   </tr>
134 134
   <tr>

+ 9
- 9
sections/userhistory/email_history2.php View File

@@ -182,9 +182,9 @@ if ($Old ?? false) {
182 182
       <td>Set from IP</td>
183 183
     </tr>
184 184
 <?
185
-$Current['Email'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Current['Email']) : '[Encrypted]';
186
-$Current['CurrentIP'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Current['CurrentIP']) : '[Encrypted]';
187
-$Current['IP'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Current['IP']) : '[Encrypted]';
185
+$Current['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['Email']) : '[Encrypted]';
186
+$Current['CurrentIP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['CurrentIP']) : '[Encrypted]';
187
+$Current['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['IP']) : '[Encrypted]';
188 188
 ?>
189 189
     <tr class="row">
190 190
       <td><?=display_str($Current['Email'])?></td>
@@ -211,7 +211,7 @@ $Current['IP'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Current['IP']) : '[Enc
211 211
 if ($CurrentMatches ?? false) {
212 212
   // Match on the current email
213 213
   foreach ($CurrentMatches as $Match) {
214
-    $Match['IP'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Match['IP']) : '[Encrypted]';
214
+    $Match['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Match['IP']) : '[Encrypted]';
215 215
 ?>
216 216
     <tr class="row">
217 217
       <td><?=$Match['Username']?></td>
@@ -279,8 +279,8 @@ if ($Old ?? false) {
279 279
     $Matches = ob_get_contents();
280 280
     ob_end_clean();
281 281
 
282
-    $Record['Email'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Record['Email']) : '[Encrypted]';
283
-    $Record['IP'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Record['IP']) : '[Encrypted]';
282
+    $Record['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Record['Email']) : '[Encrypted]';
283
+    $Record['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Record['IP']) : '[Encrypted]';
284 284
 ?>
285 285
     <tr class="row">
286 286
       <td><?=display_str($Record['Email'])?><?=(($MatchCount > 0) ? ' <a data-toggle-target="#matches_'.$j.'">('.$MatchCount.')</a>' : '')?></td>
@@ -325,7 +325,7 @@ if ($OldMatches ?? false) {
325 325
       ++$i;
326 326
       // Match email is the same as the invite email
327 327
 
328
-      $Match['IP'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Match['IP']) : '[Encrypted]';
328
+      $Match['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Match['IP']) : '[Encrypted]';
329 329
 ?>
330 330
     <tr class="row hidden" id="matches_invite">
331 331
       <td><?=$Match['Username']?></td>
@@ -349,8 +349,8 @@ $MatchCount = $i;
349 349
 $Matches = ob_get_contents();
350 350
 ob_end_clean();
351 351
 
352
-$Invite['Email'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Invite['Email']) : '[Encrypted]';
353
-$Invite['IP'] = apcu_exists('DBKEY') ? DBCrypt::decrypt($Invite['IP']) : '[Encrypted]';
352
+$Invite['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Invite['Email']) : '[Encrypted]';
353
+$Invite['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Invite['IP']) : '[Encrypted]';
354 354
 ?>
355 355
     <tr class="row">
356 356
       <td><?=display_str($Invite['Email'])?><?=(($MatchCount > 0) ? ' <a data-toggle-target="#matches_invite">('.$MatchCount.')</a>' : '')?></td>

+ 4
- 4
sections/userhistory/email_history_userview.php View File

@@ -23,10 +23,10 @@ $EncEmails = $DB->collect("Email");
23 23
 $Emails = [];
24 24
 
25 25
 foreach ($EncEmails as $Enc) {
26
-  if (!isset($Emails[DBCrypt::decrypt($Enc)])) {
27
-    $Emails[DBCrypt::decrypt($Enc)] = [];
26
+  if (!isset($Emails[Crypto::decrypt($Enc)])) {
27
+    $Emails[Crypto::decrypt($Enc)] = [];
28 28
   }
29
-  $Emails[DBCrypt::decrypt($Enc)][] = $Enc;
29
+  $Emails[Crypto::decrypt($Enc)][] = $Enc;
30 30
 }
31 31
 
32 32
 $DB->query("
@@ -35,7 +35,7 @@ $DB->query("
35 35
   WHERE ID = '$UserID'");
36 36
 
37 37
 list($Curr) = $DB->next_record();
38
-$Curr = DBCrypt::decrypt($Curr);
38
+$Curr = Crypto::decrypt($Curr);
39 39
 
40 40
 if (!$Self) {
41 41
   $DB->query("SELECT Username FROM users_main WHERE ID = '$UserID'");

+ 1
- 1
sections/userhistory/ip_history.php View File

@@ -187,7 +187,7 @@ $CanManageIPBans = check_perms('admin_manage_ipbans');
187 187
 foreach ($Results as $Index => $Result) {
188 188
   list($IP, $StartTime, $EndTime, $UserIDs, $UserStartTimes, $UserEndTimes, $Usernames, $UsersEnabled, $UsersDonor, $UsersWarned) = $Result;
189 189
 
190
-  $IP = apcu_exists('DBKEY') ? DBCrypt::decrypt($IP) : '[Encrypted]';
190
+  $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
191 191
 
192 192
   $HasDupe = false;
193 193
   $UserIDs = explode('|', $UserIDs);

+ 4
- 4
sections/userhistory/ip_history_userview.php View File

@@ -23,10 +23,10 @@ $EncIPs = $DB->collect("IP");
23 23
 $IPs = [];
24 24
 
25 25
 foreach ($EncIPs as $Enc) {
26
-  if (!isset($IPs[DBCrypt::decrypt($Enc)])) {
27
-    $IPs[DBCrypt::decrypt($Enc)] = [];
26
+  if (!isset($IPs[Crypto::decrypt($Enc)])) {
27
+    $IPs[Crypto::decrypt($Enc)] = [];
28 28
   }
29
-  $IPs[DBCrypt::decrypt($Enc)][] = $Enc;
29
+  $IPs[Crypto::decrypt($Enc)][] = $Enc;
30 30
 }
31 31
 
32 32
 $DB->query("
@@ -35,7 +35,7 @@ $DB->query("
35 35
   WHERE ID = '$UserID'");
36 36
 
37 37
 list($Curr) = $DB->next_record();
38
-$Curr = DBCrypt::decrypt($Curr);
38
+$Curr = Crypto::decrypt($Curr);
39 39
 
40 40
 if (!$Self) {
41 41
   $DB->query("SELECT Username FROM users_main WHERE ID = '$UserID'");

+ 1
- 1
sections/userhistory/password_history.php View File

@@ -49,7 +49,7 @@ $DB->query("
49 49
   </tr>
50 50
 <?
51 51
 while (list($ChangeTime, $ChangerIP) = $DB->next_record()) {
52
-  $ChangerIP = (apcu_exists('DBKEY')) ? DBCrypt::decrypt($ChangerIP) : '[Encrypted]';
52
+  $ChangerIP = (apcu_exists('DBKEY')) ? Crypto::decrypt($ChangerIP) : '[Encrypted]';
53 53
 ?>
54 54
   <tr class="row">
55 55
     <td><?=time_diff($ChangeTime)?></td>

Loading…
Cancel
Save