Browse Source

More prepared queries, friends feature, etc.

biotorrents 3 years ago
parent
commit
51f318ea42

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

@@ -22,7 +22,7 @@ class Wiki
22 22
         $Aliases = G::$Cache->get_value('wiki_aliases');
23 23
         if (!$Aliases) {
24 24
             $QueryID = G::$DB->get_query_id();
25
-            G::$DB->query("
25
+            G::$DB->prepared_query("
26 26
             SELECT Alias, ArticleID
27 27
             FROM wiki_aliases");
28 28
             $Aliases = G::$DB->to_pair('Alias', 'ArticleID');
@@ -67,7 +67,7 @@ class Wiki
67 67
         $Contents = G::$Cache->get_value('wiki_article_'.$ArticleID);
68 68
         if (!$Contents) {
69 69
             $QueryID = G::$DB->get_query_id();
70
-            G::$DB->query("
70
+            G::$DB->prepared_query("
71 71
             SELECT
72 72
               w.Revision,
73 73
               w.Title,

+ 4
- 4
sections/forums/take_warn.php View File

@@ -35,7 +35,7 @@ if ($WarningLength !== 'verbal') {
35 35
   Tools::update_user_notes($UserID, $AdminComment);
36 36
 }
37 37
 
38
-$DB->query("
38
+$DB->prepared_query("
39 39
   INSERT INTO users_warnings_forums
40 40
     (UserID, Comment)
41 41
   VALUES
@@ -45,7 +45,7 @@ $DB->query("
45 45
 Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
46 46
 
47 47
 //edit the post
48
-$DB->query("
48
+$DB->prepared_query("
49 49
   SELECT
50 50
     p.Body,
51 51
     p.AuthorID,
@@ -66,7 +66,7 @@ $DB->query("
66 66
 list($OldBody, $AuthorID, $TopicID, $ForumID, $Page) = $DB->next_record();
67 67
 
68 68
 // Perform the update
69
-$DB->query("
69
+$DB->prepared_query("
70 70
   UPDATE forums_posts
71 71
   SET Body = '" . db_string($Body) . "',
72 72
     EditedUserID = '$UserID',
@@ -101,7 +101,7 @@ if ($ThreadInfo['StickyPostID'] == $PostID) {
101 101
   $Cache->cache_value("thread_$TopicID" . '_info', $ThreadInfo, 0);
102 102
 }
103 103
 
104
-$DB->query("
104
+$DB->prepared_query("
105 105
   INSERT INTO comments_edits
106 106
     (Page, PostID, EditUser, EditTime, Body)
107 107
   VALUES

+ 11
- 11
sections/forums/thread.php View File

@@ -22,7 +22,7 @@ if (!isset($_GET['threadid']) || !is_number($_GET['threadid'])) {
22 22
     if (isset($_GET['topicid']) && is_number($_GET['topicid'])) {
23 23
         $ThreadID = $_GET['topicid'];
24 24
     } elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
25
-        $DB->query("
25
+        $DB->prepared_query("
26 26
       SELECT TopicID
27 27
       FROM forums_posts
28 28
       WHERE ID = $_GET[postid]");
@@ -78,7 +78,7 @@ if ($ThreadInfo['Posts'] > $PerPage) {
78 78
         if ($ThreadInfo['StickyPostID'] < $_GET['postid']) {
79 79
             $SQL .= " AND ID != $ThreadInfo[StickyPostID]";
80 80
         }
81
-        $DB->query($SQL);
81
+        $DB->prepared_query($SQL);
82 82
         list($PostNum) = $DB->next_record();
83 83
     } else {
84 84
         $PostNum = 1;
@@ -94,7 +94,7 @@ list($CatalogueID, $CatalogueLimit) = Format::catalogue_limit($Page, $PerPage, T
94 94
 
95 95
 // Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
96 96
 if (!$Catalogue = $Cache->get_value("thread_{$ThreadID}_catalogue_$CatalogueID")) {
97
-    $DB->query("
97
+    $DB->prepared_query("
98 98
     SELECT
99 99
       p.ID,
100 100
       p.AuthorID,
@@ -127,14 +127,14 @@ if ($ThreadInfo['Posts'] <= $PerPage*$Page && $ThreadInfo['StickyPostID'] > $Las
127 127
 //Why would we skip this on locked or stickied threads?
128 128
 //if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
129 129
 
130
-  $DB->query("
130
+  $DB->prepared_query("
131 131
     SELECT PostID
132 132
     FROM forums_last_read_topics
133 133
     WHERE UserID = '$LoggedUser[ID]'
134 134
       AND TopicID = '$ThreadID'");
135 135
   list($LastRead) = $DB->next_record();
136 136
   if ($LastRead < $LastPost) {
137
-      $DB->query("
137
+      $DB->prepared_query("
138 138
       INSERT INTO forums_last_read_topics
139 139
         (UserID, TopicID, PostID)
140 140
       VALUES
@@ -158,7 +158,7 @@ if (in_array($ThreadID, $UserSubscriptions)) {
158 158
 
159 159
 $QuoteNotificationsCount = $Cache->get_value('notify_quoted_' . $LoggedUser['ID']);
160 160
 if ($QuoteNotificationsCount === false || $QuoteNotificationsCount > 0) {
161
-    $DB->query("
161
+    $DB->prepared_query("
162 162
     UPDATE users_notify_quoted
163 163
     SET UnRead = false
164 164
     WHERE UserID = '$LoggedUser[ID]'
@@ -243,13 +243,13 @@ echo $Pages;
243 243
 
244 244
 if ($ThreadInfo['NoPoll'] == 0) {
245 245
     if (!list($Question, $Answers, $Votes, $Featured, $Closed) = $Cache->get_value("polls_$ThreadID")) {
246
-        $DB->query("
246
+        $DB->prepared_query("
247 247
       SELECT Question, Answers, Featured, Closed
248 248
       FROM forums_polls
249 249
       WHERE TopicID = '$ThreadID'");
250 250
         list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
251 251
         $Answers = unserialize($Answers);
252
-        $DB->query("
252
+        $DB->prepared_query("
253 253
       SELECT Vote, COUNT(UserID)
254 254
       FROM forums_polls_votes
255 255
       WHERE TopicID = '$ThreadID'
@@ -281,7 +281,7 @@ if ($ThreadInfo['NoPoll'] == 0) {
281 281
     #$RevealVoters = in_array($ForumID, FORUMS_TO_REVEAL_VOTERS);
282 282
 
283 283
     // Polls lose the you voted arrow thingy
284
-    $DB->query("
284
+    $DB->prepared_query("
285 285
     SELECT Vote
286 286
     FROM forums_polls_votes
287 287
     WHERE UserID = '".$LoggedUser['ID']."'
@@ -349,7 +349,7 @@ if ($ThreadInfo['NoPoll'] == 0) {
349 349
             $StaffNames[] = $Staffer['Username'];
350 350
         }
351 351
 
352
-        $DB->query("
352
+        $DB->prepared_query("
353 353
         SELECT
354 354
           fpv.Vote AS Vote,
355 355
           GROUP_CONCAT(um.Username SEPARATOR ', ')
@@ -636,7 +636,7 @@ if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
636 636
   }
637 637
 
638 638
 if (check_perms('site_moderate_forums')) {
639
-    G::$DB->query("
639
+    G::$DB->prepared_query("
640 640
       SELECT ID, AuthorID, AddedTime, Body
641 641
       FROM forums_topic_notes
642 642
       WHERE TopicID = $ThreadID

+ 3
- 3
sections/forums/warn.php View File

@@ -11,14 +11,14 @@ $UserID = (int) $_POST['userid'];
11 11
 $Key = (int) $_POST['key'];
12 12
 $UserInfo = Users::user_info($UserID);
13 13
 
14
-$DB->query("
14
+$DB->prepared_query("
15 15
   SELECT p.Body, t.ForumID
16 16
   FROM forums_posts AS p
17 17
     JOIN forums_topics AS t ON p.TopicID = t.ID
18 18
   WHERE p.ID = '$PostID'");
19 19
 list($PostBody, $ForumID) = $DB -> next_record();
20 20
 
21
-View::show_header('Warn User');
21
+View::show_header('Warn');
22 22
 ?>
23 23
 
24 24
 <div>
@@ -75,7 +75,7 @@ View::show_header('Warn User');
75 75
             <textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90"
76 76
               rows="8"><?=$PostBody?></textarea>
77 77
             <br />
78
-            <input type="submit" id="submit_button" value="Warn user" tabindex="1" />
78
+            <input type="submit" id="submit_button" class="button-primary" value="Warn user" tabindex="1" />
79 79
           </td>
80 80
         </tr>
81 81
       </table>

+ 17
- 13
sections/friends/add.php View File

@@ -1,23 +1,27 @@
1 1
 <?php
2
+declare(strict_types = 1);
3
+
2 4
 authorize();
3
-if (!is_number($_GET['friendid'])) {
4
-  error(404);
5
-}
6
-$FriendID = db_string($_GET['friendid']);
5
+
6
+$FriendID = (int) $_GET['friendid'];
7
+Security::checkInt($FriendID);
7 8
 
8 9
 // Check if the user $FriendID exists
9
-$DB->query("
10
-  SELECT 1
11
-  FROM users_main
12
-  WHERE ID = '$FriendID'");
10
+$DB->prepared_query("
11
+SELECT 1
12
+FROM `users_main`
13
+WHERE `ID` = '$FriendID'
14
+");
15
+
13 16
 if (!$DB->has_results()) {
14
-  error(404);
17
+    error(404);
15 18
 }
16 19
 
17
-$DB->query("
18
-  INSERT IGNORE INTO friends
19
-    (UserID, FriendID)
20
+$DB->prepared_query("
21
+  INSERT IGNORE INTO `friends`
22
+    (`UserID`, `FriendID`)
20 23
   VALUES
21
-    ('$LoggedUser[ID]', '$FriendID')");
24
+    ('$LoggedUser[ID]', '$FriendID')
25
+");
22 26
 
23 27
 header('Location: friends.php');

+ 9
- 7
sections/friends/comment.php View File

@@ -1,9 +1,11 @@
1
-<?
2
-$DB->query("
3
-  UPDATE friends
4
-  SET Comment='$P[comment]'
5
-  WHERE UserID='$LoggedUser[ID]'
6
-    AND FriendID='$P[friendid]'");
1
+<?php
2
+declare(strict_types = 1);
3
+
4
+$DB->prepared_query("
5
+  UPDATE `friends`
6
+  SET `Comment`='$P[comment]'
7
+  WHERE `UserID`='$LoggedUser[ID]'
8
+    AND `FriendID`='$P[friendid]'
9
+");
7 10
 
8 11
 header('Location: friends.php');
9
-?>

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

@@ -3,7 +3,7 @@
3 3
 
4 4
 /**
5 5
  * Main friends page
6
- * 
6
+ *
7 7
  * This page lists a user's friends.
8 8
  * There's no real point in caching this page.
9 9
  * I doubt users load it that much.
@@ -21,7 +21,7 @@ $UserID = $LoggedUser['ID'];
21 21
 list($Page, $Limit) = Format::page_limit(FRIENDS_PER_PAGE);
22 22
 
23 23
 // Main query
24
-$DB->query("
24
+$DB->prepared_query("
25 25
   SELECT
26 26
     SQL_CALC_FOUND_ROWS
27 27
     f.`FriendID`,
@@ -42,10 +42,10 @@ $DB->query("
42 42
 $Friends = $DB->to_array(false, MYSQLI_BOTH, array(6, 'Paranoia'));
43 43
 
44 44
 // Number of results (for pagination)
45
-$DB->query('SELECT FOUND_ROWS()');
45
+$DB->prepared_query('SELECT FOUND_ROWS()');
46 46
 list($Results) = $DB->next_record();
47 47
 
48
-// Start printing stuff ?>
48
+// Start printing stuff?>
49 49
 
50 50
 <div>
51 51
   <div class="header">

+ 17
- 15
sections/friends/index.php View File

@@ -1,33 +1,35 @@
1
-<?
2
-$P = db_array($_POST);
1
+<?php
2
+declare(strict_types = 1);
3
+
3 4
 enforce_login();
4
-if (!empty($_REQUEST['friendid']) && !is_number($_REQUEST['friendid'])) {
5
-  error(404);
6
-}
5
+$P = db_array($_POST);
6
+
7
+$FriendID = (int) $_REQUEST['friendid'];
8
+Security::checkInt($FriendID);
7 9
 
8 10
 if (!empty($_REQUEST['action'])) {
9
-  switch ($_REQUEST['action']) {
11
+    switch ($_REQUEST['action']) {
10 12
     case 'add':
11
-      include(SERVER_ROOT.'/sections/friends/add.php');
13
+      require_once "$ENV->SERVER_ROOT/sections/friends/add.php";
12 14
       break;
15
+
13 16
     case 'Remove friend':
14 17
       authorize();
15
-      include(SERVER_ROOT.'/sections/friends/remove.php');
18
+      require_once "$ENV->SERVER_ROOT/sections/friends/remove.php";
16 19
       break;
20
+
17 21
     case 'Update':
18 22
       authorize();
19
-      include(SERVER_ROOT.'/sections/friends/comment.php');
20
-      break;
21
-    case 'whois':
22
-      include(SERVER_ROOT.'/sections/friends/whois.php');
23
+      require_once "$ENV->SERVER_ROOT/sections/friends/comment.php";
23 24
       break;
25
+
24 26
     case 'Contact':
25
-      header('Location: inbox.php?action=compose&to='.$_POST['friendid']);
27
+      header("Location: inbox.php?action=compose&to=$FriendID");
26 28
       break;
29
+      
27 30
     default:
28 31
       error(404);
29 32
   }
30 33
 } else {
31
-  include(SERVER_ROOT.'/sections/friends/friends.php');
34
+    require_once "$ENV->SERVER_ROOT/sections/friends/friends.php";
32 35
 }
33
-?>

+ 8
- 6
sections/friends/remove.php View File

@@ -1,8 +1,10 @@
1
-<?
2
-$DB->query("
3
-  DELETE FROM friends
4
-  WHERE UserID='$LoggedUser[ID]'
5
-    AND FriendID='$P[friendid]'");
1
+<?php
2
+declare(strict_types = 1);
3
+
4
+$DB->prepared_query("
5
+  DELETE FROM `friends`
6
+  WHERE `UserID`='$LoggedUser[ID]'
7
+    AND `FriendID`='$P[friendid]'
8
+");
6 9
 
7 10
 header('Location: friends.php');
8
-?>

+ 2
- 2
sections/inbox/compose.php View File

@@ -19,7 +19,7 @@ if (!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$ToID])) {
19 19
     error(403);
20 20
 }
21 21
 
22
-$DB->query("
22
+$DB->prepared_query("
23 23
   SELECT Username
24 24
   FROM users_main
25 25
   WHERE ID='$ToID'");
@@ -60,7 +60,7 @@ new TEXTAREA_PREVIEW(
60 60
       <div id="preview" class="hidden"></div>
61 61
       <div id="buttons" class="center">
62 62
         <input type="button" value="Preview" onclick="Quick_Preview();" />
63
-        <input type="submit" value="Send message" />
63
+        <input type="submit" class="button-primary" value="Send message" />
64 64
       </div>
65 65
     </div>
66 66
   </form>

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

@@ -24,7 +24,7 @@ if (isset($_POST['Username'])) {
24 24
     $torrent_pass = Users::make_secret();
25 25
 
26 26
     //Create the account
27
-    $DB->query("
27
+    $DB->prepared_query("
28 28
       INSERT INTO users_main
29 29
         (Username, Email, PassHash, torrent_pass, Enabled, PermissionID)
30 30
       VALUES
@@ -39,7 +39,7 @@ if (isset($_POST['Username'])) {
39 39
     Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass));
40 40
 
41 41
     //Default stylesheet
42
-    $DB->query("
42
+    $DB->prepared_query("
43 43
       SELECT ID
44 44
       FROM stylesheets");
45 45
     list($StyleID) = $DB->next_record();
@@ -48,14 +48,14 @@ if (isset($_POST['Username'])) {
48 48
     $AuthKey = Users::make_secret();
49 49
 
50 50
     //Give them a row in users_info
51
-    $DB->query("
51
+    $DB->prepared_query("
52 52
       INSERT INTO users_info
53 53
         (UserID, StyleID, AuthKey, JoinDate)
54 54
       VALUES
55 55
         ('".db_string($UserID)."', '".db_string($StyleID)."', '".db_string($AuthKey)."', NOW())");
56 56
 
57 57
     // Give the notification settings
58
-    $DB->query("INSERT INTO users_notifications_settings (UserID) VALUES ('$UserID')");
58
+    $DB->prepared_query("INSERT INTO users_notifications_settings (UserID) VALUES ('$UserID')");
59 59
 
60 60
     //Redirect to users profile
61 61
     header ("Location: user.php?id=$UserID");

+ 1
- 1
sections/top10/donors.php View File

@@ -15,7 +15,7 @@ $Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
15 15
 $Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10;
16 16
 
17 17
 $IsMod = check_perms("users_mod");
18
-$DB->query("
18
+$DB->prepared_query("
19 19
 SELECT
20 20
   `UserID`,
21 21
   `TotalRank`,

+ 1
- 1
sections/top10/history.php View File

@@ -66,7 +66,7 @@ if (!empty($_GET['date'])) {
66 66
 
67 67
     $Details = $Cache->get_value("top10_history_$SQLTime");
68 68
     if ($Details === false) {
69
-        $DB->query("
69
+        $DB->prepared_query("
70 70
         SELECT
71 71
           tht.`Rank`,
72 72
           tht.`TitleString`,

+ 2
- 2
sections/top10/tags.php View File

@@ -28,7 +28,7 @@ $Limit = in_array($Limit, [10,100,250]) ? $Limit : 10;
28 28
 
29 29
 if ($Details == 'all' || $Details == 'ut') {
30 30
     if (!$TopUsedTags = $Cache->get_value('topusedtag_'.$Limit)) {
31
-        $DB->query("
31
+        $DB->prepared_query("
32 32
         SELECT
33 33
           t.ID,
34 34
           t.Name,
@@ -47,7 +47,7 @@ if ($Details == 'all' || $Details == 'ut') {
47 47
 
48 48
 if ($Details == 'all' || $Details == 'ur') {
49 49
     if (!$TopRequestTags = $Cache->get_value('toprequesttag_'.$Limit)) {
50
-        $DB->query("
50
+        $DB->prepared_query("
51 51
         SELECT
52 52
           t.ID,
53 53
           t.Name,

+ 8
- 8
sections/top10/torrents.php View File

@@ -208,7 +208,7 @@ if ($Details === 'all' || $Details === 'day') {
208 208
               ORDER BY (t.Seeders + t.Leechers) DESC
209 209
               LIMIT $Limit;";
210 210
 
211
-            $DB->query($Query);
211
+            $DB->prepared_query($Query);
212 212
             $TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM);
213 213
             $Cache->cache_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastDay, 3600 * 2);
214 214
             $Cache->clear_query_lock('top10');
@@ -235,7 +235,7 @@ if ($Details === 'all' || $Details === 'week') {
235 235
               ORDER BY (t.Seeders + t.Leechers) DESC
236 236
               LIMIT $Limit;";
237 237
 
238
-            $DB->query($Query);
238
+            $DB->prepared_query($Query);
239 239
             $TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM);
240 240
             $Cache->cache_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastWeek, 3600 * 6);
241 241
             $Cache->clear_query_lock('top10');
@@ -262,7 +262,7 @@ if ($Details === 'all' || $Details === 'month') {
262 262
               ORDER BY (t.Seeders + t.Leechers) DESC
263 263
               LIMIT $Limit;";
264 264
 
265
-            $DB->query($Query);
265
+            $DB->prepared_query($Query);
266 266
             $TopTorrentsActiveLastMonth = $DB->to_array(false, MYSQLI_NUM);
267 267
             $Cache->cache_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastMonth, 3600 * 6);
268 268
             $Cache->clear_query_lock('top10');
@@ -294,7 +294,7 @@ if ($Details === 'all' || $Details === 'year') {
294 294
               ORDER BY (t.Seeders + t.Leechers) DESC
295 295
               LIMIT $Limit;";
296 296
 
297
-            $DB->query($Query);
297
+            $DB->prepared_query($Query);
298 298
             $TopTorrentsActiveLastYear = $DB->to_array(false, MYSQLI_NUM);
299 299
             $Cache->cache_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastYear, 3600 * 6);
300 300
             $Cache->clear_query_lock('top10');
@@ -325,7 +325,7 @@ if ($Details === 'all' || $Details === 'overall') {
325 325
               ORDER BY (t.Seeders + t.Leechers) DESC
326 326
               LIMIT $Limit;";
327 327
 
328
-            $DB->query($Query);
328
+            $DB->prepared_query($Query);
329 329
             $TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM);
330 330
             $Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveAllTime, 3600 * 6);
331 331
             $Cache->clear_query_lock('top10');
@@ -351,7 +351,7 @@ if (($Details === 'all' || $Details === 'snatched') && !$Filtered) {
351 351
               ORDER BY t.Snatched DESC
352 352
               LIMIT $Limit;";
353 353
 
354
-            $DB->query($Query);
354
+            $DB->prepared_query($Query);
355 355
             $TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM);
356 356
             $Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSnatched, 3600 * 6);
357 357
             $Cache->clear_query_lock('top10');
@@ -380,7 +380,7 @@ if (($Details === 'all' || $Details === 'data') && !$Filtered) {
380 380
               ORDER BY Data DESC
381 381
               LIMIT $Limit;";
382 382
 
383
-            $DB->query($Query);
383
+            $DB->prepared_query($Query);
384 384
             $TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM);
385 385
             $Cache->cache_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsTransferred, 3600 * 6);
386 386
             $Cache->clear_query_lock('top10');
@@ -405,7 +405,7 @@ if (($Details === 'all' || $Details === 'seeded') && !$Filtered) {
405 405
               ORDER BY t.Seeders DESC
406 406
               LIMIT $Limit;";
407 407
 
408
-            $DB->query($Query);
408
+            $DB->prepared_query($Query);
409 409
             $TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM);
410 410
             $Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSeeded, 3600 * 6);
411 411
             $Cache->clear_query_lock('top10');

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

@@ -48,7 +48,7 @@ $BaseQuery = "
48 48
 
49 49
   if ($Details == 'all' || $Details == 'ul') {
50 50
       if (!$TopUserUploads = $Cache->get_value('topuser_ul_'.$Limit)) {
51
-          $DB->query("$BaseQuery ORDER BY u.Uploaded DESC LIMIT $Limit;");
51
+          $DB->prepared_query("$BaseQuery ORDER BY u.Uploaded DESC LIMIT $Limit;");
52 52
           $TopUserUploads = $DB->to_array();
53 53
           $Cache->cache_value('topuser_ul_'.$Limit, $TopUserUploads, 3600 * 12);
54 54
       }
@@ -57,7 +57,7 @@ $BaseQuery = "
57 57
 
58 58
   if ($Details == 'all' || $Details == 'dl') {
59 59
       if (!$TopUserDownloads = $Cache->get_value('topuser_dl_'.$Limit)) {
60
-          $DB->query("$BaseQuery ORDER BY u.Downloaded DESC LIMIT $Limit;");
60
+          $DB->prepared_query("$BaseQuery ORDER BY u.Downloaded DESC LIMIT $Limit;");
61 61
           $TopUserDownloads = $DB->to_array();
62 62
           $Cache->cache_value('topuser_dl_'.$Limit, $TopUserDownloads, 3600 * 12);
63 63
       }
@@ -66,7 +66,7 @@ $BaseQuery = "
66 66
 
67 67
   if ($Details == 'all' || $Details == 'numul') {
68 68
       if (!$TopUserNumUploads = $Cache->get_value('topuser_numul_'.$Limit)) {
69
-          $DB->query("$BaseQuery ORDER BY NumUploads DESC LIMIT $Limit;");
69
+          $DB->prepared_query("$BaseQuery ORDER BY NumUploads DESC LIMIT $Limit;");
70 70
           $TopUserNumUploads = $DB->to_array();
71 71
           $Cache->cache_value('topuser_numul_'.$Limit, $TopUserNumUploads, 3600 * 12);
72 72
       }
@@ -75,7 +75,7 @@ $BaseQuery = "
75 75
 
76 76
   if ($Details == 'all' || $Details == 'uls') {
77 77
       if (!$TopUserUploadSpeed = $Cache->get_value('topuser_ulspeed_'.$Limit)) {
78
-          $DB->query("$BaseQuery ORDER BY UpSpeed DESC LIMIT $Limit;");
78
+          $DB->prepared_query("$BaseQuery ORDER BY UpSpeed DESC LIMIT $Limit;");
79 79
           $TopUserUploadSpeed = $DB->to_array();
80 80
           $Cache->cache_value('topuser_ulspeed_'.$Limit, $TopUserUploadSpeed, 3600 * 12);
81 81
       }
@@ -84,7 +84,7 @@ $BaseQuery = "
84 84
 
85 85
   if ($Details == 'all' || $Details == 'dls') {
86 86
       if (!$TopUserDownloadSpeed = $Cache->get_value('topuser_dlspeed_'.$Limit)) {
87
-          $DB->query("$BaseQuery ORDER BY DownSpeed DESC LIMIT $Limit;");
87
+          $DB->prepared_query("$BaseQuery ORDER BY DownSpeed DESC LIMIT $Limit;");
88 88
           $TopUserDownloadSpeed = $DB->to_array();
89 89
           $Cache->cache_value('topuser_dlspeed_'.$Limit, $TopUserDownloadSpeed, 3600 * 12);
90 90
       }

Loading…
Cancel
Save