Browse Source

Remove GeoIP features and data

biotorrents 4 years ago
parent
commit
67aa729cc8

+ 2
- 3
classes/permissions_form.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+declare(strict_types=1);
2 3
 
3 4
 /********************************************************************************
4 5
  ************ Permissions form ********************** user.php and tools.php ****
@@ -98,7 +99,6 @@ $PermissionsArray = array(
98 99
   'admin_schedule' => 'Can run the site schedule.',
99 100
   'admin_login_watch' => 'Can manage login watch.',
100 101
   'admin_manage_wiki' => 'Can manage wiki access.',
101
-  'admin_update_geoip' => 'Can update geoIP data.',
102 102
   'site_collages_recover' => 'Can recover \'deleted\' collages.',
103 103
   'torrents_add_artist' => 'Can add artists to any group.',
104 104
   'edit_unknowns' => 'Can edit unknown release information.',
@@ -261,8 +261,7 @@ function permissions_form()
261 261
     display_perm('admin_manage_permissions', 'Can edit permission classes/user permissions.');
262 262
     display_perm('admin_schedule', 'Can run the site schedule.');
263 263
     display_perm('admin_login_watch', 'Can manage login watch.');
264
-    display_perm('admin_manage_wiki', 'Can manage wiki access.');
265
-    display_perm('admin_update_geoip', 'Can update geoIP data.'); ?>
264
+    display_perm('admin_manage_wiki', 'Can manage wiki access.'); ?>
266 265
         </td>
267 266
       </tr>
268 267
     </table>

+ 0
- 6
classes/script_start.php View File

@@ -417,12 +417,6 @@ if (isset($_COOKIE['session']) && isset($_COOKIE['userid'])) {
417 417
         VALUES
418 418
           ('$LoggedUser[ID]', '".Crypto::encrypt($NewIP)."', NOW())");
419 419
 
420
-        $ipcc = Tools::geoip($NewIP);
421
-        $DB->query("
422
-        UPDATE users_main
423
-        SET IP = '".Crypto::encrypt($NewIP)."', ipcc = '$ipcc'
424
-          WHERE ID = '$LoggedUser[ID]'");
425
-
426 420
         $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
427 421
         $Cache->update_row(false, array('IP' => Crypto::encrypt($_SERVER['REMOTE_ADDR'])));
428 422
         $Cache->commit_transaction(0);

+ 2
- 50
classes/tools.class.php View File

@@ -1,6 +1,6 @@
1 1
 <?php
2
+#declare(strict_types=1);
2 3
 
3
-# todo: Check strick equality gently
4 4
 class Tools
5 5
 {
6 6
     /**
@@ -60,45 +60,6 @@ class Tools
60 60
         return $IPnum;
61 61
     }
62 62
 
63
-    /**
64
-     * Geolocate an IP address using the database
65
-     *
66
-     * @param $IP the ip to fetch the country for
67
-     * @return the country of origin
68
-     */
69
-    public static function geoip($IP)
70
-    {
71
-        static $IPs = [];
72
-        if (isset($IPs[$IP])) {
73
-            return $IPs[$IP];
74
-        }
75
-
76
-        if (is_number($IP)) {
77
-            $Long = $IP;
78
-        } else {
79
-            $Long = Tools::ip_to_unsigned($IP);
80
-        }
81
-
82
-        if (!$Long || $Long == 2130706433) { // No need to check cc for 127.0.0.1
83
-            return false;
84
-        }
85
-
86
-        $QueryID = G::$DB->get_query_id();
87
-        G::$DB->query("
88
-        SELECT EndIP, Code
89
-        FROM geoip_country
90
-          WHERE $Long >= StartIP
91
-          ORDER BY StartIP DESC
92
-          LIMIT 1");
93
-
94
-        if ((!list($EndIP, $Country) = G::$DB->next_record()) || $EndIP < $Long) {
95
-            $Country = '?';
96
-        }
97
-
98
-        G::$DB->set_query_id($QueryID);
99
-        $IPs[$IP] = $Country;
100
-        return $Country;
101
-    }
102 63
 
103 64
     /**
104 65
      * Gets the hostname for an IP address
@@ -169,16 +130,7 @@ class Tools
169 130
      */
170 131
     public static function display_ip($IP)
171 132
     {
172
-        $Line = display_str($IP).' ('.Tools::get_country_code_by_ajax($IP).') ';
173
-        $Line .= '<a href="user.php?action=search&amp;ip_history=on&amp;ip='.display_str($IP).'&amp;matchtype=strict" title="Search" class="brackets tooltip">S</a>';
174
-        return $Line;
175
-    }
176
-
177
-    public static function get_country_code_by_ajax($IP)
178
-    {
179
-        static $ID = 0;
180
-        ++$ID;
181
-        return '<span id="cc_'.$ID.'">Resolving CC...<script type="text/javascript">ajax.get(\'tools.php?action=get_cc&ip='.$IP.'\', function(cc) {$(\'#cc_'.$ID.'\').raw().innerHTML = cc;});</script></span>';
133
+        return $Line = '<a href="user.php?action=search&amp;ip_history=on&amp;ip='.display_str($IP).'&amp;matchtype=strict" title="Search" class="brackets tooltip">S</a>';
182 134
     }
183 135
 
184 136
 

+ 0
- 1
classes/util.php View File

@@ -208,7 +208,6 @@ function notify($Channel, $Message)
208 208
             . $LoggedUser['Username']
209 209
             . ")" : $_SERVER['REMOTE_ADDR']
210 210
             . " ("
211
-            . Tools::geoip($_SERVER['REMOTE_ADDR'])
212 211
         . ")")
213 212
         
214 213
         . " accessing https://"

+ 1
- 17
gazelle.sql View File

@@ -483,22 +483,6 @@ CREATE TABLE `friends` (
483 483
   KEY `FriendID` (`FriendID`)
484 484
 ) ENGINE=InnoDB CHARSET=utf8mb4;
485 485
 
486
-CREATE TABLE `geoip_asn` (
487
-  `StartIP` varbinary(16) NOT NULL,
488
-  `EndIP` varbinary(16) NOT NULL,
489
-  `ASN` decimal(10,0) NOT NULL,
490
-  PRIMARY KEY (`StartIP`,`EndIP`)
491
-) ENGINE=InnoDB CHARSET=utf8mb4;
492
-
493
-CREATE TABLE `geoip_country` (
494
-  `StartIP` decimal(39,0) NOT NULL,
495
-  `EndIP` decimal(39,0) NOT NULL,
496
-  `Code` varchar(2) NOT NULL,
497
-  PRIMARY KEY (`StartIP`,`EndIP`)
498
-) ENGINE=InnoDB CHARSET=utf8mb4;
499
-
500 486
 -- 2020-03-09
501 487
 CREATE TABLE `group_log` (
502 488
   `ID` int NOT NULL AUTO_INCREMENT,
@@ -1493,7 +1477,6 @@ CREATE TABLE `users_main` (
1493 1477
   `torrent_pass` char(32) NOT NULL DEFAULT '',
1494 1478
   `RequiredRatio` double(10,8) NOT NULL DEFAULT '0.00000000',
1495 1479
   `RequiredRatioWork` double(10,8) NOT NULL DEFAULT '0.00000000',
1496
-  `ipcc` varchar(2) NOT NULL DEFAULT '',
1497 1480
   `FLTokens` int NOT NULL DEFAULT '0',
1498 1481
   `BonusPoints` int unsigned NOT NULL DEFAULT '0',
1499 1482
   `IRCLines` int unsigned NOT NULL DEFAULT '0',
@@ -1511,7 +1494,6 @@ CREATE TABLE `users_main` (
1511 1494
   KEY `Invites` (`Invites`),
1512 1495
   KEY `torrent_pass` (`torrent_pass`),
1513 1496
   KEY `RequiredRatio` (`RequiredRatio`),
1514
-  KEY `cc_index` (`ipcc`),
1515 1497
   KEY `PermissionID` (`PermissionID`)
1516 1498
 ) ENGINE=InnoDB CHARSET=utf8mb4;
1517 1499
 
@@ -1778,7 +1760,7 @@ CREATE TABLE `xbt_snatched` (
1778 1760
 SET FOREIGN_KEY_CHECKS = 1;
1779 1761
 
1780 1762
 INSERT INTO permissions (ID, Level, Name, `Values`, DisplayStaff) VALUES
1781
-  (15, 1000, 'Sysop', 'a:100:{s:10:\"site_leech\";i:1;s:11:\"site_upload\";i:1;s:9:\"site_vote\";i:1;s:20:\"site_submit_requests\";i:1;s:20:\"site_advanced_search\";i:1;s:10:\"site_top10\";i:1;s:19:\"site_advanced_top10\";i:1;s:16:\"site_album_votes\";i:1;s:20:\"site_torrents_notify\";i:1;s:20:\"site_collages_create\";i:1;s:20:\"site_collages_manage\";i:1;s:20:\"site_collages_delete\";i:1;s:23:\"site_collages_subscribe\";i:1;s:22:\"site_collages_personal\";i:1;s:28:\"site_collages_renamepersonal\";i:1;s:19:\"site_make_bookmarks\";i:1;s:14:\"site_edit_wiki\";i:1;s:22:\"site_can_invite_always\";i:1;s:27:\"site_send_unlimited_invites\";i:1;s:22:\"site_moderate_requests\";i:1;s:18:\"site_delete_artist\";i:1;s:20:\"site_moderate_forums\";i:1;s:17:\"site_admin_forums\";i:1;s:23:\"site_forums_double_post\";i:1;s:14:\"site_view_flow\";i:1;s:18:\"site_view_full_log\";i:1;s:28:\"site_view_torrent_snatchlist\";i:1;s:18:\"site_recommend_own\";i:1;s:27:\"site_manage_recommendations\";i:1;s:15:\"site_delete_tag\";i:1;s:23:\"site_disable_ip_history\";i:1;s:14:\"zip_downloader\";i:1;s:10:\"site_debug\";i:1;s:17:\"site_proxy_images\";i:1;s:16:\"site_search_many\";i:1;s:20:\"users_edit_usernames\";i:1;s:16:\"users_edit_ratio\";i:1;s:20:\"users_edit_own_ratio\";i:1;s:17:\"users_edit_titles\";i:1;s:18:\"users_edit_avatars\";i:1;s:18:\"users_edit_invites\";i:1;s:22:\"users_edit_watch_hours\";i:1;s:21:\"users_edit_reset_keys\";i:1;s:19:\"users_edit_profiles\";i:1;s:18:\"users_view_friends\";i:1;s:20:\"users_reset_own_keys\";i:1;s:19:\"users_edit_password\";i:1;s:19:\"users_promote_below\";i:1;s:16:\"users_promote_to\";i:1;s:16:\"users_give_donor\";i:1;s:10:\"users_warn\";i:1;s:19:\"users_disable_users\";i:1;s:19:\"users_disable_posts\";i:1;s:17:\"users_disable_any\";i:1;s:18:\"users_delete_users\";i:1;s:18:\"users_view_invites\";i:1;s:20:\"users_view_seedleech\";i:1;s:19:\"users_view_uploaded\";i:1;s:15:\"users_view_keys\";i:1;s:14:\"users_view_ips\";i:1;s:16:\"users_view_email\";i:1;s:18:\"users_invite_notes\";i:1;s:23:\"users_override_paranoia\";i:1;s:12:\"users_logout\";i:1;s:20:\"users_make_invisible\";i:1;s:9:\"users_mod\";i:1;s:13:\"torrents_edit\";i:1;s:15:\"torrents_delete\";i:1;s:20:\"torrents_delete_fast\";i:1;s:18:\"torrents_freeleech\";i:1;s:20:\"torrents_search_fast\";i:1;i:1;s:19:\"torrents_fix_ghosts\";i:1;s:17:\"admin_manage_news\";i:1;s:17:\"admin_manage_blog\";i:1;s:18:\"admin_manage_polls\";i:1;s:19:\"admin_manage_forums\";i:1;s:16:\"admin_manage_fls\";i:1;s:13:\"admin_reports\";i:1;s:26:\"admin_advanced_user_search\";i:1;s:18:\"admin_create_users\";i:1;s:15:\"admin_donor_log\";i:1;s:19:\"admin_manage_ipbans\";i:1;i:1;s:17:\"admin_clear_cache\";i:1;s:15:\"admin_whitelist\";i:1;s:24:\"admin_manage_permissions\";i:1;s:14:\"admin_schedule\";i:1;s:17:\"admin_login_watch\";i:1;s:17:\"admin_manage_wiki\";i:1;s:18:\"admin_update_geoip\";i:1;s:21:\"site_collages_recover\";i:1;s:19:\"torrents_add_artist\";i:1;s:13:\"edit_unknowns\";i:1;s:19:\"forums_polls_create\";i:1;s:21:\"forums_polls_moderate\";i:1;s:12:\"project_team\";i:1;s:25:\"torrents_edit_vanityhouse\";i:1;s:23:\"artist_edit_vanityhouse\";i:1;s:21:\"site_tag_aliases_read\";i:1;}', '1'),
1763
+  (15, 1000, 'Sysop', 'a:100:{s:10:\"site_leech\";i:1;s:11:\"site_upload\";i:1;s:9:\"site_vote\";i:1;s:20:\"site_submit_requests\";i:1;s:20:\"site_advanced_search\";i:1;s:10:\"site_top10\";i:1;s:19:\"site_advanced_top10\";i:1;s:16:\"site_album_votes\";i:1;s:20:\"site_torrents_notify\";i:1;s:20:\"site_collages_create\";i:1;s:20:\"site_collages_manage\";i:1;s:20:\"site_collages_delete\";i:1;s:23:\"site_collages_subscribe\";i:1;s:22:\"site_collages_personal\";i:1;s:28:\"site_collages_renamepersonal\";i:1;s:19:\"site_make_bookmarks\";i:1;s:14:\"site_edit_wiki\";i:1;s:22:\"site_can_invite_always\";i:1;s:27:\"site_send_unlimited_invites\";i:1;s:22:\"site_moderate_requests\";i:1;s:18:\"site_delete_artist\";i:1;s:20:\"site_moderate_forums\";i:1;s:17:\"site_admin_forums\";i:1;s:23:\"site_forums_double_post\";i:1;s:14:\"site_view_flow\";i:1;s:18:\"site_view_full_log\";i:1;s:28:\"site_view_torrent_snatchlist\";i:1;s:18:\"site_recommend_own\";i:1;s:27:\"site_manage_recommendations\";i:1;s:15:\"site_delete_tag\";i:1;s:23:\"site_disable_ip_history\";i:1;s:14:\"zip_downloader\";i:1;s:10:\"site_debug\";i:1;s:17:\"site_proxy_images\";i:1;s:16:\"site_search_many\";i:1;s:20:\"users_edit_usernames\";i:1;s:16:\"users_edit_ratio\";i:1;s:20:\"users_edit_own_ratio\";i:1;s:17:\"users_edit_titles\";i:1;s:18:\"users_edit_avatars\";i:1;s:18:\"users_edit_invites\";i:1;s:22:\"users_edit_watch_hours\";i:1;s:21:\"users_edit_reset_keys\";i:1;s:19:\"users_edit_profiles\";i:1;s:18:\"users_view_friends\";i:1;s:20:\"users_reset_own_keys\";i:1;s:19:\"users_edit_password\";i:1;s:19:\"users_promote_below\";i:1;s:16:\"users_promote_to\";i:1;s:16:\"users_give_donor\";i:1;s:10:\"users_warn\";i:1;s:19:\"users_disable_users\";i:1;s:19:\"users_disable_posts\";i:1;s:17:\"users_disable_any\";i:1;s:18:\"users_delete_users\";i:1;s:18:\"users_view_invites\";i:1;s:20:\"users_view_seedleech\";i:1;s:19:\"users_view_uploaded\";i:1;s:15:\"users_view_keys\";i:1;s:14:\"users_view_ips\";i:1;s:16:\"users_view_email\";i:1;s:18:\"users_invite_notes\";i:1;s:23:\"users_override_paranoia\";i:1;s:12:\"users_logout\";i:1;s:20:\"users_make_invisible\";i:1;s:9:\"users_mod\";i:1;s:13:\"torrents_edit\";i:1;s:15:\"torrents_delete\";i:1;s:20:\"torrents_delete_fast\";i:1;s:18:\"torrents_freeleech\";i:1;s:20:\"torrents_search_fast\";i:1;i:1;s:19:\"torrents_fix_ghosts\";i:1;s:17:\"admin_manage_news\";i:1;s:17:\"admin_manage_blog\";i:1;s:18:\"admin_manage_polls\";i:1;s:19:\"admin_manage_forums\";i:1;s:16:\"admin_manage_fls\";i:1;s:13:\"admin_reports\";i:1;s:26:\"admin_advanced_user_search\";i:1;s:18:\"admin_create_users\";i:1;s:15:\"admin_donor_log\";i:1;s:19:\"admin_manage_ipbans\";i:1;i:1;s:17:\"admin_clear_cache\";i:1;s:15:\"admin_whitelist\";i:1;s:24:\"admin_manage_permissions\";i:1;s:14:\"admin_schedule\";i:1;s:17:\"admin_login_watch\";i:1;s:17:\"admin_manage_wiki\";i:1;i:1;s:21:\"site_collages_recover\";i:1;s:19:\"torrents_add_artist\";i:1;s:13:\"edit_unknowns\";i:1;s:19:\"forums_polls_create\";i:1;s:21:\"forums_polls_moderate\";i:1;s:12:\"project_team\";i:1;s:25:\"torrents_edit_vanityhouse\";i:1;s:23:\"artist_edit_vanityhouse\";i:1;s:21:\"site_tag_aliases_read\";i:1;}', '1'),
1782 1764
   (11, 800, 'Moderator', 'a:89:{s:26:\"admin_advanced_user_search\";i:1;s:17:\"admin_clear_cache\";i:1;s:18:\"admin_create_users\";i:1;i:1;s:15:\"admin_donor_log\";i:1;s:17:\"admin_login_watch\";i:1;s:17:\"admin_manage_blog\";i:1;s:19:\"admin_manage_ipbans\";i:1;s:17:\"admin_manage_news\";i:1;s:18:\"admin_manage_polls\";i:1;s:17:\"admin_manage_wiki\";i:1;s:13:\"admin_reports\";i:1;s:23:\"artist_edit_vanityhouse\";i:1;s:13:\"edit_unknowns\";i:1;s:19:\"forums_polls_create\";i:1;s:21:\"forums_polls_moderate\";i:1;s:12:\"project_team\";i:1;s:17:\"site_admin_forums\";i:1;s:20:\"site_advanced_search\";i:1;s:19:\"site_advanced_top10\";i:1;s:16:\"site_album_votes\";i:1;s:22:\"site_can_invite_always\";i:1;s:20:\"site_collages_create\";i:1;s:20:\"site_collages_delete\";i:1;s:20:\"site_collages_manage\";i:1;s:22:\"site_collages_personal\";i:1;s:21:\"site_collages_recover\";i:1;s:28:\"site_collages_renamepersonal\";i:1;s:23:\"site_collages_subscribe\";i:1;s:18:\"site_delete_artist\";i:1;s:15:\"site_delete_tag\";i:1;s:23:\"site_disable_ip_history\";i:1;s:14:\"site_edit_wiki\";i:1;s:23:\"site_forums_double_post\";i:1;s:10:\"site_leech\";i:1;s:19:\"site_make_bookmarks\";i:1;s:27:\"site_manage_recommendations\";i:1;s:20:\"site_moderate_forums\";i:1;s:22:\"site_moderate_requests\";i:1;s:17:\"site_proxy_images\";i:1;s:18:\"site_recommend_own\";i:1;s:16:\"site_search_many\";i:1;s:27:\"site_send_unlimited_invites\";i:1;s:20:\"site_submit_requests\";i:1;s:21:\"site_tag_aliases_read\";i:1;s:10:\"site_top10\";i:1;s:20:\"site_torrents_notify\";i:1;s:11:\"site_upload\";i:1;s:14:\"site_view_flow\";i:1;s:18:\"site_view_full_log\";i:1;s:28:\"site_view_torrent_snatchlist\";i:1;s:9:\"site_vote\";i:1;s:19:\"torrents_add_artist\";i:1;s:15:\"torrents_delete\";i:1;s:20:\"torrents_delete_fast\";i:1;s:13:\"torrents_edit\";i:1;s:25:\"torrents_edit_vanityhouse\";i:1;s:19:\"torrents_fix_ghosts\";i:1;s:18:\"torrents_freeleech\";i:1;i:1;s:20:\"torrents_search_fast\";i:1;s:18:\"users_delete_users\";i:1;s:17:\"users_disable_any\";i:1;s:19:\"users_disable_posts\";i:1;s:19:\"users_disable_users\";i:1;s:18:\"users_edit_avatars\";i:1;s:18:\"users_edit_invites\";i:1;s:20:\"users_edit_own_ratio\";i:1;s:19:\"users_edit_password\";i:1;s:19:\"users_edit_profiles\";i:1;s:16:\"users_edit_ratio\";i:1;s:21:\"users_edit_reset_keys\";i:1;s:17:\"users_edit_titles\";i:1;s:16:\"users_give_donor\";i:1;s:12:\"users_logout\";i:1;s:20:\"users_make_invisible\";i:1;s:9:\"users_mod\";i:1;s:23:\"users_override_paranoia\";i:1;s:19:\"users_promote_below\";i:1;s:20:\"users_reset_own_keys\";i:1;s:10:\"users_warn\";i:1;s:16:\"users_view_email\";i:1;s:18:\"users_view_friends\";i:1;s:18:\"users_view_invites\";i:1;s:14:\"users_view_ips\";i:1;s:15:\"users_view_keys\";i:1;s:20:\"users_view_seedleech\";i:1;s:19:\"users_view_uploaded\";i:1;s:14:\"zip_downloader\";i:1;}', '1'),
1783 1765
   (2, 100, 'User', 'a:7:{s:10:\"site_leech\";i:1;s:11:\"site_upload\";i:1;s:9:\"site_vote\";i:1;s:20:\"site_advanced_search\";i:1;s:10:\"site_top10\";i:1;s:14:\"site_edit_wiki\";i:1;s:19:\"torrents_add_artist\";i:1;}', '0'),
1784 1766
   (3, 150, 'Member', 'a:10:{s:10:\"site_leech\";i:1;s:11:\"site_upload\";i:1;s:9:\"site_vote\";i:1;s:20:\"site_submit_requests\";i:1;s:20:\"site_advanced_search\";i:1;s:10:\"site_top10\";i:1;s:20:\"site_collages_manage\";i:1;s:19:\"site_make_bookmarks\";i:1;s:14:\"site_edit_wiki\";i:1;s:19:\"torrents_add_artist\";i:1;}', '0'),

+ 22
- 9
sections/login/index.php View File

@@ -46,7 +46,6 @@ if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'recover') {
46 46
         SELECT
47 47
           m.ID,
48 48
           m.Email,
49
-          m.ipcc,
50 49
           i.ResetExpires
51 50
         FROM users_main AS m
52 51
           INNER JOIN users_info AS i ON i.UserID = m.ID
@@ -283,26 +282,36 @@ else {
283 282
                         # todo: Make sure the type is (int)
284 283
                         if ($Enabled === '1') {
285 284
 
286
-              // Check if the current login attempt is from a location previously logged in from
285
+                            // Check if the current login attempt is from a location previously logged in from
287 286
                             if (apcu_exists('DBKEY')) {
288 287
                                 $DB->query("
289
-                                SELECT IP
290
-                                FROM users_history_ips
291
-                                  WHERE UserID = ?", $UserID);
288
+                                SELECT
289
+                                  `IP`
290
+                                FROM
291
+                                  `users_history_ips`
292
+                                WHERE
293
+                                  `UserID` = '$UserID'
294
+                                ");
295
+
292 296
                                 $IPs = $DB->to_array(false, MYSQLI_NUM);
293 297
                                 $QueryParts = [];
298
+
294 299
                                 foreach ($IPs as $i => $IP) {
295 300
                                     $IPs[$i] = Crypto::decrypt($IP[0]);
296 301
                                 }
302
+
297 303
                                 $IPs = array_unique($IPs);
298 304
                                 if (count($IPs) > 0) { // Always allow first login
299 305
                                     foreach ($IPs as $IP) {
300 306
                                         $QueryParts[] = "(StartIP<=INET6_ATON('$IP') AND EndIP>=INET6_ATON('$IP'))";
301 307
                                     }
308
+
309
+                                    /*
302 310
                                     $DB->query('SELECT ASN FROM geoip_asn WHERE '.implode(' OR ', $QueryParts));
303 311
                                     $PastASNs = array_column($DB->to_array(false, MYSQLI_NUM), 0);
304 312
                                     $DB->query("SELECT ASN FROM geoip_asn WHERE StartIP<=INET6_ATON('$_SERVER[REMOTE_ADDR]') AND EndIP>=INET6_ATON('$_SERVER[REMOTE_ADDR]')");
305 313
                                     list($CurrentASN) = $DB->next_record();
314
+                                    */
306 315
 
307 316
                                     // If FEATURE_ENFORCE_LOCATIONS is enabled, require users to confirm new logins
308 317
                                     if (!in_array($CurrentASN, $PastASNs) && $ENV->FEATURE_ENFORCE_LOCATIONS) {
@@ -310,10 +319,14 @@ else {
310 319
                                         if ($Cache->get_value('new_location_'.$UserID.'_'.$CurrentASN) !== true) {
311 320
                                             $DB->query("
312 321
                                             SELECT
313
-                                              UserName,
314
-                                              Email
315
-                                            FROM users_main
316
-                                              WHERE ID = ?", $UserID);
322
+                                              `UserName`,
323
+                                              `Email`
324
+                                            FROM
325
+                                              `users_main`
326
+                                            WHERE
327
+                                              `ID` = '$UserID'
328
+                                            ");
329
+                                            
317 330
                                             list($Username, $Email) = $DB->next_record();
318 331
                                             Users::auth_location($UserID, $Username, $CurrentASN, Crypto::decrypt($Email));
319 332
                                             require('newlocation.php');

+ 2
- 4
sections/register/index.php View File

@@ -105,11 +105,10 @@ if (!empty($_REQUEST['confirm'])) {
105 105
                 $Enabled = '0';
106 106
             }
107 107
 
108
-            $IPcc = Tools::geoip($_SERVER['REMOTE_ADDR']);
109 108
 
110 109
             $DB->query("
111 110
         INSERT INTO users_main
112
-          (Username, Email, PassHash, torrent_pass, IP, PermissionID, Enabled, Invites, FLTokens, Uploaded, ipcc)
111
+          (Username, Email, PassHash, torrent_pass, IP, PermissionID, Enabled, Invites, FLTokens, Uploaded)
113 112
         VALUES
114 113
           ('".db_string(trim($_POST['username']))."',
115 114
           '".Crypto::encrypt($_POST['email'])."',
@@ -120,8 +119,7 @@ if (!empty($_REQUEST['confirm'])) {
120 119
           '$Enabled',
121 120
           '".$ENV->STARTING_INVITES."',
122 121
           '".$ENV->STARTING_TOKENS."',
123
-          '".$ENV->STARTING_UPLOAD."',
124
-          '$IPcc')
122
+          '".$ENV->STARTING_UPLOAD."')
125 123
           ");
126 124
 
127 125
             $UserID = $DB->inserted_id();

+ 0
- 24
sections/schedule/manually/update_geodist.php View File

@@ -1,24 +0,0 @@
1
-<?php
2
-
3
-$IPs = [];
4
-$DB->query("SELECT IP FROM users_main WHERE Enabled = '1'");
5
-
6
-while (list($EncIP) = $DB->next_record()) {
7
-    $IPs[] = Crypto::decrypt($EncIP);
8
-}
9
-
10
-$DB->query("CREATE TEMPORARY TABLE users_ips_decrypted (IP VARCHAR(45) NOT NULL)");
11
-$DB->query("INSERT INTO users_ips_decrypted (IP) VALUES('".implode("'),('", $IPs)."')");
12
-$DB->query("TRUNCATE TABLE users_geodistribution");
13
-
14
-$DB->query("
15
-  INSERT INTO users_geodistribution
16
-    (Code, Users)
17
-  SELECT g.Code, COUNT(u.IP) AS Users
18
-  FROM geoip_country AS g
19
-    JOIN users_ips_decrypted AS u ON INET_ATON(u.IP) BETWEEN g.StartIP AND g.EndIP
20
-  GROUP BY g.Code
21
-  ORDER BY Users DESC");
22
-  
23
-$DB->query("DROP TABLE users_ips_decrypted");
24
-$Cache->delete_value('geodistribution');

+ 2
- 8
sections/tools/data/registration_log.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+#declare(strict_types=1);
2 3
 
3 4
 if (!check_perms('users_view_ips') || !check_perms('users_view_email')) {
4 5
     error(403);
@@ -33,7 +34,6 @@ $RS = "
33 34
     SQL_CALC_FOUND_ROWS
34 35
     m.ID,
35 36
     m.IP,
36
-    m.ipcc,
37 37
     m.Email,
38 38
     m.Username,
39 39
     m.PermissionID,
@@ -50,7 +50,6 @@ $RS = "
50 50
     ) AS Uses,
51 51
     im.ID,
52 52
     im.IP,
53
-    im.ipcc,
54 53
     im.Email,
55 54
     im.Username,
56 55
     im.PermissionID,
@@ -115,7 +114,7 @@ if ($DB->has_results()) {
115 114
   </tr>
116 115
 
117 116
   <?php
118
-  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()) {
117
+  while (list($UserID, $IP, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses) = $DB->next_record()) {
119 118
       $RowClass = $IP === $InviterIP ? 'warning' : '';
120 119
       $Email = apcu_exists('DBKEY') ? Crypto::decrypt($Email) : '[Encrypted]';
121 120
       $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
@@ -186,11 +185,6 @@ if ($DB->has_results()) {
186 185
       </span><br />
187 186
     </td>
188 187
 
189
-    <td>
190
-      <?=$IPCC?><br />
191
-      <?=$InviterIPCC?>
192
-    </td>
193
-
194 188
     <td>
195 189
       <?=Tools::get_host_by_ajax($IP)?><br />
196 190
       <?=Tools::get_host_by_ajax($InviterIP)?>

+ 0
- 110
sections/tools/development/update_geoip.php View File

@@ -1,110 +0,0 @@
1
-<?
2
-ini_set('memory_limit', '1G');
3
-set_time_limit(0);
4
-
5
-$LIMIT = 1000;
6
-
7
-if (!check_perms('site_debug')) {
8
-  error(403);
9
-}
10
-
11
-View::show_header();
12
-chdir('/tmp');
13
-// requires wget, unzip, gunzip commands to be installed
14
-
15
-// Country section
16
-shell_exec('wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip');
17
-shell_exec('wget http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz');
18
-shell_exec('unzip GeoIPCountryCSV.zip');
19
-shell_exec('gunzip GeoIPv6.csv.gz');
20
-shell_exec('cut -d , -f 3-5 GeoIPCountryWhois.csv > GeoIPCountry.csv');
21
-shell_exec('cut -d , -f 3-5 GeoIPv6.csv | tr -d " " >> GeoIPCountry.csv');
22
-
23
-if (($fd = fopen('GeoIPCountry.csv', 'r')) !== false) {
24
-  $DB->query("TRUNCATE TABLE geoip_country");
25
-  $Values = [];
26
-  $Count = 0;
27
-  while (($Data = fgetcsv($fd)) !== false) {
28
-    list($StartIP, $EndIP, $CountryID) = $Data;
29
-    $Values[] = "($StartIP, $EndIP, '$CountryID')";
30
-    $Count++;
31
-    if ($Count % $LIMIT == 0) {
32
-      $DB->query("
33
-        INSERT INTO geoip_country (StartIP, EndIP, Code)
34
-        VALUES ".implode(', ', $Values));
35
-      $Values = [];
36
-    }
37
-  }
38
-  if (count($Values) > 0) {
39
-    $DB->query("
40
-      INSERT INTO geoip_country (StartIP, EndIP, Code)
41
-      VALUES ".implode(', ', $Values));
42
-  }
43
-  echo 'GeoIP_Country: There are '.($Count+count($Values)).' entries <br />';
44
-} else {
45
-  echo 'Country Error';
46
-}
47
-shell_exec('rm GeoIPCountryCSV.zip GeoIPv6.csv.gz GeoIPCountryWhois.csv GeoIPv6.csv GeoIPCountry.csv');
48
-
49
-// ASN (v4) section
50
-shell_exec('wget http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum2.zip');
51
-shell_exec('unzip GeoIPASNum2.zip');
52
-
53
-if (($fd = fopen('GeoIPASNum2.csv', 'r')) !== false) {
54
-  $DB->query("TRUNCATE TABLE geoip_asn");
55
-  $Values = [];
56
-  $Count = 0;
57
-  while (($Data = fgetcsv($fd)) !== false) {
58
-    list($StartIP, $EndIP, $ASN) = $Data;
59
-    $ASN = substr($ASN, 2, strpos($ASN, ' ') ? strpos($ASN, ' ')-2 : strlen($ASN)-2);
60
-    $Values[] = "(INET6_ATON(INET_NTOA($StartIP)), INET6_ATON(INET_NTOA($EndIP)), $ASN)";
61
-    $Count++;
62
-    if ($Count % $LIMIT == 0) {
63
-      $DB->query("
64
-        INSERT INTO geoip_asn (StartIP, EndIP, ASN)
65
-        VALUES ".implode(', ', $Values));
66
-      $Values = [];
67
-    }
68
-  }
69
-  if (count($Values) > 0) {
70
-    $DB->query("
71
-      INSERT INTO geoip_asn (StartIP, EndIP, ASN)
72
-      VALUES ".implode(', ', $Values));
73
-  }
74
-  echo 'GeoIP_ASN (v4): There are '.($Count+count($Values)).' entries <br />';
75
-} else {
76
-  echo 'ASNv4 Error';
77
-}
78
-shell_exec('rm GeoIPASNum2.zip GeoIPASNum2.csv');
79
-
80
-// ASN (v6) section
81
-shell_exec('wget http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum2v6.zip');
82
-shell_exec('unzip GeoIPASNum2v6.zip');
83
-
84
-if (($fd = fopen('GeoIPASNum2v6.csv', 'r')) !== false) {
85
-  $Values = [];
86
-  $Count = 0;
87
-  while (($Data = fgetcsv($fd)) !== false) {
88
-    list($ASN, $StartIP, $EndIP) = $Data;
89
-    $ASN = substr($ASN, 2, strpos($ASN, ' ') ? strpos($ASN, ' ')-2 : strlen($ASN)-2);
90
-    $Values[] = "(INET6_ATON('$StartIP'), INET6_ATON('$EndIP'), $ASN)";
91
-    $Count++;
92
-    if ($Count % $LIMIT == 0) {
93
-      $DB->query("
94
-        INSERT INTO geoip_asn (StartIP, EndIP, ASN)
95
-        VALUES ".implode(', ', $Values));
96
-      $Values = [];
97
-    }
98
-  }
99
-  if (count($Values) > 0) {
100
-    $DB->query("
101
-      INSERT INTO geoip_asn (StartIP, EndIP, ASN)
102
-      VALUES ".implode(', ', $Values));
103
-  }
104
-  echo 'GeoIP_ASN (v6): There are '.($Count+count($Values)).' entries <br />';
105
-} else {
106
-  echo 'ASNv6 Error';
107
-}
108
-shell_exec('rm GeoIPASNum2v6.zip GeoIPASNum2v6.tmp GeoIPASNum2v6.csv');
109
-
110
-View::show_footer();

+ 0
- 10
sections/tools/index.php View File

@@ -25,12 +25,6 @@ if (!isset($_REQUEST['action'])) {
25 25
     #error('Need to set an "action" parameter in sections/tools/tools.php.');
26 26
 }
27 27
 
28
-if (substr($_REQUEST['action'], 0, 12) === 'update_geoip' && !isset($argv[1])) {
29
-    if (!check_perms('site_debug')) {
30
-        error(403);
31
-    }
32
-}
33
-
34 28
 if (substr($_REQUEST['action'], 0, 16) === 'rerender_gallery' && !isset($argv[1])) {
35 29
     if (!check_perms('site_debug')) {
36 30
         error(403);
@@ -419,10 +413,6 @@ switch ($_REQUEST['action']) {
419 413
   // END Data
420 414
 
421 415
   // Misc
422
-  case 'update_geoip':
423
-    include SERVER_ROOT.'/sections/tools/development/update_geoip.php';
424
-    break;
425
-
426 416
   case 'dupe_ips':
427 417
     include SERVER_ROOT.'/sections/tools/misc/dupe_ip.php';
428 418
     break;

+ 0
- 19
sections/tools/services/get_cc.php View File

@@ -1,19 +0,0 @@
1
-<?php
2
-
3
-if (isset($_SERVER['http_if_modified_since'])) {
4
-    header('Status: 304 Not Modified');
5
-    error();
6
-}
7
-
8
-header('Expires: '.date('D, d-M-Y H:i:s \U\T\C', time() + 3600 * 24 * 120)); //120 days
9
-header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C', time()));
10
-
11
-if (!check_perms('users_view_ips')) {
12
-    error('Access denied.');
13
-}
14
-
15
-if (empty($_GET['ip'])) {
16
-    error('Invalid IP address.');
17
-}
18
-
19
-die(Tools::geoip($_GET['ip']));

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

@@ -1,4 +1,5 @@
1 1
 <?php
2
+#declare(strict_types=1);
2 3
 
3 4
 /***********************************************
4 5
  * This file displays the list of available tools in the staff toolbox.
@@ -167,7 +168,6 @@ View::show_header('Staff Tools');
167 168
   create_row("Service stats", "tools.php?action=service_stats", check_perms("site_debug"));
168 169
   create_row("Miscellaneous values", "tools.php?action=misc_values", check_perms('users_mod'));
169 170
   create_row("Tracker info", "tools.php?action=ocelot_info", check_perms("users_mod"));
170
-  create_row("Update GeoIP", "tools.php?action=update_geoip", check_perms("admin_update_geoip"));
171 171
 
172 172
   if ($ToolsHTML) {
173 173
       ?>
@@ -229,7 +229,7 @@ View::show_header('Staff Tools');
229 229
         <tr class="colhead">
230 230
           <td>Torrents</td>
231 231
         </tr>
232
-        <?=       $ToolsHTML ?>
232
+        <?= $ToolsHTML ?>
233 233
       </table>
234 234
     </div>
235 235
     <?php

+ 3
- 10
sections/user/advancedsearch.php View File

@@ -308,15 +308,6 @@ if (count($_GET)) {
308 308
             $Join['la'] .= ' JOIN locked_accounts AS la ON la.UserID = um1.ID ';
309 309
         }
310 310
 
311
-
312
-        if (!empty($_GET['cc'])) {
313
-            if ($_GET['cc_op'] == 'equal') {
314
-                $Where[] = "um1.ipcc = '".db_string($_GET['cc'])."'";
315
-            } else {
316
-                $Where[] = "um1.ipcc != '".db_string($_GET['cc'])."'";
317
-            }
318
-        }
319
-
320 311
         if (!empty($_GET['tracker_ip'])) {
321 312
             $Distinct = 'DISTINCT ';
322 313
             $Join['xfu'] = ' JOIN xbt_files_users AS xfu ON um1.ID = xfu.uid ';
@@ -1131,7 +1122,7 @@ while (list($UserID, $Username, $Uploaded, $Downloaded, $Snatched, $Invitees, $C
1131 1122
       <td><?=Format::get_ratio_html($Uploaded, $Downloaded)?>
1132 1123
       </td>
1133 1124
       <td style="word-break: break-all;"><?=display_str($IP)?>
1134
-        (<?=Tools::get_country_code_by_ajax($IP)?>)</td>
1125
+      </td>
1135 1126
       <td><?=display_str($Email)?>
1136 1127
       </td>
1137 1128
       <td><?=time_diff($JoinDate)?>
@@ -1170,7 +1161,9 @@ while (list($UserID, $Username, $Uploaded, $Downloaded, $Snatched, $Invitees, $C
1170 1161
 ?>
1171 1162
   </table>
1172 1163
 </div>
1164
+
1173 1165
 <div class="linkbox">
1174 1166
   <?=$Pages?>
1175 1167
 </div>
1168
+
1176 1169
 <?php View::show_footer();

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

@@ -1,4 +1,6 @@
1
-<?
1
+<?php
2
+#declare(strict_types=1);
3
+
2 4
 /************************************************************************
3 5
 ||------------|| User email history page ||---------------------------||
4 6
 
@@ -10,10 +12,9 @@ user.
10 12
 
11 13
 ************************************************************************/
12 14
 
13
-
14 15
 $UserID = $_GET['userid'];
15 16
 if (!is_number($UserID)) {
16
-  error(404);
17
+    error(404);
17 18
 }
18 19
 
19 20
 $DB->query("
@@ -25,7 +26,7 @@ $DB->query("
25 26
 list($Joined, $Class) = $DB->next_record();
26 27
 
27 28
 if (!check_perms('users_view_email', $Class)) {
28
-  error(403);
29
+    error(403);
29 30
 }
30 31
 
31 32
 $UsersOnly = $_GET['usersonly'];
@@ -38,7 +39,7 @@ list($Username)= $DB->next_record();
38 39
 View::show_header("Email history for $Username");
39 40
 
40 41
 if ($UsersOnly == 1) {
41
-  $DB->query("
42
+    $DB->query("
42 43
     SELECT
43 44
       u.Email,
44 45
       NOW() AS Time,
@@ -46,7 +47,6 @@ if ($UsersOnly == 1) {
46 47
       c.Code
47 48
     FROM users_main AS u
48 49
       LEFT JOIN users_main AS u2 ON u2.Email = u.Email AND u2.ID != '$UserID'
49
-      LEFT JOIN geoip_country AS c ON INET_ATON(u.IP) BETWEEN c.StartIP AND c.EndIP
50 50
     WHERE u.ID = '$UserID'
51 51
       AND u2.ID > 0
52 52
     UNION
@@ -57,20 +57,17 @@ if ($UsersOnly == 1) {
57 57
       c.Code
58 58
     FROM users_history_emails AS h
59 59
       LEFT JOIN users_history_emails AS h2 ON h2.email = h.email and h2.UserID != '$UserID'
60
-      LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
61 60
     WHERE h.UserID = '$UserID'
62
-      AND h2.UserID > 0"
63
-      /*AND Time IS NOT NULL*/."
61
+      AND h2.UserID > 0
64 62
     ORDER BY Time DESC");
65 63
 } else {
66
-  $DB->query("
64
+    $DB->query("
67 65
     SELECT
68 66
       u.Email,
69 67
       NOW() AS Time,
70 68
       u.IP,
71 69
       c.Code
72 70
     FROM users_main AS u
73
-      LEFT JOIN geoip_country AS c ON INET_ATON(u.IP) BETWEEN c.StartIP AND c.EndIP
74 71
     WHERE u.ID = '$UserID'
75 72
     UNION
76 73
     SELECT
@@ -79,9 +76,7 @@ if ($UsersOnly == 1) {
79 76
       h.IP,
80 77
       c.Code
81 78
     FROM users_history_emails AS h
82
-      LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
83
-    WHERE UserID = '$UserID' "
84
-      /*AND Time IS NOT NULL*/."
79
+    WHERE UserID = '$UserID'
85 80
     ORDER BY Time DESC");
86 81
 }
87 82
 $History = $DB->to_array();
@@ -93,31 +88,36 @@ $History = $DB->to_array();
93 88
   <tr class="colhead">
94 89
     <td>Email</td>
95 90
     <td>Set</td>
96
-    <td>IP <a href="userhistory.php?action=ips&amp;userid=<?=$UserID ?>" class="brackets">H</a></td>
97
-<? if ($UsersOnly == 1) {
98
-?>
99
-  <td>User</td>
100
-<?
91
+    <td>IP <a
92
+        href="userhistory.php?action=ips&amp;userid=<?=$UserID ?>"
93
+        class="brackets">H</a></td>
94
+    <?php if ($UsersOnly == 1) {
95
+    ?>
96
+    <td>User</td>
97
+    <?php
101 98
 }
102 99
 ?>
103 100
   </tr>
104
-<?
101
+  <?php
105 102
 foreach ($History as $Key => $Values) {
106
-  if (isset($History[$Key + 1])) {
107
-    $Values['Time'] = $History[$Key + 1]['Time'];
108
-  } else {
109
-    $Values['Time'] = $Joined;
110
-  }
103
+    if (isset($History[$Key + 1])) {
104
+        $Values['Time'] = $History[$Key + 1]['Time'];
105
+    } else {
106
+        $Values['Time'] = $Joined;
107
+    }
111 108
 
112
-  $ValuesIP = apcu_exists('DBKEY') ? Crypto::decrypt($Values['IP']) : '[Encrypted]';
113
-?>
109
+    $ValuesIP = apcu_exists('DBKEY') ? Crypto::decrypt($Values['IP']) : '[Encrypted]'; ?>
114 110
   <tr class="row">
115
-    <td><?=display_str($Values['Email'])?></td>
116
-    <td><?=time_diff($Values['Time'])?></td>
117
-    <td><?=display_str($ValuesIP)?> (<?=display_str($Values['Code'])?>) <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($ValuesIP)?>" class="brackets tooltip" title="Search">S</a></td>
118
-<?
111
+    <td><?=display_str($Values['Email'])?>
112
+    </td>
113
+    <td><?=time_diff($Values['Time'])?>
114
+    </td>
115
+    <td><?=display_str($ValuesIP)?> (<?=display_str($Values['Code'])?>) <a
116
+        href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($ValuesIP)?>"
117
+        class="brackets tooltip" title="Search">S</a></td>
118
+    <?php
119 119
   if ($UsersOnly == 1) {
120
-    $ueQuery = $DB->query("
120
+      $ueQuery = $DB->query("
121 121
           SELECT
122 122
             ue.UserID,
123 123
             um.Username,
@@ -127,28 +127,28 @@ foreach ($History as $Key => $Values) {
127 127
           WHERE ue.Email = '".db_string($Values['Email'])."'
128 128
             AND ue.UserID != $UserID
129 129
             AND um.ID = ue.UserID");
130
-    while (list($UserID2, $Time, $IP) = $DB->next_record()) {
131
-      $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
132
-?>
130
+      while (list($UserID2, $Time, $IP) = $DB->next_record()) {
131
+          $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]'; ?>
133 132
   </tr>
134 133
   <tr>
135 134
     <td></td>
136
-    <td><?=time_diff($Time)?></td>
137
-    <td><?=display_str($IP)?></td>
138
-<?
135
+    <td><?=time_diff($Time)?>
136
+    </td>
137
+    <td><?=display_str($IP)?>
138
+    </td>
139
+    <?php
139 140
       $UserURL = site_url()."user.php?id=$UserID2";
140
-      $DB->query("
141
+          $DB->query("
141 142
         SELECT Enabled
142 143
         FROM users_main
143 144
         WHERE ID = $UserID2");
144
-      list($Enabled) = $DB->next_record();
145
-      $DB->set_query_id($ueQuery);
146
-?>
145
+          list($Enabled) = $DB->next_record();
146
+          $DB->set_query_id($ueQuery); ?>
147 147
     <td><a href="<?=display_str($UserURL)?>"><?=Users::format_username($UserID2, false, false, true)?></a></td>
148 148
   </tr>
149
-<?
150
-    }
149
+  <?php
150
+      }
151 151
   }
152 152
 } ?>
153 153
 </table>
154
-<? View::show_footer(); ?>
154
+<?php View::show_footer();

+ 183
- 158
sections/userhistory/email_history2.php View File

@@ -1,4 +1,6 @@
1
-<?
1
+<?php
2
+#declare(strict_types=1);
3
+
2 4
 /************************************************************************
3 5
 ||------------|| User email history page ||---------------------------||
4 6
 
@@ -12,7 +14,7 @@ user.
12 14
 
13 15
 $UserID = $_GET['userid'];
14 16
 if (!is_number($UserID)) {
15
-  error(404);
17
+    error(404);
16 18
 }
17 19
 
18 20
 $DB->query("
@@ -26,7 +28,7 @@ $DB->query("
26 28
 list($Joined, $Class) = $DB->next_record();
27 29
 
28 30
 if (!check_perms('users_view_email', $Class)) {
29
-  error(403);
31
+    error(403);
30 32
 }
31 33
 
32 34
 // todo: Is this even used?
@@ -40,7 +42,8 @@ list($Username) = $DB->next_record();
40 42
 View::show_header("Email history for $Username");
41 43
 
42 44
 // Get current email (and matches)
43
-$DB->query("
45
+$DB->query(
46
+    "
44 47
   SELECT
45 48
     m.Email,
46 49
     NOW() AS Time,
@@ -63,7 +66,8 @@ $DB->query("
63 66
 $CurrentEmail = ($DB->to_array())[0]; // Only variables should be passed by reference
64 67
 
65 68
 // Get historic emails (and matches)
66
-$DB->query("
69
+$DB->query(
70
+    "
67 71
   SELECT
68 72
     h2.Email,
69 73
     h2.Time,
@@ -93,74 +97,73 @@ $Current['IP'] = $History[(count($History) - 1)]['IP'];
93 97
 
94 98
 // Matches for current email
95 99
 if ($CurrentEmail['Usernames'] != '') {
96
-  $UserIDs = explode('|', $CurrentEmail['UserIDs']);
97
-  $Usernames = explode('|', $CurrentEmail['Usernames']);
98
-  $UsersEnabled = explode('|', $CurrentEmail['UsersEnabled']);
99
-  $UsersDonor = explode('|', $CurrentEmail['UsersDonor']);
100
-  $UsersWarned = explode('|', $CurrentEmail['UsersWarned']);
101
-  $UserSetTimes = explode('|', $CurrentEmail['UserSetTimes']);
102
-  $UserIPs = explode('|', $CurrentEmail['UserIPs']);
100
+    $UserIDs = explode('|', $CurrentEmail['UserIDs']);
101
+    $Usernames = explode('|', $CurrentEmail['Usernames']);
102
+    $UsersEnabled = explode('|', $CurrentEmail['UsersEnabled']);
103
+    $UsersDonor = explode('|', $CurrentEmail['UsersDonor']);
104
+    $UsersWarned = explode('|', $CurrentEmail['UsersWarned']);
105
+    $UserSetTimes = explode('|', $CurrentEmail['UserSetTimes']);
106
+    $UserIPs = explode('|', $CurrentEmail['UserIPs']);
103 107
 
104
-  foreach ($UserIDs as $Key => $Val) {
105
-    $CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val, true, true, true);
106
-    $CurrentMatches[$Key]['IP'] = $UserIPs[$Key];
107
-    $CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key];
108
-  }
108
+    foreach ($UserIDs as $Key => $Val) {
109
+        $CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val, true, true, true);
110
+        $CurrentMatches[$Key]['IP'] = $UserIPs[$Key];
111
+        $CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key];
112
+    }
109 113
 }
110 114
 
111 115
 // Email history records
112 116
 if (count($History) === 1) {
113
-  $Invite['Email'] = $History[0]['Email'];
114
-  $Invite['EndTime'] = $Joined;
115
-  $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
116
-  $Invite['IP'] = $History[0]['IP'];
117
-  if (!$Current['StartTime']) {
118
-    $Current['StartTime'] = $Joined;
119
-  }
120
-} else {
121
-  foreach ($History as $Key => $Val) {
122
-    if (isset($History[$Key + 1]) && !$History[$Key + 1]['Time'] && !$Val['Time']) {
123
-      // Invited email
124
-      $Invite['Email'] = $Val['Email'];
125
-      $Invite['EndTime'] = $Joined;
126
-      $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
127
-      $Invite['IP'] = $Val['IP'];
128
-
129
-    } elseif (isset($History[$Key - 1]) && $History[$Key - 1]['Email'] != $Val['Email'] && $Val['Time']) {
130
-      // Old email
131
-      $i = 1;
132
-      while ($Val['Email'] == $History[$Key + $i]['Email']) {
133
-        $i++;
134
-      }
135
-      $Old[$Key]['StartTime'] = (isset($History[$Key + $i]) && $History[$Key + $i]['Time']) ? $History[$Key + $i]['Time'] : $Joined;
136
-      $Old[$Key]['EndTime'] = $Val['Time'];
137
-      $Old[$Key]['IP'] = $Val['IP'];
138
-      $Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));
139
-      $Old[$Key]['Email'] = $Val['Email'];
117
+    $Invite['Email'] = $History[0]['Email'];
118
+    $Invite['EndTime'] = $Joined;
119
+    $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
120
+    $Invite['IP'] = $History[0]['IP'];
121
+    if (!$Current['StartTime']) {
122
+        $Current['StartTime'] = $Joined;
140 123
     }
124
+} else {
125
+    foreach ($History as $Key => $Val) {
126
+        if (isset($History[$Key + 1]) && !$History[$Key + 1]['Time'] && !$Val['Time']) {
127
+            // Invited email
128
+            $Invite['Email'] = $Val['Email'];
129
+            $Invite['EndTime'] = $Joined;
130
+            $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
131
+            $Invite['IP'] = $Val['IP'];
132
+        } elseif (isset($History[$Key - 1]) && $History[$Key - 1]['Email'] != $Val['Email'] && $Val['Time']) {
133
+            // Old email
134
+            $i = 1;
135
+            while ($Val['Email'] == $History[$Key + $i]['Email']) {
136
+                $i++;
137
+            }
138
+            $Old[$Key]['StartTime'] = (isset($History[$Key + $i]) && $History[$Key + $i]['Time']) ? $History[$Key + $i]['Time'] : $Joined;
139
+            $Old[$Key]['EndTime'] = $Val['Time'];
140
+            $Old[$Key]['IP'] = $Val['IP'];
141
+            $Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));
142
+            $Old[$Key]['Email'] = $Val['Email'];
143
+        }
141 144
 
142
-    if ($Val['Usernames'] != '') {
143
-      // Match with old email
144
-      $OldMatches[$Key]['Email'] = $Val['Email'];
145
-      $OldMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val['UserIDs'], true, true, true);
146
-      $OldMatches[$Key]['EndTime'] = $Val['UserSetTimes'];
147
-      $OldMatches[$Key]['IP'] = $Val['UserIPs'];
145
+        if ($Val['Usernames'] != '') {
146
+            // Match with old email
147
+            $OldMatches[$Key]['Email'] = $Val['Email'];
148
+            $OldMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val['UserIDs'], true, true, true);
149
+            $OldMatches[$Key]['EndTime'] = $Val['UserSetTimes'];
150
+            $OldMatches[$Key]['IP'] = $Val['UserIPs'];
151
+        }
148 152
     }
149
-  }
150 153
 }
151 154
 
152 155
 // Clean up arrays
153 156
 if ($Old ?? false) {
154
-  $Old = array_reverse(array_reverse($Old));
155
-  $LastOld = count($Old) - 1;
156
-  if ($Old[$LastOld]['StartTime'] != $Invite['EndTime']) {
157
-    // Make sure the timeline is intact (invite email was used as email for the account in the beginning)
158
-    $Old[$LastOld + 1]['Email'] = $Invite['Email'];
159
-    $Old[$LastOld + 1]['StartTime'] = $Invite['EndTime'];
160
-    $Old[$LastOld + 1]['EndTime'] = $Old[$LastOld]['StartTime'];
161
-    $Old[$LastOld + 1]['ElapsedTime'] = date(time() + strtotime($Old[$LastOld + 1]['EndTime'] ) - strtotime($Old[$LastOld + 1]['StartTime']));
162
-    $Old[$LastOld + 1]['IP'] = $Invite['IP'];
163
-  }
157
+    $Old = array_reverse(array_reverse($Old));
158
+    $LastOld = count($Old) - 1;
159
+    if ($Old[$LastOld]['StartTime'] != $Invite['EndTime']) {
160
+        // Make sure the timeline is intact (invite email was used as email for the account in the beginning)
161
+        $Old[$LastOld + 1]['Email'] = $Invite['Email'];
162
+        $Old[$LastOld + 1]['StartTime'] = $Invite['EndTime'];
163
+        $Old[$LastOld + 1]['EndTime'] = $Old[$LastOld]['StartTime'];
164
+        $Old[$LastOld + 1]['ElapsedTime'] = date(time() + strtotime($Old[$LastOld + 1]['EndTime']) - strtotime($Old[$LastOld + 1]['StartTime']));
165
+        $Old[$LastOld + 1]['IP'] = $Invite['IP'];
166
+    }
164 167
 }
165 168
 
166 169
 // Start page with current email
@@ -169,7 +172,8 @@ if ($Old ?? false) {
169 172
   <div class="header">
170 173
     <h2>Email history for <a href="user.php?id=<?=$UserID ?>"><?=$Username ?></a></h2>
171 174
     <div class="linkbox center">
172
-      <a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" class="brackets">Old email history</a>
175
+      <a href="userhistory.php?action=email&amp;userid=<?=$UserID?>"
176
+        class="brackets">Old email history</a>
173 177
     </div>
174 178
   </div>
175 179
   <br />
@@ -178,61 +182,69 @@ if ($Old ?? false) {
178 182
       <td>Current email</td>
179 183
       <td>Start</td>
180 184
       <td>End</td>
181
-      <td>Current IP <a href="userhistory.php?action=ips&amp;userid=<?=$UserID ?>" class="brackets">H</a></td>
185
+      <td>Current IP <a
186
+          href="userhistory.php?action=ips&amp;userid=<?=$UserID ?>"
187
+          class="brackets">H</a></td>
182 188
       <td>Set from IP</td>
183 189
     </tr>
184
-<?
190
+    <?php
185 191
 $Current['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['Email']) : '[Encrypted]';
186 192
 $Current['CurrentIP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['CurrentIP']) : '[Encrypted]';
187 193
 $Current['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Current['IP']) : '[Encrypted]';
188 194
 ?>
189 195
     <tr class="row">
190
-      <td><?=display_str($Current['Email'])?></td>
191
-      <td><?=time_diff($Current['StartTime'])?></td>
196
+      <td><?=display_str($Current['Email'])?>
197
+      </td>
198
+      <td><?=time_diff($Current['StartTime'])?>
199
+      </td>
192 200
       <td></td>
193 201
       <td>
194 202
         <?=display_str($Current['CurrentIP'])?>
195
-        (<?=Tools::get_country_code_by_ajax($Current['CurrentIP'])?>)
196
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['CurrentIP'])?>" class="brackets tooltip" title="Search">S</a>
197
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Current['CurrentIP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
203
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['CurrentIP'])?>"
204
+          class="brackets tooltip" title="Search">S</a>
205
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Current['CurrentIP'])?>"
206
+          class="brackets tooltip" title="Search WIMIA.com">WI</a>
198 207
         <br />
199 208
         <?=Tools::get_host_by_ajax($Current['CurrentIP'])?>
200 209
       </td>
201 210
       <td>
202 211
         <?=display_str($Current['IP'])?>
203
-        (<?=Tools::get_country_code_by_ajax($Current['IP'])?>)
204
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['IP'])?>" class="brackets tooltip" title="Search">S</a>
205
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Current['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
212
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['IP'])?>"
213
+          class="brackets tooltip" title="Search">S</a>
214
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Current['IP'])?>"
215
+          class="brackets tooltip" title="Search WIMIA.com">WI</a>
206 216
         <br />
207 217
         <?=Tools::get_host_by_ajax($Current['IP'])?>
208 218
       </td>
209 219
     </tr>
210
-<?
220
+    <?php
211 221
 if ($CurrentMatches ?? false) {
212
-  // Match on the current email
213
-  foreach ($CurrentMatches as $Match) {
214
-    $Match['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Match['IP']) : '[Encrypted]';
215
-?>
222
+    // Match on the current email
223
+    foreach ($CurrentMatches as $Match) {
224
+        $Match['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Match['IP']) : '[Encrypted]'; ?>
216 225
     <tr class="row">
217
-      <td><?=$Match['Username']?></td>
226
+      <td><?=$Match['Username']?>
227
+      </td>
218 228
       <td></td>
219
-      <td><?=time_diff($Match['EndTime'])?></td>
229
+      <td><?=time_diff($Match['EndTime'])?>
230
+      </td>
220 231
       <td></td>
221 232
       <td>
222 233
         <?=display_str($Match['IP'])?>
223
-        (<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
224
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
225
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
234
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>"
235
+          class="brackets tooltip" title="Search">S</a>
236
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>"
237
+          class="brackets tooltip" title="Search WIMIA.com">WI</a>
226 238
         <br />
227 239
         <?=Tools::get_host_by_ajax($Match['IP'])?>
228 240
       </td>
229 241
     </tr>
230
-<?
231
-  }
242
+    <?php
243
+    }
232 244
 }
233 245
 // Old emails
234 246
 if ($Old ?? false) {
235
-?>
247
+    ?>
236 248
     <tr class="colhead">
237 249
       <td>Old emails</td>
238 250
       <td>Start</td>
@@ -240,71 +252,78 @@ if ($Old ?? false) {
240 252
       <td>Elapsed</td>
241 253
       <td>Set from IP</td>
242 254
     </tr>
243
-<?
255
+    <?php
244 256
   $j = 0;
245
-  // Old email
246
-  foreach ($Old as $Record) {
247
-    ++$j;
257
+    // Old email
258
+    foreach ($Old as $Record) {
259
+        ++$j;
248 260
 
249
-    // Matches on old email
250
-    ob_start();
251
-    $i = 0;
252
-    if ($OldMatches ?? false) {
253
-      foreach ($OldMatches as $Match) {
254
-        if ($Match['Email'] == $Record['Email']) {
255
-          ++$i;
256
-          // Email matches
261
+        // Matches on old email
262
+        ob_start();
263
+        $i = 0;
264
+        if ($OldMatches ?? false) {
265
+            foreach ($OldMatches as $Match) {
266
+                if ($Match['Email'] == $Record['Email']) {
267
+                    ++$i;
268
+                    // Email matches
257 269
   ?>
258
-      <tr class="row hidden" id="matches_<?=$j?>">
259
-        <td><?=$Match['Username']?></td>
260
-        <td></td>
261
-        <td><?=time_diff($Match['EndTime'])?></td>
262
-        <td></td>
263
-        <td>
264
-          <?=display_str($Match['IP'])?>
265
-          (<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
266
-          <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
267
-          <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
268
-          <br />
269
-          <?=Tools::get_host_by_ajax($Match['IP'])?>
270
-        </td>
271
-      </tr>
272
-  <?
270
+    <tr class="row hidden" id="matches_<?=$j?>">
271
+      <td><?=$Match['Username']?>
272
+      </td>
273
+      <td></td>
274
+      <td><?=time_diff($Match['EndTime'])?>
275
+      </td>
276
+      <td></td>
277
+      <td>
278
+        <?=display_str($Match['IP'])?>
279
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>"
280
+          class="brackets tooltip" title="Search">S</a>
281
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>"
282
+          class="brackets tooltip" title="Search WIMIA.com">WI</a>
283
+        <br />
284
+        <?=Tools::get_host_by_ajax($Match['IP'])?>
285
+      </td>
286
+    </tr>
287
+    <?php
288
+                }
289
+            }
273 290
         }
274
-      }
275
-    }
276 291
 
277
-    // Save matches to variable
278
-    $MatchCount = $i;
279
-    $Matches = ob_get_contents();
280
-    ob_end_clean();
292
+        // Save matches to variable
293
+        $MatchCount = $i;
294
+        $Matches = ob_get_contents();
295
+        ob_end_clean();
281 296
 
282
-    $Record['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Record['Email']) : '[Encrypted]';
283
-    $Record['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Record['IP']) : '[Encrypted]';
284
-?>
297
+        $Record['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Record['Email']) : '[Encrypted]';
298
+        $Record['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Record['IP']) : '[Encrypted]'; ?>
285 299
     <tr class="row">
286
-      <td><?=display_str($Record['Email'])?><?=(($MatchCount > 0) ? ' <a data-toggle-target="#matches_'.$j.'">('.$MatchCount.')</a>' : '')?></td>
287
-      <td><?=time_diff($Record['StartTime'])?></td>
288
-      <td><?=time_diff($Record['EndTime'])?></td>
289
-      <td><?=time_diff($Record['ElapsedTime'])?></td>
300
+      <td><?=display_str($Record['Email'])?><?=(($MatchCount > 0) ? ' <a data-toggle-target="#matches_'.$j.'">('.$MatchCount.')</a>' : '')?>
301
+      </td>
302
+      <td><?=time_diff($Record['StartTime'])?>
303
+      </td>
304
+      <td><?=time_diff($Record['EndTime'])?>
305
+      </td>
306
+      <td><?=time_diff($Record['ElapsedTime'])?>
307
+      </td>
290 308
       <td>
291 309
         <?=display_str($Record['IP'])?>
292
-        (<?=Tools::get_country_code_by_ajax($Record['IP'])?>)
293
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Record['IP'])?>" class="brackets tooltip" title="Search">S</a>
294
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Record['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
310
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Record['IP'])?>"
311
+          class="brackets tooltip" title="Search">S</a>
312
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Record['IP'])?>"
313
+          class="brackets tooltip" title="Search WIMIA.com">WI</a>
295 314
         <br />
296 315
         <?=Tools::get_host_by_ajax($Record['IP'])?>
297 316
       </td>
298 317
     </tr>
299
-<?
318
+    <?php
300 319
     if ($MatchCount > 0) {
301
-      if (isset($Matches)) {
302
-        echo $Matches;
303
-        unset($Matches);
304
-        unset($MatchCount);
305
-      }
320
+        if (isset($Matches)) {
321
+            echo $Matches;
322
+            unset($Matches);
323
+            unset($MatchCount);
324
+        }
325
+    }
306 326
     }
307
-  }
308 327
 }
309 328
 // Invite email (always there)
310 329
 ?>
@@ -315,35 +334,37 @@ if ($Old ?? false) {
315 334
       <td>Age of account</td>
316 335
       <td>Registration IP address</td>
317 336
     </tr>
318
-<?
337
+    <?php
319 338
 // Matches on invite email
320 339
 $i = 0;
321 340
 ob_start();
322 341
 if ($OldMatches ?? false) {
323
-  foreach ($OldMatches as $Match) {
324
-    if ($Match['Email'] == $Invite['Email']) {
325
-      ++$i;
326
-      // Match email is the same as the invite email
342
+    foreach ($OldMatches as $Match) {
343
+        if ($Match['Email'] == $Invite['Email']) {
344
+            ++$i;
345
+            // Match email is the same as the invite email
327 346
 
328
-      $Match['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Match['IP']) : '[Encrypted]';
329
-?>
347
+            $Match['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Match['IP']) : '[Encrypted]'; ?>
330 348
     <tr class="row hidden" id="matches_invite">
331
-      <td><?=$Match['Username']?></td>
349
+      <td><?=$Match['Username']?>
350
+      </td>
332 351
       <td></td>
333
-      <td><?=time_diff($Match['EndTime'])?></td>
352
+      <td><?=time_diff($Match['EndTime'])?>
353
+      </td>
334 354
       <td></td>
335 355
       <td>
336 356
         <?=display_str($Match['IP'])?>
337
-        (<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
338
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
339
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
357
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>"
358
+          class="brackets tooltip" title="Search">S</a>
359
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>"
360
+          class="brackets tooltip" title="Search WIMIA.com">WI</a>
340 361
         <br />
341 362
         <?=Tools::get_host_by_ajax($Match['IP'])?>
342 363
       </td>
343 364
     </tr>
344
-<?
365
+    <?php
366
+        }
345 367
     }
346
-  }
347 368
 }
348 369
 $MatchCount = $i;
349 370
 $Matches = ob_get_contents();
@@ -353,26 +374,30 @@ $Invite['Email'] = apcu_exists('DBKEY') ? Crypto::decrypt($Invite['Email']) : '[
353 374
 $Invite['IP'] = apcu_exists('DBKEY') ? Crypto::decrypt($Invite['IP']) : '[Encrypted]';
354 375
 ?>
355 376
     <tr class="row">
356
-      <td><?=display_str($Invite['Email'])?><?=(($MatchCount > 0) ? ' <a data-toggle-target="#matches_invite">('.$MatchCount.')</a>' : '')?></td>
377
+      <td><?=display_str($Invite['Email'])?><?=(($MatchCount > 0) ? ' <a data-toggle-target="#matches_invite">('.$MatchCount.')</a>' : '')?>
378
+      </td>
357 379
       <td>Never</td>
358
-      <td><?=time_diff($Invite['EndTime'])?></td>
359
-      <td><?=time_diff($Invite['AccountAge'])?></td>
380
+      <td><?=time_diff($Invite['EndTime'])?>
381
+      </td>
382
+      <td><?=time_diff($Invite['AccountAge'])?>
383
+      </td>
360 384
       <td>
361 385
         <?=display_str($Invite['IP'])?>
362
-        (<?=Tools::get_country_code_by_ajax($Invite['IP'])?>)
363
-        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Invite['IP'])?>" class="brackets tooltip" title="Search">S</a>
364
-        <a href="http://whatismyipaddress.com/ip/<?=display_str($Invite['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
386
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Invite['IP'])?>"
387
+          class="brackets tooltip" title="Search">S</a>
388
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Invite['IP'])?>"
389
+          class="brackets tooltip" title="Search WIMIA.com">WI</a>
365 390
         <br />
366 391
         <?=Tools::get_host_by_ajax($Invite['IP'])?>
367 392
       </td>
368 393
     </tr>
369
-<?
394
+    <?php
370 395
 
371 396
 if ($Matches) {
372
-  echo $Matches;
397
+    echo $Matches;
373 398
 }
374 399
 
375 400
 ?>
376 401
   </table>
377 402
 </div>
378
-<? View::show_footer(); ?>
403
+<?php View::show_footer();

+ 150
- 123
sections/userhistory/ip_history.php View File

@@ -1,4 +1,6 @@
1 1
 <?php
2
+#declare(strict_types=1);
3
+
2 4
 /************************************************************************
3 5
 ||------------|| User IP history page ||---------------------------||
4 6
 
@@ -14,7 +16,7 @@ define('IPS_PER_PAGE', 25);
14 16
 
15 17
 $UserID = $_GET['userid'];
16 18
 if (!is_number($UserID)) {
17
-  error(404);
19
+    error(404);
18 20
 }
19 21
 
20 22
 $DB->query("
@@ -27,69 +29,71 @@ $DB->query("
27 29
 list($Username, $Class) = $DB->next_record();
28 30
 
29 31
 if (!check_perms('users_view_ips', $Class)) {
30
-  error(403);
32
+    error(403);
31 33
 }
32 34
 
33 35
 $UsersOnly = isset($_GET['usersonly']) ? $_GET['usersonly'] : 0;
34 36
 
35 37
 if (isset($_POST['ip'])) {
36
-  $SearchIP = db_string(str_replace("*", "%", trim($_POST['ip'])));
37
-  $SearchIPQuery = " AND h1.IP LIKE '$SearchIP' ";
38
+    $SearchIP = db_string(str_replace("*", "%", trim($_POST['ip'])));
39
+    $SearchIPQuery = " AND h1.IP LIKE '$SearchIP' ";
38 40
 } else {
39
-  $SearchIPQuery = "";
41
+    $SearchIPQuery = "";
40 42
 }
41 43
 
42 44
 View::show_header("IP address history for $Username");
43 45
 ?>
44
-<script type="text/javascript">//<![CDATA[
45
-function ShowIPs(rowname) {
46
-  $('tr[name="' + rowname + '"]').gtoggle();
46
+<script type="text/javascript">
47
+  //<![CDATA[
48
+  function ShowIPs(rowname) {
49
+    $('tr[name="' + rowname + '"]').gtoggle();
47 50
 
48
-}
49
-function Ban(ip, id, elemID) {
50
-  var notes = prompt("Enter notes for this ban");
51
-  if (notes != null && notes.length > 0) {
52
-    var xmlhttp;
53
-    if (window.XMLHttpRequest) {
54
-      xmlhttp = new XMLHttpRequest();
55
-    } else {
56
-      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
57
-    }
58
-    xmlhttp.onreadystatechange=function() {
59
-      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
60
-        document.getElementById(elemID).innerHTML = "<strong>[Banned]</strong>";
61
-      }
62
-    }
63
-    xmlhttp.open("GET", "tools.php?action=quick_ban&perform=create&ip=" + ip + "&notes=" + notes, true);
64
-    xmlhttp.send();
65 51
   }
66 52
 
67
-}
68
-/*
69
-function UnBan(ip, id, elemID) {
70
-    var xmlhttp;
71
-    if (window.XMLHttpRequest) {
72
-      xmlhttp = new XMLHttpRequest();
73
-    } else {
74
-      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
75
-    }
76
-    xmlhttp.onreadystatechange = function() {
77
-      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
78
-        document.getElementById(elemID).innerHTML = "Ban";
79
-        document.getElementById(elemID).onclick = function() { Ban(ip, id, elemID); return false; };
53
+  function Ban(ip, id, elemID) {
54
+    var notes = prompt("Enter notes for this ban");
55
+    if (notes != null && notes.length > 0) {
56
+      var xmlhttp;
57
+      if (window.XMLHttpRequest) {
58
+        xmlhttp = new XMLHttpRequest();
59
+      } else {
60
+        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
61
+      }
62
+      xmlhttp.onreadystatechange = function() {
63
+        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
64
+          document.getElementById(elemID).innerHTML = "<strong>[Banned]</strong>";
65
+        }
80 66
       }
67
+      xmlhttp.open("GET", "tools.php?action=quick_ban&perform=create&ip=" + ip + "&notes=" + notes, true);
68
+      xmlhttp.send();
81 69
     }
82
-    xmlhttp.open("GET","tools.php?action=quick_ban&perform=delete&id=" + id + "&ip=" + ip, true);
83
-    xmlhttp.send();
84
-}
85
-*/
86
-//]]>
70
+
71
+  }
72
+  /*
73
+  function UnBan(ip, id, elemID) {
74
+      var xmlhttp;
75
+      if (window.XMLHttpRequest) {
76
+        xmlhttp = new XMLHttpRequest();
77
+      } else {
78
+        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
79
+      }
80
+      xmlhttp.onreadystatechange = function() {
81
+        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
82
+          document.getElementById(elemID).innerHTML = "Ban";
83
+          document.getElementById(elemID).onclick = function() { Ban(ip, id, elemID); return false; };
84
+        }
85
+      }
86
+      xmlhttp.open("GET","tools.php?action=quick_ban&perform=delete&id=" + id + "&ip=" + ip, true);
87
+      xmlhttp.send();
88
+  }
89
+  */
90
+  //]]>
87 91
 </script>
88
-<?
92
+<?php
89 93
 list($Page, $Limit) = Format::page_limit(IPS_PER_PAGE);
90 94
 
91 95
 if ($UsersOnly == 1) {
92
-  $RS = $DB->query("
96
+    $RS = $DB->query("
93 97
     SELECT
94 98
       SQL_CALC_FOUND_ROWS
95 99
       h1.IP,
@@ -112,7 +116,7 @@ if ($UsersOnly == 1) {
112 116
     ORDER BY h1.StartTime DESC
113 117
     LIMIT $Limit");
114 118
 } else {
115
-  $RS = $DB->query("
119
+    $RS = $DB->query("
116 120
     SELECT
117 121
       SQL_CALC_FOUND_ROWS
118 122
       h1.IP,
@@ -143,130 +147,153 @@ $Pages = Format::get_pages($Page, $NumResults, IPS_PER_PAGE, 9);
143 147
 ?>
144 148
 <div>
145 149
   <div class="header">
146
-    <h2>IP address history for <a href="user.php?id=<?=$UserID?>"><?=$Username?></a></h2>
150
+    <h2>IP address history for <a
151
+        href="user.php?id=<?=$UserID?>"><?=$Username?></a></h2>
147 152
     <div class="linkbox">
148
-<?php if ($UsersOnly) { ?>
149
-      <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" class="brackets">View all IP addresses</a>
150
-<?php } else { ?>
151
-      <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1" class="brackets">View IP addresses with users</a>
152
-<?php } ?>
153
+      <?php if ($UsersOnly) { ?>
154
+      <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>"
155
+        class="brackets">View all IP addresses</a>
156
+      <?php } else { ?>
157
+      <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1"
158
+        class="brackets">View IP addresses with users</a>
159
+      <?php } ?>
153 160
     </div>
154
-<?php if ($Pages) { ?>
155
-    <div class="linkbox pager"><?=$Pages?></div>
156
-<?php } ?>
161
+    <?php if ($Pages) { ?>
162
+    <div class="linkbox pager"><?=$Pages?>
163
+    </div>
164
+    <?php } ?>
157 165
   </div>
158 166
   <table>
159 167
     <tr class="colhead">
160 168
       <td>IP address search</td>
161 169
     </tr>
162 170
 
163
-    <tr><td>
164
-      <form class="search_form" name="ip_log" method="post" action="">
165
-        <input type="text" name="ip" />
166
-        <input type="submit" value="Search" />
167
-        Wildcard (*) search examples: 127.0.* or 1*2.0.*.1 or *.*.*.*
168
-      </form>
169
-    </td></tr>
171
+    <tr>
172
+      <td>
173
+        <form class="search_form" name="ip_log" method="post" action="">
174
+          <input type="text" name="ip" />
175
+          <input type="submit" value="Search" />
176
+          Wildcard (*) search examples: 127.0.* or 1*2.0.*.1 or *.*.*.*
177
+        </form>
178
+      </td>
179
+    </tr>
170 180
   </table>
171 181
 
172 182
   <table id="iphistory">
173 183
     <tr class="colhead">
174 184
       <td>IP address</td>
175
-      <td>Started <a href="#" onclick="$('#iphistory td:nth-child(2), #iphistory td:nth-child(4)').ghide(); $('#iphistory td:nth-child(3), #iphistory td:nth-child(5)').gshow(); return false;" class="brackets">Toggle</a></td>
176
-      <td class="hidden">Started <a href="#" onclick="$('#iphistory td:nth-child(2), #iphistory td:nth-child(4)').gshow(); $('#iphistory td:nth-child(3), #iphistory td:nth-child(5)').ghide(); return false;" class="brackets">Toggle</a></td>
185
+      <td>Started <a href="#"
186
+          onclick="$('#iphistory td:nth-child(2), #iphistory td:nth-child(4)').ghide(); $('#iphistory td:nth-child(3), #iphistory td:nth-child(5)').gshow(); return false;"
187
+          class="brackets">Toggle</a></td>
188
+      <td class="hidden">Started <a href="#"
189
+          onclick="$('#iphistory td:nth-child(2), #iphistory td:nth-child(4)').gshow(); $('#iphistory td:nth-child(3), #iphistory td:nth-child(5)').ghide(); return false;"
190
+          class="brackets">Toggle</a></td>
177 191
       <td>Ended</td>
178 192
       <td class="hidden">Ended</td>
179 193
       <td>Elapsed</td>
180 194
     </tr>
181
-<?
195
+    <?php
182 196
 $counter = 0;
183 197
 $IPs = [];
184 198
 $Results = $DB->to_array();
185 199
 $CanManageIPBans = check_perms('admin_manage_ipbans');
186 200
 
187 201
 foreach ($Results as $Index => $Result) {
188
-  list($IP, $StartTime, $EndTime, $UserIDs, $UserStartTimes, $UserEndTimes, $Usernames, $UsersEnabled, $UsersDonor, $UsersWarned) = $Result;
202
+    list($IP, $StartTime, $EndTime, $UserIDs, $UserStartTimes, $UserEndTimes, $Usernames, $UsersEnabled, $UsersDonor, $UsersWarned) = $Result;
189 203
 
190
-  $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
204
+    $IP = apcu_exists('DBKEY') ? Crypto::decrypt($IP) : '[Encrypted]';
191 205
 
192
-  $HasDupe = false;
193
-  $UserIDs = explode('|', $UserIDs);
194
-  if (!$EndTime) {
195
-    $EndTime = sqltime();
196
-  }
197
-  if ($UserIDs[0] != 0) {
198
-    $HasDupe = true;
199
-    $UserStartTimes = explode('|', $UserStartTimes);
200
-    $UserEndTimes = explode('|', $UserEndTimes);
201
-    $Usernames = explode('|', $Usernames);
202
-    $UsersEnabled = explode('|', $UsersEnabled);
203
-    $UsersDonor = explode('|', $UsersDonor);
204
-    $UsersWarned = explode('|', $UsersWarned);
205
-  }
206
-?>
206
+    $HasDupe = false;
207
+    $UserIDs = explode('|', $UserIDs);
208
+    if (!$EndTime) {
209
+        $EndTime = sqltime();
210
+    }
211
+    if ($UserIDs[0] != 0) {
212
+        $HasDupe = true;
213
+        $UserStartTimes = explode('|', $UserStartTimes);
214
+        $UserEndTimes = explode('|', $UserEndTimes);
215
+        $Usernames = explode('|', $Usernames);
216
+        $UsersEnabled = explode('|', $UsersEnabled);
217
+        $UsersDonor = explode('|', $UsersDonor);
218
+        $UsersWarned = explode('|', $UsersWarned);
219
+    } ?>
207 220
     <tr class="row">
208 221
       <td>
209
-        <?=$IP?> (<?=Tools::get_country_code_by_ajax($IP)?>)<?
222
+        <?=$IP?>
223
+        <?php
210 224
   if ($CanManageIPBans) {
211
-    if (!isset($IPs[$IP])) {
212
-      $sql = "
225
+      if (!isset($IPs[$IP])) {
226
+          $sql = "
213 227
         SELECT ID, FromIP, ToIP
214 228
         FROM ip_bans
215 229
         WHERE '".Tools::ip_to_unsigned($IP)."' BETWEEN FromIP AND ToIP
216 230
         LIMIT 1";
217
-      $DB->query($sql);
231
+          $DB->query($sql);
218 232
 
219
-      if ($DB->has_results()) {
220
-        $IPs[$IP] = true;
221
-?>
233
+          if ($DB->has_results()) {
234
+              $IPs[$IP] = true; ?>
222 235
         <strong>[Banned]</strong>
223
-<?
224
-      } else {
225
-        $IPs[$IP] = false;
226
-?>
227
-        <a id="<?=$counter?>" href="#" onclick="Ban('<?=$IP?>', '', '<?=$counter?>'); this.onclick = null; return false;" class="brackets">Ban</a>
228
-<?
236
+        <?php
237
+          } else {
238
+              $IPs[$IP] = false; ?>
239
+        <a id="<?=$counter?>" href="#"
240
+          onclick="Ban('<?=$IP?>', '', '<?=$counter?>'); this.onclick = null; return false;"
241
+          class="brackets">Ban</a>
242
+        <?php
243
+          }
244
+          $counter++;
229 245
       }
230
-      $counter++;
231
-    }
232
-  }
233
-?>
246
+  } ?>
234 247
         <br />
235 248
         <?=Tools::get_host_by_ajax($IP)?>
236 249
         <?=($HasDupe ? '<a href="#" onclick="ShowIPs('.$Index.'); return false;">('.count($UserIDs).')</a>' : '(0)')?>
237 250
       </td>
238
-      <td><?=time_diff($StartTime)?></td>
239
-      <td class="hidden"><?=$StartTime?></td>
240
-      <td><?=time_diff($EndTime)?></td>
241
-      <td class="hidden"><?=$EndTime?></td>
242
-      <td><?//time_diff(strtotime($StartTime), strtotime($EndTime)); ?></td>
251
+      <td><?=time_diff($StartTime)?>
252
+      </td>
253
+      <td class="hidden"><?=$StartTime?>
254
+      </td>
255
+      <td><?=time_diff($EndTime)?>
256
+      </td>
257
+      <td class="hidden"><?=$EndTime?>
258
+      </td>
259
+      <td>
260
+        <?//time_diff(strtotime($StartTime), strtotime($EndTime));?>
261
+      </td>
243 262
     </tr>
244
-<?
263
+    <?php
245 264
   if ($HasDupe) {
246
-    $HideMe = (count($UserIDs) > 10);
247
-    foreach ($UserIDs as $Key => $Val) {
248
-      if (!$UserEndTimes[$Key]) {
249
-        $UserEndTimes[$Key] = sqltime();
250
-      }
251
-?>
252
-    <tr class="row<?=($HideMe ? ' hidden' : '')?>" name="<?=$Index?>">
253
-      <td>&nbsp;&nbsp;&#187;&nbsp;<?=Users::format_username($Val, true, true, true)?></td>
254
-      <td><?=time_diff($UserStartTimes[$Key])?></td>
255
-      <td class="hidden"><?=$UserStartTimes[$Key]?></td>
256
-      <td><?=time_diff($UserEndTimes[$Key])?></td>
257
-      <td class="hidden"><?=$UserEndTimes[$Key]?></td>
258
-      <td><?//time_diff(strtotime($UserStartTimes[$Key]), strtotime($UserEndTimes[$Key])); ?></td>
265
+      $HideMe = (count($UserIDs) > 10);
266
+      foreach ($UserIDs as $Key => $Val) {
267
+          if (!$UserEndTimes[$Key]) {
268
+              $UserEndTimes[$Key] = sqltime();
269
+          } ?>
270
+    <tr
271
+      class="row<?=($HideMe ? ' hidden' : '')?>"
272
+      name="<?=$Index?>">
273
+      <td>&nbsp;&nbsp;&#187;&nbsp;<?=Users::format_username($Val, true, true, true)?>
274
+      </td>
275
+      <td><?=time_diff($UserStartTimes[$Key])?>
276
+      </td>
277
+      <td class="hidden"><?=$UserStartTimes[$Key]?>
278
+      </td>
279
+      <td><?=time_diff($UserEndTimes[$Key])?>
280
+      </td>
281
+      <td class="hidden"><?=$UserEndTimes[$Key]?>
282
+      </td>
283
+      <td>
284
+        <?//time_diff(strtotime($UserStartTimes[$Key]), strtotime($UserEndTimes[$Key]));?>
285
+      </td>
259 286
     </tr>
260
-<?
261
-
262
-    }
287
+    <?php
288
+      }
263 289
   }
264 290
 }
265 291
 ?>
266 292
   </table>
293
+
267 294
   <div class="linkbox">
268 295
     <?=$Pages?>
269 296
   </div>
270 297
 </div>
271
-<?
272
-View::show_footer();
298
+
299
+<?php View::show_footer();

+ 34
- 30
sections/userhistory/ip_tracker_history.php View File

@@ -1,4 +1,6 @@
1 1
 <?php
2
+#declare(strict_types=1);
3
+
2 4
 /************************************************************************
3 5
 ||------------|| User IP history page ||---------------------------||
4 6
 
@@ -13,12 +15,12 @@ user.
13 15
 define('IPS_PER_PAGE', 25);
14 16
 
15 17
 if (!check_perms('users_mod')) {
16
-  error(403);
18
+    error(403);
17 19
 }
18 20
 
19 21
 $UserID = $_GET['userid'];
20 22
 if (!is_number($UserID)) {
21
-  error(404);
23
+    error(404);
22 24
 }
23 25
 
24 26
 $DB->query("
@@ -30,7 +32,7 @@ $DB->query("
30 32
 list($Username, $Class) = $DB->next_record();
31 33
 
32 34
 if (!check_perms('users_view_ips', $Class)) {
33
-  error(403);
35
+    error(403);
34 36
 }
35 37
 
36 38
 $UsersOnly = $_GET['usersonly'];
@@ -38,15 +40,17 @@ $UsersOnly = $_GET['usersonly'];
38 40
 View::show_header("Tracker IP address history for $Username");
39 41
 ?>
40 42
 <script type="text/javascript">
41
-function ShowIPs(rowname) {
42
-  $('tr[name="'+rowname+'"]').gtoggle();
43
-}
43
+  function ShowIPs(rowname) {
44
+    $('tr[name="' + rowname + '"]').gtoggle();
45
+  }
44 46
 </script>
45
-<?
47
+<?php
46 48
 list($Page, $Limit) = Format::page_limit(IPS_PER_PAGE);
47 49
 
48 50
 $Perms = get_permissions_for_user($UserID);
49
-if ($Perms['site_disable_ip_history']) $Limit = 0;
51
+if ($Perms['site_disable_ip_history']) {
52
+    $Limit = 0;
53
+}
50 54
 
51 55
 $TrackerIps = $DB->query("
52 56
   SELECT IP, fid, tstamp
@@ -65,38 +69,38 @@ $Pages = Format::get_pages($Page, $NumResults, IPS_PER_PAGE, 9);
65 69
 ?>
66 70
 <div>
67 71
   <div class="header">
68
-    <h2>Tracker IP address history for <a href="user.php?id=<?=$UserID?>"><?=$Username?></a></h2>
72
+    <h2>Tracker IP address history for <a
73
+        href="user.php?id=<?=$UserID?>"><?=$Username?></a></h2>
74
+  </div>
75
+  <div class="linkbox"><?=$Pages?>
69 76
   </div>
70
-  <div class="linkbox"><?=$Pages?></div>
71 77
   <table>
72 78
     <tr class="colhead">
73 79
       <td>IP address</td>
74 80
       <td>Torrent</td>
75 81
       <td>Time</td>
76 82
     </tr>
77
-<?
83
+    <?php
78 84
 $Results = $DB->to_array();
79 85
 foreach ($Results as $Index => $Result) {
80
-  list($IP, $TorrentID, $Time) = $Result;
81
-
82
-?>
83
-  <tr class="row">
84
-    <td>
85
-      <?=$IP?> (<?=Tools::get_country_code_by_ajax($IP)?>)<br /><?=Tools::get_host_by_ajax($IP)?>
86
-      <a href="http://whatismyipaddress.com/ip/<?=display_str($IP)?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
87
-    </td>
88
-    <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td>
89
-    <td><?=date('Y-m-d g:i:s', $Time)?></td>
90
-  </tr>
91
-<?
86
+    list($IP, $TorrentID, $Time) = $Result; ?>
87
+    <tr class="row">
88
+      <td>
89
+        <?=$IP?><br /><?=Tools::get_host_by_ajax($IP)?>
90
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($IP)?>"
91
+          class="brackets tooltip" title="Search WIMIA.com">WI</a>
92
+      </td>
93
+      <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td>
94
+      <td><?=date('Y-m-d g:i:s', $Time)?>
95
+      </td>
96
+    </tr>
97
+    <?php
92 98
 }
93 99
 ?>
94
-</table>
95
-<div class="linkbox">
96
-  <?=$Pages?>
97
-</div>
100
+  </table>
101
+  <div class="linkbox">
102
+    <?=$Pages?>
103
+  </div>
98 104
 </div>
99 105
 
100
-<?
101
-View::show_footer();
102
-?>
106
+<?php View::show_footer();

Loading…
Cancel
Save