8 Commits

Author SHA1 Message Date
  biotorrents abbdd7612d Use prepared queries on stats and store 4 years ago
  biotorrents 8f824a4843 Use prepared queries on better, blog, and some bookmarks (add/remove artist notifications still broken) 4 years ago
  biotorrents d1ca9c6f18 Use prepared queries on classes/script_start.php 4 years ago
  biotorrents 881b17cd1e Use prepared queries for subscriptions, collages, and some tools; fix minor bugs 4 years ago
  biotorrents f7c0a57e33 Use prepared queries on the wiki 4 years ago
  biotorrents e691b575e8 Make Matcha a stylesheet addition of Bookish 4 years ago
  biotorrents 33d4d43448 Delete the Genaviv stylesheet! 4 years ago
  biotorrents da6d0c0cee Remove label aliases and apply Skeleton to the Toolbox 4 years ago
100 changed files with 860 additions and 595 deletions
  1. 2
    2
      classes/donationsview.class.php
  2. 4
    4
      classes/mysql.class.php
  3. 1
    1
      classes/permissions_form.php
  4. 9
    9
      classes/script_start.php
  5. 1
    1
      classes/torrent_form.class.php
  6. 3
    15
      gazelle.sql
  7. 12
    10
      sections/artist/notify.php
  8. 19
    15
      sections/artist/notifyremove.php
  9. 1
    1
      sections/better/better.php
  10. 1
    1
      sections/better/covers.php
  11. 3
    3
      sections/better/folders.php
  12. 1
    1
      sections/better/literature.php
  13. 1
    1
      sections/better/single.php
  14. 3
    3
      sections/better/tags.php
  15. 10
    10
      sections/blog/index.php
  16. 6
    6
      sections/bookmarks/add.php
  17. 3
    3
      sections/bookmarks/artists.php
  18. 1
    1
      sections/collages/browse.php
  19. 1
    1
      sections/collages/recover.php
  20. 2
    2
      sections/collages/torrent_collage.php
  21. 1
    1
      sections/forums/edit_rules.php
  22. 2
    2
      sections/forums/forum.php
  23. 1
    1
      sections/forums/newthread.php
  24. 5
    4
      sections/forums/thread.php
  25. 3
    7
      sections/register/closed.php
  26. 1
    1
      sections/requests/request.php
  27. 3
    3
      sections/stats/torrents.php
  28. 5
    5
      sections/stats/users.php
  29. 3
    3
      sections/store/badge.php
  30. 6
    6
      sections/store/coinbadge.php
  31. 7
    7
      sections/store/freeleechize.php
  32. 8
    8
      sections/store/freeleechpool.php
  33. 3
    3
      sections/store/invite.php
  34. 3
    3
      sections/store/points_1.php
  35. 3
    3
      sections/store/points_10.php
  36. 3
    3
      sections/store/points_100.php
  37. 3
    3
      sections/store/points_1000.php
  38. 4
    4
      sections/store/promotion.php
  39. 2
    2
      sections/store/store.php
  40. 3
    3
      sections/store/title.php
  41. 3
    3
      sections/store/token.php
  42. 3
    3
      sections/store/upload_1.php
  43. 3
    3
      sections/store/upload_10.php
  44. 3
    3
      sections/store/upload_100.php
  45. 3
    3
      sections/store/upload_1000.php
  46. 9
    5
      sections/tools/data/database_specifics.php
  47. 8
    8
      sections/tools/data/economic_stats.php
  48. 1
    1
      sections/tools/data/invite_pool.php
  49. 1
    1
      sections/tools/data/registration_log.php
  50. 5
    5
      sections/tools/data/torrent_stats.php
  51. 1
    1
      sections/tools/development/clear_cache.php
  52. 17
    17
      sections/tools/development/misc_values.php
  53. 4
    0
      sections/tools/development/render_build_preview.js
  54. 36
    27
      sections/tools/development/rerender_gallery.php
  55. 2
    2
      sections/tools/development/service_stats.php
  56. 1
    1
      sections/tools/finances/donation_log.php
  57. 13
    17
      sections/tools/index.php
  58. 2
    2
      sections/tools/managers/bans.php
  59. 5
    5
      sections/tools/managers/email_blacklist.php
  60. 2
    2
      sections/tools/managers/global_notification.php
  61. 0
    114
      sections/tools/managers/label_aliases.php
  62. 1
    1
      sections/tools/managers/mass_pm.php
  63. 1
    1
      sections/tools/managers/multiple_freeleech.php
  64. 4
    4
      sections/tools/managers/news.php
  65. 1
    1
      sections/tools/managers/official_tags.php
  66. 1
    1
      sections/tools/managers/permissions_alter.php
  67. 2
    2
      sections/tools/managers/permissions_list.php
  68. 126
    103
      sections/tools/managers/sitewide_freeleech.php
  69. 2
    2
      sections/tools/managers/tag_aliases.php
  70. 1
    1
      sections/tools/managers/tokens.php
  71. 4
    2
      sections/tools/managers/whitelist_list.php
  72. 1
    1
      sections/tools/misc/create_user.php
  73. 1
    1
      sections/tools/misc/database_key.php
  74. 1
    1
      sections/tools/misc/manipulate_tree.php
  75. 1
    1
      sections/tools/misc/tags.php
  76. 9
    11
      sections/tools/tools.php
  77. 3
    5
      sections/torrents/download.php
  78. 1
    1
      sections/user/permissions.php
  79. 7
    7
      sections/user/user.php
  80. 3
    3
      sections/userhistory/collage_subscribe.php
  81. 2
    2
      sections/userhistory/subscribed_collages.php
  82. 2
    2
      sections/userhistory/subscriptions.php
  83. 1
    1
      sections/userhistory/thread_subscribe.php
  84. 8
    6
      sections/userhistory/token_history.php
  85. 2
    2
      sections/wiki/add_alias.php
  86. 6
    3
      sections/wiki/compare.php
  87. 1
    1
      sections/wiki/create.php
  88. 4
    4
      sections/wiki/delete.php
  89. 2
    2
      sections/wiki/delete_alias.php
  90. 1
    1
      sections/wiki/edit.php
  91. 2
    2
      sections/wiki/revisions.php
  92. 6
    6
      sections/wiki/search.php
  93. 3
    3
      sections/wiki/takecreate.php
  94. 2
    2
      sections/wiki/takeedit.php
  95. 1
    1
      sections/wiki/wiki_browse.php
  96. 0
    23
      static/styles/assets/scss/fonts.scss
  97. 1
    0
      static/styles/bookish/bookish.scss
  98. 371
    0
      static/styles/bookish/matcha/matcha.scss
  99. 0
    0
      static/styles/bookish/matcha/sam-komon.png
  100. 0
    0
      static/styles/bookish/scss/colors.scss

+ 2
- 2
classes/donationsview.class.php View File

6
     public static function render_mod_donations($UserID)
6
     public static function render_mod_donations($UserID)
7
     {
7
     {
8
         ?>
8
         ?>
9
-<table class="layout box" id="donation_box">
9
+<table class="box skeleton-fix" id="donation_box">
10
   <tr class="colhead">
10
   <tr class="colhead">
11
     <td colspan="2">
11
     <td colspan="2">
12
       Donor System (add points)
12
       Donor System (add points)
34
   </tr>
34
   </tr>
35
 </table>
35
 </table>
36
 
36
 
37
-<table class="layout box" id="donor_points_box">
37
+<table class="box skeleton-fix" id="donor_points_box">
38
   <tr class="colhead">
38
   <tr class="colhead">
39
     <td colspan="3" class="tooltip"
39
     <td colspan="3" class="tooltip"
40
       title='Use this tool only when manually correcting values. If crediting donations normally, use the "Donor System (add points)" tool'>
40
       title='Use this tool only when manually correcting values. If crediting donations normally, use the "Donor System (add points)" tool'>

+ 4
- 4
classes/mysql.class.php View File

22
 
22
 
23
 * Making a query
23
 * Making a query
24
 
24
 
25
-$DB->query("
25
+$DB->prepared_query("
26
   SELECT *
26
   SELECT *
27
   FROM table...");
27
   FROM table...");
28
 
28
 
92
   This class can only hold one result set at a time. Using set_query_id allows
92
   This class can only hold one result set at a time. Using set_query_id allows
93
   you to set the result set that the class is using to the result set in
93
   you to set the result set that the class is using to the result set in
94
   $ResultSet. This result set should have been obtained earlier by using
94
   $ResultSet. This result set should have been obtained earlier by using
95
-  $DB->query().
95
+  $DB->prepared_query().
96
 
96
 
97
   Example:
97
   Example:
98
 
98
 
99
-  $FoodRS = $DB->query("
99
+  $FoodRS = $DB->prepared_query("
100
       SELECT *
100
       SELECT *
101
       FROM food");
101
       FROM food");
102
-  $DB->query("
102
+  $DB->prepared_query("
103
     SELECT *
103
     SELECT *
104
     FROM drink");
104
     FROM drink");
105
   $Drinks = $DB->next_record();
105
   $Drinks = $DB->next_record();

+ 1
- 1
classes/permissions_form.php View File

284
     </div>
284
     </div>
285
     
285
     
286
     <div class="submit_container">
286
     <div class="submit_container">
287
-      <input type="submit" name="submit" value="Save Permission Class" />
287
+      <input type="submit" name="submit" class ="button-primary" value="Save Permission Class" />
288
     </div>
288
     </div>
289
 HTML;
289
 HTML;
290
 }
290
 }

+ 9
- 9
classes/script_start.php View File

225
 
225
 
226
     $UserSessions = $Cache->get_value("users_sessions_$UserID");
226
     $UserSessions = $Cache->get_value("users_sessions_$UserID");
227
     if (!is_array($UserSessions)) {
227
     if (!is_array($UserSessions)) {
228
-        $DB->query(
228
+        $DB->prepared_query(
229
             "
229
             "
230
         SELECT
230
         SELECT
231
           SessionID,
231
           SessionID,
250
     // Check if user is enabled
250
     // Check if user is enabled
251
     $Enabled = $Cache->get_value('enabled_'.$LoggedUser['ID']);
251
     $Enabled = $Cache->get_value('enabled_'.$LoggedUser['ID']);
252
     if ($Enabled === false) {
252
     if ($Enabled === false) {
253
-        $DB->query("
253
+        $DB->prepared_query("
254
         SELECT Enabled
254
         SELECT Enabled
255
           FROM users_main
255
           FROM users_main
256
           WHERE ID = '$LoggedUser[ID]'");
256
           WHERE ID = '$LoggedUser[ID]'");
267
     // Up/Down stats
267
     // Up/Down stats
268
     $UserStats = $Cache->get_value('user_stats_'.$LoggedUser['ID']);
268
     $UserStats = $Cache->get_value('user_stats_'.$LoggedUser['ID']);
269
     if (!is_array($UserStats)) {
269
     if (!is_array($UserStats)) {
270
-        $DB->query("
270
+        $DB->prepared_query("
271
         SELECT Uploaded AS BytesUploaded, Downloaded AS BytesDownloaded, RequiredRatio
271
         SELECT Uploaded AS BytesUploaded, Downloaded AS BytesDownloaded, RequiredRatio
272
         FROM users_main
272
         FROM users_main
273
           WHERE ID = '$LoggedUser[ID]'");
273
           WHERE ID = '$LoggedUser[ID]'");
321
 
321
 
322
     // Update LastUpdate every 10 minutes
322
     // Update LastUpdate every 10 minutes
323
     if (strtotime($UserSessions[$SessionID]['LastUpdate']) + 600 < time()) {
323
     if (strtotime($UserSessions[$SessionID]['LastUpdate']) + 600 < time()) {
324
-        $DB->query("
324
+        $DB->prepared_query("
325
         UPDATE users_main
325
         UPDATE users_main
326
         SET LastAccess = NOW()
326
         SET LastAccess = NOW()
327
         WHERE ID = '$LoggedUser[ID]'
327
         WHERE ID = '$LoggedUser[ID]'
343
         WHERE UserID = '$LoggedUser[ID]'
343
         WHERE UserID = '$LoggedUser[ID]'
344
         AND SessionID = '".db_string($SessionID)."'";
344
         AND SessionID = '".db_string($SessionID)."'";
345
 
345
 
346
-        $DB->query($SessionQuery);
346
+        $DB->prepared_query($SessionQuery);
347
         $Cache->begin_transaction("users_sessions_$UserID");
347
         $Cache->begin_transaction("users_sessions_$UserID");
348
         $Cache->delete_row($SessionID);
348
         $Cache->delete_row($SessionID);
349
 
349
 
362
     if (isset($LoggedUser['Permissions']['site_torrents_notify'])) {
362
     if (isset($LoggedUser['Permissions']['site_torrents_notify'])) {
363
         $LoggedUser['Notify'] = $Cache->get_value('notify_filters_'.$LoggedUser['ID']);
363
         $LoggedUser['Notify'] = $Cache->get_value('notify_filters_'.$LoggedUser['ID']);
364
         if (!is_array($LoggedUser['Notify'])) {
364
         if (!is_array($LoggedUser['Notify'])) {
365
-            $DB->query("
365
+            $DB->prepared_query("
366
             SELECT ID, Label
366
             SELECT ID, Label
367
             FROM users_notify_filters
367
             FROM users_notify_filters
368
               WHERE UserID = '$LoggedUser[ID]'");
368
               WHERE UserID = '$LoggedUser[ID]'");
394
     // Get stylesheets
394
     // Get stylesheets
395
     $Stylesheets = $Cache->get_value('stylesheets');
395
     $Stylesheets = $Cache->get_value('stylesheets');
396
     if (!is_array($Stylesheets)) {
396
     if (!is_array($Stylesheets)) {
397
-        $DB->query('
397
+        $DB->prepared_query('
398
         SELECT
398
         SELECT
399
           ID,
399
           ID,
400
           LOWER(REPLACE(Name, " ", "_")) AS Name,
400
           LOWER(REPLACE(Name, " ", "_")) AS Name,
429
     setcookie('keeplogged', '', time() - 60 * 60 * 24 * 365, '/', '', false);
429
     setcookie('keeplogged', '', time() - 60 * 60 * 24 * 365, '/', '', false);
430
 
430
 
431
     if ($SessionID) {
431
     if ($SessionID) {
432
-        G::$DB->query("
432
+        G::$DB->prepared_query("
433
         DELETE FROM users_sessions
433
         DELETE FROM users_sessions
434
           WHERE UserID = '" . G::$LoggedUser['ID'] . "'
434
           WHERE UserID = '" . G::$LoggedUser['ID'] . "'
435
           AND SessionID = '".db_string($SessionID)."'");
435
           AND SessionID = '".db_string($SessionID)."'");
451
 {
451
 {
452
     $UserID = G::$LoggedUser['ID'];
452
     $UserID = G::$LoggedUser['ID'];
453
 
453
 
454
-    G::$DB->query("
454
+    G::$DB->prepared_query("
455
     DELETE FROM users_sessions
455
     DELETE FROM users_sessions
456
       WHERE UserID = '$UserID'");
456
       WHERE UserID = '$UserID'");
457
 
457
 

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

419
 
419
 
420
         # Start printing the form
420
         # Start printing the form
421
         echo '<h2 class="header">Torrent Form</h2>';
421
         echo '<h2 class="header">Torrent Form</h2>';
422
-        echo '<table class="torrent_form">';
422
+        echo '<table class="torrent_form skeleton-fix">';
423
 
423
 
424
         
424
         
425
         /**
425
         /**

+ 3
- 15
gazelle.sql View File

566
 ) ENGINE=InnoDB CHARSET=utf8mb4;
566
 ) ENGINE=InnoDB CHARSET=utf8mb4;
567
 
567
 
568
 
568
 
569
-CREATE TABLE `label_aliases` (
570
-  `ID` int NOT NULL AUTO_INCREMENT,
571
-  `BadLabel` varchar(100) NOT NULL, -- todo: 100 vs. 255?
572
-  `AliasLabel` varchar(100) NOT NULL, -- todo
573
-  PRIMARY KEY (`ID`),
574
-  KEY `BadLabel` (`BadLabel`),
575
-  KEY `AliasLabel` (`AliasLabel`)
576
-) ENGINE=InnoDB CHARSET=utf8mb4;
577
-
578
-
579
 -- 2020-03-09
569
 -- 2020-03-09
580
 CREATE TABLE `last_sent_email` (
570
 CREATE TABLE `last_sent_email` (
581
   `UserID` int NOT NULL,
571
   `UserID` int NOT NULL,
1819
 
1808
 
1820
 
1809
 
1821
 INSERT INTO `stylesheets` (`ID`, `Name`, `Description`, `Default`, `Additions`, `Color`) VALUES
1810
 INSERT INTO `stylesheets` (`ID`, `Name`, `Description`, `Default`, `Additions`, `Color`) VALUES
1822
-  (1, 'matcha', 'BioTorrents.de Stylesheet', '0', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue', '#000000'),
1823
-  (2, 'bookish', 'Template Stylesheet', '1', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue', '#000000'),
1811
+  (1, 'bookish', 'BioTorrents.de Stylesheet', '1', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue;checkbox=matcha', '#000000'),
1812
+  (2, 'postmod', 'What.cd Stylesheet', '0', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue;', '#000000'),
1824
   (3, 'oppai', 'Oppaitime Stylesheet', '0', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue', '#fbc2e5'),
1813
   (3, 'oppai', 'Oppaitime Stylesheet', '0', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue', '#fbc2e5'),
1825
-  (4, 'beluga', 'Beluga Stylesheet', '0', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue;checkbox=pink;checkbox=haze', '#23252a'),
1826
-  (5, 'genaviv', 'Genaviv Stylesheet', '0', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue;checkbox=fixed_header', '#0a0a0a'),
1827
-  (6, 'postmod', 'What.cd Stylesheet', '0', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue;', '#000000');
1814
+  (4, 'beluga', 'Beluga Stylesheet', '0', 'select=noto_sans;select=luxi_sans;select=cmodern_sans;select=noto_serif;select=luxi_serif;select=cmodern_serif;select=opendyslexic;select=comic_neue;checkbox=pink;checkbox=haze', '#23252a');
1828
 
1815
 
1829
 
1816
 
1830
 INSERT INTO `wiki_articles` (`ID`, `Revision`, `Title`, `Body`, `MinClassRead`, `MinClassEdit`, `Date`, `Author`) VALUES
1817
 INSERT INTO `wiki_articles` (`ID`, `Revision`, `Title`, `Body`, `MinClassRead`, `MinClassEdit`, `Date`, `Author`) VALUES

+ 12
- 10
sections/artist/notify.php View File

5
 if (!check_perms('site_torrents_notify')) {
5
 if (!check_perms('site_torrents_notify')) {
6
     error(403);
6
     error(403);
7
 }
7
 }
8
-$ArtistID = $_GET['artistid'];
9
-if (!is_number($ArtistID)) {
10
-    error(0);
11
-}
8
+
9
+$ArtistID = (int) $_GET['artistid'];
10
+Security::checkInt($ArtistID);
11
+
12
 /*
12
 /*
13
-$DB->query("
13
+$DB->prepared_query("
14
   SELECT GROUP_CONCAT(Name SEPARATOR '|')
14
   SELECT GROUP_CONCAT(Name SEPARATOR '|')
15
   FROM artists_alias
15
   FROM artists_alias
16
   WHERE ArtistID = '$ArtistID'
16
   WHERE ArtistID = '$ArtistID'
18
   GROUP BY ArtistID");
18
   GROUP BY ArtistID");
19
 list($ArtistAliases) = $DB->next_record(MYSQLI_NUM, FALSE);
19
 list($ArtistAliases) = $DB->next_record(MYSQLI_NUM, FALSE);
20
 */
20
 */
21
-$DB->query("
21
+
22
+$DB->prepared_query("
22
   SELECT Name
23
   SELECT Name
23
   FROM artists_group
24
   FROM artists_group
24
   WHERE ArtistID = '$ArtistID'");
25
   WHERE ArtistID = '$ArtistID'");
26
 
27
 
27
 $Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID']);
28
 $Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID']);
28
 if (empty($Notify)) {
29
 if (empty($Notify)) {
29
-    $DB->query("
30
+    $DB->prepared_query("
30
     SELECT ID, Artists
31
     SELECT ID, Artists
31
     FROM users_notify_filters
32
     FROM users_notify_filters
32
     WHERE Label = 'Artist notifications'
33
     WHERE Label = 'Artist notifications'
34
     ORDER BY ID
35
     ORDER BY ID
35
     LIMIT 1");
36
     LIMIT 1");
36
 } else {
37
 } else {
37
-    $DB->query("
38
+    $DB->prepared_query("
38
     SELECT ID, Artists
39
     SELECT ID, Artists
39
     FROM users_notify_filters
40
     FROM users_notify_filters
40
     WHERE ID = '$Notify[ID]'");
41
     WHERE ID = '$Notify[ID]'");
41
 }
42
 }
43
+
42
 if (empty($Notify) && !$DB->has_results()) {
44
 if (empty($Notify) && !$DB->has_results()) {
43
-    $DB->query("
45
+    $DB->prepared_query("
44
     INSERT INTO users_notify_filters
46
     INSERT INTO users_notify_filters
45
       (UserID, Label, Artists)
47
       (UserID, Label, Artists)
46
     VALUES
48
     VALUES
52
     list($ID, $ArtistNames) = $DB->next_record(MYSQLI_NUM, false);
54
     list($ID, $ArtistNames) = $DB->next_record(MYSQLI_NUM, false);
53
     if (stripos($ArtistNames, "|$ArtistAliases|") === false) {
55
     if (stripos($ArtistNames, "|$ArtistAliases|") === false) {
54
         $ArtistNames .= "$ArtistAliases|";
56
         $ArtistNames .= "$ArtistAliases|";
55
-        $DB->query("
57
+        $DB->prepared_query("
56
       UPDATE users_notify_filters
58
       UPDATE users_notify_filters
57
       SET Artists = '".db_string($ArtistNames)."'
59
       SET Artists = '".db_string($ArtistNames)."'
58
       WHERE ID = '$ID'");
60
       WHERE ID = '$ID'");

+ 19
- 15
sections/artist/notifyremove.php View File

1
-<?
1
+<?php
2
+#declare(strict_types=1);
3
+
2
 authorize();
4
 authorize();
3
 if (!check_perms('site_torrents_notify')) {
5
 if (!check_perms('site_torrents_notify')) {
4
-  error(403);
5
-}
6
-$ArtistID = $_GET['artistid'];
7
-if (!is_number($ArtistID)) {
8
-  error(0);
6
+    error(403);
9
 }
7
 }
10
 
8
 
9
+$ArtistID = (int) $_GET['artistid'];
10
+Security::checkInt($ArtistID);
11
+
11
 if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
12
 if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
12
-  $DB->query("
13
+    $DB->prepared_query("
13
     SELECT ID, Artists
14
     SELECT ID, Artists
14
     FROM users_notify_filters
15
     FROM users_notify_filters
15
     WHERE Label = 'Artist notifications'
16
     WHERE Label = 'Artist notifications'
17
     ORDER BY ID
18
     ORDER BY ID
18
     LIMIT 1");
19
     LIMIT 1");
19
 } else {
20
 } else {
20
-  $DB->query("
21
+    $DB->prepared_query("
21
     SELECT ID, Artists
22
     SELECT ID, Artists
22
     FROM users_notify_filters
23
     FROM users_notify_filters
23
     WHERE ID = '$Notify[ID]'");
24
     WHERE ID = '$Notify[ID]'");
24
 }
25
 }
25
 list($ID, $Artists) = $DB->next_record(MYSQLI_NUM, false);
26
 list($ID, $Artists) = $DB->next_record(MYSQLI_NUM, false);
26
-$DB->query("
27
+
28
+$DB->prepared_query("
27
   SELECT Name
29
   SELECT Name
28
   FROM artists_alias
30
   FROM artists_alias
29
   WHERE ArtistID = '$ArtistID'
31
   WHERE ArtistID = '$ArtistID'
30
     AND Redirect = 0");
32
     AND Redirect = 0");
33
+
31
 while (list($Alias) = $DB->next_record(MYSQLI_NUM, false)) {
34
 while (list($Alias) = $DB->next_record(MYSQLI_NUM, false)) {
32
-  while (stripos($Artists, "|$Alias|") !== false) {
33
-    $Artists = str_ireplace("|$Alias|", '|', $Artists);
34
-  }
35
+    while (stripos($Artists, "|$Alias|") !== false) {
36
+        $Artists = str_ireplace("|$Alias|", '|', $Artists);
37
+    }
35
 }
38
 }
39
+
36
 if ($Artists == '|') {
40
 if ($Artists == '|') {
37
-  $DB->query("
41
+    $DB->prepared_query("
38
     DELETE FROM users_notify_filters
42
     DELETE FROM users_notify_filters
39
     WHERE ID = $ID");
43
     WHERE ID = $ID");
40
 } else {
44
 } else {
41
-  $DB->query("
45
+    $DB->prepared_query("
42
     UPDATE users_notify_filters
46
     UPDATE users_notify_filters
43
     SET Artists = '".db_string($Artists)."'
47
     SET Artists = '".db_string($Artists)."'
44
     WHERE ID = '$ID'");
48
     WHERE ID = '$ID'");
45
 }
49
 }
50
+
46
 $Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
51
 $Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
47
 $Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
52
 $Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
48
 header('Location: '.$_SERVER['HTTP_REFERER']);
53
 header('Location: '.$_SERVER['HTTP_REFERER']);
49
-?>

+ 1
- 1
sections/better/better.php View File

24
 </h3>
24
 </h3>
25
 
25
 
26
 <div class="box pad">
26
 <div class="box pad">
27
-  <table class="better_list">
27
+  <table class="skeleton-fix">
28
     <tr class="colhead">
28
     <tr class="colhead">
29
       <td style="width: 150px;">Method</td>
29
       <td style="width: 150px;">Method</td>
30
       <td style="width: 400px;">Additional Information</td>
30
       <td style="width: 400px;">Additional Information</td>

+ 1
- 1
sections/better/covers.php View File

31
 $DB->exec_prepared_query();
31
 $DB->exec_prepared_query();
32
 
32
 
33
 $Groups = $DB->to_array('id', MYSQLI_ASSOC);
33
 $Groups = $DB->to_array('id', MYSQLI_ASSOC);
34
-$DB->query('SELECT FOUND_ROWS()');
34
+$DB->prepared_query('SELECT FOUND_ROWS()');
35
 list($NumResults) = $DB->next_record();
35
 list($NumResults) = $DB->next_record();
36
 $Results = Torrents::get_groups(array_keys($Groups));
36
 $Results = Torrents::get_groups(array_keys($Groups));
37
 
37
 

+ 3
- 3
sections/better/folders.php View File

2
 #declare(strict_types=1);
2
 #declare(strict_types=1);
3
 
3
 
4
 if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
4
 if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
5
-    $DB->query("
5
+    $DB->prepared_query("
6
     DELETE FROM torrents_bad_folders
6
     DELETE FROM torrents_bad_folders
7
     WHERE TorrentID = ".$_GET['remove']);
7
     WHERE TorrentID = ".$_GET['remove']);
8
 
8
 
9
-    $DB->query("
9
+    $DB->prepared_query("
10
     SELECT GroupID
10
     SELECT GroupID
11
     FROM torrents
11
     FROM torrents
12
     WHERE ID = ".$_GET['remove']);
12
     WHERE ID = ".$_GET['remove']);
24
 }
24
 }
25
 
25
 
26
 View::show_header('Torrents with bad folder names');
26
 View::show_header('Torrents with bad folder names');
27
-$DB->query("
27
+$DB->prepared_query("
28
   SELECT tbf.TorrentID, t.GroupID
28
   SELECT tbf.TorrentID, t.GroupID
29
   FROM torrents_bad_folders AS tbf
29
   FROM torrents_bad_folders AS tbf
30
     JOIN torrents AS t ON t.ID = tbf.TorrentID
30
     JOIN torrents AS t ON t.ID = tbf.TorrentID

+ 1
- 1
sections/better/literature.php View File

31
 ");
31
 ");
32
 
32
 
33
 $Groups = $DB->to_array('id', MYSQLI_ASSOC);
33
 $Groups = $DB->to_array('id', MYSQLI_ASSOC);
34
-$DB->query('SELECT FOUND_ROWS()');
34
+$DB->prepared_query('SELECT FOUND_ROWS()');
35
 list($NumResults) = $DB->next_record();
35
 list($NumResults) = $DB->next_record();
36
 $Results = Torrents::get_groups(array_keys($Groups)); ?>
36
 $Results = Torrents::get_groups(array_keys($Groups)); ?>
37
 
37
 

+ 1
- 1
sections/better/single.php View File

2
 declare(strict_types = 1);
2
 declare(strict_types = 1);
3
 
3
 
4
 if (($Results = $Cache->get_value('better_single_groupids')) === false) {
4
 if (($Results = $Cache->get_value('better_single_groupids')) === false) {
5
-    $DB->query("
5
+    $DB->prepared_query("
6
     SELECT
6
     SELECT
7
       t.`ID` AS `TorrentID`,
7
       t.`ID` AS `TorrentID`,
8
       t.`GroupID` AS `GroupID`
8
       t.`GroupID` AS `GroupID`

+ 3
- 3
sections/better/tags.php View File

2
 declare(strict_types=1);
2
 declare(strict_types=1);
3
 
3
 
4
 if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
4
 if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
5
-    $DB->query("
5
+    $DB->prepared_query("
6
     DELETE FROM torrents_bad_tags
6
     DELETE FROM torrents_bad_tags
7
     WHERE TorrentID = ".$_GET['remove']);
7
     WHERE TorrentID = ".$_GET['remove']);
8
 
8
 
9
-    $DB->query("
9
+    $DB->prepared_query("
10
     SELECT GroupID
10
     SELECT GroupID
11
     FROM torrents
11
     FROM torrents
12
     WHERE ID = ".$_GET['remove']);
12
     WHERE ID = ".$_GET['remove']);
25
 
25
 
26
 View::show_header('Torrents with bad tags');
26
 View::show_header('Torrents with bad tags');
27
 
27
 
28
-$DB->query("
28
+$DB->prepared_query("
29
   SELECT tbt.TorrentID, t.GroupID
29
   SELECT tbt.TorrentID, t.GroupID
30
   FROM torrents_bad_tags AS tbt
30
   FROM torrents_bad_tags AS tbt
31
     JOIN torrents AS t ON t.ID = tbt.TorrentID
31
     JOIN torrents AS t ON t.ID = tbt.TorrentID

+ 10
- 10
sections/blog/index.php View File

11
         switch ($_REQUEST['action']) {
11
         switch ($_REQUEST['action']) {
12
       case 'deadthread':
12
       case 'deadthread':
13
         if (is_number($_GET['id'])) {
13
         if (is_number($_GET['id'])) {
14
-            $DB->query("
14
+            $DB->prepared_query("
15
             UPDATE blog
15
             UPDATE blog
16
             SET ThreadID = NULL
16
             SET ThreadID = NULL
17
             WHERE ID = ".$_GET['id']);
17
             WHERE ID = ".$_GET['id']);
24
       case 'takeeditblog':
24
       case 'takeeditblog':
25
         authorize();
25
         authorize();
26
         if (is_number($_POST['blogid']) && is_number($_POST['thread'])) {
26
         if (is_number($_POST['blogid']) && is_number($_POST['thread'])) {
27
-            $DB->query("
27
+            $DB->prepared_query("
28
             UPDATE blog
28
             UPDATE blog
29
             SET
29
             SET
30
               Title = '".db_string($_POST['title'])."',
30
               Title = '".db_string($_POST['title'])."',
40
       case 'editblog':
40
       case 'editblog':
41
         if (is_number($_GET['id'])) {
41
         if (is_number($_GET['id'])) {
42
             $BlogID = $_GET['id'];
42
             $BlogID = $_GET['id'];
43
-            $DB->query("
43
+            $DB->prepared_query("
44
             SELECT Title, Body, ThreadID
44
             SELECT Title, Body, ThreadID
45
             FROM blog
45
             FROM blog
46
             WHERE ID = $BlogID");
46
             WHERE ID = $BlogID");
51
       case 'deleteblog':
51
       case 'deleteblog':
52
         if (is_number($_GET['id'])) {
52
         if (is_number($_GET['id'])) {
53
             authorize();
53
             authorize();
54
-            $DB->query("
54
+            $DB->prepared_query("
55
             DELETE FROM blog
55
             DELETE FROM blog
56
             WHERE ID = '".db_string($_GET['id'])."'");
56
             WHERE ID = '".db_string($_GET['id'])."'");
57
             $Cache->delete_value('blog');
57
             $Cache->delete_value('blog');
66
         $Body = db_string($_POST['body']);
66
         $Body = db_string($_POST['body']);
67
         $ThreadID = $_POST['thread'];
67
         $ThreadID = $_POST['thread'];
68
         if ($ThreadID && is_number($ThreadID)) {
68
         if ($ThreadID && is_number($ThreadID)) {
69
-            $DB->query("
69
+            $DB->prepared_query("
70
             SELECT ForumID
70
             SELECT ForumID
71
             FROM forums_topics
71
             FROM forums_topics
72
             WHERE ID = $ThreadID");
72
             WHERE ID = $ThreadID");
81
             }
81
             }
82
         }
82
         }
83
 
83
 
84
-        $DB->query("
84
+        $DB->prepared_query("
85
           INSERT INTO blog
85
           INSERT INTO blog
86
             (UserID, Title, Body, Time, ThreadID, Important)
86
             (UserID, Title, Body, Time, ThreadID, Important)
87
           VALUES
87
           VALUES
96
             $Cache->delete_value('blog_latest_id');
96
             $Cache->delete_value('blog_latest_id');
97
         }
97
         }
98
         if (isset($_POST['subscribe'])) {
98
         if (isset($_POST['subscribe'])) {
99
-            $DB->query("
99
+            $DB->prepared_query("
100
             INSERT IGNORE INTO users_subscriptions
100
             INSERT IGNORE INTO users_subscriptions
101
             VALUES ('$LoggedUser[ID]', $ThreadID)");
101
             VALUES ('$LoggedUser[ID]', $ThreadID)");
102
             $Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']);
102
             $Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']);
140
       <label for="subscribebox">Subscribe</label>
140
       <label for="subscribebox">Subscribe</label>
141
 
141
 
142
       <div class="center">
142
       <div class="center">
143
-        <input type="submit"
143
+        <input type="submit" class="button-primary"
144
           value="<?=!isset($_GET['action']) ? 'Create blog post' : 'Edit blog post'; ?>" />
144
           value="<?=!isset($_GET['action']) ? 'Create blog post' : 'Edit blog post'; ?>" />
145
       </div>
145
       </div>
146
     </div>
146
     </div>
153
 <div>
153
 <div>
154
   <?php
154
   <?php
155
 if (!$Blog = $Cache->get_value('blog')) {
155
 if (!$Blog = $Cache->get_value('blog')) {
156
-    $DB->query("
156
+    $DB->prepared_query("
157
     SELECT
157
     SELECT
158
       b.ID,
158
       b.ID,
159
       um.Username,
159
       um.Username,
174
     $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
174
     $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
175
     $Cache->update_row(false, array('LastReadBlog' => $Blog[0][0]));
175
     $Cache->update_row(false, array('LastReadBlog' => $Blog[0][0]));
176
     $Cache->commit_transaction(0);
176
     $Cache->commit_transaction(0);
177
-    $DB->query("
177
+    $DB->prepared_query("
178
     UPDATE users_info
178
     UPDATE users_info
179
     SET LastReadBlog = '".$Blog[0][0]."'
179
     SET LastReadBlog = '".$Blog[0][0]."'
180
     WHERE UserID = ".$LoggedUser['ID']);
180
     WHERE UserID = ".$LoggedUser['ID']);

+ 6
- 6
sections/bookmarks/add.php View File

18
 }
18
 }
19
 
19
 
20
 $PageID = $_GET['id'];
20
 $PageID = $_GET['id'];
21
-$DB->query("
21
+$DB->prepared_query("
22
 SELECT
22
 SELECT
23
   `UserID`
23
   `UserID`
24
 FROM
24
 FROM
29
 
29
 
30
 if (!$DB->has_results()) {
30
 if (!$DB->has_results()) {
31
     if ($Type === 'torrent') {
31
     if ($Type === 'torrent') {
32
-        $DB->query("
32
+        $DB->prepared_query("
33
         SELECT
33
         SELECT
34
           MAX(`Sort`)
34
           MAX(`Sort`)
35
         FROM
35
         FROM
44
         }
44
         }
45
 
45
 
46
         $Sort += 1;
46
         $Sort += 1;
47
-        $DB->query("
47
+        $DB->prepared_query("
48
         INSERT IGNORE
48
         INSERT IGNORE
49
         INTO $Table(`UserID`, $Col, `Time`, `Sort`)
49
         INTO $Table(`UserID`, $Col, `Time`, `Sort`)
50
         VALUES(
50
         VALUES(
55
         )
55
         )
56
         ");
56
         ");
57
     } else {
57
     } else {
58
-        $DB->query("
58
+        $DB->prepared_query("
59
         INSERT IGNORE
59
         INSERT IGNORE
60
         INTO $Table(`UserID`, $Col, `Time`)
60
         INTO $Table(`UserID`, $Col, `Time`)
61
         VALUES(
61
         VALUES(
69
     $Cache->delete_value('bookmarks_'.$Type.'_'.$LoggedUser['ID']);
69
     $Cache->delete_value('bookmarks_'.$Type.'_'.$LoggedUser['ID']);
70
     if ($Type === 'torrent') {
70
     if ($Type === 'torrent') {
71
         $Cache->delete_value("bookmarks_group_ids_$UserID");
71
         $Cache->delete_value("bookmarks_group_ids_$UserID");
72
-        $DB->query("
72
+        $DB->prepared_query("
73
         SELECT
73
         SELECT
74
           `title`,
74
           `title`,
75
           `year`,
75
           `year`,
115
             $Feed->populate('torrents_bookmarks_t_'.$LoggedUser['torrent_pass'], $Item);
115
             $Feed->populate('torrents_bookmarks_t_'.$LoggedUser['torrent_pass'], $Item);
116
         }
116
         }
117
     } elseif ($Type === 'request') {
117
     } elseif ($Type === 'request') {
118
-        $DB->query("
118
+        $DB->prepared_query("
119
         SELECT
119
         SELECT
120
           `UserID`
120
           `UserID`
121
         FROM
121
         FROM

+ 3
- 3
sections/bookmarks/artists.php View File

13
         error(404);
13
         error(404);
14
     }
14
     }
15
 
15
 
16
-    $DB->query("
16
+    $DB->prepared_query("
17
       SELECT Username
17
       SELECT Username
18
       FROM users_main
18
       FROM users_main
19
       WHERE ID = '$UserID'");
19
       WHERE ID = '$UserID'");
25
 $Sneaky = $UserID !== $LoggedUser['ID'];
25
 $Sneaky = $UserID !== $LoggedUser['ID'];
26
 //$ArtistList = Bookmarks::all_bookmarks('artist', $UserID);
26
 //$ArtistList = Bookmarks::all_bookmarks('artist', $UserID);
27
 
27
 
28
-$DB->query("
28
+$DB->prepared_query("
29
   SELECT ag.ArtistID, ag.Name
29
   SELECT ag.ArtistID, ag.Name
30
   FROM bookmarks_artists AS ba
30
   FROM bookmarks_artists AS ba
31
     INNER JOIN artists_group AS ag ON ba.ArtistID = ag.ArtistID
31
     INNER JOIN artists_group AS ag ON ba.ArtistID = ag.ArtistID
81
         <?php
81
         <?php
82
   if (check_perms('site_torrents_notify')) {
82
   if (check_perms('site_torrents_notify')) {
83
       if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
83
       if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
84
-          $DB->query("
84
+          $DB->prepared_query("
85
             SELECT ID, Artists
85
             SELECT ID, Artists
86
             FROM users_notify_filters
86
             FROM users_notify_filters
87
             WHERE UserID = '$LoggedUser[ID]'
87
             WHERE UserID = '$LoggedUser[ID]'

+ 1
- 1
sections/collages/browse.php View File

180
         <input type="hidden" name="action" value="search" />
180
         <input type="hidden" name="action" value="search" />
181
       </div>
181
       </div>
182
 
182
 
183
-      <table cellpadding="6" cellspacing="1" border="0" class="layout torrent_search" width="100%">
183
+      <table cellpadding="6" cellspacing="1" border="0" class="skeleton-fix" width="100%">
184
         <tr id="search_terms">
184
         <tr id="search_terms">
185
           <td class="label"></td>
185
           <td class="label"></td>
186
           <td>
186
           <td>

+ 1
- 1
sections/collages/recover.php View File

39
           <input type="text" name="collage_id" size="8" />
39
           <input type="text" name="collage_id" size="8" />
40
         </div>
40
         </div>
41
         <div class="submit_div">
41
         <div class="submit_div">
42
-          <input value="Recover!" type="submit" />
42
+          <input value="Recover" class="button-primary" type="submit" />
43
         </div>
43
         </div>
44
       </form>
44
       </form>
45
     </div>
45
     </div>

+ 2
- 2
sections/collages/torrent_collage.php View File

8
 
8
 
9
 // Build the data for the collage and the torrent list
9
 // Build the data for the collage and the torrent list
10
 // todo: Cache this
10
 // todo: Cache this
11
-$DB->query("
11
+$DB->prepared_query("
12
 SELECT
12
 SELECT
13
   ct.`GroupID`,
13
   ct.`GroupID`,
14
   ct.`UserID`
14
   ct.`UserID`
15
 FROM `collages_torrents` AS ct
15
 FROM `collages_torrents` AS ct
16
-  JOIN `torrents_group` AS tg ON tg.`ID` = ct.`GroupID`
16
+  JOIN `torrents_group` AS tg ON tg.`id` = ct.`GroupID`
17
 WHERE ct.`CollageID` = '$CollageID'
17
 WHERE ct.`CollageID` = '$CollageID'
18
 ORDER BY ct.`Sort`
18
 ORDER BY ct.`Sort`
19
 ");
19
 ");

+ 1
- 1
sections/forums/edit_rules.php View File

69
         </td>
69
         </td>
70
 
70
 
71
         <td>
71
         <td>
72
-          <input type="submit" name="add" value="Add thread" />
72
+          <input type="submit" name="add" class="button-primary" value="Add thread" />
73
         </td>
73
         </td>
74
       </form>
74
       </form>
75
 
75
 

+ 2
- 2
sections/forums/forum.php View File

145
 
145
 
146
             <tr>
146
             <tr>
147
               <td colspan="2" style="text-align: center;">
147
               <td colspan="2" style="text-align: center;">
148
-                <input type="submit" name="submit" value="Search" />
148
+                <input type="submit" name="submit" class="button-primary" value="Search" />
149
               </td>
149
               </td>
150
             </tr>
150
             </tr>
151
           </table>
151
           </table>
186
   </div>
186
   </div>
187
 </div>
187
 </div>
188
 
188
 
189
-<table class="forum_index alternate_rows" width="100%">
189
+<table class="forum_index skeleton-fix">
190
   <tr class="colhead">
190
   <tr class="colhead">
191
     <td style="width: 2%;"></td>
191
     <td style="width: 2%;"></td>
192
     <td>Latest</td>
192
     <td>Latest</td>

+ 1
- 1
sections/forums/newthread.php View File

103
       <input type="hidden" name="auth"
103
       <input type="hidden" name="auth"
104
         value="<?=$LoggedUser['AuthKey']?>" />
104
         value="<?=$LoggedUser['AuthKey']?>" />
105
       <input type="hidden" name="forum" value="<?=$ForumID?>" />
105
       <input type="hidden" name="forum" value="<?=$ForumID?>" />
106
-      <table id="newthreadtext" class="layout new_thread">
106
+      <table id="newthreadtext" class="new_thread skeleton-fix">
107
         <tr>
107
         <tr>
108
           <td class="label">Title</td>
108
           <td class="label">Title</td>
109
           <td><input id="title" class="required" type="text" name="title" style="width: 98%;" /></td>
109
           <td><input id="title" class="required" type="text" name="title" style="width: 98%;" /></td>

+ 5
- 4
sections/forums/thread.php View File

435
         <br />
435
         <br />
436
         <br />
436
         <br />
437
         <?php } ?>
437
         <?php } ?>
438
-        <input type="button"
438
+        <input type="button" class="button-primary"
439
           onclick="ajax.post('index.php','poll',function(response) { $('#poll_container').raw().innerHTML = response});"
439
           onclick="ajax.post('index.php','poll',function(response) { $('#poll_container').raw().innerHTML = response});"
440
           value="Vote" />
440
           value="Vote" />
441
       </form>
441
       </form>
470
   </div>
470
   </div>
471
 </div>
471
 </div>
472
 <?php
472
 <?php
473
-} //End Polls
473
+} // End Polls
474
 
474
 
475
-//Sqeeze in stickypost
475
+// Sqeeze in stickypost
476
 if ($ThreadInfo['StickyPostID']) {
476
 if ($ThreadInfo['StickyPostID']) {
477
     if ($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
477
     if ($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
478
         array_unshift($Thread, $ThreadInfo['StickyPost']);
478
         array_unshift($Thread, $ThreadInfo['StickyPost']);
634
     ));
634
     ));
635
       }
635
       }
636
   }
636
   }
637
+
637
 if (check_perms('site_moderate_forums')) {
638
 if (check_perms('site_moderate_forums')) {
638
     G::$DB->query("
639
     G::$DB->query("
639
       SELECT ID, AuthorID, AddedTime, Body
640
       SELECT ID, AuthorID, AddedTime, Body
670
           $ID = 'topic_notes',
671
           $ID = 'topic_notes',
671
       ); ?>
672
       ); ?>
672
         </div>
673
         </div>
673
-        <input type="submit" value="Save" />
674
+        <input type="submit" class="button-primary" value="Save" />
674
       </td>
675
       </td>
675
     </tr>
676
     </tr>
676
   </table>
677
   </table>

+ 3
- 7
sections/register/closed.php View File

1
 <?php
1
 <?php
2
-View::show_header('Registration Closed');
3
-?>
4
-
5
-<div style="width: 250px;">
6
-  <p><strong>Sorry, the site is currently invite only.</strong></p>
7
-</div>
2
+declare(strict_types=1);
8
 
3
 
9
-<?php
4
+View::show_header('Registration Closed');
5
+echo '<p><strong>Sorry, the site is currently invite only.</strong></p>';
10
 View::show_footer();
6
 View::show_footer();

+ 1
- 1
sections/requests/request.php View File

244
     <div class="box">
244
     <div class="box">
245
       <div class="head"><strong>Info</strong></div>
245
       <div class="head"><strong>Info</strong></div>
246
       <div class="pad">
246
       <div class="pad">
247
-        <table class="layout request_form">
247
+        <table class="request_form skeleton-fix">
248
           <tr>
248
           <tr>
249
             <td class="label">Created</td>
249
             <td class="label">Created</td>
250
             <td>
250
             <td>

+ 3
- 3
sections/stats/torrents.php View File

7
 LIMIT 1, 12
7
 LIMIT 1, 12
8
 */
8
 */
9
 if (!list($Labels, $InFlow, $OutFlow, $Max) = $Cache->get_value('torrents_timeline')) {
9
 if (!list($Labels, $InFlow, $OutFlow, $Max) = $Cache->get_value('torrents_timeline')) {
10
-    $DB->query("
10
+    $DB->prepared_query("
11
     SELECT
11
     SELECT
12
       DATE_FORMAT(`Time`, '%b %Y') AS Month,
12
       DATE_FORMAT(`Time`, '%b %Y') AS Month,
13
       COUNT(`ID`)
13
       COUNT(`ID`)
23
     ");
23
     ");
24
     $TimelineIn = array_reverse($DB->to_array());
24
     $TimelineIn = array_reverse($DB->to_array());
25
 
25
 
26
-    $DB->query("
26
+    $DB->prepared_query("
27
     SELECT
27
     SELECT
28
       DATE_FORMAT(`Time`, '%b %Y') AS Month,
28
       DATE_FORMAT(`Time`, '%b %Y') AS Month,
29
       COUNT(`ID`)
29
       COUNT(`ID`)
51
 }
51
 }
52
 
52
 
53
 if (!$CategoryDistribution = $Cache->get_value('category_distribution')) {
53
 if (!$CategoryDistribution = $Cache->get_value('category_distribution')) {
54
-    $DB->query("
54
+    $DB->prepared_query("
55
     SELECT
55
     SELECT
56
       tg.`category_id`,
56
       tg.`category_id`,
57
       COUNT(t.`ID`) AS Torrents
57
       COUNT(t.`ID`) AS Torrents

+ 5
- 5
sections/stats/users.php View File

3
 
3
 
4
 
4
 
5
 if (!$ClassDistribution = $Cache->get_value('class_distribution')) {
5
 if (!$ClassDistribution = $Cache->get_value('class_distribution')) {
6
-    $DB->query("
6
+    $DB->prepared_query("
7
       SELECT p.Name, COUNT(m.ID) AS Users
7
       SELECT p.Name, COUNT(m.ID) AS Users
8
       FROM users_main AS m
8
       FROM users_main AS m
9
         JOIN permissions AS p ON m.PermissionID = p.ID
9
         JOIN permissions AS p ON m.PermissionID = p.ID
16
 }
16
 }
17
 
17
 
18
 if (!$PlatformDistribution = $Cache->get_value('platform_distribution')) {
18
 if (!$PlatformDistribution = $Cache->get_value('platform_distribution')) {
19
-    $DB->query("
19
+    $DB->prepared_query("
20
       SELECT OperatingSystem, COUNT(DISTINCT UserID) AS Users
20
       SELECT OperatingSystem, COUNT(DISTINCT UserID) AS Users
21
       FROM users_sessions
21
       FROM users_sessions
22
       GROUP BY OperatingSystem
22
       GROUP BY OperatingSystem
27
 }
27
 }
28
 
28
 
29
 if (!$BrowserDistribution = $Cache->get_value('browser_distribution')) {
29
 if (!$BrowserDistribution = $Cache->get_value('browser_distribution')) {
30
-    $DB->query("
30
+    $DB->prepared_query("
31
       SELECT Browser, COUNT(DISTINCT UserID) AS Users
31
       SELECT Browser, COUNT(DISTINCT UserID) AS Users
32
       FROM users_sessions
32
       FROM users_sessions
33
       GROUP BY Browser
33
       GROUP BY Browser
39
 
39
 
40
 // Timeline generation
40
 // Timeline generation
41
 if (!list($Labels, $InFlow, $OutFlow) = $Cache->get_value('users_timeline')) {
41
 if (!list($Labels, $InFlow, $OutFlow) = $Cache->get_value('users_timeline')) {
42
-    $DB->query("
42
+    $DB->prepared_query("
43
       SELECT DATE_FORMAT(JoinDate,\"%b %Y\") AS Month, COUNT(UserID)
43
       SELECT DATE_FORMAT(JoinDate,\"%b %Y\") AS Month, COUNT(UserID)
44
       FROM users_info
44
       FROM users_info
45
       GROUP BY Month
45
       GROUP BY Month
47
       LIMIT 1, 11");
47
       LIMIT 1, 11");
48
     $TimelineIn = array_reverse($DB->to_array());
48
     $TimelineIn = array_reverse($DB->to_array());
49
 
49
 
50
-    $DB->query("
50
+    $DB->prepared_query("
51
       SELECT DATE_FORMAT(BanDate,\"%b %Y\") AS Month, COUNT(UserID)
51
       SELECT DATE_FORMAT(BanDate,\"%b %Y\") AS Month, COUNT(UserID)
52
       FROM users_info
52
       FROM users_info
53
       WHERE BanDate > 0
53
       WHERE BanDate > 0

+ 3
- 3
sections/store/badge.php View File

29
 
29
 
30
 if (isset($_GET['confirm']) && $_GET['confirm'] === '1') {
30
 if (isset($_GET['confirm']) && $_GET['confirm'] === '1') {
31
     if (!isset($Err)) {
31
     if (!isset($Err)) {
32
-        $DB->query("
32
+        $DB->prepared_query("
33
           SELECT BonusPoints
33
           SELECT BonusPoints
34
           FROM users_main
34
           FROM users_main
35
           WHERE ID = $UserID");
35
           WHERE ID = $UserID");
42
                 if (!Badges::award_badge($UserID, $BadgeID)) {
42
                 if (!Badges::award_badge($UserID, $BadgeID)) {
43
                     $Err = 'Could not award badge, unknown error occurred.';
43
                     $Err = 'Could not award badge, unknown error occurred.';
44
                 } else {
44
                 } else {
45
-                    $DB->query("
45
+                    $DB->prepared_query("
46
                       UPDATE users_main
46
                       UPDATE users_main
47
                       SET BonusPoints = BonusPoints - " . $Prices[$BadgeID] ."
47
                       SET BonusPoints = BonusPoints - " . $Prices[$BadgeID] ."
48
                       WHERE ID = $UserID");
48
                       WHERE ID = $UserID");
49
 
49
 
50
-                    $DB->query("
50
+                    $DB->prepared_query("
51
                       UPDATE users_info
51
                       UPDATE users_info
52
                       SET AdminComment = CONCAT('".sqltime()." - Purchased badge $BadgeID from store\n\n', AdminComment)
52
                       SET AdminComment = CONCAT('".sqltime()." - Purchased badge $BadgeID from store\n\n', AdminComment)
53
                       WHERE UserID = $UserID");
53
                       WHERE UserID = $UserID");

+ 6
- 6
sections/store/coinbadge.php View File

2
 #declare(strict_types=1);
2
 #declare(strict_types=1);
3
 
3
 
4
 $UserID = $LoggedUser['ID'];
4
 $UserID = $LoggedUser['ID'];
5
-$DB->query("
5
+$DB->prepared_query("
6
   SELECT First, Second
6
   SELECT First, Second
7
   FROM misc
7
   FROM misc
8
   WHERE Name='CoinBadge'");
8
   WHERE Name='CoinBadge'");
10
 if ($DB->has_results()) {
10
 if ($DB->has_results()) {
11
     list($Purchases, $Price) = $DB->next_record();
11
     list($Purchases, $Price) = $DB->next_record();
12
 } else {
12
 } else {
13
-    $DB->query("
13
+    $DB->prepared_query("
14
     INSERT INTO misc
14
     INSERT INTO misc
15
       (Name, First, Second)
15
       (Name, First, Second)
16
     VALUES ('CoinBadge', 0, 1000)");
16
     VALUES ('CoinBadge', 0, 1000)");
24
   if (isset($_GET['confirm'])
24
   if (isset($_GET['confirm'])
25
    && $_GET['confirm'] === 1
25
    && $_GET['confirm'] === 1
26
    && !Badges::has_badge($UserID, 255)) {
26
    && !Badges::has_badge($UserID, 255)) {
27
-      $DB->query("
27
+      $DB->prepared_query("
28
       SELECT BonusPoints
28
       SELECT BonusPoints
29
       FROM users_main
29
       FROM users_main
30
       WHERE ID = $UserID");
30
       WHERE ID = $UserID");
34
           if (!Badges::award_badge($UserID, 255)) {
34
           if (!Badges::award_badge($UserID, 255)) {
35
               $Err = 'Could not award badge, unknown error occurred.';
35
               $Err = 'Could not award badge, unknown error occurred.';
36
           } else {
36
           } else {
37
-              $DB->query("
37
+              $DB->prepared_query("
38
               UPDATE users_main
38
               UPDATE users_main
39
               SET BonusPoints = BonusPoints - $Price
39
               SET BonusPoints = BonusPoints - $Price
40
               WHERE ID = $UserID");
40
               WHERE ID = $UserID");
41
 
41
 
42
-              $DB->query("
42
+              $DB->prepared_query("
43
               UPDATE users_info
43
               UPDATE users_info
44
               SET AdminComment = CONCAT('".sqltime()." - Purchased badge 255 from store\n\n', AdminComment)
44
               SET AdminComment = CONCAT('".sqltime()." - Purchased badge 255 from store\n\n', AdminComment)
45
               WHERE UserID = $UserID");
45
               WHERE UserID = $UserID");
50
               $x = $Purchases;
50
               $x = $Purchases;
51
               $Price = 1000+$x*(10000+1400*((sin($x/1.3)+cos($x/4.21))+(sin($x/2.6)+cos(2*$x/4.21))/2));
51
               $Price = 1000+$x*(10000+1400*((sin($x/1.3)+cos($x/4.21))+(sin($x/2.6)+cos(2*$x/4.21))/2));
52
 
52
 
53
-              $DB->query("
53
+              $DB->prepared_query("
54
               UPDATE misc
54
               UPDATE misc
55
               SET First  = $Purchases,
55
               SET First  = $Purchases,
56
                 Second = $Price
56
                 Second = $Price

+ 7
- 7
sections/store/freeleechize.php View File

26
     $UserID = $LoggedUser['ID'];
26
     $UserID = $LoggedUser['ID'];
27
 
27
 
28
     // Make sure torrent exists
28
     // Make sure torrent exists
29
-    $DB->query("
29
+    $DB->prepared_query("
30
       SELECT FreeTorrent, FreeLeechType
30
       SELECT FreeTorrent, FreeLeechType
31
       FROM torrents
31
       FROM torrents
32
       WHERE ID = $TorrentID");
32
       WHERE ID = $TorrentID");
42
         error('Torrent does not exist');
42
         error('Torrent does not exist');
43
     }
43
     }
44
 
44
 
45
-    $DB->query("
45
+    $DB->prepared_query("
46
       SELECT BonusPoints
46
       SELECT BonusPoints
47
       FROM users_main
47
       FROM users_main
48
       WHERE ID = $UserID");
48
       WHERE ID = $UserID");
51
         list($Points) = $DB->next_record();
51
         list($Points) = $DB->next_record();
52
 
52
 
53
         if ($Points >= $Cost) {
53
         if ($Points >= $Cost) {
54
-            $DB->query("
54
+            $DB->prepared_query("
55
               SELECT TorrentID
55
               SELECT TorrentID
56
               FROM shop_freeleeches
56
               FROM shop_freeleeches
57
               WHERE TorrentID = $TorrentID");
57
               WHERE TorrentID = $TorrentID");
58
 
58
 
59
             if ($DB->has_results()) {
59
             if ($DB->has_results()) {
60
-                $DB->query("
60
+                $DB->prepared_query("
61
                   UPDATE shop_freeleeches
61
                   UPDATE shop_freeleeches
62
                   SET ExpiryTime = ExpiryTime + INTERVAL 1 DAY
62
                   SET ExpiryTime = ExpiryTime + INTERVAL 1 DAY
63
                   WHERE TorrentID = $TorrentID");
63
                   WHERE TorrentID = $TorrentID");
64
             } else {
64
             } else {
65
-                $DB->query("
65
+                $DB->prepared_query("
66
                   INSERT INTO shop_freeleeches
66
                   INSERT INTO shop_freeleeches
67
                     (TorrentID, ExpiryTime)
67
                     (TorrentID, ExpiryTime)
68
                   VALUES($TorrentID, NOW() + INTERVAL 1 DAY)");
68
                   VALUES($TorrentID, NOW() + INTERVAL 1 DAY)");
69
                 Torrents::freeleech_torrents($TorrentID, 1, 3);
69
                 Torrents::freeleech_torrents($TorrentID, 1, 3);
70
             }
70
             }
71
 
71
 
72
-            $DB->query("
72
+            $DB->prepared_query("
73
               UPDATE users_main
73
               UPDATE users_main
74
               SET BonusPoints = BonusPoints - $Cost
74
               SET BonusPoints = BonusPoints - $Cost
75
               WHERE ID = $UserID");
75
               WHERE ID = $UserID");
76
 
76
 
77
-            $DB->query("
77
+            $DB->prepared_query("
78
               UPDATE users_info
78
               UPDATE users_info
79
               SET AdminComment = CONCAT('".sqltime()." - Made TorrentID $TorrentID freeleech for 24 more hours via the store\n\n', AdminComment)
79
               SET AdminComment = CONCAT('".sqltime()." - Made TorrentID $TorrentID freeleech for 24 more hours via the store\n\n', AdminComment)
80
               WHERE UserID = $UserID");
80
               WHERE UserID = $UserID");

+ 8
- 8
sections/store/freeleechpool.php View File

10
     }
10
     }
11
 
11
 
12
     $UserID = $LoggedUser['ID'];
12
     $UserID = $LoggedUser['ID'];
13
-    $DB->query("
13
+    $DB->prepared_query("
14
       SELECT BonusPoints
14
       SELECT BonusPoints
15
       FROM users_main
15
       FROM users_main
16
       WHERE ID = $UserID");
16
       WHERE ID = $UserID");
21
         if ($Points >= $Donation) {
21
         if ($Points >= $Donation) {
22
             $PoolTipped = false;
22
             $PoolTipped = false;
23
 
23
 
24
-            $DB->query("
24
+            $DB->prepared_query("
25
               UPDATE users_main
25
               UPDATE users_main
26
               SET BonusPoints = BonusPoints - $Donation
26
               SET BonusPoints = BonusPoints - $Donation
27
               WHERE ID = $UserID");
27
               WHERE ID = $UserID");
28
 
28
 
29
-            $DB->query("
29
+            $DB->prepared_query("
30
               UPDATE misc
30
               UPDATE misc
31
               SET First = First + $Donation
31
               SET First = First + $Donation
32
               WHERE Name = 'FreeleechPool'");
32
               WHERE Name = 'FreeleechPool'");
33
             $Cache->delete_value('user_info_heavy_'.$UserID);
33
             $Cache->delete_value('user_info_heavy_'.$UserID);
34
 
34
 
35
             // Check to see if we're now over the target pool size
35
             // Check to see if we're now over the target pool size
36
-            $DB->query("
36
+            $DB->prepared_query("
37
               SELECT First, Second
37
               SELECT First, Second
38
               FROM misc
38
               FROM misc
39
               WHERE Name = 'FreeleechPool'");
39
               WHERE Name = 'FreeleechPool'");
48
 
48
 
49
                     for ($i = 0; $i < $NumTorrents; $i++) {
49
                     for ($i = 0; $i < $NumTorrents; $i++) {
50
                         $TorrentSize = intval($Pool * (($i===$NumTorrents-1)?1:(rand(10, 80)/100)) * 100000); # todo
50
                         $TorrentSize = intval($Pool * (($i===$NumTorrents-1)?1:(rand(10, 80)/100)) * 100000); # todo
51
-                        $DB->query("
51
+                        $DB->prepared_query("
52
                           SELECT ID, Size
52
                           SELECT ID, Size
53
                           FROM torrents
53
                           FROM torrents
54
                           WHERE Size < $TorrentSize
54
                           WHERE Size < $TorrentSize
61
                         if ($DB->has_results()) {
61
                         if ($DB->has_results()) {
62
                             list($TorrentID, $Size) = $DB->next_record();
62
                             list($TorrentID, $Size) = $DB->next_record();
63
 
63
 
64
-                            $DB->query("
64
+                            $DB->prepared_query("
65
                               INSERT INTO shop_freeleeches
65
                               INSERT INTO shop_freeleeches
66
                                 (TorrentID, ExpiryTime)
66
                                 (TorrentID, ExpiryTime)
67
                               VALUES($TorrentID, NOW() + INTERVAL 2 DAY)");
67
                               VALUES($TorrentID, NOW() + INTERVAL 2 DAY)");
77
                     }
77
                     }
78
 
78
 
79
                     $Target = rand(10000, 100000);
79
                     $Target = rand(10000, 100000);
80
-                    $DB->query("
80
+                    $DB->prepared_query("
81
                       UPDATE misc
81
                       UPDATE misc
82
                       SET First = 0,
82
                       SET First = 0,
83
                         Second = $Target
83
                         Second = $Target
116
 <?php
116
 <?php
117
 View::show_footer();
117
 View::show_footer();
118
 } else {
118
 } else {
119
-    $DB->query("
119
+    $DB->prepared_query("
120
       SELECT First
120
       SELECT First
121
       FROM misc
121
       FROM misc
122
       WHERE Name = 'FreeleechPool'");
122
       WHERE Name = 'FreeleechPool'");

+ 3
- 3
sections/store/invite.php View File

6
 $Purchase = "1 invite";
6
 $Purchase = "1 invite";
7
 $UserID = $LoggedUser['ID'];
7
 $UserID = $LoggedUser['ID'];
8
 
8
 
9
-$DB->query("
9
+$DB->prepared_query("
10
   SELECT BonusPoints
10
   SELECT BonusPoints
11
   FROM users_main
11
   FROM users_main
12
   WHERE ID = $UserID");
12
   WHERE ID = $UserID");
15
     list($Points) = $DB->next_record();
15
     list($Points) = $DB->next_record();
16
 
16
 
17
     if ($Points >= $Cost) {
17
     if ($Points >= $Cost) {
18
-        $DB->query("
18
+        $DB->prepared_query("
19
           UPDATE users_main
19
           UPDATE users_main
20
           SET BonusPoints = BonusPoints - $Cost,
20
           SET BonusPoints = BonusPoints - $Cost,
21
             Invites = Invites + 1
21
             Invites = Invites + 1
22
           WHERE ID = $UserID");
22
           WHERE ID = $UserID");
23
 
23
 
24
-        $DB->query("
24
+        $DB->prepared_query("
25
           UPDATE users_info
25
           UPDATE users_info
26
           SET AdminComment = CONCAT('".sqltime()." - Purchased an invite from the store\n\n', AdminComment)
26
           SET AdminComment = CONCAT('".sqltime()." - Purchased an invite from the store\n\n', AdminComment)
27
           WHERE UserID = $UserID");
27
           WHERE UserID = $UserID");

+ 3
- 3
sections/store/points_1.php View File

9
 $GiB = 1024 * 1024 * 1024;
9
 $GiB = 1024 * 1024 * 1024;
10
 $Cost = intval(0.15 * $GiB);
10
 $Cost = intval(0.15 * $GiB);
11
 
11
 
12
-$DB->query("
12
+$DB->prepared_query("
13
   SELECT Uploaded
13
   SELECT Uploaded
14
   FROM users_main
14
   FROM users_main
15
   WHERE ID = $UserID");
15
   WHERE ID = $UserID");
18
     list($Upload) = $DB->next_record();
18
     list($Upload) = $DB->next_record();
19
 
19
 
20
     if ($Upload >= $Cost) {
20
     if ($Upload >= $Cost) {
21
-        $DB->query("
21
+        $DB->prepared_query("
22
           UPDATE users_main
22
           UPDATE users_main
23
           SET BonusPoints = BonusPoints + 10,
23
           SET BonusPoints = BonusPoints + 10,
24
             Uploaded = Uploaded - $Cost
24
             Uploaded = Uploaded - $Cost
25
           WHERE ID = $UserID");
25
           WHERE ID = $UserID");
26
 
26
 
27
-        $DB->query("
27
+        $DB->prepared_query("
28
           UPDATE users_info
28
           UPDATE users_info
29
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
29
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
30
           WHERE UserID = $UserID");
30
           WHERE UserID = $UserID");

+ 3
- 3
sections/store/points_10.php View File

9
 $GiB = 1024 * 1024 * 1024;
9
 $GiB = 1024 * 1024 * 1024;
10
 $Cost = 1.5 * $GiB;
10
 $Cost = 1.5 * $GiB;
11
 
11
 
12
-$DB->query("
12
+$DB->prepared_query("
13
   SELECT Uploaded
13
   SELECT Uploaded
14
   FROM users_main
14
   FROM users_main
15
   WHERE ID = $UserID");
15
   WHERE ID = $UserID");
18
     list($Upload) = $DB->next_record();
18
     list($Upload) = $DB->next_record();
19
 
19
 
20
     if ($Upload >= $Cost) {
20
     if ($Upload >= $Cost) {
21
-        $DB->query("
21
+        $DB->prepared_query("
22
           UPDATE users_main
22
           UPDATE users_main
23
           SET BonusPoints = BonusPoints + 100,
23
           SET BonusPoints = BonusPoints + 100,
24
             Uploaded = Uploaded - $Cost
24
             Uploaded = Uploaded - $Cost
25
           WHERE ID = $UserID");
25
           WHERE ID = $UserID");
26
 
26
 
27
-        $DB->query("
27
+        $DB->prepared_query("
28
           UPDATE users_info
28
           UPDATE users_info
29
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
29
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
30
           WHERE UserID = $UserID");
30
           WHERE UserID = $UserID");

+ 3
- 3
sections/store/points_100.php View File

9
 $GiB = 1024 * 1024 * 1024;
9
 $GiB = 1024 * 1024 * 1024;
10
 $Cost = 15.0 * $GiB;
10
 $Cost = 15.0 * $GiB;
11
 
11
 
12
-$DB->query("
12
+$DB->prepared_query("
13
   SELECT Uploaded
13
   SELECT Uploaded
14
   FROM users_main
14
   FROM users_main
15
   WHERE ID = $UserID");
15
   WHERE ID = $UserID");
18
     list($Upload) = $DB->next_record();
18
     list($Upload) = $DB->next_record();
19
 
19
 
20
     if ($Upload >= $Cost) {
20
     if ($Upload >= $Cost) {
21
-        $DB->query("
21
+        $DB->prepared_query("
22
           UPDATE users_main
22
           UPDATE users_main
23
           SET BonusPoints = BonusPoints + 1000,
23
           SET BonusPoints = BonusPoints + 1000,
24
             Uploaded = Uploaded - $Cost
24
             Uploaded = Uploaded - $Cost
25
           WHERE ID = $UserID");
25
           WHERE ID = $UserID");
26
 
26
 
27
-        $DB->query("
27
+        $DB->prepared_query("
28
           UPDATE users_info
28
           UPDATE users_info
29
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
29
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
30
           WHERE UserID = $UserID");
30
           WHERE UserID = $UserID");

+ 3
- 3
sections/store/points_1000.php View File

9
 $GiB = 1024*1024*1024;
9
 $GiB = 1024*1024*1024;
10
 $Cost = 150.0 * $GiB;
10
 $Cost = 150.0 * $GiB;
11
 
11
 
12
-$DB->query("
12
+$DB->prepared_query("
13
   SELECT Uploaded
13
   SELECT Uploaded
14
   FROM users_main
14
   FROM users_main
15
   WHERE ID = $UserID");
15
   WHERE ID = $UserID");
18
     list($Upload) = $DB->next_record();
18
     list($Upload) = $DB->next_record();
19
 
19
 
20
     if ($Upload >= $Cost) {
20
     if ($Upload >= $Cost) {
21
-        $DB->query("
21
+        $DB->prepared_query("
22
           UPDATE users_main
22
           UPDATE users_main
23
           SET BonusPoints = BonusPoints + 10000,
23
           SET BonusPoints = BonusPoints + 10000,
24
             Uploaded = Uploaded - $Cost
24
             Uploaded = Uploaded - $Cost
25
           WHERE ID = $UserID");
25
           WHERE ID = $UserID");
26
 
26
 
27
-        $DB->query("
27
+        $DB->prepared_query("
28
           UPDATE users_info
28
           UPDATE users_info
29
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
29
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
30
           WHERE UserID = $UserID");
30
           WHERE UserID = $UserID");

+ 4
- 4
sections/store/promotion.php View File

64
 );
64
 );
65
 
65
 
66
 $To = -1;
66
 $To = -1;
67
-$DB->query("
67
+$DB->prepared_query("
68
   SELECT PermissionID, BonusPoints, Warned, Uploaded, Downloaded, (Uploaded / Downloaded) AS Ratio, Enabled, COUNT(torrents.ID) AS Uploads, COUNT(DISTINCT torrents.GroupID) AS Groups
68
   SELECT PermissionID, BonusPoints, Warned, Uploaded, Downloaded, (Uploaded / Downloaded) AS Ratio, Enabled, COUNT(torrents.ID) AS Uploads, COUNT(DISTINCT torrents.GroupID) AS Groups
69
   FROM users_main
69
   FROM users_main
70
     JOIN users_info ON users_main.ID = users_info.UserID
70
     JOIN users_info ON users_main.ID = users_info.UserID
100
         $Err[] = "This account is disabled, how did you get here?";
100
         $Err[] = "This account is disabled, how did you get here?";
101
     } else {
101
     } else {
102
         if ($Classes[$To]['NonSmall'] > 0) {
102
         if ($Classes[$To]['NonSmall'] > 0) {
103
-            $DB->query("
103
+            $DB->prepared_query("
104
               SELECT COUNT(torrents.ID)
104
               SELECT COUNT(torrents.ID)
105
               FROM torrents
105
               FROM torrents
106
               JOIN torrents_group ON torrents.GroupID = torrents_group.ID
106
               JOIN torrents_group ON torrents.GroupID = torrents_group.ID
159
         }
159
         }
160
 
160
 
161
         if (!isset($Err)) {
161
         if (!isset($Err)) {
162
-            $DB->query("
162
+            $DB->prepared_query("
163
               UPDATE users_main
163
               UPDATE users_main
164
               SET
164
               SET
165
                 BonusPoints = BonusPoints - ".$Classes[$To]['Price'].",
165
                 BonusPoints = BonusPoints - ".$Classes[$To]['Price'].",
166
                 PermissionID = $To
166
                 PermissionID = $To
167
               WHERE ID = $UserID");
167
               WHERE ID = $UserID");
168
 
168
 
169
-            $DB->query("
169
+            $DB->prepared_query("
170
               UPDATE users_info
170
               UPDATE users_info
171
               SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($To)." via store purchase\n\n', AdminComment)
171
               SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($To)." via store purchase\n\n', AdminComment)
172
               WHERE UserID = $UserID");
172
               WHERE UserID = $UserID");

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

6
 
6
 
7
 if (!$LoggedUser['DisablePoints']) {
7
 if (!$LoggedUser['DisablePoints']) {
8
     $PointsRate = 0;
8
     $PointsRate = 0;
9
-    $getTorrents = $DB->query("
9
+    $getTorrents = $DB->prepared_query("
10
       SELECT um.BonusPoints,
10
       SELECT um.BonusPoints,
11
         COUNT(DISTINCT x.fid) AS Torrents,
11
         COUNT(DISTINCT x.fid) AS Torrents,
12
         SUM(t.Size) AS Size,
12
         SUM(t.Size) AS Size,
271
       </tr>
271
       </tr>
272
 
272
 
273
       <?php
273
       <?php
274
-$DB->query("
274
+$DB->prepared_query("
275
   SELECT ID AS BadgeID, Name, Description
275
   SELECT ID AS BadgeID, Name, Description
276
   FROM badges
276
   FROM badges
277
   WHERE ID IN (40, 41, 42, 43, 44, 45, 46, 47, 48)
277
   WHERE ID IN (40, 41, 42, 43, 44, 45, 46, 47, 48)

+ 3
- 3
sections/store/title.php View File

11
     $Title = htmlspecialchars($_POST['title'], ENT_QUOTES);
11
     $Title = htmlspecialchars($_POST['title'], ENT_QUOTES);
12
     $UserID = $LoggedUser['ID'];
12
     $UserID = $LoggedUser['ID'];
13
 
13
 
14
-    $DB->query("
14
+    $DB->prepared_query("
15
       SELECT BonusPoints
15
       SELECT BonusPoints
16
       FROM users_main
16
       FROM users_main
17
       WHERE ID = $UserID");
17
       WHERE ID = $UserID");
20
         list($Points) = $DB->next_record();
20
         list($Points) = $DB->next_record();
21
 
21
 
22
         if ($Points >= $Cost) {
22
         if ($Points >= $Cost) {
23
-            $DB->query("
23
+            $DB->prepared_query("
24
               UPDATE users_main
24
               UPDATE users_main
25
               SET BonusPoints = BonusPoints - $Cost,
25
               SET BonusPoints = BonusPoints - $Cost,
26
                 Title = ?
26
                 Title = ?
27
               WHERE ID = ?", $Title, $UserID);
27
               WHERE ID = ?", $Title, $UserID);
28
 
28
 
29
-            $DB->query("
29
+            $DB->prepared_query("
30
               UPDATE users_info
30
               UPDATE users_info
31
               SET AdminComment = CONCAT(NOW(), ' - Changed title to ', ?, ' via the store\n\n', AdminComment)
31
               SET AdminComment = CONCAT(NOW(), ' - Changed title to ', ?, ' via the store\n\n', AdminComment)
32
               WHERE UserID = ?", $Title, $UserID);
32
               WHERE UserID = ?", $Title, $UserID);

+ 3
- 3
sections/store/token.php View File

6
 $Purchase = "1 freeleech token";
6
 $Purchase = "1 freeleech token";
7
 $UserID = $LoggedUser['ID'];
7
 $UserID = $LoggedUser['ID'];
8
 
8
 
9
-$DB->query("
9
+$DB->prepared_query("
10
   SELECT BonusPoints
10
   SELECT BonusPoints
11
   FROM users_main
11
   FROM users_main
12
   WHERE ID = $UserID");
12
   WHERE ID = $UserID");
15
     list($Points) = $DB->next_record();
15
     list($Points) = $DB->next_record();
16
 
16
 
17
     if ($Points >= $Cost) {
17
     if ($Points >= $Cost) {
18
-        $DB->query("
18
+        $DB->prepared_query("
19
           UPDATE users_main
19
           UPDATE users_main
20
           SET BonusPoints = BonusPoints - $Cost,
20
           SET BonusPoints = BonusPoints - $Cost,
21
             FLTokens = FLTokens + 1
21
             FLTokens = FLTokens + 1
22
           WHERE ID = $UserID");
22
           WHERE ID = $UserID");
23
 
23
 
24
-        $DB->query("
24
+        $DB->prepared_query("
25
           UPDATE users_info
25
           UPDATE users_info
26
           SET AdminComment = CONCAT('".sqltime()." - Purchased a freeleech token from the store\n\n', AdminComment)
26
           SET AdminComment = CONCAT('".sqltime()." - Purchased a freeleech token from the store\n\n', AdminComment)
27
           WHERE UserID = $UserID");
27
           WHERE UserID = $UserID");

+ 3
- 3
sections/store/upload_1.php View File

7
 $GiB = 1024*1024*1024;
7
 $GiB = 1024*1024*1024;
8
 $Cost = 15;
8
 $Cost = 15;
9
 
9
 
10
-$DB->query("
10
+$DB->prepared_query("
11
   SELECT BonusPoints
11
   SELECT BonusPoints
12
   FROM users_main
12
   FROM users_main
13
   WHERE ID = $UserID");
13
   WHERE ID = $UserID");
16
     list($Points) = $DB->next_record();
16
     list($Points) = $DB->next_record();
17
 
17
 
18
     if ($Points >= $Cost) {
18
     if ($Points >= $Cost) {
19
-        $DB->query("
19
+        $DB->prepared_query("
20
           UPDATE users_main
20
           UPDATE users_main
21
           SET BonusPoints = BonusPoints - $Cost,
21
           SET BonusPoints = BonusPoints - $Cost,
22
             Uploaded = Uploaded + ($GiB * 0.1)
22
             Uploaded = Uploaded + ($GiB * 0.1)
23
           WHERE ID = $UserID");
23
           WHERE ID = $UserID");
24
 
24
 
25
-        $DB->query("
25
+        $DB->prepared_query("
26
           UPDATE users_info
26
           UPDATE users_info
27
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
27
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
28
           WHERE UserID = $UserID");
28
           WHERE UserID = $UserID");

+ 3
- 3
sections/store/upload_10.php View File

7
 $GiB = 1024*1024*1024;
7
 $GiB = 1024*1024*1024;
8
 $Cost = 150;
8
 $Cost = 150;
9
 
9
 
10
-$DB->query("
10
+$DB->prepared_query("
11
   SELECT BonusPoints
11
   SELECT BonusPoints
12
   FROM users_main
12
   FROM users_main
13
   WHERE ID = $UserID");
13
   WHERE ID = $UserID");
16
     list($Points) = $DB->next_record();
16
     list($Points) = $DB->next_record();
17
 
17
 
18
     if ($Points >= $Cost) {
18
     if ($Points >= $Cost) {
19
-        $DB->query("
19
+        $DB->prepared_query("
20
           UPDATE users_main
20
           UPDATE users_main
21
           SET BonusPoints = BonusPoints - $Cost,
21
           SET BonusPoints = BonusPoints - $Cost,
22
             Uploaded = Uploaded + ($GiB * 1)
22
             Uploaded = Uploaded + ($GiB * 1)
23
           WHERE ID = $UserID");
23
           WHERE ID = $UserID");
24
 
24
 
25
-        $DB->query("
25
+        $DB->prepared_query("
26
           UPDATE users_info
26
           UPDATE users_info
27
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
27
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
28
           WHERE UserID = $UserID");
28
           WHERE UserID = $UserID");

+ 3
- 3
sections/store/upload_100.php View File

7
 $GiB = 1024*1024*1024;
7
 $GiB = 1024*1024*1024;
8
 $Cost = 1500;
8
 $Cost = 1500;
9
 
9
 
10
-$DB->query("
10
+$DB->prepared_query("
11
   SELECT BonusPoints
11
   SELECT BonusPoints
12
   FROM users_main
12
   FROM users_main
13
   WHERE ID = $UserID");
13
   WHERE ID = $UserID");
16
     list($Points) = $DB->next_record();
16
     list($Points) = $DB->next_record();
17
 
17
 
18
     if ($Points >= $Cost) {
18
     if ($Points >= $Cost) {
19
-        $DB->query("
19
+        $DB->prepared_query("
20
           UPDATE users_main
20
           UPDATE users_main
21
           SET BonusPoints = BonusPoints - $Cost,
21
           SET BonusPoints = BonusPoints - $Cost,
22
             Uploaded = Uploaded + ($GiB * 10)
22
             Uploaded = Uploaded + ($GiB * 10)
23
           WHERE ID = $UserID");
23
           WHERE ID = $UserID");
24
 
24
 
25
-        $DB->query("
25
+        $DB->prepared_query("
26
           UPDATE users_info
26
           UPDATE users_info
27
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
27
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
28
           WHERE UserID = $UserID");
28
           WHERE UserID = $UserID");

+ 3
- 3
sections/store/upload_1000.php View File

7
 $GiB = 1024*1024*1024;
7
 $GiB = 1024*1024*1024;
8
 $Cost = 15000;
8
 $Cost = 15000;
9
 
9
 
10
-$DB->query("
10
+$DB->prepared_query("
11
   SELECT BonusPoints
11
   SELECT BonusPoints
12
   FROM users_main
12
   FROM users_main
13
   WHERE ID = $UserID");
13
   WHERE ID = $UserID");
16
     list($Points) = $DB->next_record();
16
     list($Points) = $DB->next_record();
17
 
17
 
18
     if ($Points >= $Cost) {
18
     if ($Points >= $Cost) {
19
-        $DB->query("
19
+        $DB->prepared_query("
20
           UPDATE users_main
20
           UPDATE users_main
21
           SET BonusPoints = BonusPoints - $Cost,
21
           SET BonusPoints = BonusPoints - $Cost,
22
             Uploaded = Uploaded + ($GiB * 100)
22
             Uploaded = Uploaded + ($GiB * 100)
23
           WHERE ID = $UserID");
23
           WHERE ID = $UserID");
24
 
24
 
25
-        $DB->query("
25
+        $DB->prepared_query("
26
           UPDATE users_info
26
           UPDATE users_info
27
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
27
           SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
28
           WHERE UserID = $UserID");
28
           WHERE UserID = $UserID");

+ 9
- 5
sections/tools/data/database_specifics.php View File

5
 
5
 
6
 // View schemas
6
 // View schemas
7
 if (!empty($_GET['table'])) {
7
 if (!empty($_GET['table'])) {
8
-    $DB->query('SHOW TABLES');
8
+    $DB->prepared_query('SHOW TABLES');
9
     $Tables =$DB->collect('Tables_in_'.$ENV->getPriv('SQLDB'));
9
     $Tables =$DB->collect('Tables_in_'.$ENV->getPriv('SQLDB'));
10
 
10
 
11
     if (!in_array($_GET['table'], $Tables)) {
11
     if (!in_array($_GET['table'], $Tables)) {
12
         error(0);
12
         error(0);
13
     }
13
     }
14
 
14
 
15
-    $DB->query('SHOW CREATE TABLE '.db_string($_GET['table']));
15
+    $DB->prepared_query('SHOW CREATE TABLE '.db_string($_GET['table']));
16
     list(, $Schema) = $DB->next_record(MYSQLI_NUM, false);
16
     list(, $Schema) = $DB->next_record(MYSQLI_NUM, false);
17
     header('Content-type: text/plain');
17
     header('Content-type: text/plain');
18
     error($Schema);
18
     error($Schema);
20
 
20
 
21
 // Cache the tables for 4 hours, makes sorting faster
21
 // Cache the tables for 4 hours, makes sorting faster
22
 if (!$Tables = $Cache->get_value('database_table_stats')) {
22
 if (!$Tables = $Cache->get_value('database_table_stats')) {
23
-    $DB->query('SHOW TABLE STATUS');
23
+    $DB->prepared_query('SHOW TABLE STATUS');
24
     $Tables =$DB->to_array();
24
     $Tables =$DB->to_array();
25
     $Cache->cache_value('database_table_stats', $Tables, 3600 * 4);
25
     $Cache->cache_value('database_table_stats', $Tables, 3600 * 4);
26
 }
26
 }
146
           Size
146
           Size
147
       </td>
147
       </td>
148
 
148
 
149
+      <!--
149
       <td>
150
       <td>
150
         Tools
151
         Tools
151
       </td>
152
       </td>
153
+      -->
152
     </tr>
154
     </tr>
153
 
155
 
154
     <?php
156
     <?php
191
         <?=Format::get_size($DataSize + $IndexSize)?>
193
         <?=Format::get_size($DataSize + $IndexSize)?>
192
       </td>
194
       </td>
193
 
195
 
196
+      <!--
194
       <td>
197
       <td>
195
-        <a href="tools.php?action=database_specifics&table=<?=display_str($Name)?>"
196
-          class="brackets">Schema</a>
198
+        <a href="tools.php?action=database_specifics&table=<?=null#display_str($Name)?>"
199
+      class="brackets">Schema</a>
197
       </td>
200
       </td>
201
+      -->
198
     </tr>
202
     </tr>
199
     <?php
203
     <?php
200
 }
204
 }

+ 8
- 8
sections/tools/data/economic_stats.php View File

43
 View::show_header('Economy');
43
 View::show_header('Economy');
44
 
44
 
45
 if (!$EconomicStats = $Cache->get_value('new_economic_stats')) {
45
 if (!$EconomicStats = $Cache->get_value('new_economic_stats')) {
46
-    $DB->query("
46
+    $DB->prepared_query("
47
       SELECT SUM(Uploaded), SUM(Downloaded), COUNT(ID)
47
       SELECT SUM(Uploaded), SUM(Downloaded), COUNT(ID)
48
       FROM users_main
48
       FROM users_main
49
       WHERE Enabled = '1'");
49
       WHERE Enabled = '1'");
50
     list($TotalUpload, $TotalDownload, $NumUsers) = $DB->next_record();
50
     list($TotalUpload, $TotalDownload, $NumUsers) = $DB->next_record();
51
 
51
 
52
-    $DB->query("
52
+    $DB->prepared_query("
53
       SELECT SUM(Bounty)
53
       SELECT SUM(Bounty)
54
       FROM requests_votes");
54
       FROM requests_votes");
55
     list($TotalBounty) = $DB->next_record();
55
     list($TotalBounty) = $DB->next_record();
56
 
56
 
57
-    $DB->query("
57
+    $DB->prepared_query("
58
       SELECT SUM(rv.Bounty)
58
       SELECT SUM(rv.Bounty)
59
       FROM requests_votes AS rv
59
       FROM requests_votes AS rv
60
         JOIN requests AS r ON r.ID = rv.RequestID
60
         JOIN requests AS r ON r.ID = rv.RequestID
61
       WHERE TorrentID > 0");
61
       WHERE TorrentID > 0");
62
     list($AvailableBounty) = $DB->next_record();
62
     list($AvailableBounty) = $DB->next_record();
63
 
63
 
64
-    $DB->query("
64
+    $DB->prepared_query("
65
       SELECT SUM(Snatched), COUNT(ID)
65
       SELECT SUM(Snatched), COUNT(ID)
66
       FROM torrents");
66
       FROM torrents");
67
     list($TotalSnatches, $TotalTorrents) = $DB->next_record(); // This is the total number of snatches for torrents that still exist
67
     list($TotalSnatches, $TotalTorrents) = $DB->next_record(); // This is the total number of snatches for torrents that still exist
68
 
68
 
69
-    $DB->query("
69
+    $DB->prepared_query("
70
       SELECT COUNT(uid)
70
       SELECT COUNT(uid)
71
       FROM xbt_snatched");
71
       FROM xbt_snatched");
72
     list($TotalOverallSnatches) = $DB->next_record();
72
     list($TotalOverallSnatches) = $DB->next_record();
73
 
73
 
74
     if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
74
     if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
75
-        $DB->query("
75
+        $DB->prepared_query("
76
           SELECT COUNT(fid)
76
           SELECT COUNT(fid)
77
           FROM xbt_files_users
77
           FROM xbt_files_users
78
           WHERE remaining = 0");
78
           WHERE remaining = 0");
79
         list($TotalSeeders) = $DB->next_record();
79
         list($TotalSeeders) = $DB->next_record();
80
 
80
 
81
-        $DB->query("
81
+        $DB->prepared_query("
82
           SELECT COUNT(fid)
82
           SELECT COUNT(fid)
83
           FROM xbt_files_users
83
           FROM xbt_files_users
84
           WHERE remaining > 0");
84
           WHERE remaining > 0");
88
     }
88
     }
89
 
89
 
90
     $TotalPeers = $TotalLeechers + $TotalSeeders;
90
     $TotalPeers = $TotalLeechers + $TotalSeeders;
91
-    $DB->query("
91
+    $DB->prepared_query("
92
       SELECT COUNT(ID)
92
       SELECT COUNT(ID)
93
       FROM users_main
93
       FROM users_main
94
       WHERE (
94
       WHERE (

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

76
           <input type="email" name="search" size="60"
76
           <input type="email" name="search" size="60"
77
             value="<?=display_str($Search)?>" />
77
             value="<?=display_str($Search)?>" />
78
           &nbsp;
78
           &nbsp;
79
-          <input type="submit" value="Search log" />
79
+          <input type="submit" class="button-primary" value="Search log" />
80
         </td>
80
         </td>
81
       </tr>
81
       </tr>
82
     </table>
82
     </table>

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

80
   <input type="hidden" name="action" value="registration_log" />
80
   <input type="hidden" name="action" value="registration_log" />
81
   Joined after: <input type="date" name="after_date" />
81
   Joined after: <input type="date" name="after_date" />
82
   Joined before: <input type="date" name="before_date" />
82
   Joined before: <input type="date" name="before_date" />
83
-  <input type="submit" />
83
+  <input type="submit" class="button-primary" />
84
 </form>
84
 </form>
85
 
85
 
86
 <?php
86
 <?php

+ 5
- 5
sections/tools/data/torrent_stats.php View File

8
 View::show_header('Torrents');
8
 View::show_header('Torrents');
9
 
9
 
10
 if (!$TorrentStats = $Cache->get_value('new_torrent_stats')) {
10
 if (!$TorrentStats = $Cache->get_value('new_torrent_stats')) {
11
-    $DB->query("
11
+    $DB->prepared_query("
12
     SELECT COUNT(ID), SUM(Size), SUM(FileCount)
12
     SELECT COUNT(ID), SUM(Size), SUM(FileCount)
13
     FROM torrents");
13
     FROM torrents");
14
     list($TorrentCount, $TotalSize, $TotalFiles) = $DB->next_record();
14
     list($TorrentCount, $TotalSize, $TotalFiles) = $DB->next_record();
15
 
15
 
16
-    $DB->query("
16
+    $DB->prepared_query("
17
     SELECT COUNT(ID)
17
     SELECT COUNT(ID)
18
     FROM users_main
18
     FROM users_main
19
     WHERE Enabled = '1'");
19
     WHERE Enabled = '1'");
20
     list($NumUsers) = $DB->next_record();
20
     list($NumUsers) = $DB->next_record();
21
 
21
 
22
-    $DB->query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 1 DAY)");
22
+    $DB->prepared_query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 1 DAY)");
23
     list($DayNum, $DaySize, $DayFiles) = $DB->next_record();
23
     list($DayNum, $DaySize, $DayFiles) = $DB->next_record();
24
 
24
 
25
-    $DB->query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 7 DAY)");
25
+    $DB->prepared_query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 7 DAY)");
26
     list($WeekNum, $WeekSize, $WeekFiles) = $DB->next_record();
26
     list($WeekNum, $WeekSize, $WeekFiles) = $DB->next_record();
27
 
27
 
28
-    $DB->query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 30 DAY)");
28
+    $DB->prepared_query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE(NOW(), INTERVAL 30 DAY)");
29
     list($MonthNum, $MonthSize, $MonthFiles) = $DB->next_record();
29
     list($MonthNum, $MonthSize, $MonthFiles) = $DB->next_record();
30
   
30
   
31
     $Cache->cache_value('new_torrent_stats', array($TorrentCount, $TotalSize, $TotalFiles,
31
     $Cache->cache_value('new_torrent_stats', array($TorrentCount, $TotalSize, $TotalFiles,

+ 1
- 1
sections/tools/development/clear_cache.php View File

45
 
45
 
46
         <textarea type="text" name="key" id="key"
46
         <textarea type="text" name="key" id="key"
47
           class="inputtext"><?=((isset($_GET['key']) && (isset($_GET['submit']))) ? display_str($_GET['key']) : '')?></textarea>
47
           class="inputtext"><?=((isset($_GET['key']) && (isset($_GET['submit']))) ? display_str($_GET['key']) : '')?></textarea>
48
-        <input type="submit" name="submit" class="submit" />
48
+        <input type="submit" name="submit" class="submit button-primary" />
49
       </form>
49
       </form>
50
     </td>
50
     </td>
51
   </tr>
51
   </tr>

+ 17
- 17
sections/tools/development/misc_values.php View File

7
 
7
 
8
 if (!check_perms('admin_manage_permissions')) {
8
 if (!check_perms('admin_manage_permissions')) {
9
     View::show_header('Site Options');
9
     View::show_header('Site Options');
10
-    $DB->query("SELECT Name, First, Second FROM misc"); ?>
10
+    $DB->prepared_query("SELECT Name, First, Second FROM misc"); ?>
11
 
11
 
12
 <div class="header">
12
 <div class="header">
13
   <h1>Miscellaneous Values</h1>
13
   <h1>Miscellaneous Values</h1>
14
 </div>
14
 </div>
15
 
15
 
16
-<table width="100%">
17
-  <tr class="colhead">
18
-    <td>Name</td>
19
-    <td>First</td>
20
-    <td>Second</td>
16
+<table class="skeleton-fix">
17
+  <tr>
18
+    <th>Name</th>
19
+    <th>First</th>
20
+    <th>Second</th>
21
   </tr>
21
   </tr>
22
 
22
 
23
   <?php
23
   <?php
50
 
50
 
51
     if ($_POST['submit'] === 'Delete') {
51
     if ($_POST['submit'] === 'Delete') {
52
         $Name = db_string($_POST['name']);
52
         $Name = db_string($_POST['name']);
53
-        $DB->query("DELETE FROM misc WHERE Name = '" . $Name . "'");
53
+        $DB->prepared_query("DELETE FROM misc WHERE Name = '" . $Name . "'");
54
     } else {
54
     } else {
55
         $Val->SetFields('name', '1', 'regex', 'The name must be separated by underscores. No spaces are allowed.', array('regex' => '/^[a-z][:_a-z0-9]{0,63}$/i'));
55
         $Val->SetFields('name', '1', 'regex', 'The name must be separated by underscores. No spaces are allowed.', array('regex' => '/^[a-z][:_a-z0-9]{0,63}$/i'));
56
         $Val->SetFields('first', '1', 'string', 'You must specify the first value.');
56
         $Val->SetFields('first', '1', 'string', 'You must specify the first value.');
66
         $Second = db_string($_POST['second']);
66
         $Second = db_string($_POST['second']);
67
 
67
 
68
         if ($_POST['submit'] === 'Edit') {
68
         if ($_POST['submit'] === 'Edit') {
69
-            $DB->query("SELECT Name FROM misc WHERE ID = '" . db_string($_POST['id']) . "'");
69
+            $DB->prepared_query("SELECT Name FROM misc WHERE ID = '" . db_string($_POST['id']) . "'");
70
             list($OldName) = $DB->next_record();
70
             list($OldName) = $DB->next_record();
71
 
71
 
72
-            $DB->query("
72
+            $DB->prepared_query("
73
               UPDATE misc
73
               UPDATE misc
74
               SET
74
               SET
75
                 Name = '$Name',
75
                 Name = '$Name',
78
               WHERE ID = '" . db_string($_POST['id']) . "'
78
               WHERE ID = '" . db_string($_POST['id']) . "'
79
             ");
79
             ");
80
         } else {
80
         } else {
81
-            $DB->query("
81
+            $DB->prepared_query("
82
               INSERT INTO misc (Name, First, Second)
82
               INSERT INTO misc (Name, First, Second)
83
               VALUES ('$Name', '$First', '$Second')
83
               VALUES ('$Name', '$First', '$Second')
84
             ");
84
             ");
86
     }
86
     }
87
 }
87
 }
88
 
88
 
89
-$DB->query("
89
+$DB->prepared_query("
90
   SELECT
90
   SELECT
91
     ID,
91
     ID,
92
     Name,
92
     Name,
125
         </td>
125
         </td>
126
 
126
 
127
         <td>
127
         <td>
128
-          <input type="text" size="60" name="first" />
128
+          <input type="text" size="50" name="first" />
129
         </td>
129
         </td>
130
 
130
 
131
         <td>
131
         <td>
132
-          <input type="text" size="60" name="second" />
132
+          <input type="text" size="50" name="second" />
133
         </td>
133
         </td>
134
 
134
 
135
         <td>
135
         <td>
136
-          <input type="submit" name="submit" value="Create" />
136
+          <input type="submit" name="submit" class="button-primary" value="Create" />
137
         </td>
137
         </td>
138
       </form>
138
       </form>
139
     </tr>
139
     </tr>
154
         </td>
154
         </td>
155
 
155
 
156
         <td>
156
         <td>
157
-          <input type="text" size="60" name="first"
157
+          <input type="text" size="50" name="first"
158
             value="<?=$First?>" />
158
             value="<?=$First?>" />
159
         </td>
159
         </td>
160
 
160
 
161
         <td>
161
         <td>
162
-          <input type="text" size="60" name="second"
162
+          <input type="text" size="50" name="second"
163
             value="<?=$Second?>" />
163
             value="<?=$Second?>" />
164
         </td>
164
         </td>
165
 
165
 
166
         <td>
166
         <td>
167
-          <input type="submit" name="submit" value="Edit" />
167
+          <input type="submit" name="submit" class="button-primary" value="Edit" />
168
           <input type="submit" name="submit" value="Delete" />
168
           <input type="submit" name="submit" value="Delete" />
169
         </td>
169
         </td>
170
       </form>
170
       </form>

+ 4
- 0
sections/tools/development/render_build_preview.js View File

14
   console.log(JSON.stringify(returnStatus));
14
   console.log(JSON.stringify(returnStatus));
15
   phantom.exit();
15
   phantom.exit();
16
 }
16
 }
17
+
17
 fs.changeWorkingDirectory(toolsMiscPath);
18
 fs.changeWorkingDirectory(toolsMiscPath);
18
 if (!fs.exists('render_base.html')) {
19
 if (!fs.exists('render_base.html')) {
19
   // Rendering base doesn't exist, who broke things?
20
   // Rendering base doesn't exist, who broke things?
28
     width: 1200,
29
     width: 1200,
29
     height: 1000
30
     height: 1000
30
   };
31
   };
32
+
31
   // Switch to specific stylesheet subdirectory
33
   // Switch to specific stylesheet subdirectory
32
   fs.changeWorkingDirectory(rootPath + '/' + staticPath + 'styles/' + system.args[3] + '/');
34
   fs.changeWorkingDirectory(rootPath + '/' + staticPath + 'styles/' + system.args[3] + '/');
33
   if (!fs.isWritable(fs.workingDirectory)) {
35
   if (!fs.isWritable(fs.workingDirectory)) {
36
     console.log(JSON.stringify(returnStatus));
38
     console.log(JSON.stringify(returnStatus));
37
     phantom.exit();
39
     phantom.exit();
38
   }
40
   }
41
+
39
   fs.write('preview.html', page.content, 'w');
42
   fs.write('preview.html', page.content, 'w');
40
   if (!fs.isFile('preview.html')) {
43
   if (!fs.isFile('preview.html')) {
41
     // Failed to store specific preview file.
44
     // Failed to store specific preview file.
43
     console.log(JSON.stringify(returnStatus));
46
     console.log(JSON.stringify(returnStatus));
44
     phantom.exit();
47
     phantom.exit();
45
   }
48
   }
49
+
46
   page.close();
50
   page.close();
47
   returnStatus.status = 0;
51
   returnStatus.status = 0;
48
   console.log(JSON.stringify(returnStatus));
52
   console.log(JSON.stringify(returnStatus));

+ 36
- 27
sections/tools/development/rerender_gallery.php View File

1
-<?
2
-/*
1
+<?php
2
+#declare(strict_types=1);
3
+
4
+/**
3
  * This page creates previews of all supported stylesheets
5
  * This page creates previews of all supported stylesheets
4
  * SERVER_ROOT . '/' . STATIC_SERVER . 'styles/preview' must exist and be writable
6
  * SERVER_ROOT . '/' . STATIC_SERVER . 'styles/preview' must exist and be writable
5
  * Dependencies are PhantomJS (http://phantomjs.org/) and
7
  * Dependencies are PhantomJS (http://phantomjs.org/) and
6
  * ImageMagick (http://www.imagemagick.org/script/index.php)
8
  * ImageMagick (http://www.imagemagick.org/script/index.php)
7
  */
9
  */
10
+
8
 View::show_header('Rerender stylesheet gallery images');
11
 View::show_header('Rerender stylesheet gallery images');
9
-$DB->query('
12
+$DB->prepared_query('
10
   SELECT
13
   SELECT
11
     ID,
14
     ID,
12
     LOWER(REPLACE(Name," ","_")) AS Name,
15
     LOWER(REPLACE(Name," ","_")) AS Name,
21
     <div class="box box_info">
24
     <div class="box box_info">
22
       <div class="head colhead_dark">Rendering parameters</div>
25
       <div class="head colhead_dark">Rendering parameters</div>
23
       <ul class="stats nobullet">
26
       <ul class="stats nobullet">
24
-        <li>Server root: <?= var_dump(SERVER_ROOT); ?></li>
25
-        <li>Static server: <?= var_dump(STATIC_SERVER); ?></li>
26
-        <li>Whoami: <? echo(shell_exec('whoami')); ?></li>
27
-        <li>Path: <? echo dirname(__FILE__); ?></li>
28
-        <li>Phantomjs ver: <? echo (shell_exec('/usr/bin/phantomjs -v;')); ?></li>
27
+        <li>Server root: <?= var_dump(SERVER_ROOT); ?>
28
+        </li>
29
+        <li>Static server: <?= var_dump(STATIC_SERVER); ?>
30
+        </li>
31
+        <li>Whoami: <?php echo(shell_exec('whoami')); ?>
32
+        </li>
33
+        <li>Path: <?php echo dirname(__FILE__); ?>
34
+        </li>
35
+        <li>Phantomjs ver: <?php echo(shell_exec('/usr/bin/phantomjs -v')); ?>
36
+        </li>
29
       </ul>
37
       </ul>
30
     </div>
38
     </div>
31
   </div>
39
   </div>
40
     <div class="box">
48
     <div class="box">
41
       <div class="head">Rendering status</div>
49
       <div class="head">Rendering status</div>
42
       <div class="pad">
50
       <div class="pad">
43
-<?
51
+        <?php
44
 //set_time_limit(0);
52
 //set_time_limit(0);
45
 foreach ($Styles as $Style) {
53
 foreach ($Styles as $Style) {
46
-?>
54
+    ?>
47
         <div class="box">
55
         <div class="box">
48
-          <h6><?= $Style['Name'] ?></h6>
56
+          <h6><?= $Style['Name'] ?>
57
+          </h6>
49
           <p>Build preview:
58
           <p>Build preview:
50
-<?
59
+            <?php
51
   $CmdLine = '/usr/bin/phantomjs "' . dirname(__FILE__) . '/render_build_preview.js" "' . SERVER_ROOT . '" "' . STATIC_SERVER . '" "' . $Style['Name'] . '" "' . dirname(__FILE__) . '"';
60
   $CmdLine = '/usr/bin/phantomjs "' . dirname(__FILE__) . '/render_build_preview.js" "' . SERVER_ROOT . '" "' . STATIC_SERVER . '" "' . $Style['Name'] . '" "' . dirname(__FILE__) . '"';
52
-  $BuildResult = json_decode(shell_exec(escapeshellcmd($CmdLine)), true);
53
-  switch ($BuildResult['status']) {
61
+    $BuildResult = json_decode(shell_exec(escapeshellcmd($CmdLine)), true);
62
+    switch ($BuildResult['status']) {
54
     case 0:
63
     case 0:
55
       echo 'Success.';
64
       echo 'Success.';
56
       break;
65
       break;
68
       break;
77
       break;
69
     default:
78
     default:
70
       echo 'Err: Unknown error returned';
79
       echo 'Err: Unknown error returned';
71
-  }
72
-?>
80
+  } ?>
73
           </p>
81
           </p>
74
-<?
82
+          <?php
75
   //If build was successful, snap a preview.
83
   //If build was successful, snap a preview.
76
   if ($BuildResult['status'] === 0) {
84
   if ($BuildResult['status'] === 0) {
77
-?>
85
+      ?>
78
           <p>Snap preview:
86
           <p>Snap preview:
79
-<?
87
+            <?php
80
     $CmdLine = '/usr/bin/phantomjs "' . dirname(__FILE__) . '/render_snap_preview.js" "' . SERVER_ROOT . '" "' . STATIC_SERVER . '" "' . $Style['Name'] . '" "' . dirname(__FILE__) . '"';
88
     $CmdLine = '/usr/bin/phantomjs "' . dirname(__FILE__) . '/render_snap_preview.js" "' . SERVER_ROOT . '" "' . STATIC_SERVER . '" "' . $Style['Name'] . '" "' . dirname(__FILE__) . '"';
81
-    $SnapResult = json_decode(shell_exec(escapeshellcmd($CmdLine)), true);
82
-    switch ($SnapResult['status']) {
89
+      $SnapResult = json_decode(shell_exec(escapeshellcmd($CmdLine)), true);
90
+      switch ($SnapResult['status']) {
83
       case 0:
91
       case 0:
84
         echo 'Success.';
92
         echo 'Success.';
85
         $CmdLine = '/usr/bin/convert "' . $ImagePath . '/full_' . $Style['Name'] . '.png" -filter Box -resize 40% -quality 94 "' . $ImagePath . '/thumb_' . $Style['Name'] . '.png"';
93
         $CmdLine = '/usr/bin/convert "' . $ImagePath . '/full_' . $Style['Name'] . '.png" -filter Box -resize 40% -quality 94 "' . $ImagePath . '/thumb_' . $Style['Name'] . '.png"';
86
         $ResizeResult = shell_exec(escapeshellcmd($CmdLine));
94
         $ResizeResult = shell_exec(escapeshellcmd($CmdLine));
87
         if ($ResizeResult !== null) {
95
         if ($ResizeResult !== null) {
88
-          echo ' But failed to resize image';
96
+            echo ' But failed to resize image';
89
         }
97
         }
90
         break;
98
         break;
91
       case -1:
99
       case -1:
108
         break;
116
         break;
109
       default:
117
       default:
110
         echo 'Err: Unknown error returned.';
118
         echo 'Err: Unknown error returned.';
111
-    }
112
-?>
119
+    } ?>
113
           </p>
120
           </p>
114
-<?php } ?>
121
+          <?php
122
+  } ?>
115
         </div>
123
         </div>
116
-<? } ?>
124
+        <?php
125
+} ?>
117
       </div>
126
       </div>
118
     </div>
127
     </div>
119
   </div>
128
   </div>
120
 </div>
129
 </div>
121
-<?
130
+<?php
122
 View::show_footer();
131
 View::show_footer();

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

10
     $Cache->flush();
10
     $Cache->flush();
11
 }
11
 }
12
 
12
 
13
-$DB->query('SHOW GLOBAL STATUS');
13
+$DB->prepared_query('SHOW GLOBAL STATUS');
14
 $DBStats = $DB->to_array('Variable_name');
14
 $DBStats = $DB->to_array('Variable_name');
15
 $MemStats = $Cache->getStats();
15
 $MemStats = $Cache->getStats();
16
 
16
 
119
             <input type="hidden" name="auth"
119
             <input type="hidden" name="auth"
120
               value="<?=$LoggedUser['AuthKey']?>" />
120
               value="<?=$LoggedUser['AuthKey']?>" />
121
             <input type="hidden" name="global_flush" value="1" />
121
             <input type="hidden" name="global_flush" value="1" />
122
-            <input type="submit" value="Flush" />
122
+            <input type="submit" class="button-primary" value="Flush" />
123
           </form>
123
           </form>
124
         </td>
124
         </td>
125
       </tr>
125
       </tr>

+ 1
- 1
sections/tools/finances/donation_log.php View File

145
       </tr>
145
       </tr>
146
       <tr>
146
       <tr>
147
         <td>
147
         <td>
148
-          <input type="submit" value="Search donation log" />
148
+          <input type="submit" class="button-primary" value="Search donation log" />
149
         </td>
149
         </td>
150
       </tr>
150
       </tr>
151
     </table>
151
     </table>

+ 13
- 17
sections/tools/index.php View File

125
     }
125
     }
126
 
126
 
127
     if (is_number($_POST['newsid'])) {
127
     if (is_number($_POST['newsid'])) {
128
-        $DB->query("
128
+        $DB->prepared_query("
129
           UPDATE news
129
           UPDATE news
130
           SET Title = '".db_string($_POST['title'])."',
130
           SET Title = '".db_string($_POST['title'])."',
131
             Body = '".db_string($_POST['body'])."'
131
             Body = '".db_string($_POST['body'])."'
144
 
144
 
145
     if (is_number($_GET['id'])) {
145
     if (is_number($_GET['id'])) {
146
         authorize();
146
         authorize();
147
-        $DB->query("
147
+        $DB->prepared_query("
148
           DELETE FROM news
148
           DELETE FROM news
149
           WHERE ID = '".db_string($_GET['id'])."'");
149
           WHERE ID = '".db_string($_GET['id'])."'");
150
 
150
 
166
         error(403);
166
         error(403);
167
     }
167
     }
168
 
168
 
169
-    $DB->query("
169
+    $DB->prepared_query("
170
       INSERT INTO news (UserID, Title, Body, Time)
170
       INSERT INTO news (UserID, Title, Body, Time)
171
       VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', NOW())");
171
       VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', NOW())");
172
 
172
 
205
     include SERVER_ROOT.'/sections/tools/managers/tag_aliases.php';
205
     include SERVER_ROOT.'/sections/tools/managers/tag_aliases.php';
206
     break;
206
     break;
207
 
207
 
208
-  case 'label_aliases':
209
-    include SERVER_ROOT.'/sections/tools/managers/label_aliases.php';
210
-    break;
211
-
212
   case 'global_notification':
208
   case 'global_notification':
213
     include SERVER_ROOT.'/sections/tools/managers/global_notification.php';
209
     include SERVER_ROOT.'/sections/tools/managers/global_notification.php';
214
     break;
210
     break;
229
         //$Val->SetFields('test', true, 'number', 'You did not enter a valid level for this permission set.');
225
         //$Val->SetFields('test', true, 'number', 'You did not enter a valid level for this permission set.');
230
 
226
 
231
         if (is_numeric($_REQUEST['id'])) {
227
         if (is_numeric($_REQUEST['id'])) {
232
-            $DB->query("
228
+            $DB->prepared_query("
233
               SELECT p.ID, p.Name, p.Abbreviation, p.Level, p.Secondary, p.PermittedForums, p.Values, p.DisplayStaff, COUNT(u.ID)
229
               SELECT p.ID, p.Name, p.Abbreviation, p.Level, p.Secondary, p.PermittedForums, p.Values, p.DisplayStaff, COUNT(u.ID)
234
               FROM permissions AS p
230
               FROM permissions AS p
235
                 LEFT JOIN users_main AS u ON u.PermissionID = p.ID
231
                 LEFT JOIN users_main AS u ON u.PermissionID = p.ID
248
             $Err = $Val->ValidateForm($_POST);
244
             $Err = $Val->ValidateForm($_POST);
249
 
245
 
250
             if (!is_numeric($_REQUEST['id'])) {
246
             if (!is_numeric($_REQUEST['id'])) {
251
-                $DB->query("
247
+                $DB->prepared_query("
252
                   SELECT ID
248
                   SELECT ID
253
                   FROM permissions
249
                   FROM permissions
254
                   WHERE Level = '".db_string($_REQUEST['level'])."'");
250
                   WHERE Level = '".db_string($_REQUEST['level'])."'");
276
 
272
 
277
             if (!$Err) {
273
             if (!$Err) {
278
                 if (!is_numeric($_REQUEST['id'])) {
274
                 if (!is_numeric($_REQUEST['id'])) {
279
-                    $DB->query("
275
+                    $DB->prepared_query("
280
                       INSERT INTO permissions (Level, Name, Abbreviation, Secondary, PermittedForums, `Values`, DisplayStaff)
276
                       INSERT INTO permissions (Level, Name, Abbreviation, Secondary, PermittedForums, `Values`, DisplayStaff)
281
                       VALUES ('".db_string($Level)."',
277
                       VALUES ('".db_string($Level)."',
282
                         '".db_string($Name)."',
278
                         '".db_string($Name)."',
286
                         '".db_string(serialize($Values))."',
282
                         '".db_string(serialize($Values))."',
287
                         '".db_string($DisplayStaff)."')");
283
                         '".db_string($DisplayStaff)."')");
288
                 } else {
284
                 } else {
289
-                    $DB->query("
285
+                    $DB->prepared_query("
290
                       UPDATE permissions
286
                       UPDATE permissions
291
                       SET Level = '".db_string($Level)."',
287
                       SET Level = '".db_string($Level)."',
292
                         Name = '".db_string($Name)."',
288
                         Name = '".db_string($Name)."',
299
 
295
 
300
                     $Cache->delete_value('perm_'.$_REQUEST['id']);
296
                     $Cache->delete_value('perm_'.$_REQUEST['id']);
301
                     if ($Secondary) {
297
                     if ($Secondary) {
302
-                        $DB->query("
298
+                        $DB->prepared_query("
303
                           SELECT DISTINCT UserID
299
                           SELECT DISTINCT UserID
304
                           FROM users_levels
300
                           FROM users_levels
305
                           WHERE PermissionID = ".db_string($_REQUEST['id']));
301
                           WHERE PermissionID = ".db_string($_REQUEST['id']));
318
         include SERVER_ROOT.'/sections/tools/managers/permissions_alter.php';
314
         include SERVER_ROOT.'/sections/tools/managers/permissions_alter.php';
319
     } else {
315
     } else {
320
         if (!empty($_REQUEST['removeid'])) {
316
         if (!empty($_REQUEST['removeid'])) {
321
-            $DB->query("
317
+            $DB->prepared_query("
322
               DELETE FROM permissions
318
               DELETE FROM permissions
323
               WHERE ID = '".db_string($_REQUEST['removeid'])."'");
319
               WHERE ID = '".db_string($_REQUEST['removeid'])."'");
324
 
320
 
325
-            $DB->query("
321
+            $DB->prepared_query("
326
               SELECT UserID
322
               SELECT UserID
327
               FROM users_levels
323
               FROM users_levels
328
               WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'");
324
               WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'");
331
                 $Cache->delete_value("user_info_$UserID");
327
                 $Cache->delete_value("user_info_$UserID");
332
                 $Cache->delete_value("user_info_heavy_$UserID");
328
                 $Cache->delete_value("user_info_heavy_$UserID");
333
             }
329
             }
334
-            $DB->query("
330
+            $DB->prepared_query("
335
               DELETE FROM users_levels
331
               DELETE FROM users_levels
336
               WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'");
332
               WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'");
337
 
333
 
338
-            $DB->query("
334
+            $DB->prepared_query("
339
               SELECT ID
335
               SELECT ID
340
               FROM users_main
336
               FROM users_main
341
               WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'");
337
               WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'");
345
                 $Cache->delete_value("user_info_heavy_$UserID");
341
                 $Cache->delete_value("user_info_heavy_$UserID");
346
             }
342
             }
347
 
343
 
348
-            $DB->query("
344
+            $DB->prepared_query("
349
               UPDATE users_main
345
               UPDATE users_main
350
               SET PermissionID = '".USER."'
346
               SET PermissionID = '".USER."'
351
               WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'");
347
               WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'");

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

109
             value="<?=(!empty($_GET['notes']) ? display_str($_GET['notes']) : '')?>" />
109
             value="<?=(!empty($_GET['notes']) ? display_str($_GET['notes']) : '')?>" />
110
         </td>
110
         </td>
111
         <td>
111
         <td>
112
-          <input type="submit" value="Search" />
112
+          <input type="submit" class="button-primary" value="Search" />
113
         </td>
113
         </td>
114
       </tr>
114
       </tr>
115
     </table>
115
     </table>
143
         <input type="text" size="72" name="notes" />
143
         <input type="text" size="72" name="notes" />
144
       </td>
144
       </td>
145
       <td>
145
       <td>
146
-        <input type="submit" name="submit" value="Create" />
146
+        <input type="submit" name="submit" class="button-primary" value="Create" />
147
       </td>
147
       </td>
148
     </form>
148
     </form>
149
   </tr>
149
   </tr>

+ 5
- 5
sections/tools/managers/email_blacklist.php View File

44
   <input type="hidden" name="action" value="email_blacklist" />
44
   <input type="hidden" name="action" value="email_blacklist" />
45
   <input type="email" name="email" size="30" placeholder="Email" />
45
   <input type="email" name="email" size="30" placeholder="Email" />
46
   <input type="search" name="comment" size="60" placeholder="Comment" />
46
   <input type="search" name="comment" size="60" placeholder="Comment" />
47
-  <input type="submit" value="Search" />
47
+  <input type="submit" class="button-primary" value="Search" />
48
 </form>
48
 </form>
49
 <div class="linkbox pager">
49
 <div class="linkbox pager">
50
   <br />
50
   <br />
68
       <input type="hidden" name="action" value="email_blacklist_alter" />
68
       <input type="hidden" name="action" value="email_blacklist_alter" />
69
       <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
69
       <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
70
       <td><input type="text" name="email" size="30" /></td>
70
       <td><input type="text" name="email" size="30" /></td>
71
-      <td colspan="2"><input type="text" name="comment" size="60" /></td>
72
-      <td><input type="submit" value="Create" /></td>
71
+      <td colspan="2"><input type="text" name="comment" size="50" /></td>
72
+      <td><input type="submit" class="button-primary" value="Create" /></td>
73
     </form>
73
     </form>
74
   </tr>
74
   </tr>
75
 <?
75
 <?
83
         <input type="hidden" name="id" value="<?=$Result['ID']?>" />
83
         <input type="hidden" name="id" value="<?=$Result['ID']?>" />
84
         <input type="email" name="email" value="<?=display_str($Result['Email'])?>" size="30" />
84
         <input type="email" name="email" value="<?=display_str($Result['Email'])?>" size="30" />
85
       </td>
85
       </td>
86
-      <td><input type="text" name="comment" value="<?=display_str($Result['Comment'])?>" size="60" /></td>
86
+      <td><input type="text" name="comment" value="<?=display_str($Result['Comment'])?>" size="50" /></td>
87
       <td><?=Users::format_username($Result ['UserID'], false, false, false)?><br /><?=time_diff($Result ['Time'], 1)?></td>
87
       <td><?=Users::format_username($Result ['UserID'], false, false, false)?><br /><?=time_diff($Result ['Time'], 1)?></td>
88
       <td>
88
       <td>
89
-        <input type="submit" name="submit" value="Edit" />
89
+        <input type="submit" name="submit" class="button-primary" value="Edit" />
90
         <input type="submit" name="submit" value="Delete" />
90
         <input type="submit" name="submit" value="Delete" />
91
       </td>
91
       </td>
92
     </form>
92
     </form>

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

18
   <form action="tools.php" method="post">
18
   <form action="tools.php" method="post">
19
     <input type="hidden" name="action" value="take_global_notification" />
19
     <input type="hidden" name="action" value="take_global_notification" />
20
     <input type="hidden" name="type" value="set" />
20
     <input type="hidden" name="type" value="set" />
21
-    <table align="center">
21
+    <table class="skeleton-fix">
22
       <tr>
22
       <tr>
23
         <td class="label">
23
         <td class="label">
24
           Message
24
           Message
69
 
69
 
70
       <tr>
70
       <tr>
71
         <td>
71
         <td>
72
-          <input type="submit" name="set" value="Create Notification" />
72
+          <input type="submit" name="set" class="button-primary" value="Create Notification" />
73
         </td>
73
         </td>
74
 
74
 
75
         <?php if ($GlobalNotification) { ?>
75
         <?php if ($GlobalNotification) { ?>

+ 0
- 114
sections/tools/managers/label_aliases.php View File

1
-<?php
2
-/*
3
-if (!check_perms('torrents_edit') || $LoggedUser['DisableWiki']) {
4
-  error(403);
5
-}
6
-*/
7
-
8
-if (!check_perms('users_mod') && !$LoggedUser['ExtraClasses'][DELTA_TEAM]) {
9
-  error(403);
10
-}
11
-
12
-View::show_header('Label Aliases');
13
-
14
-$OrderBy = $_GET['order'] === 'BadLabels' ? 'BadLabel' : 'AliasLabel';
15
-/*
16
-$LabelID = (int)$_GET['id'];
17
-$LabelNameSQL = '';
18
-//TODO join with labels table to get label name
19
-if (!empty($LabelID)) {
20
-  $DB->query("
21
-    SELECT name
22
-    FROM labels
23
-    WHERE ID = '$LabelID'");
24
-  if ($DB->has_results()) {
25
-    list($LabelName) = $DB->next_record();
26
-  }
27
-  $LabelNameSQL = " WHERE AliasLabel = '$LabelName'";
28
-}
29
-*/
30
-
31
-if (isset($_POST['newalias'])) {
32
-  $BadLabel = db_string($_POST['BadLabel']);
33
-  $AliasLabel = db_string($_POST['AliasLabel']);
34
-
35
-  $DB->query("
36
-    INSERT INTO label_aliases (BadLabel, AliasLabel)
37
-    VALUES ('$BadLabel', '$AliasLabel')");
38
-}
39
-
40
-if (isset($_POST['changealias']) && is_number($_POST['aliasid'])) {
41
-  $AliasID = $_POST['aliasid'];
42
-  $BadLabel = db_string($_POST['BadLabel']);
43
-  $AliasLabel = db_string($_POST['AliasLabel']);
44
-
45
-  if ($_POST['save']) {
46
-    $DB->query("
47
-      UPDATE label_aliases
48
-      SET BadLabel = '$BadLabel', AliasLabel = '$AliasLabel'
49
-      WHERE ID = '$AliasID' ");
50
-  }
51
-  if ($_POST['delete']) {
52
-    $DB->query("
53
-      DELETE FROM label_aliases
54
-      WHERE ID = '$AliasID'");
55
-  }
56
-}
57
-?>
58
-<div class="header">
59
-  <h2>Label Aliases<?=($LabelName ? " for <a href=\"labels.php?id=$LabelID\">$LabelName</a>" : '')?></h2>
60
-  <div class="linkbox">
61
-    <a href="tools.php?action=label_aliases&amp;order=GoodLabels" class="brackets">Sort by good labels</a>
62
-    <a href="tools.php?action=label_aliases&amp;order=BadLabels" class="brackets">Sort by bad labels</a>
63
-  </div>
64
-</div>
65
-<table width="100%">
66
-  <tr class="colhead">
67
-    <td>Label</td>
68
-    <td>Renamed from</td>
69
-    <td>Submit</td>
70
-  </tr>
71
-  <tr />
72
-  <tr>
73
-    <form method="post" action="">
74
-      <input type="hidden" name="newalias" value="1" />
75
-      <td>
76
-        <input type="text" name="AliasLabel" />
77
-      </td>
78
-      <td>
79
-        <input type="text" name="BadLabel" />
80
-      </td>
81
-      <td>
82
-        <input type="submit" value="Add alias" />
83
-      </td>
84
-    </form>
85
-  </tr>
86
-<?
87
-$DB->query("
88
-  SELECT ID, BadLabel, AliasLabel
89
-  FROM label_aliases
90
-  $LabelNameSQL
91
-  ORDER BY $OrderBy");
92
-while (list($ID, $BadLabel, $AliasLabel) = $DB->next_record()) {
93
-?>
94
-  <tr>
95
-    <form method="post" action="">
96
-      <input type="hidden" name="changealias" value="1" />
97
-      <input type="hidden" name="aliasid" value="<?=$ID?>" />
98
-      <td>
99
-        <input type="text" name="AliasLabel" value="<?=$AliasLabel?>" />
100
-      </td>
101
-      <td>
102
-        <input type="text" name="BadLabel" value="<?=$BadLabel?>" />
103
-      </td>
104
-      <td>
105
-        <input type="submit" name="save" value="Save alias" />
106
-        <input type="submit" name="delete" value="Delete alias" />
107
-      </td>
108
-    </form>
109
-  </tr>
110
-<?
111
-}
112
-?>
113
-</table>
114
-<? View::show_footer(); ?>

+ 1
- 1
sections/tools/managers/mass_pm.php View File

45
       <div id="preview" class="hidden"></div>
45
       <div id="preview" class="hidden"></div>
46
       <div id="buttons" class="center">
46
       <div id="buttons" class="center">
47
         <input type="button" value="Preview" onclick="Quick_Preview();" />
47
         <input type="button" value="Preview" onclick="Quick_Preview();" />
48
-        <input type="submit" value="Send message" />
48
+        <input type="submit" class="button-primary" value="Send message" />
49
       </div>
49
       </div>
50
     </div>
50
     </div>
51
   </form>
51
   </form>

+ 1
- 1
sections/tools/managers/multiple_freeleech.php View File

112
                 <option value="m" <?=$_POST['scale'] == 'm' ? 'selected' : ''?>>MB</option>
112
                 <option value="m" <?=$_POST['scale'] == 'm' ? 'selected' : ''?>>MB</option>
113
                 <option value="g" <?=!isset($_POST['scale']) || $_POST['scale'] == 'g' ? 'selected' : ''?>>GB</option>
113
                 <option value="g" <?=!isset($_POST['scale']) || $_POST['scale'] == 'g' ? 'selected' : ''?>>GB</option>
114
             </select><br /><br />
114
             </select><br /><br />
115
-            <input type="submit" value="Submit" />
115
+            <input type="submit" class="button-primary" value="Submit" />
116
         </form>
116
         </form>
117
     </div>
117
     </div>
118
 </div>
118
 </div>

+ 4
- 4
sections/tools/managers/news.php View File

21
     if (is_number($_POST['newsid'])) {
21
     if (is_number($_POST['newsid'])) {
22
         authorize();
22
         authorize();
23
 
23
 
24
-        $DB->query("
24
+        $DB->prepared_query("
25
         UPDATE news
25
         UPDATE news
26
         SET Title = '".db_string($_POST['title'])."', Body = '".db_string($_POST['body'])."'
26
         SET Title = '".db_string($_POST['title'])."', Body = '".db_string($_POST['body'])."'
27
         WHERE ID = '".db_string($_POST['newsid'])."'");
27
         WHERE ID = '".db_string($_POST['newsid'])."'");
36
   case 'editnews':
36
   case 'editnews':
37
     if (is_number($_GET['id'])) {
37
     if (is_number($_GET['id'])) {
38
         $NewsID = $_GET['id'];
38
         $NewsID = $_GET['id'];
39
-        $DB->query("
39
+        $DB->prepared_query("
40
         SELECT Title, Body
40
         SELECT Title, Body
41
         FROM news
41
         FROM news
42
         WHERE ID = $NewsID");
42
         WHERE ID = $NewsID");
78
 ); ?>
78
 ); ?>
79
 
79
 
80
       <div class="center">
80
       <div class="center">
81
-        <input type="submit"
81
+        <input type="submit" class="button-primary"
82
           value="<?= ($_GET['action'] === 'news') ? 'Create news post' : 'Edit news post';?>">
82
           value="<?= ($_GET['action'] === 'news') ? 'Create news post' : 'Edit news post';?>">
83
       </div>
83
       </div>
84
     </div>
84
     </div>
86
 
86
 
87
   <h2>News archive</h2>
87
   <h2>News archive</h2>
88
   <?php
88
   <?php
89
-$DB->query('
89
+$DB->prepared_query('
90
   SELECT
90
   SELECT
91
     ID,
91
     ID,
92
     Title,
92
     Title,

+ 1
- 1
sections/tools/managers/official_tags.php View File

120
         </tr>
120
         </tr>
121
         <tr style="border-top: thin solid;">
121
         <tr style="border-top: thin solid;">
122
           <td colspan="11" style="text-align: center;">
122
           <td colspan="11" style="text-align: center;">
123
-            <input type="submit" value="Submit changes" />
123
+            <input type="submit" class="button-primary" value="Submit changes" />
124
           </td>
124
           </td>
125
         </tr>
125
         </tr>
126
 
126
 

+ 1
- 1
sections/tools/managers/permissions_alter.php View File

25
     <a href="tools.php?action=permissions" class="brackets">Back to permission list</a>
25
     <a href="tools.php?action=permissions" class="brackets">Back to permission list</a>
26
     <a href="tools.php" class="brackets">Back to tools</a>
26
     <a href="tools.php" class="brackets">Back to tools</a>
27
   </div>
27
   </div>
28
-  <table class="permission_head layout box">
28
+  <table class="permission_head skeleton-fix">
29
     <tr>
29
     <tr>
30
       <td class="label">Permission name</td>
30
       <td class="label">Permission name</td>
31
       <td><input type="text" name="name" id="name"
31
       <td><input type="text" name="name" id="name"

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

18
     </div>
18
     </div>
19
   </div>
19
   </div>
20
 <?
20
 <?
21
-$DB->query("
21
+$DB->prepared_query("
22
   SELECT
22
   SELECT
23
     p.ID,
23
     p.ID,
24
     p.Name,
24
     p.Name,
33
 if ($DB->has_results()) {
33
 if ($DB->has_results()) {
34
 ?>
34
 ?>
35
   <div class="box">
35
   <div class="box">
36
-  <table width="100%">
36
+  <table class="skeleton-fix">
37
     <tr class="colhead">
37
     <tr class="colhead">
38
       <td>Name</td>
38
       <td>Name</td>
39
       <td>Level</td>
39
       <td>Level</td>

+ 126
- 103
sections/tools/managers/sitewide_freeleech.php View File

1
-<?
1
+<?php
2
+declare(strict_types=1);
3
+
2
 if (isset($_POST['type'])) {
4
 if (isset($_POST['type'])) {
3
-  if ($_POST['type'] == 'tag') {
4
-    authorize();
5
-    if (!isset($_POST['tag'])) {
6
-      error("You didn't enter a tag, dipshit.");
7
-    }
8
-    $Tag = db_string($_POST['tag']);
9
-    $DB->query("
10
-      SELECT ID
11
-      FROM tags
12
-      WHERE
13
-        Name = '" . $Tag . "'");
14
-    if ($DB->has_results()) {
15
-      $Tag = str_replace('.', '_', $Tag);
16
-      $DB->query("
17
-        SELECT t.ID
18
-        FROM torrents AS t
19
-          JOIN torrents_group AS tg ON t.GroupID = tg.ID
20
-        WHERE t.FreeTorrent != '2'
21
-          AND (t.FreeLeechType = '0' OR t.FreeLeechType = '3')
22
-          AND tg.TagList LIKE '%" . $Tag . "%'");
23
-      if ($DB->has_results()) {
24
-        $IDs = $DB->collect('ID');
25
-        $Duration = db_string($_POST['duration']);
26
-        $Query = "INSERT IGNORE INTO shop_freeleeches (TorrentID, ExpiryTime) VALUES ";
27
-        foreach ($IDs as $ID) {
28
-          $Query .= "(" . $ID . ", NOW() + INTERVAL " . $Duration . " HOUR), ";
5
+    if ($_POST['type'] === 'tag') {
6
+        authorize();
7
+
8
+        if (!isset($_POST['tag'])) {
9
+            error("You didn't enter a tag, dipshit.");
29
         }
10
         }
30
-        $Query = substr($Query, 0, strlen($Query) - 2);
31
-        $Query .= " ON DUPLICATE KEY UPDATE ExpiryTime = ExpiryTime + INTERVAL " . $Duration . " HOUR";
32
-        $DB->query($Query);
33
 
11
 
12
+        $Tag = db_string($_POST['tag']);
34
         $DB->query("
13
         $DB->query("
35
-          INSERT INTO misc
36
-            (Name, First, Second)
37
-          VALUES
38
-            ('" . $Tag . "', '" . (time() + (60 * 60 * $Duration)) . "', 'freeleech')
39
-          ON DUPLICATE KEY UPDATE
40
-            First = CONVERT(First, UNSIGNED INTEGER) + " . (60 * 60 * $Duration));
41
-        Torrents::freeleech_torrents($IDs, 1, 3, false);
42
-        echo("Success! Now run the indexer.");
43
-      } else {
44
-        error('No torrents with that tag exist.');
45
-      }
46
-    } else {
47
-      error("That tag doesn't exist.");
48
-    }
49
-  } elseif ($_POST['type'] == 'global') {
50
-    authorize();
51
-    $DB->query("
52
-      SELECT t.ID
53
-      FROM torrents AS t
54
-        JOIN torrents_group AS tg ON t.GroupID = tg.ID
55
-      WHERE t.FreeTorrent != '2'
56
-        AND (t.FreeLeechType = '0' OR t.FreeLeechType = '3')");
57
-    if ($DB->has_results()) {
58
-      $IDs = $DB->collect('ID');
59
-      $Duration = db_string($_POST['duration']);
60
-      $Query = "INSERT IGNORE INTO shop_freeleeches (TorrentID, ExpiryTime) VALUES ";
61
-      foreach ($IDs as $ID) {
62
-        $Query .= "(" . $ID . ", NOW() + INTERVAL " . $Duration . " HOUR), ";
63
-      }
64
-      $Query = substr($Query, 0, strlen($Query) - 2);
65
-      $Query .= " ON DUPLICATE KEY UPDATE ExpiryTime = ExpiryTime + INTERVAL " . $Duration . " HOUR";
66
-      $DB->query($Query);
67
-      $DB->query("
68
-        INSERT INTO misc
69
-          (Name, First, Second)
14
+        SELECT `ID`
15
+        FROM `tags`
16
+        WHERE `Name` = '$Tag'
17
+        ");
18
+
19
+        if ($DB->has_results()) {
20
+            $Tag = str_replace('.', '_', $Tag);
21
+            $DB->query("
22
+            SELECT t.`ID`
23
+            FROM `torrents` AS t
24
+            JOIN `torrents_group` AS tg ON t.`GroupID` = tg.`id`
25
+            WHERE t.`FreeTorrent` != '2'
26
+            AND (t.`FreeLeechType` = '0' OR t.`FreeLeechType` = '3')
27
+            AND tg.`tag_list` LIKE '%$Tag%'
28
+            ");
29
+
30
+            if ($DB->has_results()) {
31
+                $IDs = $DB->collect('ID');
32
+                $Duration = db_string($_POST['duration']);
33
+                $Query = "INSERT IGNORE INTO `shop_freeleeches` (TorrentID, ExpiryTime) VALUES ";
34
+
35
+                foreach ($IDs as $ID) {
36
+                    $Query .= "(" . $ID . ", NOW() + INTERVAL " . $Duration . " HOUR), ";
37
+                }
38
+
39
+                $Query = substr($Query, 0, strlen($Query) - 2);
40
+                $Query .= " ON DUPLICATE KEY UPDATE ExpiryTime = ExpiryTime + INTERVAL " . $Duration . " HOUR";
41
+                $DB->query($Query);
42
+
43
+                $DB->query(
44
+                    "
45
+                INSERT INTO `misc`
46
+                  (Name, First, Second)
47
+                VALUES
48
+                  ('$Tag', '" . (time() + (60 * 60 * $Duration)) . "', 'freeleech')
49
+                ON DUPLICATE KEY UPDATE
50
+                  `First` = CONVERT(`First`, UNSIGNED INTEGER) + " . (60 * 60 * $Duration)
51
+                );
52
+
53
+                Torrents::freeleech_torrents($IDs, 1, 3, false);
54
+                echo("Success! Now run the indexer.");
55
+            } else {
56
+                error('No torrents with that tag exist.');
57
+            }
58
+        } else {
59
+            error("That tag doesn't exist.");
60
+        }
61
+    } elseif ($_POST['type'] === 'global') {
62
+        authorize();
63
+
64
+        $DB->query("
65
+        SELECT t.`ID`
66
+        FROM `torrents` AS t
67
+        JOIN `torrents_group` AS tg ON t.`GroupID` = tg.`id`
68
+        WHERE t.`FreeTorrent` != '2'
69
+        AND (t.`FreeLeechType` = '0' OR t.`FreeLeechType` = '3')
70
+        ");
71
+
72
+        if ($DB->has_results()) {
73
+            $IDs = $DB->collect('ID');
74
+            $Duration = db_string($_POST['duration']);
75
+            $Query = "INSERT IGNORE INTO shop_freeleeches (TorrentID, ExpiryTime) VALUES ";
76
+
77
+            foreach ($IDs as $ID) {
78
+                $Query .= "(" . $ID . ", NOW() + INTERVAL " . $Duration . " HOUR), ";
79
+            }
80
+
81
+            $Query = substr($Query, 0, strlen($Query) - 2);
82
+            $Query .= " ON DUPLICATE KEY UPDATE ExpiryTime = ExpiryTime + INTERVAL " . $Duration . " HOUR";
83
+            $DB->query($Query);
84
+
85
+            $DB->query(
86
+                "
87
+        INSERT INTO `misc`
88
+          (`Name`, `First`, `Second`)
70
         VALUES
89
         VALUES
71
           ('global', '" . (time() + (60 * 60 * $Duration)) . "', 'freeleech')
90
           ('global', '" . (time() + (60 * 60 * $Duration)) . "', 'freeleech')
72
         ON DUPLICATE KEY UPDATE
91
         ON DUPLICATE KEY UPDATE
73
-          First = CONVERT(First, UNSIGNED INTEGER) + " . (60 * 60 * $Duration));
74
-      Torrents::freeleech_torrents($IDs, 1, 3, false);
75
-      echo("Success! Now run the indexer.");
76
-    } else {
77
-      error("RIP Oppaitime");
92
+          `First` = CONVERT(`First`, UNSIGNED INTEGER) + " . (60 * 60 * $Duration)
93
+            );
94
+        
95
+            Torrents::freeleech_torrents($IDs, 1, 3, false);
96
+            echo("Success! Now run the indexer.");
97
+        } else {
98
+            error("RIP Oppaitime");
99
+        }
78
     }
100
     }
79
-  }
80
 } else {
101
 } else {
81
-  View::show_header('Site-Wide Freeleech'); ?>
82
-  <div>
83
-    <div class="box text-align: center;">
84
-      <strong>Make sure you run the indexer after using either of these tools, or torrents may disappear from search until the indexer runs.</strong>
85
-    </div>
86
-    <div class="box text-align: center;">
87
-      <form action="tools.php" method="POST">
88
-        <input type="hidden" name="action" value="freeleech" />
89
-        <input type="hidden" name="type" value="tag">
90
-        <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
91
-        <strong>Single Tag Freeleech</strong>
92
-        <br />
93
-        <input id="tag_name" type="text" name="tag" placeholder="Tag" value="" />
94
-        <br />
95
-        <input id="tag_duration" type="number" name="duration" placeholder="Duration (hours)" value="" />
96
-        <br />
97
-        <input type="submit" value="RELEASE THE LEECH" />
98
-      </form>
99
-    </div>
100
-    <div class="box text-align: center;">
101
-      <form action="tools.php" method="POST">
102
-        <input type="hidden" name="action" value="freeleech" />
103
-        <input type="hidden" name="type" value="global" />
104
-        <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
105
-        <strong>Global Freeleech</strong>
106
-        <br />
107
-        <input id="global_duration" type="number" name="duration" placeholder="Duration (hours)" value="" />
108
-        <br />
109
-        <input type="submit" value="RELEASE THE LEECH" />
110
-    </div>
102
+    View::show_header('Site-Wide Freeleech'); ?>
103
+<div>
104
+  <div class="box text-align: center;">
105
+    <strong>Make sure you run the indexer after using either of these tools, or torrents may disappear from search until
106
+      the indexer runs.</strong>
107
+  </div>
108
+  <div class="box text-align: center;">
109
+    <form action="tools.php" method="POST">
110
+      <input type="hidden" name="action" value="freeleech" />
111
+      <input type="hidden" name="type" value="tag">
112
+      <input type="hidden" name="auth"
113
+        value="<?=$LoggedUser['AuthKey']?>" />
114
+      <strong>Single Tag Freeleech</strong>
115
+      <br />
116
+      <input id="tag_name" type="text" name="tag" placeholder="Tag" value="" />
117
+      <br />
118
+      <input id="tag_duration" type="number" name="duration" placeholder="Duration (hours)" value="" />
119
+      <br />
120
+      <input type="submit" class="button-primary" value="RELEASE THE LEECH" />
121
+    </form>
122
+  </div>
123
+  <div class="box text-align: center;">
124
+    <form action="tools.php" method="POST">
125
+      <input type="hidden" name="action" value="freeleech" />
126
+      <input type="hidden" name="type" value="global" />
127
+      <input type="hidden" name="auth"
128
+        value="<?=$LoggedUser['AuthKey']?>" />
129
+      <strong>Global Freeleech</strong>
130
+      <br />
131
+      <input id="global_duration" type="number" name="duration" placeholder="Duration (hours)" value="" />
132
+      <br />
133
+      <input type="submit" class="button-primary" value="RELEASE THE LEECH" />
111
   </div>
134
   </div>
112
-  <? View::show_footer();
135
+</div>
136
+<?php View::show_footer();
113
 }
137
 }
114
-?>

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

64
       </td>
64
       </td>
65
 <?php if (check_perms('users_mod')) { ?>
65
 <?php if (check_perms('users_mod')) { ?>
66
       <td>
66
       <td>
67
-        <input type="submit" value="Add alias" />
67
+        <input type="submit" class="button-primary" value="Add alias" />
68
       </td>
68
       </td>
69
 <?php } ?>
69
 <?php } ?>
70
     </form>
70
     </form>
88
       </td>
88
       </td>
89
 <?php if (check_perms('users_mod')) { ?>
89
 <?php if (check_perms('users_mod')) { ?>
90
       <td>
90
       <td>
91
-        <input type="submit" name="save" value="Save alias" />
91
+        <input type="submit" name="save" class="button-primary" value="Save alias" />
92
         <input type="submit" name="delete" value="Delete alias" />
92
         <input type="submit" name="delete" value="Delete alias" />
93
       </td>
93
       </td>
94
 <?php } ?>
94
 <?php } ?>

+ 1
- 1
sections/tools/managers/tokens.php View File

82
     <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
82
     <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
83
     Tokens to add: <input type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
83
     Tokens to add: <input type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
84
     <label for="leechdisabled">Grant tokens to leech disabled users: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" /><br /><br />
84
     <label for="leechdisabled">Grant tokens to leech disabled users: </label><input type="checkbox" id="leechdisabled" name="leechdisabled" value="1" /><br /><br />
85
-    <input type="submit" name="addtokens" value="Add tokens" />
85
+    <input type="submit" name="addtokens" class="button-primary" value="Add tokens" />
86
   </form>
86
   </form>
87
 </div>
87
 </div>
88
 <br />
88
 <br />

+ 4
- 2
sections/tools/managers/whitelist_list.php View File

1
 <?
1
 <?
2
+#declare(strict_types = 1);
3
+
2
 if (!check_perms('admin_whitelist')) {
4
 if (!check_perms('admin_whitelist')) {
3
   error(403);
5
   error(403);
4
 }
6
 }
28
         <input type="text" size="10" name="peer_id" placeholder="Peer ID" />
30
         <input type="text" size="10" name="peer_id" placeholder="Peer ID" />
29
       </td>
31
       </td>
30
       <td>
32
       <td>
31
-        <input type="submit" value="Create" />
33
+        <input type="submit" class="button-primary" value="Create" />
32
       </td>
34
       </td>
33
     </tr>
35
     </tr>
34
   </table>
36
   </table>
56
         <input type="text" size="10" name="peer_id" value="<?=$Peer_ID?>" />
58
         <input type="text" size="10" name="peer_id" value="<?=$Peer_ID?>" />
57
       </td>
59
       </td>
58
       <td>
60
       <td>
59
-        <input type="submit" name="submit" value="Edit" />
61
+        <input type="submit" name="submit" class="button-primary" value="Edit" />
60
         <input type="submit" name="submit" value="Delete" />
62
         <input type="submit" name="submit" value="Delete" />
61
       </td>
63
       </td>
62
     </tr>
64
     </tr>

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

110
       </tr>
110
       </tr>
111
       <tr>
111
       <tr>
112
         <td colspan="2" align="right">
112
         <td colspan="2" align="right">
113
-          <input type="submit" name="submit" value="Create User" class="submit" />
113
+          <input type="submit" name="submit" value="Create User" class="submit button-primary" />
114
         </td>
114
         </td>
115
       </tr>
115
       </tr>
116
     </table>
116
     </table>

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

40
 
40
 
41
     <div style="display: flex;">
41
     <div style="display: flex;">
42
       <input type="text" name="dbkey" style="flex-grow: 1;" />
42
       <input type="text" name="dbkey" style="flex-grow: 1;" />
43
-      <input type="submit" name="submit" value="Update key" />
43
+      <input type="submit" name="submit" class="button-primary" value="Update key" />
44
     </div>
44
     </div>
45
 
45
 
46
   </form>
46
   </form>

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

109
           if ($_POST['perform'] === 'inviteprivs') { echo ' selected="selected"'; } ?>>Disable invites privileges</option>
109
           if ($_POST['perform'] === 'inviteprivs') { echo ' selected="selected"'; } ?>>Disable invites privileges</option>
110
           </select>
110
           </select>
111
         </td>
111
         </td>
112
-        <td align="left"><input type="submit" value="Go" /></td>
112
+        <td align="left"><input type="submit" class="button-primary" value="Go" /></td>
113
       </tr>
113
       </tr>
114
     </table>
114
     </table>
115
   </form>
115
   </form>

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

40
       </tr>
40
       </tr>
41
       <tr>
41
       <tr>
42
         <td class="center" colspan="5">
42
         <td class="center" colspan="5">
43
-          <input type="submit" value="Process Tag" />
43
+          <input type="submit" class="button-primary" value="Process Tag" />
44
         </td>
44
         </td>
45
       </tr>
45
       </tr>
46
     </table>
46
     </table>

+ 9
- 11
sections/tools/tools.php View File

53
   if ($ToolsHTML) {
53
   if ($ToolsHTML) {
54
       ?>
54
       ?>
55
     <div class="permission_subcontainer">
55
     <div class="permission_subcontainer">
56
-      <table class="layout admin_tools">
56
+      <table class="admin-tools skeleton-fix">
57
         <tr class="colhead">
57
         <tr class="colhead">
58
           <td>Administration</td>
58
           <td>Administration</td>
59
         </tr>
59
         </tr>
72
   if ($ToolsHTML) {
72
   if ($ToolsHTML) {
73
       ?>
73
       ?>
74
     <div class="permission_subcontainer">
74
     <div class="permission_subcontainer">
75
-      <table class="layout admin_tools">
75
+      <table class="admin-tools skeleton-fix">
76
         <tr class="colhead">
76
         <tr class="colhead">
77
           <td>Announcements</td>
77
           <td>Announcements</td>
78
         </tr>
78
         </tr>
89
   if ($ToolsHTML) {
89
   if ($ToolsHTML) {
90
       ?>
90
       ?>
91
     <div class="permission_subcontainer">
91
     <div class="permission_subcontainer">
92
-      <table class="layout admin_tools">
92
+      <table class="admin-tools skeleton-fix">
93
         <tr class="colhead">
93
         <tr class="colhead">
94
           <td>Community</td>
94
           <td>Community</td>
95
         </tr>
95
         </tr>
107
   if ($ToolsHTML) {
107
   if ($ToolsHTML) {
108
       ?>
108
       ?>
109
     <div class="permission_subcontainer">
109
     <div class="permission_subcontainer">
110
-      <table class="layout admin_tools">
110
+      <table class="admin-tools skeleton-fix">
111
         <tr class="colhead">
111
         <tr class="colhead">
112
           <td>Finances</td>
112
           <td>Finances</td>
113
         </tr>
113
         </tr>
124
   // begin Queue category
124
   // begin Queue category
125
   $ToolsHTML = "";
125
   $ToolsHTML = "";
126
   create_row("Auto-Enable requests", "tools.php?action=enable_requests", check_perms("users_mod"));
126
   create_row("Auto-Enable requests", "tools.php?action=enable_requests", check_perms("users_mod"));
127
-  create_row("Email deletion requests", "tools.php?action=delete_email", check_perms("users_mod"));
128
   create_row("Login watch", "tools.php?action=login_watch", check_perms("admin_login_watch"));
127
   create_row("Login watch", "tools.php?action=login_watch", check_perms("admin_login_watch"));
129
 
128
 
130
   if ($ToolsHTML) {
129
   if ($ToolsHTML) {
131
       ?>
130
       ?>
132
     <div class="permission_subcontainer">
131
     <div class="permission_subcontainer">
133
-      <table class="layout admin_tools">
132
+      <table class="admin-tools skeleton-fix">
134
         <tr class="colhead">
133
         <tr class="colhead">
135
           <td>Queue</td>
134
           <td>Queue</td>
136
         </tr>
135
         </tr>
149
   if ($ToolsHTML) {
148
   if ($ToolsHTML) {
150
       ?>
149
       ?>
151
     <div class="permission_subcontainer">
150
     <div class="permission_subcontainer">
152
-      <table class="layout admin_tools">
151
+      <table class="admin-tools skeleton-fix">
153
         <tr class="colhead">
152
         <tr class="colhead">
154
           <td>Managers</td>
153
           <td>Managers</td>
155
         </tr>
154
         </tr>
171
   if ($ToolsHTML) {
170
   if ($ToolsHTML) {
172
       ?>
171
       ?>
173
     <div class="permission_subcontainer">
172
     <div class="permission_subcontainer">
174
-      <table class="layout admin_tools">
173
+      <table class="admin-tools skeleton-fix">
175
         <tr class="colhead">
174
         <tr class="colhead">
176
           <td>Development</td>
175
           <td>Development</td>
177
         </tr>
176
         </tr>
200
   if ($ToolsHTML) {
199
   if ($ToolsHTML) {
201
       ?>
200
       ?>
202
     <div class="permission_subcontainer">
201
     <div class="permission_subcontainer">
203
-      <table class="layout admin_tools">
202
+      <table class="admin-tools skeleton-fix">
204
         <tr class="colhead">
203
         <tr class="colhead">
205
           <td>Site Information</td>
204
           <td>Site Information</td>
206
         </tr>
205
         </tr>
215
   create_row("Collage recovery", "collages.php?action=recover", check_perms("site_collages_recover"));
214
   create_row("Collage recovery", "collages.php?action=recover", check_perms("site_collages_recover"));
216
   create_row("Manage freeleech tokens", "tools.php?action=tokens", check_perms("users_mod"));
215
   create_row("Manage freeleech tokens", "tools.php?action=tokens", check_perms("users_mod"));
217
   create_row("Multiple freeleech", "tools.php?action=multiple_freeleech", check_perms("users_mod"));
216
   create_row("Multiple freeleech", "tools.php?action=multiple_freeleech", check_perms("users_mod"));
218
-  create_row("Label aliases", "tools.php?action=label_aliases", check_perms("users_mod"));
219
   create_row("Tag aliases", "tools.php?action=tag_aliases", check_perms("users_mod"));
217
   create_row("Tag aliases", "tools.php?action=tag_aliases", check_perms("users_mod"));
220
   create_row("Batch tag editor", "tools.php?action=edit_tags", check_perms("users_mod"));
218
   create_row("Batch tag editor", "tools.php?action=edit_tags", check_perms("users_mod"));
221
   create_row("Official tags manager", "tools.php?action=official_tags", check_perms("users_mod"));
219
   create_row("Official tags manager", "tools.php?action=official_tags", check_perms("users_mod"));
224
   if ($ToolsHTML) {
222
   if ($ToolsHTML) {
225
       ?>
223
       ?>
226
     <div class="permission_subcontainer">
224
     <div class="permission_subcontainer">
227
-      <table class="layout admin_tools">
225
+      <table class="admin-tools skeleton-fix">
228
         <tr class="colhead">
226
         <tr class="colhead">
229
           <td>Torrents</td>
227
           <td>Torrents</td>
230
         </tr>
228
         </tr>

+ 3
- 5
sections/torrents/download.php View File

40
     }
40
     }
41
 }
41
 }
42
 
42
 
43
-$TorrentID = $_REQUEST['id'];
44
-if (!is_number($TorrentID)) {
45
-    error(0);
46
-}
43
+$TorrentID = (int) $_REQUEST['id'];
44
+Security::checkInt($TorrentID);
47
 
45
 
48
 /*
46
 /*
49
   uTorrent Remote and various scripts redownload .torrent files periodically.
47
   uTorrent Remote and various scripts redownload .torrent files periodically.
108
 if ($_REQUEST['usetoken'] && $FreeTorrent === '0') {
106
 if ($_REQUEST['usetoken'] && $FreeTorrent === '0') {
109
     if (isset($LoggedUser)) {
107
     if (isset($LoggedUser)) {
110
         $FLTokens = $LoggedUser['FLTokens'];
108
         $FLTokens = $LoggedUser['FLTokens'];
111
-        if ($LoggedUser['CanLeech'] !== '1') {
109
+        if ($LoggedUser['CanLeech'] !== 1) {
112
             error('You cannot use tokens while leech disabled.');
110
             error('You cannot use tokens while leech disabled.');
113
         }
111
         }
114
     } else {
112
     } else {

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

100
 </div>
100
 </div>
101
 <br />
101
 <br />
102
 <form class="manage_form" name="permissions" id="permissionsform" method="post" action="">
102
 <form class="manage_form" name="permissions" id="permissionsform" method="post" action="">
103
-  <table class="layout permission_head">
103
+  <table class="permission_head skeleton-fix">
104
     <tr>
104
     <tr>
105
       <td class="label">Extra personal collages</td>
105
       <td class="label">Extra personal collages</td>
106
       <td><input type="text" name="maxcollages" size="5"
106
       <td><input type="text" name="maxcollages" size="5"

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

349
           <input type="hidden" name="to" value="<?=$UserID?>">
349
           <input type="hidden" name="to" value="<?=$UserID?>">
350
           <div class="flex_input_container">
350
           <div class="flex_input_container">
351
             <input type="text" name="amount" placeholder="Amount">
351
             <input type="text" name="amount" placeholder="Amount">
352
-            <input type="submit" value="Send">
352
+            <input type="submit" class="button-primary" value="Send">
353
           </div>
353
           </div>
354
           <textarea name="message" rows="2" placeholder="Message"></textarea>
354
           <textarea name="message" rows="2" placeholder="Message"></textarea>
355
           <label><input type="checkbox" name="adjust"> Adjust for tax?</label>
355
           <label><input type="checkbox" name="adjust"> Adjust for tax?</label>
1180
       </div>
1180
       </div>
1181
     </div>
1181
     </div>
1182
 
1182
 
1183
-    <table class="layout box" id="user_info_box">
1183
+    <table class="box skeleton-fix" id="user_info_box">
1184
       <tr class="colhead">
1184
       <tr class="colhead">
1185
         <td colspan="2">
1185
         <td colspan="2">
1186
           User Information
1186
           User Information
1452
     </table>
1452
     </table>
1453
 
1453
 
1454
     <?php if (check_perms('users_warn')) { ?>
1454
     <?php if (check_perms('users_warn')) { ?>
1455
-    <table class="layout box" id="warn_user_box">
1455
+    <table class="box skeleton-fix" id="warn_user_box">
1456
       <tr class="colhead">
1456
       <tr class="colhead">
1457
         <td colspan="2">
1457
         <td colspan="2">
1458
           Warnings
1458
           Warnings
1514
       <?php } ?>
1514
       <?php } ?>
1515
     </table>
1515
     </table>
1516
     <?php if (check_perms('users_disable_any')) { ?>
1516
     <?php if (check_perms('users_disable_any')) { ?>
1517
-    <table class="layout box" id="user_lock_account">
1517
+    <table class="box skeleton-fix" id="user_lock_account">
1518
       <tr class="colhead">
1518
       <tr class="colhead">
1519
         <td colspan="2">
1519
         <td colspan="2">
1520
           Lock Account
1520
           Lock Account
1540
       </tr>
1540
       </tr>
1541
     </table>
1541
     </table>
1542
     <?php }  ?>
1542
     <?php }  ?>
1543
-    <table class="layout box" id="user_privs_box">
1543
+    <table class="box skeleton-fix" id="user_privs_box">
1544
       <tr class="colhead">
1544
       <tr class="colhead">
1545
         <td colspan="2">
1545
         <td colspan="2">
1546
           User Privileges
1546
           User Privileges
1661
   } ?>
1661
   } ?>
1662
     </table>
1662
     </table>
1663
     <?php if (check_perms('users_logout')) { ?>
1663
     <?php if (check_perms('users_logout')) { ?>
1664
-    <table class="layout box" id="session_box">
1664
+    <table class="box skeleton-fix" id="session_box">
1665
       <tr class="colhead">
1665
       <tr class="colhead">
1666
         <td colspan="2">
1666
         <td colspan="2">
1667
           Session
1667
           Session
1682
       DonationsView::render_mod_donations($UserID);
1682
       DonationsView::render_mod_donations($UserID);
1683
   }
1683
   }
1684
 ?>
1684
 ?>
1685
-    <table class="layout box" id="submit_box">
1685
+    <table class="box skeleton-fix" id="submit_box">
1686
       <tr class="colhead">
1686
       <tr class="colhead">
1687
         <td colspan="2">
1687
         <td colspan="2">
1688
           Submit
1688
           Submit

+ 3
- 3
sections/userhistory/collage_subscribe.php View File

9
 $CollageID = (int)$_GET['collageid'];
9
 $CollageID = (int)$_GET['collageid'];
10
 
10
 
11
 if (!$UserSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) {
11
 if (!$UserSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) {
12
-  $DB->query('
12
+  $DB->prepared_query('
13
     SELECT CollageID
13
     SELECT CollageID
14
     FROM users_collage_subs
14
     FROM users_collage_subs
15
     WHERE UserID = '.db_string($LoggedUser['ID']));
15
     WHERE UserID = '.db_string($LoggedUser['ID']));
18
 }
18
 }
19
 
19
 
20
 if (($Key = array_search($CollageID, $UserSubscriptions)) !== false) {
20
 if (($Key = array_search($CollageID, $UserSubscriptions)) !== false) {
21
-  $DB->query('
21
+  $DB->prepared_query('
22
     DELETE FROM users_collage_subs
22
     DELETE FROM users_collage_subs
23
     WHERE UserID = '.db_string($LoggedUser['ID'])."
23
     WHERE UserID = '.db_string($LoggedUser['ID'])."
24
       AND CollageID = $CollageID");
24
       AND CollageID = $CollageID");
25
   unset($UserSubscriptions[$Key]);
25
   unset($UserSubscriptions[$Key]);
26
   Collages::decrease_subscriptions($CollageID);
26
   Collages::decrease_subscriptions($CollageID);
27
 } else {
27
 } else {
28
-  $DB->query("
28
+  $DB->prepared_query("
29
     INSERT IGNORE INTO users_collage_subs
29
     INSERT IGNORE INTO users_collage_subs
30
       (UserID, CollageID, LastVisit)
30
       (UserID, CollageID, LastVisit)
31
     VALUES
31
     VALUES

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

39
     GROUP BY c.ID";
39
     GROUP BY c.ID";
40
 }
40
 }
41
 
41
 
42
-$DB->query($sql);
42
+$DB->prepared_query($sql);
43
 $NumResults = $DB->record_count();
43
 $NumResults = $DB->record_count();
44
 $CollageSubs = $DB->to_array();
44
 $CollageSubs = $DB->to_array();
45
 ?>
45
 ?>
85
             $TorrentTable = '';
85
             $TorrentTable = '';
86
 
86
 
87
             list($CollageID, $CollageName, $CollageSize, $LastVisit) = $Collage;
87
             list($CollageID, $CollageName, $CollageSize, $LastVisit) = $Collage;
88
-            $RS = $DB->query("
88
+            $RS = $DB->prepared_query("
89
       SELECT GroupID
89
       SELECT GroupID
90
       FROM collages_torrents
90
       FROM collages_torrents
91
       WHERE CollageID = $CollageID
91
       WHERE CollageID = $CollageID

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

35
  * LastReadAvatar
35
  * LastReadAvatar
36
  * LastReadEditedUserID
36
  * LastReadEditedUserID
37
  */
37
  */
38
-$DB->query("
38
+$DB->prepared_query("
39
   (SELECT
39
   (SELECT
40
     SQL_CALC_FOUND_ROWS
40
     SQL_CALC_FOUND_ROWS
41
     s.`Page`,
41
     s.`Page`,
89
   LIMIT $Limit");
89
   LIMIT $Limit");
90
 
90
 
91
 $Results = $DB->to_array(false, MYSQLI_ASSOC, false);
91
 $Results = $DB->to_array(false, MYSQLI_ASSOC, false);
92
-$DB->query('SELECT FOUND_ROWS()');
92
+$DB->prepared_query('SELECT FOUND_ROWS()');
93
 list($NumResults) = $DB->next_record();
93
 list($NumResults) = $DB->next_record();
94
 
94
 
95
 $Debug->log_var($Results, 'Results');
95
 $Debug->log_var($Results, 'Results');

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

12
 
12
 
13
 $TopicID = (int)$_GET['topicid'];
13
 $TopicID = (int)$_GET['topicid'];
14
 
14
 
15
-$DB->query("
15
+$DB->prepared_query("
16
   SELECT f.ID
16
   SELECT f.ID
17
   FROM forums_topics AS t
17
   FROM forums_topics AS t
18
     JOIN forums AS f ON f.ID = t.ForumID
18
     JOIN forums AS f ON f.ID = t.ForumID

+ 8
- 6
sections/userhistory/token_history.php View File

12
 
12
 
13
 # Validate user ID
13
 # Validate user ID
14
 if (isset($_GET['userid'])) {
14
 if (isset($_GET['userid'])) {
15
-    $UserID = $_GET['userid'];
15
+    $UserID = (int) $_GET['userid'];
16
 } else {
16
 } else {
17
-    $UserID = $LoggedUser['ID'];
17
+    $UserID = (int) $LoggedUser['ID'];
18
 }
18
 }
19
 
19
 
20
 Security::checkInt($UserID);
20
 Security::checkInt($UserID);
36
         error(403);
36
         error(403);
37
     }
37
     }
38
 
38
 
39
-    $UserID = $_GET['userid'];
40
-    $TorrentID = $_GET['torrentid'];
39
+    $UserID = (int) $_GET['userid'];
40
+    $TorrentID = (int) $_GET['torrentid'];
41
     Security::checkInt($UserID, $TorrentID);
41
     Security::checkInt($UserID, $TorrentID);
42
 
42
 
43
     $DB->prepare_query("
43
     $DB->prepare_query("
101
 $DB->exec_prepared_query();
101
 $DB->exec_prepared_query();
102
 
102
 
103
 $Tokens = $DB->to_array();
103
 $Tokens = $DB->to_array();
104
-$DB->query('SELECT FOUND_ROWS()');
104
+$DB->prepared_query('SELECT FOUND_ROWS()');
105
 list($NumResults) = $DB->next_record();
105
 list($NumResults) = $DB->next_record();
106
 $Pages = Format::get_pages($Page, $NumResults, 25);
106
 $Pages = Format::get_pages($Page, $NumResults, 25);
107
 ?>
107
 ?>
144
         $Name = "(<i>Deleted torrent <a href='log.php?search=Torrent+$TorrentID'>$TorrentID</a></i>)";
144
         $Name = "(<i>Deleted torrent <a href='log.php?search=Torrent+$TorrentID'>$TorrentID</a></i>)";
145
     }
145
     }
146
 
146
 
147
+    /*
147
     $ArtistName = Artists::display_artists($Artists[$GroupID]);
148
     $ArtistName = Artists::display_artists($Artists[$GroupID]);
148
     if ($ArtistName) {
149
     if ($ArtistName) {
149
         $Name = $ArtistName.$Name;
150
         $Name = $ArtistName.$Name;
150
-    } ?>
151
+    }
152
+    */ ?>
151
 
153
 
152
   <tr class="row">
154
   <tr class="row">
153
     <td>
155
     <td>

+ 2
- 2
sections/wiki/add_alias.php View File

9
 
9
 
10
 $ArticleID = (int)$_POST['article'];
10
 $ArticleID = (int)$_POST['article'];
11
 
11
 
12
-$DB->query("SELECT MinClassEdit FROM wiki_articles WHERE ID = $ArticleID");
12
+$DB->prepared_query("SELECT MinClassEdit FROM wiki_articles WHERE ID = $ArticleID");
13
 list($MinClassEdit) = $DB->next_record();
13
 list($MinClassEdit) = $DB->next_record();
14
 
14
 
15
 if ($MinClassEdit > $LoggedUser['EffectiveClass']) {
15
 if ($MinClassEdit > $LoggedUser['EffectiveClass']) {
20
 $Dupe = Wiki::alias_to_id($_POST['alias']);
20
 $Dupe = Wiki::alias_to_id($_POST['alias']);
21
 
21
 
22
 if ($NewAlias !== '' && $NewAlias!== 'addalias' && $Dupe === false) { // Not null, and not dupe
22
 if ($NewAlias !== '' && $NewAlias!== 'addalias' && $Dupe === false) { // Not null, and not dupe
23
-    $DB->query("INSERT INTO wiki_aliases (Alias, UserID, ArticleID) VALUES ('$NewAlias', '$LoggedUser[ID]', '$ArticleID')");
23
+    $DB->prepared_query("INSERT INTO wiki_aliases (Alias, UserID, ArticleID) VALUES ('$NewAlias', '$LoggedUser[ID]', '$ArticleID')");
24
 } else {
24
 } else {
25
     error('The alias you attempted to add was either null or already in the database.');
25
     error('The alias you attempted to add was either null or already in the database.');
26
 }
26
 }

+ 6
- 3
sections/wiki/compare.php View File

64
     if ((int) $Rev === $Revision) {
64
     if ((int) $Rev === $Revision) {
65
         $Str = $Body;
65
         $Str = $Body;
66
     } else {
66
     } else {
67
-        $DB->query("
67
+        $DB->prepared_query("
68
           SELECT Body
68
           SELECT Body
69
           FROM wiki_revisions
69
           FROM wiki_revisions
70
           WHERE ID = '$ID'
70
           WHERE ID = '$ID'
84
   || !is_number($_GET['old'])
84
   || !is_number($_GET['old'])
85
   || !is_number($_GET['new'])
85
   || !is_number($_GET['new'])
86
   || !is_number($_GET['id'])
86
   || !is_number($_GET['id'])
87
-  || $_GET['old'] > $_GET['new']
88
 ) {
87
 ) {
89
-    error(0);
88
+    error(400);
89
+}
90
+
91
+if ($_GET['old'] > $_GET['new']) {
92
+    error('The new revision compared must be newer than the old revision to compare against.');
90
 }
93
 }
91
 
94
 
92
 $ArticleID = (int) $_GET['id'];
95
 $ArticleID = (int) $_GET['id'];

+ 1
- 1
sections/wiki/create.php View File

40
           <input type="button" value="Preview"
40
           <input type="button" value="Preview"
41
             class="hidden button_preview_<?=$ReplyText->getID()?>"
41
             class="hidden button_preview_<?=$ReplyText->getID()?>"
42
             tabindex="1" />
42
             tabindex="1" />
43
-          <input type="submit" value="Submit" />
43
+          <input type="submit" class="button-primary" value="Submit" />
44
         </div>
44
         </div>
45
       </div>
45
       </div>
46
     </form>
46
     </form>

+ 4
- 4
sections/wiki/delete.php View File

14
     error('You cannot delete the main wiki article.');
14
     error('You cannot delete the main wiki article.');
15
 }
15
 }
16
 
16
 
17
-$DB->query("
17
+$DB->prepared_query("
18
   SELECT Title
18
   SELECT Title
19
   FROM wiki_articles
19
   FROM wiki_articles
20
   WHERE ID = $ID");
20
   WHERE ID = $ID");
29
 Misc::write_log("Wiki article $ID ($Title) was deleted by ".$LoggedUser['Username']);
29
 Misc::write_log("Wiki article $ID ($Title) was deleted by ".$LoggedUser['Username']);
30
 
30
 
31
 // Delete
31
 // Delete
32
-$DB->query("DELETE FROM wiki_articles WHERE ID = $ID");
33
-$DB->query("DELETE FROM wiki_aliases WHERE ArticleID = $ID");
34
-$DB->query("DELETE FROM wiki_revisions WHERE ID = $ID");
32
+$DB->prepared_query("DELETE FROM wiki_articles WHERE ID = $ID");
33
+$DB->prepared_query("DELETE FROM wiki_aliases WHERE ArticleID = $ID");
34
+$DB->prepared_query("DELETE FROM wiki_revisions WHERE ID = $ID");
35
 
35
 
36
 Wiki::flush_aliases();
36
 Wiki::flush_aliases();
37
 Wiki::flush_article($ID);
37
 Wiki::flush_article($ID);

+ 2
- 2
sections/wiki/delete_alias.php View File

5
 
5
 
6
 $ArticleID = Wiki::alias_to_id($_GET['alias']);
6
 $ArticleID = Wiki::alias_to_id($_GET['alias']);
7
 
7
 
8
-$DB->query("SELECT MinClassEdit FROM wiki_articles WHERE ID = $ArticleID");
8
+$DB->prepared_query("SELECT MinClassEdit FROM wiki_articles WHERE ID = $ArticleID");
9
 list($MinClassEdit) = $DB->next_record();
9
 list($MinClassEdit) = $DB->next_record();
10
 if ($MinClassEdit > $LoggedUser['EffectiveClass']) {
10
 if ($MinClassEdit > $LoggedUser['EffectiveClass']) {
11
     error(403);
11
     error(403);
12
 }
12
 }
13
 
13
 
14
-$DB->query("DELETE FROM wiki_aliases WHERE Alias='".Wiki::normalize_alias($_GET['alias'])."'");
14
+$DB->prepared_query("DELETE FROM wiki_aliases WHERE Alias='".Wiki::normalize_alias($_GET['alias'])."'");
15
 Wiki::flush_article($ArticleID);
15
 Wiki::flush_article($ArticleID);
16
 Wiki::flush_aliases();
16
 Wiki::flush_aliases();

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

57
           <input type="button" value="Preview"
57
           <input type="button" value="Preview"
58
             class="hidden button_preview_<?=$ReplyText->getID()?>"
58
             class="hidden button_preview_<?=$ReplyText->getID()?>"
59
             tabindex="1" />
59
             tabindex="1" />
60
-          <input type="submit" value="Submit" />
60
+          <input type="submit" class="button-primary" value="Submit" />
61
         </div>
61
         </div>
62
       </div>
62
       </div>
63
     </form>
63
     </form>

+ 2
- 2
sections/wiki/revisions.php View File

58
       </tr>
58
       </tr>
59
 
59
 
60
       <?php
60
       <?php
61
-$DB->query("
61
+$DB->prepared_query("
62
   SELECT
62
   SELECT
63
     Revision,
63
     Revision,
64
     Title,
64
     Title,
98
 
98
 
99
       <tr>
99
       <tr>
100
         <td class="center" colspan="6">
100
         <td class="center" colspan="6">
101
-          <input type="submit" value="Compare" />
101
+          <input type="submit" class="button-primary" value="Compare" />
102
         </td>
102
         </td>
103
       </tr>
103
       </tr>
104
     </table>
104
     </table>

+ 6
- 6
sections/wiki/search.php View File

154
 
154
 
155
         <tr>
155
         <tr>
156
           <td colspan="4" class="center">
156
           <td colspan="4" class="center">
157
-            <input type="submit" value="Search" />
157
+            <input type="submit" class="button-primary" value="Search" />
158
           </td>
158
           </td>
159
         </tr>
159
         </tr>
160
       </table>
160
       </table>
170
   </div>
170
   </div>
171
   <?php } ?>
171
   <?php } ?>
172
 
172
 
173
-  <table width="100%">
174
-    <tr class="colhead">
175
-      <td>Article</td>
176
-      <td>Last updated on</td>
177
-      <td>Last edited by</td>
173
+  <table class="skeleton-fix">
174
+    <tr>
175
+      <th>Article</th>
176
+      <th>Last updated on</th>
177
+      <th>Last edited by</th>
178
     </tr>
178
     </tr>
179
 
179
 
180
     <?php
180
     <?php

+ 3
- 3
sections/wiki/takecreate.php View File

14
 $Err = $Val->ValidateForm($_POST);
14
 $Err = $Val->ValidateForm($_POST);
15
 
15
 
16
 if (!$Err) {
16
 if (!$Err) {
17
-    $DB->query("
17
+    $DB->prepared_query("
18
       SELECT ID
18
       SELECT ID
19
       FROM wiki_articles
19
       FROM wiki_articles
20
       WHERE Title = '$P[title]'");
20
       WHERE Title = '$P[title]'");
53
     $Edit = 100;
53
     $Edit = 100;
54
 }
54
 }
55
 
55
 
56
-$DB->query("
56
+$DB->prepared_query("
57
   INSERT INTO wiki_articles
57
   INSERT INTO wiki_articles
58
     (Revision, Title, Body, MinClassRead, MinClassEdit, Date, Author)
58
     (Revision, Title, Body, MinClassRead, MinClassEdit, Date, Author)
59
   VALUES
59
   VALUES
64
 $Dupe = Wiki::alias_to_id($_POST['title']);
64
 $Dupe = Wiki::alias_to_id($_POST['title']);
65
 
65
 
66
 if ($TitleAlias !== '' && $Dupe === false) {
66
 if ($TitleAlias !== '' && $Dupe === false) {
67
-    $DB->query("
67
+    $DB->prepared_query("
68
       INSERT INTO wiki_aliases (Alias, ArticleID)
68
       INSERT INTO wiki_aliases (Alias, ArticleID)
69
       VALUES ('".db_string($TitleAlias)."', '$ArticleID')");
69
       VALUES ('".db_string($TitleAlias)."', '$ArticleID')");
70
     Wiki::flush_aliases();
70
     Wiki::flush_aliases();

+ 2
- 2
sections/wiki/takeedit.php View File

55
 }
55
 }
56
 
56
 
57
 // Store previous revision
57
 // Store previous revision
58
-$DB->query("
58
+$DB->prepared_query("
59
   INSERT INTO wiki_revisions
59
   INSERT INTO wiki_revisions
60
     (ID, Revision, Title, Body, Date, Author)
60
     (ID, Revision, Title, Body, Date, Author)
61
   VALUES
61
   VALUES
80
     Author = '$LoggedUser[ID]'
80
     Author = '$LoggedUser[ID]'
81
   WHERE ID = '$P[id]'";
81
   WHERE ID = '$P[id]'";
82
 
82
 
83
-$DB->query($SQL);
83
+$DB->prepared_query($SQL);
84
 Wiki::flush_article($ArticleID);
84
 Wiki::flush_article($ArticleID);
85
 header("Location: wiki.php?action=article&id=$ArticleID");
85
 header("Location: wiki.php?action=article&id=$ArticleID");

+ 1
- 1
sections/wiki/wiki_browse.php View File

29
 }
29
 }
30
 
30
 
31
 $sql .= " ORDER BY Title";
31
 $sql .= " ORDER BY Title";
32
-$DB->query($sql);
32
+$DB->prepared_query($sql);
33
 ?>
33
 ?>
34
 
34
 
35
 <div>
35
 <div>

+ 0
- 23
static/styles/assets/scss/fonts.scss View File

381
     font-weight: 600;
381
     font-weight: 600;
382
     src: url($font-path + "misc/OpenSans-SemiBold.woff2");
382
     src: url($font-path + "misc/OpenSans-SemiBold.woff2");
383
 }
383
 }
384
-
385
-/**
386
- * genaviv
387
- */
388
-
389
-/* latin-ext */
390
-@font-face {
391
-    font-family: "Source Sans Pro";
392
-    font-style: normal;
393
-    font-weight: 400;
394
-    src: url($font-path + "misc/SourceSansPro-Regular.woff2");
395
-    unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
396
-}
397
-
398
-/* latin */
399
-@font-face {
400
-    font-family: "Source Sans Pro";
401
-    font-style: normal;
402
-    font-weight: 400;
403
-    src: url($font-path + "misc/SourceSansPro-Regular.woff2");
404
-    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215,
405
-        U+E0FF, U+EFFD, U+F000;
406
-}

+ 1
- 0
static/styles/bookish/bookish.scss View File

1
 @import "../assets/go";
1
 @import "../assets/go";
2
+@import "matcha/matcha";
2
 @import "scss/bookish";
3
 @import "scss/bookish";
3
 
4
 
4
 @import "scss/colors";
5
 @import "scss/colors";

+ 371
- 0
static/styles/bookish/matcha/matcha.scss View File

1
+/**
2
+ * Matcha Additions
3
+ */
4
+
5
+body.style_matcha {
6
+    /* Body */
7
+    background: #edeae5;
8
+
9
+    /* Header and logo */
10
+    #header {
11
+        background: url("/static/styles/bookish/matcha/sam-komon.png");
12
+    }
13
+
14
+    #logo {
15
+        background: url("/static/common/logos/matcha.png") no-repeat center;
16
+        background-size: contain;
17
+        width: 250px;
18
+        height: 50px;
19
+        margin: 0 0 0 10%;
20
+    }
21
+
22
+    /* Main menu */
23
+    #menu {
24
+        background-color: #016670;
25
+    }
26
+
27
+    #menu ul li a.active {
28
+        background-color: #016670;
29
+    }
30
+
31
+    #menu ul li a:hover {
32
+        background-color: #0298a6;
33
+    }
34
+
35
+    /* Dropdown menu */
36
+    #menu .nav_dropdown {
37
+        background: #016670;
38
+        margin-top: 0;
39
+    }
40
+
41
+    .nav_dropdown > div {
42
+        box-shadow: 2px 2px 10px -2px slategray;
43
+        position: absolute;
44
+        background-color: #016670;
45
+        width: 100%;
46
+        z-index: 99999;
47
+        margin-top: 2.4em;
48
+        /* margin-top: 32px; */
49
+        left: 0;
50
+    }
51
+
52
+    .nav_dropdown > div > a {
53
+        display: none;
54
+        color: white;
55
+        height: 2.4em;
56
+        line-height: 2.4em;
57
+        text-decoration: none;
58
+    }
59
+
60
+    .nav_dropdown:hover > div > a {
61
+        display: block;
62
+    }
63
+
64
+    /* Search bars */
65
+    #searchbars {
66
+        text-align: center;
67
+        background-color: #9fedd7;
68
+        box-sizing: content-box;
69
+        padding: 0.5em 10%;
70
+        display: flex;
71
+
72
+        input {
73
+            position: relative;
74
+            border: 1px solid transparent;
75
+            box-sizing: border-box;
76
+            padding: 0.25em 0.25em 0.25em 0.5em;
77
+            background-color: white;
78
+            width: 100%;
79
+            color: black;
80
+        }
81
+
82
+        ul {
83
+            margin: 0 auto;
84
+            display: block;
85
+            text-align: center;
86
+
87
+            li {
88
+                display: inline;
89
+                margin: 0px 1px;
90
+                list-style: none;
91
+                position: relative;
92
+
93
+                form {
94
+                    display: inline;
95
+                }
96
+
97
+                ul {
98
+                    display: block;
99
+                    position: absolute;
100
+                    top: 1em;
101
+                    left: 0;
102
+                    z-index: 1000;
103
+                    background-color: white;
104
+                    width: 12em;
105
+                    margin-top: 1em;
106
+
107
+                    li {
108
+                        margin: 0 0 0 0;
109
+                        padding: 0;
110
+                        display: block;
111
+                        width: 100%;
112
+
113
+                        .highlight {
114
+                            background: white;
115
+                        }
116
+                    }
117
+                }
118
+            }
119
+        }
120
+    }
121
+
122
+    #searchbars > .search_form {
123
+        flex: 1 1 auto;
124
+        text-align: center;
125
+        margin: 0 0.1em;
126
+    }
127
+
128
+    /* Upload, Invite, etc. */
129
+    #userinfo {
130
+        background: #fff9c7;
131
+        box-shadow: 0 2px 10px -2px slategray;
132
+        color: black;
133
+        padding: 0.5em 0;
134
+        width: 100%;
135
+        text-align: center;
136
+
137
+        a {
138
+            color: black;
139
+            text-decoration: none;
140
+
141
+            &:hover {
142
+                text-decoration: underline;
143
+            }
144
+        }
145
+
146
+        b a {
147
+            font-weight: normal;
148
+            font-size: 0.9em;
149
+            font-weight: bold;
150
+        }
151
+
152
+        ul {
153
+            display: inline;
154
+            margin: 0 1%;
155
+
156
+            li {
157
+                display: inline;
158
+                margin: 0 0.1em;
159
+                line-height: 2em;
160
+                vertical-align: middle;
161
+                padding: 0;
162
+            }
163
+        }
164
+    }
165
+
166
+    #userinfo_minor > li > ul {
167
+        display: none;
168
+        position: absolute;
169
+        padding: 5px;
170
+        left: -5px;
171
+        background-color: #fff9c7;
172
+        z-index: 100;
173
+    }
174
+
175
+    /* Alerts, Toolbox, etc. */
176
+    .alertbar {
177
+        background-color: #fff9c7;
178
+        text-align: center;
179
+        color: black;
180
+        font-weight: bold;
181
+        width: 320px;
182
+        margin: 2em auto;
183
+        padding: 1em;
184
+
185
+        a {
186
+            color: black;
187
+            text-decoration: none;
188
+
189
+            &:hover {
190
+                color: black;
191
+                text-decoration: underline;
192
+            }
193
+        }
194
+
195
+        .warning {
196
+            background-color: #ffe68a;
197
+        }
198
+
199
+        .error {
200
+            background-color: #ff8a8a;
201
+        }
202
+    }
203
+
204
+    /* Column heads */
205
+    .head {
206
+        background: #9fedd7;
207
+        color: black;
208
+        padding: 0.5em 1em;
209
+    }
210
+
211
+    .colhead {
212
+        background: #9fedd7;
213
+        font-weight: bold;
214
+        color: black;
215
+    }
216
+
217
+    .colhead_dark {
218
+        background: #9fedd7;
219
+        color: black;
220
+    }
221
+
222
+    /* Box */
223
+    .box,
224
+    section {
225
+        background-color: white;
226
+        border: none;
227
+        margin-bottom: 1em;
228
+    }
229
+
230
+    /* Shadows */
231
+    .box,
232
+    .border,
233
+    .alertbar,
234
+    .artist_table,
235
+    .request_table,
236
+    .forum_index,
237
+    #userinfo_minor > li > ul,
238
+    .permissions table {
239
+        box-shadow: 2px 2px 10px -2px slategray;
240
+    }
241
+
242
+    /* Links */
243
+    a {
244
+        color: #016670;
245
+        text-decoration: none;
246
+
247
+        &:hover {
248
+            color: black;
249
+            text-decoration: underline;
250
+        }
251
+    }
252
+
253
+    /* Special links */
254
+    .forum_post .body a:not([href="#"]),
255
+    .rule_summary a,
256
+    .wiki_article a,
257
+    #actual_rules a,
258
+    .news_post .pad a,
259
+    .store_table a {
260
+        color: #016670;
261
+        text-decoration: none;
262
+    }
263
+
264
+    .forum_post .body a:hover:not([href="#"]),
265
+    .rule_summary a:hover,
266
+    .wiki_article a:hover,
267
+    #actual_rules a:hover,
268
+    .news_post .pad a:hover,
269
+    .store_table a:hover {
270
+        color: black;
271
+        text-decoration: underline;
272
+    }
273
+
274
+    /* Blockquote */
275
+    blockquote {
276
+        margin: 0.5em 2em;
277
+        padding: 1em;
278
+        border: 1px solid #bbb;
279
+    }
280
+
281
+    /* Buttons */
282
+    button:not(.editor-toolbar button),
283
+    input[type="button"],
284
+    input[type="submit"] {
285
+        background: #fbe180;
286
+        border-radius: 0.25rem;
287
+        box-shadow: 2px 2px 10px -5px slategray;
288
+    }
289
+
290
+    button:hover,
291
+    input[type="button"]:hover,
292
+    input[type="submit"]:hover {
293
+        background: #fff9c7;
294
+    }
295
+
296
+    button:focus,
297
+    input[type="button"]:focus,
298
+    input[type="submit"]:focus {
299
+        background: #fff9c7;
300
+    }
301
+
302
+    /* Text input */
303
+    input.inputtext {
304
+        border: none;
305
+        border-bottom: 1px solid #edeae5;
306
+        background-color: white;
307
+        font-size: 13px;
308
+        outline: none;
309
+        transition: ease-in-out 0.12s;
310
+
311
+        &:focus {
312
+            border-bottom: 1px solid #fbe180;
313
+        }
314
+    }
315
+
316
+    /* Cover images */
317
+    #coverCont {
318
+        background-color: #fff9c7;
319
+        padding: 5px;
320
+        box-shadow: 2px 2px 10px -2px slategray;
321
+    }
322
+
323
+    #coverCont img {
324
+        background-color: #fff9c7;
325
+    }
326
+
327
+    /* Captions */
328
+    caption {
329
+        border-bottom: 1px solid #edeae5;
330
+        font-weight: bold;
331
+    }
332
+
333
+    /* Messages */
334
+    .error_message {
335
+        padding: 1em;
336
+        background-color: #ff8a8a;
337
+        text-align: center;
338
+        color: white;
339
+        font-weight: bold;
340
+        box-shadow: 2px 2px 10px -5px slategray;
341
+    }
342
+
343
+    .save_message {
344
+        padding: 1em;
345
+        width: 50%;
346
+        margin: 2em auto;
347
+        background: #fbe180;
348
+        text-align: center;
349
+        color: black;
350
+        font-weight: bold;
351
+        box-shadow: 2px 2px 10px -5px slategray;
352
+    }
353
+
354
+    /* Forums */
355
+    .forum_post .colhead_dark {
356
+        background: #9fedd7;
357
+    }
358
+
359
+    .forum_post.staff_post .colhead_dark {
360
+        background: #fbe180;
361
+    }
362
+
363
+    .forum_post.sticky_post {
364
+        border: 2px solid #fbe180;
365
+    }
366
+
367
+    /* Inbox */
368
+    tr.unreadpm {
369
+        background-color: #fff9c7;
370
+    }
371
+} /* end body.style_matcha */

static/styles/matcha/sam-komon.png → static/styles/bookish/matcha/sam-komon.png View File


+ 0
- 0
static/styles/bookish/scss/colors.scss View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save