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,7 +6,7 @@ class DonationsView
6 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 10
   <tr class="colhead">
11 11
     <td colspan="2">
12 12
       Donor System (add points)
@@ -34,7 +34,7 @@ class DonationsView
34 34
   </tr>
35 35
 </table>
36 36
 
37
-<table class="layout box" id="donor_points_box">
37
+<table class="box skeleton-fix" id="donor_points_box">
38 38
   <tr class="colhead">
39 39
     <td colspan="3" class="tooltip"
40 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,7 +22,7 @@ $DB = NEW DB_MYSQL;
22 22
 
23 23
 * Making a query
24 24
 
25
-$DB->query("
25
+$DB->prepared_query("
26 26
   SELECT *
27 27
   FROM table...");
28 28
 
@@ -92,14 +92,14 @@ set_query_id($ResultSet)
92 92
   This class can only hold one result set at a time. Using set_query_id allows
93 93
   you to set the result set that the class is using to the result set in
94 94
   $ResultSet. This result set should have been obtained earlier by using
95
-  $DB->query().
95
+  $DB->prepared_query().
96 96
 
97 97
   Example:
98 98
 
99
-  $FoodRS = $DB->query("
99
+  $FoodRS = $DB->prepared_query("
100 100
       SELECT *
101 101
       FROM food");
102
-  $DB->query("
102
+  $DB->prepared_query("
103 103
     SELECT *
104 104
     FROM drink");
105 105
   $Drinks = $DB->next_record();

+ 1
- 1
classes/permissions_form.php View File

@@ -284,7 +284,7 @@ HTML;
284 284
     </div>
285 285
     
286 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 288
     </div>
289 289
 HTML;
290 290
 }

+ 9
- 9
classes/script_start.php View File

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

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

@@ -419,7 +419,7 @@ HTML;
419 419
 
420 420
         # Start printing the form
421 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,17 +566,6 @@ CREATE TABLE `invite_tree` (
566 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 569
 -- 2020-03-09
580 570
 CREATE TABLE `last_sent_email` (
581 571
   `UserID` int NOT NULL,
@@ -1819,12 +1808,10 @@ INSERT INTO `permissions` (`ID`, `Level`, `Name`, `Values`, `DisplayStaff`) VALU
1819 1808
 
1820 1809
 
1821 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 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 1817
 INSERT INTO `wiki_articles` (`ID`, `Revision`, `Title`, `Body`, `MinClassRead`, `MinClassEdit`, `Date`, `Author`) VALUES

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -180,7 +180,7 @@ View::show_header(($BookmarkView) ? 'Your bookmarked collections' : 'Collections
180 180
         <input type="hidden" name="action" value="search" />
181 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 184
         <tr id="search_terms">
185 185
           <td class="label"></td>
186 186
           <td>

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

@@ -39,7 +39,7 @@ View::show_header('Collage recovery!');
39 39
           <input type="text" name="collage_id" size="8" />
40 40
         </div>
41 41
         <div class="submit_div">
42
-          <input value="Recover!" type="submit" />
42
+          <input value="Recover" class="button-primary" type="submit" />
43 43
         </div>
44 44
       </form>
45 45
     </div>

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

@@ -8,12 +8,12 @@ function compare($X, $Y)
8 8
 
9 9
 // Build the data for the collage and the torrent list
10 10
 // todo: Cache this
11
-$DB->query("
11
+$DB->prepared_query("
12 12
 SELECT
13 13
   ct.`GroupID`,
14 14
   ct.`UserID`
15 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 17
 WHERE ct.`CollageID` = '$CollageID'
18 18
 ORDER BY ct.`Sort`
19 19
 ");

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

@@ -69,7 +69,7 @@ View::show_header();
69 69
         </td>
70 70
 
71 71
         <td>
72
-          <input type="submit" name="add" value="Add thread" />
72
+          <input type="submit" name="add" class="button-primary" value="Add thread" />
73 73
         </td>
74 74
       </form>
75 75
 

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

@@ -145,7 +145,7 @@ View::show_header("Forums $ENV->CRUMB ".$Forums[$ForumID]['Name']);
145 145
 
146 146
             <tr>
147 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 149
               </td>
150 150
             </tr>
151 151
           </table>
@@ -186,7 +186,7 @@ echo $Pages;
186 186
   </div>
187 187
 </div>
188 188
 
189
-<table class="forum_index alternate_rows" width="100%">
189
+<table class="forum_index skeleton-fix">
190 190
   <tr class="colhead">
191 191
     <td style="width: 2%;"></td>
192 192
     <td>Latest</td>

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

@@ -103,7 +103,7 @@ View::show_header(
103 103
       <input type="hidden" name="auth"
104 104
         value="<?=$LoggedUser['AuthKey']?>" />
105 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 107
         <tr>
108 108
           <td class="label">Title</td>
109 109
           <td><input id="title" class="required" type="text" name="title" style="width: 98%;" /></td>

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

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

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

@@ -1,10 +1,6 @@
1 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 6
 View::show_footer();

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

@@ -244,7 +244,7 @@ $encoded_artist = urlencode($encoded_artist);
244 244
     <div class="box">
245 245
       <div class="head"><strong>Info</strong></div>
246 246
       <div class="pad">
247
-        <table class="layout request_form">
247
+        <table class="request_form skeleton-fix">
248 248
           <tr>
249 249
             <td class="label">Created</td>
250 250
             <td>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -5,14 +5,14 @@ $ENV = ENV::go();
5 5
 
6 6
 // View schemas
7 7
 if (!empty($_GET['table'])) {
8
-    $DB->query('SHOW TABLES');
8
+    $DB->prepared_query('SHOW TABLES');
9 9
     $Tables =$DB->collect('Tables_in_'.$ENV->getPriv('SQLDB'));
10 10
 
11 11
     if (!in_array($_GET['table'], $Tables)) {
12 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 16
     list(, $Schema) = $DB->next_record(MYSQLI_NUM, false);
17 17
     header('Content-type: text/plain');
18 18
     error($Schema);
@@ -20,7 +20,7 @@ if (!empty($_GET['table'])) {
20 20
 
21 21
 // Cache the tables for 4 hours, makes sorting faster
22 22
 if (!$Tables = $Cache->get_value('database_table_stats')) {
23
-    $DB->query('SHOW TABLE STATUS');
23
+    $DB->prepared_query('SHOW TABLE STATUS');
24 24
     $Tables =$DB->to_array();
25 25
     $Cache->cache_value('database_table_stats', $Tables, 3600 * 4);
26 26
 }
@@ -146,9 +146,11 @@ if (check_perms('site_debug')) { ?>
146 146
           Size
147 147
       </td>
148 148
 
149
+      <!--
149 150
       <td>
150 151
         Tools
151 152
       </td>
153
+      -->
152 154
     </tr>
153 155
 
154 156
     <?php
@@ -191,10 +193,12 @@ foreach ($Tables as $Table) {
191 193
         <?=Format::get_size($DataSize + $IndexSize)?>
192 194
       </td>
193 195
 
196
+      <!--
194 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 200
       </td>
201
+      -->
198 202
     </tr>
199 203
     <?php
200 204
 }

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

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

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

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

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

@@ -80,7 +80,7 @@ $DB->set_query_id($QueryID);
80 80
   <input type="hidden" name="action" value="registration_log" />
81 81
   Joined after: <input type="date" name="after_date" />
82 82
   Joined before: <input type="date" name="before_date" />
83
-  <input type="submit" />
83
+  <input type="submit" class="button-primary" />
84 84
 </form>
85 85
 
86 86
 <?php

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

@@ -8,24 +8,24 @@ if (!check_perms('site_view_flow')) {
8 8
 View::show_header('Torrents');
9 9
 
10 10
 if (!$TorrentStats = $Cache->get_value('new_torrent_stats')) {
11
-    $DB->query("
11
+    $DB->prepared_query("
12 12
     SELECT COUNT(ID), SUM(Size), SUM(FileCount)
13 13
     FROM torrents");
14 14
     list($TorrentCount, $TotalSize, $TotalFiles) = $DB->next_record();
15 15
 
16
-    $DB->query("
16
+    $DB->prepared_query("
17 17
     SELECT COUNT(ID)
18 18
     FROM users_main
19 19
     WHERE Enabled = '1'");
20 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 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 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 29
     list($MonthNum, $MonthSize, $MonthFiles) = $DB->next_record();
30 30
   
31 31
     $Cache->cache_value('new_torrent_stats', array($TorrentCount, $TotalSize, $TotalFiles,

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

@@ -45,7 +45,7 @@ $MultiKeyTooltip = 'Enter cache keys delimited by any amount of whitespace.';
45 45
 
46 46
         <textarea type="text" name="key" id="key"
47 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 49
       </form>
50 50
     </td>
51 51
   </tr>

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

@@ -7,17 +7,17 @@ if (!check_perms('admin_manage_permissions') && !check_perms('users_mod')) {
7 7
 
8 8
 if (!check_perms('admin_manage_permissions')) {
9 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 12
 <div class="header">
13 13
   <h1>Miscellaneous Values</h1>
14 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 21
   </tr>
22 22
 
23 23
   <?php
@@ -50,7 +50,7 @@ if (isset($_POST['submit'])) {
50 50
 
51 51
     if ($_POST['submit'] === 'Delete') {
52 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 54
     } else {
55 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 56
         $Val->SetFields('first', '1', 'string', 'You must specify the first value.');
@@ -66,10 +66,10 @@ if (isset($_POST['submit'])) {
66 66
         $Second = db_string($_POST['second']);
67 67
 
68 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 70
             list($OldName) = $DB->next_record();
71 71
 
72
-            $DB->query("
72
+            $DB->prepared_query("
73 73
               UPDATE misc
74 74
               SET
75 75
                 Name = '$Name',
@@ -78,7 +78,7 @@ if (isset($_POST['submit'])) {
78 78
               WHERE ID = '" . db_string($_POST['id']) . "'
79 79
             ");
80 80
         } else {
81
-            $DB->query("
81
+            $DB->prepared_query("
82 82
               INSERT INTO misc (Name, First, Second)
83 83
               VALUES ('$Name', '$First', '$Second')
84 84
             ");
@@ -86,7 +86,7 @@ if (isset($_POST['submit'])) {
86 86
     }
87 87
 }
88 88
 
89
-$DB->query("
89
+$DB->prepared_query("
90 90
   SELECT
91 91
     ID,
92 92
     Name,
@@ -125,15 +125,15 @@ View::show_header('Miscellaneous Values');
125 125
         </td>
126 126
 
127 127
         <td>
128
-          <input type="text" size="60" name="first" />
128
+          <input type="text" size="50" name="first" />
129 129
         </td>
130 130
 
131 131
         <td>
132
-          <input type="text" size="60" name="second" />
132
+          <input type="text" size="50" name="second" />
133 133
         </td>
134 134
 
135 135
         <td>
136
-          <input type="submit" name="submit" value="Create" />
136
+          <input type="submit" name="submit" class="button-primary" value="Create" />
137 137
         </td>
138 138
       </form>
139 139
     </tr>
@@ -154,17 +154,17 @@ while (list($ID, $Name, $First, $Second) = $DB->next_record()) {
154 154
         </td>
155 155
 
156 156
         <td>
157
-          <input type="text" size="60" name="first"
157
+          <input type="text" size="50" name="first"
158 158
             value="<?=$First?>" />
159 159
         </td>
160 160
 
161 161
         <td>
162
-          <input type="text" size="60" name="second"
162
+          <input type="text" size="50" name="second"
163 163
             value="<?=$Second?>" />
164 164
         </td>
165 165
 
166 166
         <td>
167
-          <input type="submit" name="submit" value="Edit" />
167
+          <input type="submit" name="submit" class="button-primary" value="Edit" />
168 168
           <input type="submit" name="submit" value="Delete" />
169 169
         </td>
170 170
       </form>

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

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

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

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

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

@@ -10,7 +10,7 @@ if (isset($_POST['global_flush'])) {
10 10
     $Cache->flush();
11 11
 }
12 12
 
13
-$DB->query('SHOW GLOBAL STATUS');
13
+$DB->prepared_query('SHOW GLOBAL STATUS');
14 14
 $DBStats = $DB->to_array('Variable_name');
15 15
 $MemStats = $Cache->getStats();
16 16
 
@@ -119,7 +119,7 @@ View::show_header("Service Stats"); ?>
119 119
             <input type="hidden" name="auth"
120 120
               value="<?=$LoggedUser['AuthKey']?>" />
121 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 123
           </form>
124 124
         </td>
125 125
       </tr>

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

@@ -145,7 +145,7 @@ if (empty($_GET['email']) && empty($_GET['source']) && empty($_GET['username'])
145 145
       </tr>
146 146
       <tr>
147 147
         <td>
148
-          <input type="submit" value="Search donation log" />
148
+          <input type="submit" class="button-primary" value="Search donation log" />
149 149
         </td>
150 150
       </tr>
151 151
     </table>

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

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

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

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

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

@@ -44,7 +44,7 @@ list ($NumResults) = $DB->next_record();
44 44
   <input type="hidden" name="action" value="email_blacklist" />
45 45
   <input type="email" name="email" size="30" placeholder="Email" />
46 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 48
 </form>
49 49
 <div class="linkbox pager">
50 50
   <br />
@@ -68,8 +68,8 @@ list ($NumResults) = $DB->next_record();
68 68
       <input type="hidden" name="action" value="email_blacklist_alter" />
69 69
       <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
70 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 73
     </form>
74 74
   </tr>
75 75
 <?
@@ -83,10 +83,10 @@ list ($NumResults) = $DB->next_record();
83 83
         <input type="hidden" name="id" value="<?=$Result['ID']?>" />
84 84
         <input type="email" name="email" value="<?=display_str($Result['Email'])?>" size="30" />
85 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 87
       <td><?=Users::format_username($Result ['UserID'], false, false, false)?><br /><?=time_diff($Result ['Time'], 1)?></td>
88 88
       <td>
89
-        <input type="submit" name="submit" value="Edit" />
89
+        <input type="submit" name="submit" class="button-primary" value="Edit" />
90 90
         <input type="submit" name="submit" value="Delete" />
91 91
       </td>
92 92
     </form>

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

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

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

@@ -1,114 +0,0 @@
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,7 +45,7 @@ View::show_header(
45 45
       <div id="preview" class="hidden"></div>
46 46
       <div id="buttons" class="center">
47 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 49
       </div>
50 50
     </div>
51 51
   </form>

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

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

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

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

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

@@ -120,7 +120,7 @@ for ($i = 0; $i < $TagCount / 3; $i++) {
120 120
         </tr>
121 121
         <tr style="border-top: thin solid;">
122 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 124
           </td>
125 125
         </tr>
126 126
 

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

@@ -25,7 +25,7 @@ View::show_header('Manage Permissions', 'validate');
25 25
     <a href="tools.php?action=permissions" class="brackets">Back to permission list</a>
26 26
     <a href="tools.php" class="brackets">Back to tools</a>
27 27
   </div>
28
-  <table class="permission_head layout box">
28
+  <table class="permission_head skeleton-fix">
29 29
     <tr>
30 30
       <td class="label">Permission name</td>
31 31
       <td><input type="text" name="name" id="name"

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

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

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

@@ -1,114 +1,137 @@
1
-<?
1
+<?php
2
+declare(strict_types=1);
3
+
2 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 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 89
         VALUES
71 90
           ('global', '" . (time() + (60 * 60 * $Duration)) . "', 'freeleech')
72 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 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 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,7 +64,7 @@ if (check_perms('users_mod')) {
64 64
       </td>
65 65
 <?php if (check_perms('users_mod')) { ?>
66 66
       <td>
67
-        <input type="submit" value="Add alias" />
67
+        <input type="submit" class="button-primary" value="Add alias" />
68 68
       </td>
69 69
 <?php } ?>
70 70
     </form>
@@ -88,7 +88,7 @@ while (list($ID, $BadTag, $AliasTag) = $DB->next_record()) {
88 88
       </td>
89 89
 <?php if (check_perms('users_mod')) { ?>
90 90
       <td>
91
-        <input type="submit" name="save" value="Save alias" />
91
+        <input type="submit" name="save" class="button-primary" value="Save alias" />
92 92
         <input type="submit" name="delete" value="Delete alias" />
93 93
       </td>
94 94
 <?php } ?>

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

@@ -82,7 +82,7 @@ if (isset($_REQUEST['addtokens'])) {
82 82
     <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
83 83
     Tokens to add: <input type="text" name="numtokens" size="5" style="text-align: right;" value="0" /><br /><br />
84 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 86
   </form>
87 87
 </div>
88 88
 <br />

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

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

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

@@ -110,7 +110,7 @@ if (isset($_POST['Username'])) {
110 110
       </tr>
111 111
       <tr>
112 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 114
         </td>
115 115
       </tr>
116 116
     </table>

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

@@ -40,7 +40,7 @@ View::show_header('Database Encryption Key'); ?>
40 40
 
41 41
     <div style="display: flex;">
42 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 44
     </div>
45 45
 
46 46
   </form>

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

@@ -109,7 +109,7 @@ if ($_POST['id']) {
109 109
           if ($_POST['perform'] === 'inviteprivs') { echo ' selected="selected"'; } ?>>Disable invites privileges</option>
110 110
           </select>
111 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 113
       </tr>
114 114
     </table>
115 115
   </form>

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

@@ -40,7 +40,7 @@ define('MODE_DELETE', 2);
40 40
       </tr>
41 41
       <tr>
42 42
         <td class="center" colspan="5">
43
-          <input type="submit" value="Process Tag" />
43
+          <input type="submit" class="button-primary" value="Process Tag" />
44 44
         </td>
45 45
       </tr>
46 46
     </table>

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

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

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

@@ -40,10 +40,8 @@ if (!isset($_REQUEST['authkey']) || !isset($_REQUEST['torrent_pass'])) {
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 47
   uTorrent Remote and various scripts redownload .torrent files periodically.
@@ -108,7 +106,7 @@ $Artists = $Info['Artists'];
108 106
 if ($_REQUEST['usetoken'] && $FreeTorrent === '0') {
109 107
     if (isset($LoggedUser)) {
110 108
         $FLTokens = $LoggedUser['FLTokens'];
111
-        if ($LoggedUser['CanLeech'] !== '1') {
109
+        if ($LoggedUser['CanLeech'] !== 1) {
112 110
             error('You cannot use tokens while leech disabled.');
113 111
         }
114 112
     } else {

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

@@ -100,7 +100,7 @@ View::show_header("$Username &gt; Permissions");
100 100
 </div>
101 101
 <br />
102 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 104
     <tr>
105 105
       <td class="label">Extra personal collages</td>
106 106
       <td><input type="text" name="maxcollages" size="5"

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

@@ -349,7 +349,7 @@ if (!$OwnProfile && !$LoggedUser['DisablePoints']) { ?>
349 349
           <input type="hidden" name="to" value="<?=$UserID?>">
350 350
           <div class="flex_input_container">
351 351
             <input type="text" name="amount" placeholder="Amount">
352
-            <input type="submit" value="Send">
352
+            <input type="submit" class="button-primary" value="Send">
353 353
           </div>
354 354
           <textarea name="message" rows="2" placeholder="Message"></textarea>
355 355
           <label><input type="checkbox" name="adjust"> Adjust for tax?</label>
@@ -1180,7 +1180,7 @@ if (check_perms('users_mod', $Class)) { ?>
1180 1180
       </div>
1181 1181
     </div>
1182 1182
 
1183
-    <table class="layout box" id="user_info_box">
1183
+    <table class="box skeleton-fix" id="user_info_box">
1184 1184
       <tr class="colhead">
1185 1185
         <td colspan="2">
1186 1186
           User Information
@@ -1452,7 +1452,7 @@ if (!$DisablePoints) {
1452 1452
     </table>
1453 1453
 
1454 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 1456
       <tr class="colhead">
1457 1457
         <td colspan="2">
1458 1458
           Warnings
@@ -1514,7 +1514,7 @@ if (!$DisablePoints) {
1514 1514
       <?php } ?>
1515 1515
     </table>
1516 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 1518
       <tr class="colhead">
1519 1519
         <td colspan="2">
1520 1520
           Lock Account
@@ -1540,7 +1540,7 @@ if (!$DisablePoints) {
1540 1540
       </tr>
1541 1541
     </table>
1542 1542
     <?php }  ?>
1543
-    <table class="layout box" id="user_privs_box">
1543
+    <table class="box skeleton-fix" id="user_privs_box">
1544 1544
       <tr class="colhead">
1545 1545
         <td colspan="2">
1546 1546
           User Privileges
@@ -1661,7 +1661,7 @@ if (!$DisablePoints) {
1661 1661
   } ?>
1662 1662
     </table>
1663 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 1665
       <tr class="colhead">
1666 1666
         <td colspan="2">
1667 1667
           Session
@@ -1682,7 +1682,7 @@ if (!$DisablePoints) {
1682 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 1686
       <tr class="colhead">
1687 1687
         <td colspan="2">
1688 1688
           Submit

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

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

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

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

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

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

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

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

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

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

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

@@ -9,7 +9,7 @@ if (!isset($_POST['article']) || !is_number($_POST['article'])) {
9 9
 
10 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 13
 list($MinClassEdit) = $DB->next_record();
14 14
 
15 15
 if ($MinClassEdit > $LoggedUser['EffectiveClass']) {
@@ -20,7 +20,7 @@ $NewAlias = Wiki::normalize_alias($_POST['alias']);
20 20
 $Dupe = Wiki::alias_to_id($_POST['alias']);
21 21
 
22 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 24
 } else {
25 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,7 +64,7 @@ function get_body($ID, $Rev)
64 64
     if ((int) $Rev === $Revision) {
65 65
         $Str = $Body;
66 66
     } else {
67
-        $DB->query("
67
+        $DB->prepared_query("
68 68
           SELECT Body
69 69
           FROM wiki_revisions
70 70
           WHERE ID = '$ID'
@@ -84,9 +84,12 @@ if (!isset($_GET['old'])
84 84
   || !is_number($_GET['old'])
85 85
   || !is_number($_GET['new'])
86 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 95
 $ArticleID = (int) $_GET['id'];

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

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

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

@@ -14,7 +14,7 @@ if ($ID === INDEX_ARTICLE) {
14 14
     error('You cannot delete the main wiki article.');
15 15
 }
16 16
 
17
-$DB->query("
17
+$DB->prepared_query("
18 18
   SELECT Title
19 19
   FROM wiki_articles
20 20
   WHERE ID = $ID");
@@ -29,9 +29,9 @@ list($Title) = $DB->next_record(MYSQLI_NUM, false);
29 29
 Misc::write_log("Wiki article $ID ($Title) was deleted by ".$LoggedUser['Username']);
30 30
 
31 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 36
 Wiki::flush_aliases();
37 37
 Wiki::flush_article($ID);

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

@@ -5,12 +5,12 @@ authorize();
5 5
 
6 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 9
 list($MinClassEdit) = $DB->next_record();
10 10
 if ($MinClassEdit > $LoggedUser['EffectiveClass']) {
11 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 15
 Wiki::flush_article($ArticleID);
16 16
 Wiki::flush_aliases();

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

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

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

@@ -58,7 +58,7 @@ View::show_header("Revisions of ".$Title);
58 58
       </tr>
59 59
 
60 60
       <?php
61
-$DB->query("
61
+$DB->prepared_query("
62 62
   SELECT
63 63
     Revision,
64 64
     Title,
@@ -98,7 +98,7 @@ while (list($Revision, $Title, $AuthorID, $Date) = $DB->next_record()) { ?>
98 98
 
99 99
       <tr>
100 100
         <td class="center" colspan="6">
101
-          <input type="submit" value="Compare" />
101
+          <input type="submit" class="button-primary" value="Compare" />
102 102
         </td>
103 103
       </tr>
104 104
     </table>

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

@@ -154,7 +154,7 @@ $DB->set_query_id($RS);
154 154
 
155 155
         <tr>
156 156
           <td colspan="4" class="center">
157
-            <input type="submit" value="Search" />
157
+            <input type="submit" class="button-primary" value="Search" />
158 158
           </td>
159 159
         </tr>
160 160
       </table>
@@ -170,11 +170,11 @@ $DB->set_query_id($RS);
170 170
   </div>
171 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 178
     </tr>
179 179
 
180 180
     <?php

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

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

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

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

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

@@ -29,7 +29,7 @@ if ($Letter !== '1') {
29 29
 }
30 30
 
31 31
 $sql .= " ORDER BY Title";
32
-$DB->query($sql);
32
+$DB->prepared_query($sql);
33 33
 ?>
34 34
 
35 35
 <div>

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

@@ -381,26 +381,3 @@ body.style_comic_neue {
381 381
     font-weight: 600;
382 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,4 +1,5 @@
1 1
 @import "../assets/go";
2
+@import "matcha/matcha";
2 3
 @import "scss/bookish";
3 4
 
4 5
 @import "scss/colors";

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

@@ -0,0 +1,371 @@
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