7 Commits

Author SHA1 Message Date
  biotorrents 49cffc7ca5 Draft the About page and use prepared queries on reportsv2 4 years ago
  biotorrents 51f318ea42 More prepared queries, friends feature, etc. 4 years ago
  biotorrents 3beb50fa32 Text class redux 4 years ago
  biotorrents e625d03a3b Wikipedia style links, fix alertbar style, organize public header/footer, add about page 4 years ago
  biotorrents 303ae78d4b Remove bbcode.js and donor_titles.js 4 years ago
  biotorrents 0a21914f54 Fix "fix ghost entry" feature and use prepared queries on some classes 4 years ago
  biotorrents b2ff1c1d5e Remove the rest of the user history stuff (nothing to expunge) 4 years ago
86 changed files with 433 additions and 712 deletions
  1. 10
    10
      classes/artists.class.php
  2. 2
    2
      classes/badges.class.php
  3. 1
    1
      classes/bookmarks.class.php
  4. 4
    4
      classes/collages.class.php
  5. 55
    38
      classes/text.class.php
  6. 2
    2
      classes/wiki.class.php
  7. 2
    16
      design/privateheader.php
  8. 2
    2
      design/publicfooter.php
  9. 2
    8
      design/publicheader.php
  10. 0
    10
      gazelle.sql
  11. 1
    1
      sections/artist/artist.php
  12. 1
    1
      sections/collages/all_comments.php
  13. 1
    1
      sections/collages/artist_collage.php
  14. 1
    1
      sections/collages/edit.php
  15. 1
    1
      sections/collages/new.php
  16. 1
    1
      sections/collages/torrent_collage.php
  17. 1
    1
      sections/comments/comments.php
  18. 1
    1
      sections/forums/newthread.php
  19. 1
    1
      sections/forums/search.php
  20. 4
    4
      sections/forums/take_warn.php
  21. 12
    12
      sections/forums/thread.php
  22. 3
    3
      sections/forums/warn.php
  23. 17
    13
      sections/friends/add.php
  24. 9
    7
      sections/friends/comment.php
  25. 4
    4
      sections/friends/friends.php
  26. 17
    15
      sections/friends/index.php
  27. 8
    6
      sections/friends/remove.php
  28. 3
    3
      sections/inbox/compose.php
  29. 1
    1
      sections/inbox/conversation.php
  30. 6
    0
      sections/legal/index.php
  31. 1
    1
      sections/reports/compose.php
  32. 1
    1
      sections/reports/report.php
  33. 1
    1
      sections/reports/reports.php
  34. 3
    3
      sections/reportsv2/ajax_create_report.php
  35. 2
    2
      sections/reportsv2/ajax_giveback_report.php
  36. 1
    1
      sections/reportsv2/ajax_grab_report.php
  37. 7
    7
      sections/reportsv2/ajax_new_report.php
  38. 2
    2
      sections/reportsv2/ajax_update_comment.php
  39. 1
    1
      sections/reportsv2/ajax_update_resolve.php
  40. 2
    2
      sections/reportsv2/report.php
  41. 12
    12
      sections/reportsv2/static.php
  42. 74
    82
      sections/reportsv2/takereport.php
  43. 19
    19
      sections/reportsv2/takeresolve.php
  44. 7
    7
      sections/reportsv2/views.php
  45. 1
    1
      sections/requests/new_edit.php
  46. 1
    1
      sections/requests/request.php
  47. 1
    1
      sections/staffpm/viewconv.php
  48. 4
    4
      sections/tools/finances/donation_log.php
  49. 2
    2
      sections/tools/finances/donor_rewards.php
  50. 0
    4
      sections/tools/index.php
  51. 3
    3
      sections/tools/managers/bans.php
  52. 2
    2
      sections/tools/managers/email_blacklist.php
  53. 3
    3
      sections/tools/managers/email_blacklist_alter.php
  54. 1
    1
      sections/tools/managers/email_blacklist_search.php
  55. 0
    108
      sections/tools/managers/expunge_requests.php
  56. 1
    1
      sections/tools/managers/mass_pm.php
  57. 1
    1
      sections/tools/managers/news.php
  58. 4
    4
      sections/tools/misc/create_user.php
  59. 1
    1
      sections/top10/donors.php
  60. 1
    1
      sections/top10/history.php
  61. 2
    2
      sections/top10/tags.php
  62. 8
    8
      sections/top10/torrents.php
  63. 5
    5
      sections/top10/users.php
  64. 1
    1
      sections/torrents/details.php
  65. 1
    1
      sections/torrents/edit.php
  66. 1
    1
      sections/torrents/editgroup.php
  67. 7
    3
      sections/torrents/index.php
  68. 1
    1
      sections/upload/upload.php
  69. 1
    1
      sections/user/edit.php
  70. 1
    1
      sections/user/user.php
  71. 1
    1
      sections/userhistory/post_history.php
  72. 1
    1
      sections/userhistory/subscriptions.php
  73. 1
    1
      sections/wiki/article.php
  74. 1
    1
      sections/wiki/create.php
  75. 1
    1
      sections/wiki/edit.php
  76. 6
    0
      static/common/symbols/external-link-ltr-icon.svg
  77. BIN
      static/common/symbols/external.png
  78. 0
    142
      static/functions/bbcode.js
  79. 0
    33
      static/functions/donor_titles.js
  80. 8
    6
      static/styles/bookish/scss/colors.scss
  81. 8
    0
      static/styles/global/scss/fonts.scss
  82. 38
    0
      templates/legal/about.html
  83. 3
    3
      templates/legal/dmca.html
  84. 5
    5
      templates/legal/privacy.html
  85. 0
    29
      templates/staffblog/edit.twig
  86. 0
    16
      templates/staffblog/list.twig

+ 10
- 10
classes/artists.class.php View File

47
             }
47
             }
48
 
48
 
49
             $QueryID = G::$DB->get_query_id();
49
             $QueryID = G::$DB->get_query_id();
50
-            G::$DB->query("
50
+            G::$DB->prepared_query("
51
             SELECT
51
             SELECT
52
               ta.`GroupID`,
52
               ta.`GroupID`,
53
               ta.`ArtistID`,
53
               ta.`ArtistID`,
169
     public static function delete_artist($ArtistID)
169
     public static function delete_artist($ArtistID)
170
     {
170
     {
171
         $QueryID = G::$DB->get_query_id();
171
         $QueryID = G::$DB->get_query_id();
172
-        G::$DB->query("
172
+        G::$DB->prepared_query("
173
         SELECT
173
         SELECT
174
           `NAME`
174
           `NAME`
175
         FROM
175
         FROM
180
         list($Name) = G::$DB->next_record(MYSQLI_NUM, false);
180
         list($Name) = G::$DB->next_record(MYSQLI_NUM, false);
181
 
181
 
182
         // Delete requests
182
         // Delete requests
183
-        G::$DB->query("
183
+        G::$DB->prepared_query("
184
         SELECT
184
         SELECT
185
           `RequestID`
185
           `RequestID`
186
         FROM
186
         FROM
192
         $Requests = G::$DB->to_array();
192
         $Requests = G::$DB->to_array();
193
         foreach ($Requests as $Request) {
193
         foreach ($Requests as $Request) {
194
             list($RequestID) = $Request;
194
             list($RequestID) = $Request;
195
-            G::$DB->query("
195
+            G::$DB->prepared_query("
196
             DELETE
196
             DELETE
197
             FROM
197
             FROM
198
               `requests`
198
               `requests`
200
               `ID` = '$RequestID'
200
               `ID` = '$RequestID'
201
             ");
201
             ");
202
 
202
 
203
-            G::$DB->query("
203
+            G::$DB->prepared_query("
204
             DELETE
204
             DELETE
205
             FROM
205
             FROM
206
               `requests_votes`
206
               `requests_votes`
208
               `RequestID` = '$RequestID'
208
               `RequestID` = '$RequestID'
209
             ");
209
             ");
210
 
210
 
211
-            G::$DB->query("
211
+            G::$DB->prepared_query("
212
             DELETE
212
             DELETE
213
             FROM
213
             FROM
214
               `requests_tags`
214
               `requests_tags`
216
               `RequestID` = '$RequestID'
216
               `RequestID` = '$RequestID'
217
             ");
217
             ");
218
 
218
 
219
-            G::$DB->query("
219
+            G::$DB->prepared_query("
220
             DELETE
220
             DELETE
221
             FROM
221
             FROM
222
               `requests_artists`
222
               `requests_artists`
226
         }
226
         }
227
 
227
 
228
         // Delete artist
228
         // Delete artist
229
-        G::$DB->query("
229
+        G::$DB->prepared_query("
230
         DELETE
230
         DELETE
231
         FROM
231
         FROM
232
           `artists_group`
232
           `artists_group`
236
         G::$Cache->decrement('stats_artist_count');
236
         G::$Cache->decrement('stats_artist_count');
237
 
237
 
238
         // Delete wiki revisions
238
         // Delete wiki revisions
239
-        G::$DB->query("
239
+        G::$DB->prepared_query("
240
         DELETE
240
         DELETE
241
         FROM
241
         FROM
242
           `wiki_artists`
242
           `wiki_artists`
245
         ");
245
         ");
246
 
246
 
247
         // Delete tags
247
         // Delete tags
248
-        G::$DB->query("
248
+        G::$DB->prepared_query("
249
         DELETE
249
         DELETE
250
         FROM
250
         FROM
251
           `artists_tags`
251
           `artists_tags`

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

28
             return false;
28
             return false;
29
         } else {
29
         } else {
30
             $QueryID = G::$DB->get_query_id();
30
             $QueryID = G::$DB->get_query_id();
31
-            G::$DB->query("
31
+            G::$DB->prepared_query("
32
             INSERT INTO `users_badges`(`UserID`, `BadgeID`)
32
             INSERT INTO `users_badges`(`UserID`, `BadgeID`)
33
             VALUES($UserID, $BadgeID)
33
             VALUES($UserID, $BadgeID)
34
             ");
34
             ");
126
     {
126
     {
127
         $QueryID = G::$DB->get_query_id();
127
         $QueryID = G::$DB->get_query_id();
128
 
128
 
129
-        G::$DB->query("
129
+        G::$DB->prepared_query("
130
         SELECT
130
         SELECT
131
           `ID`,
131
           `ID`,
132
           `Icon`,
132
           `Icon`,

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

97
             list($Table, $Col) = self::bookmark_schema($Type);
97
             list($Table, $Col) = self::bookmark_schema($Type);
98
             $QueryID = G::$DB->get_query_id();
98
             $QueryID = G::$DB->get_query_id();
99
 
99
 
100
-            G::$DB->query("
100
+            G::$DB->prepared_query("
101
             SELECT `$Col`
101
             SELECT `$Col`
102
             FROM `$Table`
102
             FROM `$Table`
103
               WHERE UserID = '$UserID'");
103
               WHERE UserID = '$UserID'");

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

6
     public static function increase_subscriptions($CollageID)
6
     public static function increase_subscriptions($CollageID)
7
     {
7
     {
8
         $QueryID = G::$DB->get_query_id();
8
         $QueryID = G::$DB->get_query_id();
9
-        G::$DB->query("
9
+        G::$DB->prepared_query("
10
         UPDATE
10
         UPDATE
11
           `collages`
11
           `collages`
12
         SET
12
         SET
20
     public static function decrease_subscriptions($CollageID)
20
     public static function decrease_subscriptions($CollageID)
21
     {
21
     {
22
         $QueryID = G::$DB->get_query_id();
22
         $QueryID = G::$DB->get_query_id();
23
-        G::$DB->query("
23
+        G::$DB->prepared_query("
24
         UPDATE
24
         UPDATE
25
           `collages`
25
           `collages`
26
         SET
26
         SET
37
 
37
 
38
     public static function create_personal_collage()
38
     public static function create_personal_collage()
39
     {
39
     {
40
-        G::$DB->query("
40
+        G::$DB->prepared_query("
41
         SELECT
41
         SELECT
42
           COUNT(`ID`)
42
           COUNT(`ID`)
43
         FROM
43
         FROM
57
         $NameStr = db_string(G::$LoggedUser['Username']."'s personal collage".($CollageCount > 0 ? ' no. '.($CollageCount + 1) : ''));
57
         $NameStr = db_string(G::$LoggedUser['Username']."'s personal collage".($CollageCount > 0 ? ' no. '.($CollageCount + 1) : ''));
58
         $Description = db_string('Personal collage for '.G::$LoggedUser['Username'].'. The first 5 albums will appear on his or her [url='.site_url().'user.php?id= '.G::$LoggedUser['ID'].']profile[/url].');
58
         $Description = db_string('Personal collage for '.G::$LoggedUser['Username'].'. The first 5 albums will appear on his or her [url='.site_url().'user.php?id= '.G::$LoggedUser['ID'].']profile[/url].');
59
 
59
 
60
-        G::$DB->query("
60
+        G::$DB->prepared_query("
61
         INSERT INTO `collages`(
61
         INSERT INTO `collages`(
62
           `Name`,
62
           `Name`,
63
           `Description`,
63
           `Description`,

+ 55
- 38
classes/text.class.php View File

14
       's' => 0,
14
       's' => 0,
15
       '*' => 0,
15
       '*' => 0,
16
       '#' => 0,
16
       '#' => 0,
17
-      #'ch' => 0,
18
-      #'uch' => 0,
19
       'artist' => 0,
17
       'artist' => 0,
20
       'user' => 0,
18
       'user' => 0,
21
       'n' => 0,
19
       'n' => 0,
128
      */
126
      */
129
     public static $TOC = false;
127
     public static $TOC = false;
130
 
128
 
129
+
130
+    /**
131
+     * Fix the links
132
+     * 
133
+     * Make it so that internal links are in the form "/section?p=foo"
134
+     * and that external links are secure and look like Wikipedia.
135
+     * Takes an already-parsed input, to hit Markdown and BBcode.
136
+     */
137
+    public function fix_links($Parsed) {
138
+            # Replace links to $ENV->SITE_DOMAIN
139
+            $Parsed = preg_replace(
140
+                "/<a href=\"$ENV->RESOURCE_REGEX$ENV->SITE_DOMAIN\//",
141
+                '<a href="/',
142
+                $Parsed
143
+            );
144
+                
145
+            # Replace external links and add Wikipedia-style CSS class
146
+            $RelTags = 'external nofollow noopener noreferrer';
147
+
148
+            $Parsed = preg_replace(
149
+                '/<a href="https?:\/\//',
150
+                '<a class="external" rel="'.$RelTags.'" target="_blank" href="https://',
151
+                $Parsed
152
+            );
153
+
154
+            $Parsed = preg_replace(
155
+                '/<a href="ftps?:\/\//',
156
+                '<a class="external" rel="'.$RelTags.'" target="_blank" href="ftps://',
157
+                $Parsed
158
+            );
159
+
160
+            return $Parsed;       
161
+    }
131
     
162
     
163
+
132
     /**
164
     /**
133
      * Output BBCode as XHTML
165
      * Output BBCode as XHTML
134
      *
166
      *
152
         )) {
184
         )) {
153
             $Parsedown = new ParsedownExtra();
185
             $Parsedown = new ParsedownExtra();
154
             $Parsedown->setSafeMode(true);
186
             $Parsedown->setSafeMode(true);
187
+
188
+            # Prepare clean escapes
155
             $Str = html_entity_decode($Str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
189
             $Str = html_entity_decode($Str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
156
 
190
 
191
+            # Parse early and post-process
192
+            $Parsed = $Parsedown->text($Str);
193
+            
194
+            # Replace links to $ENV->SITE_DOMAIN
195
+            $Parsed = self::fix_links($Parsed);
196
+
197
+            return $Parsed;
198
+
157
             # Markdown ToC not happening yet
199
             # Markdown ToC not happening yet
158
             # Shouldn't parse_toc() output HTML
200
             # Shouldn't parse_toc() output HTML
159
             /*
201
             /*
174
             }
216
             }
175
             */
217
             */
176
 
218
 
177
-            return $P = $Parsedown->text($Str);
178
-
179
         /*
219
         /*
180
         return $P =
220
         return $P =
181
             ((self::$TOC && $OutputTOC)
221
             ((self::$TOC && $OutputTOC)
183
                 : null)
223
                 : null)
184
             . $Parsedown->text($Str);
224
             . $Parsedown->text($Str);
185
         */
225
         */
186
-        } else {
226
+        }
227
+        
228
+        /**
229
+         * BBcode formatting
230
+         */
231
+        else {
187
             global $Debug;
232
             global $Debug;
188
             $Debug->set_flag('BBCode start');
233
             $Debug->set_flag('BBCode start');
189
 
234
 
190
             self::$Headlines = [];
235
             self::$Headlines = [];
191
             $Str = display_str($Str);
236
             $Str = display_str($Str);
192
 
237
 
193
-            # Checkboxes: broken and stupid
194
-            /*
195
-            $Str = preg_replace('/\[\\[(ch|uch)]\]/i', '', $Str);
196
-            $Str = preg_replace('/\[ch\]/i', '[ch][/ch]', $Str);
197
-            $Str = preg_replace('/\[uch\]/i', '[uch][/uch]', $Str);
198
-            */
199
-
200
             // Inline links
238
             // Inline links
201
             $URLPrefix = '(\[url\]|\[url\=|\[img\=|\[img\])';
239
             $URLPrefix = '(\[url\]|\[url\=|\[img\=|\[img\])';
202
             $Str = preg_replace('/'.$URLPrefix.'\s+/i', '$1', $Str);
240
             $Str = preg_replace('/'.$URLPrefix.'\s+/i', '$1', $Str);
203
             $Str = preg_replace('/(?<!'.$URLPrefix.')http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str);
241
             $Str = preg_replace('/(?<!'.$URLPrefix.')http(s)?:\/\//i', '$1[inlineurl]http$2://', $Str);
204
             $Str = preg_replace('/\[embed\]\[inlineurl\]/', '[embed]', $Str);
242
             $Str = preg_replace('/\[embed\]\[inlineurl\]/', '[embed]', $Str);
205
 
243
 
206
-            // For anonym.to and archive.org links, remove any [inlineurl] in the middle of the link
207
-            /*
208
-            $Str = preg_replace_callback(
209
-                '/(?<=\[inlineurl\]|'.$URLPrefix.')(\S*\[inlineurl\]\S*)/m',
210
-                function ($matches) {
211
-                    return str_replace("[inlineurl]", "", $matches[0]);
212
-                },
213
-                $Str
214
-            );
215
-            */
216
-
217
             if (self::$TOC) {
244
             if (self::$TOC) {
218
                 $Str = preg_replace('/(\={5})([^=].*)\1/i', '[headline=4]$2[/headline]', $Str);
245
                 $Str = preg_replace('/(\={5})([^=].*)\1/i', '[headline=4]$2[/headline]', $Str);
219
                 $Str = preg_replace('/(\={4})([^=].*)\1/i', '[headline=3]$2[/headline]', $Str);
246
                 $Str = preg_replace('/(\={4})([^=].*)\1/i', '[headline=3]$2[/headline]', $Str);
233
                 $HTML = self::parse_toc($Min) . $HTML;
260
                 $HTML = self::parse_toc($Min) . $HTML;
234
             }
261
             }
235
 
262
 
263
+            # Rewrite the URLs
264
+            $HTML = self::fix_links($HTML);
265
+
236
             $Debug->set_flag('BBCode end');
266
             $Debug->set_flag('BBCode end');
237
             return $HTML;
267
             return $HTML;
238
         }
268
         }
871
                   break;
901
                   break;
872
 
902
 
873
 
903
 
874
-                /*
875
-                case 'ch':
876
-                  $Str .= '<input type="checkbox" checked="checked" disabled="disabled">';
877
-                  break;
878
-                */
879
-
880
-
881
-                /*
882
-                case 'uch':
883
-                  $Str .= '<input type="checkbox" disabled="disabled">';
884
-                  break;
885
-                */
886
-
887
-
888
                 case 'list':
904
                 case 'list':
889
                   $Str .= "<$Block[ListType] class=\"postlist\">";
905
                   $Str .= "<$Block[ListType] class=\"postlist\">";
890
                   foreach ($Block['Val'] as $Line) {
906
                   foreach ($Block['Val'] as $Line) {
1051
                       if ($LocalURL) {
1067
                       if ($LocalURL) {
1052
                           $Str .= '<a href="'.$LocalURL.'">'.substr($LocalURL, 1).'</a>';
1068
                           $Str .= '<a href="'.$LocalURL.'">'.substr($LocalURL, 1).'</a>';
1053
                       } else {
1069
                       } else {
1054
-                          $Str .= '<a rel="noreferrer" target="_blank" href="'.$Block['Attr'].'">'.$Block['Attr'].'</a>';
1070
+                          $Str .= '<a href="'.$Block['Attr'].'">'.$Block['Attr'].'</a>';
1071
+                          #$Str .= '<a rel="noreferrer" target="_blank" href="'.$Block['Attr'].'">'.$Block['Attr'].'</a>';
1055
                       }
1072
                       }
1056
                   }
1073
                   }
1057
                   break;
1074
                   break;

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

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

+ 2
- 16
design/privateheader.php View File

252
           <li id="nav_irc" <?=
252
           <li id="nav_irc" <?=
253
             Format::add_class($PageID, ['chat'], 'active', true)?>>
253
             Format::add_class($PageID, ['chat'], 'active', true)?>>
254
             <a href="https://join.slack.com/t/biotorrents/shared_invite/<?=$ENV->SLACK_INVITE?>"
254
             <a href="https://join.slack.com/t/biotorrents/shared_invite/<?=$ENV->SLACK_INVITE?>"
255
-              target="_blank">Slack
256
-              <img src="/static/common/symbols/external.png" style="height: 0.75em; vertical-align: center;" /></a>
255
+              target="_blank">Slack</a>
257
           </li>
256
           </li>
258
 
257
 
259
           <li id="nav_top10" <?=
258
           <li id="nav_top10" <?=
609
     }
608
     }
610
 }
609
 }
611
 
610
 
612
-if (check_perms('users_mod')) {
613
-    $NumDeleteRequests = G::$Cache->get_value('num_deletion_requests');
614
-    if ($NumDeleteRequests === false) {
615
-        G::$DB->query("SELECT COUNT(*) FROM deletion_requests");
616
-        list($NumDeleteRequests) = G::$DB->next_record();
617
-        G::$Cache->cache_value('num_deletion_requests', $NumDeleteRequests);
618
-    }
619
-
620
-    if ($NumDeleteRequests > 0) {
621
-        $ModBar[] = '<a href="tools.php?action=expunge_requests">' . $NumDeleteRequests . " Expunge request".($NumDeleteRequests > 1 ? 's' : '')."</a>";
622
-    }
623
-}
624
-
625
 if (check_perms('users_mod') && FEATURE_EMAIL_REENABLE) {
611
 if (check_perms('users_mod') && FEATURE_EMAIL_REENABLE) {
626
     $NumEnableRequests = G::$Cache->get_value(AutoEnable::CACHE_KEY_NAME);
612
     $NumEnableRequests = G::$Cache->get_value(AutoEnable::CACHE_KEY_NAME);
627
     if ($NumEnableRequests === false) {
613
     if ($NumEnableRequests === false) {
638
 if (!empty($Alerts) || !empty($ModBar)) { ?>
624
 if (!empty($Alerts) || !empty($ModBar)) { ?>
639
     <div id="alerts">
625
     <div id="alerts">
640
       <?php foreach ($Alerts as $Alert) { ?>
626
       <?php foreach ($Alerts as $Alert) { ?>
641
-      <div class="alertbar">
627
+      <div class="alertbar warning">
642
         <?=$Alert?>
628
         <?=$Alert?>
643
       </div>
629
       </div>
644
       <?php
630
       <?php

+ 2
- 2
design/publicfooter.php View File

7
 </main>
7
 </main>
8
 
8
 
9
 <footer>
9
 <footer>
10
-  <a href="https://github.com/biotorrents/gazelle" target="_blank">GitHub</a>
11
-  <a href="https://docs.biotorrents.de" target="_blank">API</a>
12
   <a href="/legal.php?p=privacy">Privacy</a>
10
   <a href="/legal.php?p=privacy">Privacy</a>
13
   <a href="/legal.php?p=dmca">DMCA</a>
11
   <a href="/legal.php?p=dmca">DMCA</a>
12
+  <a class="external" href="https://github.com/biotorrents" target="_blank">GitHub</a>
13
+  <a class="external" href="https://patreon.com/biotorrents" target="_blank">Patreon</a>
14
 </footer>
14
 </footer>
15
 
15
 
16
 <script src="$ENV->STATIC_SERVER/functions/vendor/instantpage.js" type="module"></script>
16
 <script src="$ENV->STATIC_SERVER/functions/vendor/instantpage.js" type="module"></script>

+ 2
- 8
design/publicheader.php View File

68
     echo '<a href="register.php">Register</a>';
68
     echo '<a href="register.php">Register</a>';
69
 }
69
 }
70
 
70
 
71
-/*
72
-$Email = $ENV->HELP->Email;
73
-$Subject = $ENV->HELP->Subject;
74
-$Body = $ENV->HELP->Body;
75
-echo "<a href='mailto:$Email?subject=$Subject&body=$Body'>Support</a>";
76
-*/
77
-
78
 echo <<<HTML
71
 echo <<<HTML
79
-    <a href="https://github.com/biotorrents/gazelle/issues" target="_blank">Support</a>
72
+    <a href="/legal.php?p=about">About</a>
73
+    <a class="external" href="https://docs.torrents.bio" target="_blank">Docs</a>
80
   </header>
74
   </header>
81
 
75
 
82
 <main>
76
 <main>

+ 0
- 10
gazelle.sql View File

290
 ) ENGINE=InnoDB CHARSET=utf8mb4;
290
 ) ENGINE=InnoDB CHARSET=utf8mb4;
291
 
291
 
292
 
292
 
293
-CREATE TABLE `deletion_requests` (
294
-  `UserID` int unsigned NOT NULL,
295
-  `Value` varchar(255) NOT NULL,
296
-  `Type` varchar(255) NOT NULL,
297
-  `Reason` text,
298
-  `Time` datetime,
299
-  PRIMARY KEY (`UserID`,`Value`)
300
-) ENGINE=InnoDB CHARSET=utf8mb4;
301
-
302
-
303
 -- 2020-03-09
293
 -- 2020-03-09
304
 CREATE TABLE `donations` (
294
 CREATE TABLE `donations` (
305
   `UserID` int NOT NULL,
295
   `UserID` int NOT NULL,

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

467
 // Comments (must be loaded before View::show_header so that subscriptions and quote notifications are handled properly)
467
 // Comments (must be loaded before View::show_header so that subscriptions and quote notifications are handled properly)
468
 list($NumComments, $Page, $Thread, $LastRead) = Comments::load('artist', $ArtistID);
468
 list($NumComments, $Page, $Thread, $LastRead) = Comments::load('artist', $ArtistID);
469
 
469
 
470
-View::show_header($Name, 'browse,requests,bbcode,comments,recommend,subscriptions');
470
+View::show_header($Name, 'browse,requests,comments,recommend,subscriptions');
471
 ?>
471
 ?>
472
 <div>
472
 <div>
473
   <div class="header">
473
   <div class="header">

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

29
 // Start printing
29
 // Start printing
30
 View::show_header(
30
 View::show_header(
31
     "Comments for collage $Name",
31
     "Comments for collage $Name",
32
-    'comments,bbcode,subscriptions,vendor/easymde.min',
32
+    'comments,subscriptions,vendor/easymde.min',
33
     'vendor/easymde.min'
33
     'vendor/easymde.min'
34
 );
34
 );
35
 ?>
35
 ?>

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

86
     $CollagePages[] = $CollagePage;
86
     $CollagePages[] = $CollagePage;
87
 }
87
 }
88
 
88
 
89
-View::show_header($Name, 'browse,collage,bbcode,recommend');
89
+View::show_header($Name, 'browse,collage,recommend');
90
 ?>
90
 ?>
91
 
91
 
92
 <div>
92
 <div>

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

21
 
21
 
22
 View::show_header(
22
 View::show_header(
23
     'Edit',
23
     'Edit',
24
-    'bbcode,vendor/easymde.min',
24
+    'vendor/easymde.min',
25
     'vendor/easymde.min'
25
     'vendor/easymde.min'
26
 );
26
 );
27
 
27
 

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

3
 
3
 
4
 View::show_header(
4
 View::show_header(
5
     'Create a collection',
5
     'Create a collection',
6
-    'bbcode,vendor/easymde.min',
6
+    'vendor/easymde.min',
7
     'vendor/easymde.min'
7
     'vendor/easymde.min'
8
 );
8
 );
9
 
9
 

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

340
 
340
 
341
 View::show_header(
341
 View::show_header(
342
     $Name,
342
     $Name,
343
-    'browse,collage,bbcode,recommend,wall'
343
+    'browse,collage,recommend,wall'
344
 );
344
 );
345
 ?>
345
 ?>
346
 
346
 

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

275
 }
275
 }
276
 $Links = implode(' ', $ActionLinks) . (count($TypeLinks) ? '<br />' . implode(' ', $TypeLinks) : '');
276
 $Links = implode(' ', $ActionLinks) . (count($TypeLinks) ? '<br />' . implode(' ', $TypeLinks) : '');
277
 
277
 
278
-View::show_header($Title, 'bbcode,comments');
278
+View::show_header($Title, 'comments');
279
 ?><div>
279
 ?><div>
280
   <div class="header">
280
   <div class="header">
281
     <h2><?=$Header?></h2>
281
     <h2><?=$Header?></h2>

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

28
 $ENV = ENV::go();
28
 $ENV = ENV::go();
29
 View::show_header(
29
 View::show_header(
30
     "Forums $ENV->CRUMB ".$Forum['Name']." $ENV->CRUMB New Topic",
30
     "Forums $ENV->CRUMB ".$Forum['Name']." $ENV->CRUMB New Topic",
31
-    'comments,bbcode,vendor/jquery.validate.min,form_validate,vendor/easymde.min',
31
+    'comments,vendor/jquery.validate.min,form_validate,vendor/easymde.min',
32
     'vendor/easymde.min'
32
     'vendor/easymde.min'
33
 );
33
 );
34
 ?>
34
 ?>

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

88
 }
88
 }
89
 
89
 
90
 // Let's hope we got some results - start printing out the content
90
 // Let's hope we got some results - start printing out the content
91
-View::show_header('Forums &gt; Search', 'bbcode,forum_search');
91
+View::show_header('Forums &gt; Search', 'forum_search');
92
 ?>
92
 ?>
93
 
93
 
94
 <div class="header">
94
 <div class="header">

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

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

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

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

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

11
 $Key = (int) $_POST['key'];
11
 $Key = (int) $_POST['key'];
12
 $UserInfo = Users::user_info($UserID);
12
 $UserInfo = Users::user_info($UserID);
13
 
13
 
14
-$DB->query("
14
+$DB->prepared_query("
15
   SELECT p.Body, t.ForumID
15
   SELECT p.Body, t.ForumID
16
   FROM forums_posts AS p
16
   FROM forums_posts AS p
17
     JOIN forums_topics AS t ON p.TopicID = t.ID
17
     JOIN forums_topics AS t ON p.TopicID = t.ID
18
   WHERE p.ID = '$PostID'");
18
   WHERE p.ID = '$PostID'");
19
 list($PostBody, $ForumID) = $DB -> next_record();
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
 <div>
24
 <div>
75
             <textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90"
75
             <textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90"
76
               rows="8"><?=$PostBody?></textarea>
76
               rows="8"><?=$PostBody?></textarea>
77
             <br />
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
           </td>
79
           </td>
80
         </tr>
80
         </tr>
81
       </table>
81
       </table>

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

1
 <?php
1
 <?php
2
+declare(strict_types = 1);
3
+
2
 authorize();
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
 // Check if the user $FriendID exists
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
 if (!$DB->has_results()) {
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
   VALUES
23
   VALUES
21
-    ('$LoggedUser[ID]', '$FriendID')");
24
+    ('$LoggedUser[ID]', '$FriendID')
25
+");
22
 
26
 
23
 header('Location: friends.php');
27
 header('Location: friends.php');

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

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
 header('Location: friends.php');
11
 header('Location: friends.php');
9
-?>

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

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

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

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

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

19
     error(403);
19
     error(403);
20
 }
20
 }
21
 
21
 
22
-$DB->query("
22
+$DB->prepared_query("
23
   SELECT Username
23
   SELECT Username
24
   FROM users_main
24
   FROM users_main
25
   WHERE ID='$ToID'");
25
   WHERE ID='$ToID'");
29
 }
29
 }
30
 View::show_header(
30
 View::show_header(
31
     'Compose',
31
     'Compose',
32
-    'inbox,bbcode,vendor/jquery.validate.min,form_validate,vendor/easymde.min',
32
+    'inbox,vendor/jquery.validate.min,form_validate,vendor/easymde.min',
33
     'vendor/easymde.min'
33
     'vendor/easymde.min'
34
 );
34
 );
35
 ?>
35
 ?>
60
       <div id="preview" class="hidden"></div>
60
       <div id="preview" class="hidden"></div>
61
       <div id="buttons" class="center">
61
       <div id="buttons" class="center">
62
         <input type="button" value="Preview" onclick="Quick_Preview();" />
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
       </div>
64
       </div>
65
     </div>
65
     </div>
66
   </form>
66
   </form>

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

63
 
63
 
64
 View::show_header(
64
 View::show_header(
65
     "View conversation $Subject",
65
     "View conversation $Subject",
66
-    'comments,inbox,bbcode,vendor/jquery.validate.min,form_validate,vendor/easymde.min',
66
+    'comments,inbox,vendor/jquery.validate.min,form_validate,vendor/easymde.min',
67
     'vendor/easymde.min'
67
     'vendor/easymde.min'
68
 );
68
 );
69
 
69
 

+ 6
- 0
sections/legal/index.php View File

5
 $p = $_GET['p'];
5
 $p = $_GET['p'];
6
 
6
 
7
 switch ($p) {
7
 switch ($p) {
8
+    case 'about':
9
+        View::show_header('About');
10
+        echo $Twig->render('legal/about.html');
11
+        View::show_footer();
12
+        break;
13
+
8
     case 'privacy':
14
     case 'privacy':
9
         View::show_header('Privacy');
15
         View::show_header('Privacy');
10
         echo $Twig->render('legal/privacy.html');
16
         echo $Twig->render('legal/privacy.html');

+ 1
- 1
sections/reports/compose.php View File

35
 if (!$ComposeToUsername) {
35
 if (!$ComposeToUsername) {
36
   error(404);
36
   error(404);
37
 }
37
 }
38
-View::show_header('Compose', 'inbox,bbcode');
38
+View::show_header('Compose', 'inbox');
39
 
39
 
40
 // $TypeLink is placed directly in the <textarea> when composing a PM
40
 // $TypeLink is placed directly in the <textarea> when composing a PM
41
 switch ($Type) {
41
 switch ($Type) {

+ 1
- 1
sections/reports/report.php View File

128
 
128
 
129
 View::show_header(
129
 View::show_header(
130
     'Report a '.$Type['title'],
130
     'Report a '.$Type['title'],
131
-    'bbcode,vendor/jquery.validate.min,form_validate'
131
+    'vendor/jquery.validate.min,form_validate'
132
 );
132
 );
133
 ?>
133
 ?>
134
 <div class="thin">
134
 <div class="thin">

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

13
 include(SERVER_ROOT . '/sections/reports/array.php');
13
 include(SERVER_ROOT . '/sections/reports/array.php');
14
 
14
 
15
 // Header
15
 // Header
16
-View::show_header('Reports', 'bbcode,reports');
16
+View::show_header('Reports', 'reports');
17
 
17
 
18
 if (isset($_GET['id']) && $_GET['id'] && is_number($_GET['id'])) {
18
 if (isset($_GET['id']) && $_GET['id'] && is_number($_GET['id'])) {
19
   $View = 'Single report';
19
   $View = 'Single report';

+ 3
- 3
sections/reportsv2/ajax_create_report.php View File

23
   $TorrentID = $_POST['torrentid'];
23
   $TorrentID = $_POST['torrentid'];
24
 }
24
 }
25
 
25
 
26
-$DB->query("
26
+$DB->prepared_query("
27
   SELECT tg.CategoryID
27
   SELECT tg.CategoryID
28
   FROM torrents_group AS tg
28
   FROM torrents_group AS tg
29
     JOIN torrents AS t ON t.GroupID = tg.ID
29
     JOIN torrents AS t ON t.GroupID = tg.ID
63
   error();
63
   error();
64
 }
64
 }
65
 
65
 
66
-$DB->query("
66
+$DB->prepared_query("
67
   SELECT ID
67
   SELECT ID
68
   FROM reportsv2
68
   FROM reportsv2
69
   WHERE TorrentID = $TorrentID
69
   WHERE TorrentID = $TorrentID
73
   error();
73
   error();
74
 }
74
 }
75
 
75
 
76
-$DB->query("
76
+$DB->prepared_query("
77
   INSERT INTO reportsv2
77
   INSERT INTO reportsv2
78
     (ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, ExtraID)
78
     (ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, ExtraID)
79
   VALUES
79
   VALUES

+ 2
- 2
sections/reportsv2/ajax_giveback_report.php View File

7
   error();
7
   error();
8
 }
8
 }
9
 
9
 
10
-$DB->query("
10
+$DB->prepared_query("
11
   SELECT Status
11
   SELECT Status
12
   FROM reportsv2
12
   FROM reportsv2
13
   WHERE ID = ".$_GET['id']);
13
   WHERE ID = ".$_GET['id']);
14
 list($Status) = $DB->next_record();
14
 list($Status) = $DB->next_record();
15
 if (isset($Status)) {
15
 if (isset($Status)) {
16
-  $DB->query("
16
+  $DB->prepared_query("
17
     UPDATE reportsv2
17
     UPDATE reportsv2
18
     SET Status = 'New', ResolverID = 0
18
     SET Status = 'New', ResolverID = 0
19
     WHERE ID = ".$_GET['id']);
19
     WHERE ID = ".$_GET['id']);

+ 1
- 1
sections/reportsv2/ajax_grab_report.php View File

13
   error();
13
   error();
14
 }
14
 }
15
 
15
 
16
-$DB->query("
16
+$DB->prepared_query("
17
   UPDATE reportsv2
17
   UPDATE reportsv2
18
   SET Status = 'InProgress',
18
   SET Status = 'InProgress',
19
     ResolverID = " . $LoggedUser['ID'] . "
19
     ResolverID = " . $LoggedUser['ID'] . "

+ 7
- 7
sections/reportsv2/ajax_new_report.php View File

10
 }
10
 }
11
 
11
 
12
 
12
 
13
-$DB->query("
13
+$DB->prepared_query("
14
   SELECT
14
   SELECT
15
     r.ID,
15
     r.ID,
16
     r.ReporterID,
16
     r.ReporterID,
79
 
79
 
80
     if (!$GroupID) {
80
     if (!$GroupID) {
81
       //Torrent already deleted
81
       //Torrent already deleted
82
-      $DB->query("
82
+      $DB->prepared_query("
83
         UPDATE reportsv2
83
         UPDATE reportsv2
84
         SET
84
         SET
85
           Status = 'Resolved',
85
           Status = 'Resolved',
94
 <?
94
 <?
95
       error();
95
       error();
96
     }
96
     }
97
-    $DB->query("
97
+    $DB->prepared_query("
98
       UPDATE reportsv2
98
       UPDATE reportsv2
99
       SET Status = 'InProgress',
99
       SET Status = 'InProgress',
100
         ResolverID = ".$LoggedUser['ID']."
100
         ResolverID = ".$LoggedUser['ID']."
155
               uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
155
               uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
156
               <br />
156
               <br />
157
               <div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
157
               <div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
158
-<?php $DB->query("
158
+<?php $DB->prepared_query("
159
             SELECT r.ID
159
             SELECT r.ID
160
             FROM reportsv2 AS r
160
             FROM reportsv2 AS r
161
               LEFT JOIN torrents AS t ON t.ID = r.TorrentID
161
               LEFT JOIN torrents AS t ON t.ID = r.TorrentID
167
               <div style="text-align: right;">
167
               <div style="text-align: right;">
168
                 <a href="reportsv2.php?view=group&amp;id=<?=$GroupID?>">There <?=(($GroupOthers > 1) ? "are $GroupOthers other reports" : "is 1 other report")?> for torrents in this group</a>
168
                 <a href="reportsv2.php?view=group&amp;id=<?=$GroupID?>">There <?=(($GroupOthers > 1) ? "are $GroupOthers other reports" : "is 1 other report")?> for torrents in this group</a>
169
               </div>
169
               </div>
170
-<?php $DB->query("
170
+<?php $DB->prepared_query("
171
             SELECT t.UserID
171
             SELECT t.UserID
172
             FROM reportsv2 AS r
172
             FROM reportsv2 AS r
173
               JOIN torrents AS t ON t.ID = r.TorrentID
173
               JOIN torrents AS t ON t.ID = r.TorrentID
181
               </div>
181
               </div>
182
 <?php }
182
 <?php }
183
 
183
 
184
-        $DB->query("
184
+        $DB->prepared_query("
185
             SELECT DISTINCT req.ID,
185
             SELECT DISTINCT req.ID,
186
               req.FillerID,
186
               req.FillerID,
187
               um.Username,
187
               um.Username,
242
         $First = true;
242
         $First = true;
243
         $Extras = explode(' ', $ExtraIDs);
243
         $Extras = explode(' ', $ExtraIDs);
244
         foreach ($Extras as $ExtraID) {
244
         foreach ($Extras as $ExtraID) {
245
-            $DB->query("
245
+            $DB->prepared_query("
246
                 SELECT
246
                 SELECT
247
                   tg.Name,
247
                   tg.Name,
248
                   tg.ID,
248
                   tg.ID,

+ 2
- 2
sections/reportsv2/ajax_update_comment.php View File

12
 $Message = db_string($_POST['comment']);
12
 $Message = db_string($_POST['comment']);
13
 //Message can be blank!
13
 //Message can be blank!
14
 
14
 
15
-$DB->query("
15
+$DB->prepared_query("
16
   SELECT ModComment
16
   SELECT ModComment
17
   FROM reportsv2
17
   FROM reportsv2
18
   WHERE ID = $ReportID");
18
   WHERE ID = $ReportID");
19
 list($ModComment) = $DB->next_record();
19
 list($ModComment) = $DB->next_record();
20
 if (isset($ModComment)) {
20
 if (isset($ModComment)) {
21
-  $DB->query("
21
+  $DB->prepared_query("
22
     UPDATE reportsv2
22
     UPDATE reportsv2
23
     SET ModComment = '$Message'
23
     SET ModComment = '$Message'
24
     WHERE ID = $ReportID");
24
     WHERE ID = $ReportID");

+ 1
- 1
sections/reportsv2/ajax_update_resolve.php View File

30
   error();
30
   error();
31
 }
31
 }
32
 
32
 
33
-$DB->query("
33
+$DB->prepared_query("
34
   UPDATE reportsv2
34
   UPDATE reportsv2
35
   SET Type = '$NewType'
35
   SET Type = '$NewType'
36
   WHERE ID = $ReportID");
36
   WHERE ID = $ReportID");

+ 2
- 2
sections/reportsv2/report.php View File

17
     }
17
     }
18
 } else {
18
 } else {
19
     $TorrentID = $_GET['id'];
19
     $TorrentID = $_GET['id'];
20
-    $DB->query("
20
+    $DB->prepared_query("
21
     SELECT tg.`category_id`, t.`GroupID`, u.`Username`
21
     SELECT tg.`category_id`, t.`GroupID`, u.`Username`
22
     FROM `torrents_group` AS tg
22
     FROM `torrents_group` AS tg
23
       LEFT JOIN `torrents` AS t ON t.`GroupID` = tg.`id`
23
       LEFT JOIN `torrents` AS t ON t.`GroupID` = tg.`id`
67
     */
67
     */
68
 }
68
 }
69
 
69
 
70
-View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
70
+View::show_header('Report', 'reportsv2,browse,torrent,recommend');
71
 ?>
71
 ?>
72
 
72
 
73
 <div>
73
 <div>

+ 12
- 12
sections/reportsv2/static.php View File

62
 } else {
62
 } else {
63
     switch ($View) {
63
     switch ($View) {
64
     case 'staff':
64
     case 'staff':
65
-      $DB->query("
65
+      $DB->prepared_query("
66
         SELECT `Username`
66
         SELECT `Username`
67
         FROM `users_main`
67
         FROM `users_main`
68
         WHERE `ID` = $ID");
68
         WHERE `ID` = $ID");
78
       break;
78
       break;
79
 
79
 
80
     case 'resolver':
80
     case 'resolver':
81
-      $DB->query("
81
+      $DB->prepared_query("
82
         SELECT `Username`
82
         SELECT `Username`
83
         FROM `users_main`
83
         FROM `users_main`
84
         WHERE `ID` = $ID");
84
         WHERE `ID` = $ID");
112
       break;
112
       break;
113
 
113
 
114
     case 'reporter':
114
     case 'reporter':
115
-      $DB->query("
115
+      $DB->prepared_query("
116
         SELECT `Username`
116
         SELECT `Username`
117
         FROM `users_main`
117
         FROM `users_main`
118
         WHERE `ID` = $ID");
118
         WHERE `ID` = $ID");
127
       break;
127
       break;
128
 
128
 
129
     case 'uploader':
129
     case 'uploader':
130
-      $DB->query("
130
+      $DB->prepared_query("
131
         SELECT `Username`
131
         SELECT `Username`
132
         FROM `users_main`
132
         FROM `users_main`
133
         WHERE `ID` = $ID");
133
         WHERE `ID` = $ID");
158
 /**
158
 /**
159
  * The large query
159
  * The large query
160
  */
160
  */
161
-$DB->query("
161
+$DB->prepared_query("
162
   SELECT
162
   SELECT
163
     SQL_CALC_FOUND_ROWS
163
     SQL_CALC_FOUND_ROWS
164
     r.`ID`,
164
     r.`ID`,
211
 
211
 
212
 $Reports = $DB->to_array();
212
 $Reports = $DB->to_array();
213
 
213
 
214
-$DB->query('SELECT FOUND_ROWS()');
214
+$DB->prepared_query('SELECT FOUND_ROWS()');
215
 list($Results) = $DB->next_record();
215
 list($Results) = $DB->next_record();
216
 $PageLinks = Format::get_pages($Page, $Results, REPORTS_PER_PAGE, 11);
216
 $PageLinks = Format::get_pages($Page, $Results, REPORTS_PER_PAGE, 11);
217
 
217
 
218
-View::show_header('Reports V2!', 'reportsv2,bbcode');
218
+View::show_header('Reports V2!', 'reportsv2');
219
 ?>
219
 ?>
220
 <div class="header">
220
 <div class="header">
221
   <h2><?=$Title?></h2>
221
   <h2><?=$Title?></h2>
253
 
253
 
254
           if (!$GroupID && $Status != 'Resolved') {
254
           if (!$GroupID && $Status != 'Resolved') {
255
               //Torrent already deleted
255
               //Torrent already deleted
256
-              $DB->query("
256
+              $DB->prepared_query("
257
         UPDATE `reportsv2`
257
         UPDATE `reportsv2`
258
         SET
258
         SET
259
           `Status` = 'Resolved',
259
           `Status` = 'Resolved',
338
 } ?>
338
 } ?>
339
             <div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
339
             <div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
340
 <?php if ($Status != 'Resolved') {
340
 <?php if ($Status != 'Resolved') {
341
-    $DB->query("
341
+    $DB->prepared_query("
342
             SELECT r.`ID`
342
             SELECT r.`ID`
343
             FROM `reportsv2` AS r
343
             FROM `reportsv2` AS r
344
               LEFT JOIN `torrents` AS t ON t.`ID` = r.`TorrentID`
344
               LEFT JOIN `torrents` AS t ON t.`ID` = r.`TorrentID`
352
             </div>
352
             </div>
353
 <?php }
353
 <?php }
354
 
354
 
355
-    $DB->query("
355
+    $DB->prepared_query("
356
             SELECT t.`UserID`
356
             SELECT t.`UserID`
357
             FROM `reportsv2` AS r
357
             FROM `reportsv2` AS r
358
               JOIN `torrents` AS t ON t.`ID` = r.`TorrentID`
358
               JOIN `torrents` AS t ON t.`ID` = r.`TorrentID`
366
             </div>
366
             </div>
367
 <?php }
367
 <?php }
368
 
368
 
369
-    $DB->query("
369
+    $DB->prepared_query("
370
             SELECT DISTINCT req.`ID`,
370
             SELECT DISTINCT req.`ID`,
371
               req.`FillerID`,
371
               req.`FillerID`,
372
               um.`Username`,
372
               um.`Username`,
428
         $First = true;
428
         $First = true;
429
         $Extras = explode(' ', $ExtraIDs);
429
         $Extras = explode(' ', $ExtraIDs);
430
         foreach ($Extras as $ExtraID) {
430
         foreach ($Extras as $ExtraID) {
431
-            $DB->query("
431
+            $DB->prepared_query("
432
             SELECT
432
             SELECT
433
               COALESCE(NULLIF(tg.`title`, ''), NULLIF(tg.`subject`, ''), tg.`object`) AS Name,
433
               COALESCE(NULLIF(tg.`title`, ''), NULLIF(tg.`subject`, ''), tg.`object`) AS Name,
434
               tg.`id`,
434
               tg.`id`,

+ 74
- 82
sections/reportsv2/takereport.php View File

1
-<?
1
+<?php
2
 
2
 
3
 /**
3
 /**
4
  * This page handles the backend from when a user submits a report.
4
  * This page handles the backend from when a user submits a report.
14
 
14
 
15
 authorize();
15
 authorize();
16
 
16
 
17
-if (!is_number($_POST['torrentid'])) {
18
-  error(404);
19
-} else {
20
-  $TorrentID = $_POST['torrentid'];
21
-}
22
-
23
-if (!is_number($_POST['categoryid'])) {
24
-  error(404);
25
-} else {
26
-  $CategoryID = $_POST['categoryid'];
27
-}
17
+$TorrentID = (int) $_POST['torrentid'];
18
+$CategoryID = (int) $_POST['categoryid'];
19
+Security::checkInt($TorrentID, $CategoryID);
28
 
20
 
29
 if (!isset($_POST['type'])) {
21
 if (!isset($_POST['type'])) {
30
-  error(404);
22
+    error(404);
31
 } elseif (array_key_exists($_POST['type'], $Types[$CategoryID])) {
23
 } elseif (array_key_exists($_POST['type'], $Types[$CategoryID])) {
32
-  $Type = $_POST['type'];
33
-  $ReportType = $Types[$CategoryID][$Type];
24
+    $Type = $_POST['type'];
25
+    $ReportType = $Types[$CategoryID][$Type];
34
 } elseif (array_key_exists($_POST['type'], $Types['master'])) {
26
 } elseif (array_key_exists($_POST['type'], $Types['master'])) {
35
-  $Type = $_POST['type'];
36
-  $ReportType = $Types['master'][$Type];
27
+    $Type = $_POST['type'];
28
+    $ReportType = $Types['master'][$Type];
37
 } else {
29
 } else {
38
-  //There was a type but it wasn't an option!
39
-  error(403);
30
+    // There was a type but it wasn't an option!
31
+    error(403);
40
 }
32
 }
41
 
33
 
42
-
43
 foreach ($ReportType['report_fields'] as $Field => $Value) {
34
 foreach ($ReportType['report_fields'] as $Field => $Value) {
44
-  if ($Value == '1') {
45
-    if (empty($_POST[$Field])) {
46
-      $Err = "You are missing a required field ($Field) for a ".$ReportType['title'].' report.';
35
+    if ($Value === '1') {
36
+        if (empty($_POST[$Field])) {
37
+            $Err = "You are missing a required field ($Field) for a ".$ReportType['title'].' report.';
38
+        }
47
     }
39
     }
48
-  }
49
 }
40
 }
50
 
41
 
51
 if (!empty($_POST['sitelink'])) {
42
 if (!empty($_POST['sitelink'])) {
52
-  if (preg_match_all('/'.TORRENT_REGEX.'/i', $_POST['sitelink'], $Matches)) {
53
-    $ExtraIDs = implode(' ', $Matches[4]);
54
-    if (in_array($TorrentID, $Matches[4])) {
55
-      $Err = "The extra permalinks you gave included the link to the torrent you're reporting!";
43
+    if (preg_match_all('/'.TORRENT_REGEX.'/i', $_POST['sitelink'], $Matches)) {
44
+        $ExtraIDs = implode(' ', $Matches[4]);
45
+
46
+        if (in_array($TorrentID, $Matches[4])) {
47
+            $Err = "The extra permalinks you gave included the link to the torrent you're reporting!";
48
+        }
49
+    } else {
50
+        $Err = 'The permalink was incorrect. It should look like '.site_url().'torrents.php?torrentid=12345';
56
     }
51
     }
57
-  } else {
58
-    $Err = 'The permalink was incorrect. It should look like '.site_url().'torrents.php?torrentid=12345';
59
-  }
60
 }
52
 }
61
 
53
 
62
 if (!empty($_POST['link'])) {
54
 if (!empty($_POST['link'])) {
63
-  //resource_type://domain:port/filepathname?query_string#anchor
64
-  //          http://   www     .foo.com                /bar
65
-  if (preg_match_all('/'.URL_REGEX.'/is', $_POST['link'], $Matches)) {
66
-    $Links = implode(' ', $Matches[0]);
67
-  } else {
68
-    $Err = "The extra links you provided weren't links...";
69
-  }
55
+    // resource_type://domain:port/filepathname?query_string#anchor
56
+    if (preg_match_all('/'.URL_REGEX.'/is', $_POST['link'], $Matches)) {
57
+        $Links = implode(' ', $Matches[0]);
58
+    } else {
59
+        $Err = "The extra links you provided weren't links...";
60
+    }
70
 } else {
61
 } else {
71
-  $Links = '';
62
+    $Links = '';
72
 }
63
 }
73
 
64
 
74
 if (!empty($_POST['image'])) {
65
 if (!empty($_POST['image'])) {
75
-  if (preg_match("/^(".IMAGE_REGEX.")( ".IMAGE_REGEX.")*$/is", trim($_POST['image']), $Matches)) {
76
-    $Images = $Matches[0];
77
-  } else {
78
-    $Err = "The extra image links you provided weren't links to images...";
79
-  }
66
+    if (preg_match("/^(".IMAGE_REGEX.")( ".IMAGE_REGEX.")*$/is", trim($_POST['image']), $Matches)) {
67
+        $Images = $Matches[0];
68
+    } else {
69
+        $Err = "The extra image links you provided weren't links to images...";
70
+    }
80
 } else {
71
 } else {
81
-  $Images = '';
72
+    $Images = '';
82
 }
73
 }
83
 
74
 
84
 if (!empty($_POST['track'])) {
75
 if (!empty($_POST['track'])) {
85
-  if (preg_match('/([0-9]+( [0-9]+)*)|All/is', $_POST['track'], $Matches)) {
86
-    $Tracks = $Matches[0];
87
-  } else {
88
-    $Err = 'Tracks should be given in a space-separated list of numbers with no other characters.';
89
-  }
76
+    if (preg_match('/([0-9]+( [0-9]+)*)|All/is', $_POST['track'], $Matches)) {
77
+        $Tracks = $Matches[0];
78
+    } else {
79
+        $Err = 'Tracks should be given in a space-separated list of numbers with no other characters.';
80
+    }
90
 } else {
81
 } else {
91
-  $Tracks = '';
82
+    $Tracks = '';
92
 }
83
 }
93
 
84
 
94
 if (!empty($_POST['extra'])) {
85
 if (!empty($_POST['extra'])) {
95
-  $Extra = db_string($_POST['extra']);
86
+    $Extra = db_string($_POST['extra']);
96
 } else {
87
 } else {
97
-  $Err = 'As useful as blank reports are, could you be a tiny bit more helpful? (Leave a comment)';
88
+    $Err = 'As useful as blank reports are, could you be a tiny bit more helpful? (Leave a comment)';
98
 }
89
 }
99
 
90
 
100
-$DB->query("
101
-  SELECT GroupID
102
-  FROM torrents
103
-  WHERE ID = $TorrentID");
91
+$DB->prepared_query("
92
+  SELECT `GroupID`
93
+  FROM `torrents`
94
+  WHERE `ID` = '$TorrentID'
95
+  ");
104
 if (!$DB->has_results()) {
96
 if (!$DB->has_results()) {
105
-  $Err = "A torrent with that ID doesn't exist!";
97
+    $Err = "A torrent with that ID doesn't exist!";
106
 }
98
 }
107
 list($GroupID) = $DB->next_record();
99
 list($GroupID) = $DB->next_record();
108
 
100
 
109
 if (!empty($Err)) {
101
 if (!empty($Err)) {
110
-  error($Error = $Err, $Debug = false);
111
-  include(SERVER_ROOT.'/sections/reportsv2/report.php');
112
-  error();
102
+    error($Error = $Err, $Debug = false);
103
+    include(SERVER_ROOT.'/sections/reportsv2/report.php');
104
+    error();
113
 }
105
 }
114
 
106
 
115
-$DB->query("
116
-  SELECT ID
117
-  FROM reportsv2
118
-  WHERE TorrentID = $TorrentID
119
-    AND ReporterID = ".db_string($LoggedUser['ID'])."
120
-    AND ReportedTime > '".time_minus(3)."'");
107
+$DB->prepared_query("
108
+  SELECT `ID`
109
+  FROM `reportsv2`
110
+  WHERE `TorrentID` = '$TorrentID'
111
+    AND `ReporterID` = ".db_string($LoggedUser['ID'])."
112
+    AND `ReportedTime` > '".time_minus(3)."'");
121
 if ($DB->has_results()) {
113
 if ($DB->has_results()) {
122
-  header("Location: torrents.php?torrentid=$TorrentID");
123
-  error();
114
+    header("Location: torrents.php?torrentid=$TorrentID");
115
+    error();
124
 }
116
 }
125
 
117
 
126
-$DB->query("
127
-  INSERT INTO reportsv2
128
-    (ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, Track, Image, ExtraID, Link)
118
+$DB->prepared_query("
119
+  INSERT INTO `reportsv2`
120
+    (`ReporterID`, `TorrentID`, `Type`, `UserComment`, `Status`, `ReportedTime`, `Track`, `Image`, `ExtraID`, `Link`)
129
   VALUES
121
   VALUES
130
     (".db_string($LoggedUser['ID']).", $TorrentID, '".db_string($Type)."', '$Extra', 'New', NOW(), '".db_string($Tracks)."', '".db_string($Images)."', '".db_string($ExtraIDs)."', '".db_string($Links)."')");
122
     (".db_string($LoggedUser['ID']).", $TorrentID, '".db_string($Type)."', '$Extra', 'New', NOW(), '".db_string($Tracks)."', '".db_string($Images)."', '".db_string($ExtraIDs)."', '".db_string($Links)."')");
131
 
123
 
132
 $ReportID = $DB->inserted_id();
124
 $ReportID = $DB->inserted_id();
133
 
125
 
134
-$DB->query("
135
-  SELECT UserID
136
-  FROM torrents
137
-  WHERE ID = $TorrentID");
126
+$DB->prepared_query("
127
+  SELECT `UserID`
128
+  FROM `torrents`
129
+  WHERE `ID` = $TorrentID");
138
 list($UploaderID) = $DB->next_record();
130
 list($UploaderID) = $DB->next_record();
139
-$DB->query("
140
-  SELECT Name, Title2, NameJP
141
-  FROM torrents_group
142
-  WHERE ID = $GroupID");
131
+$DB->prepared_query("
132
+  SELECT `title`, `subject`, `object`
133
+  FROM `torrents_group`
134
+  WHERE `id` = '$GroupID'
135
+  ");
143
 list($GroupNameEng, $GroupTitle2, $GroupNameJP) = $DB->next_record();
136
 list($GroupNameEng, $GroupTitle2, $GroupNameJP) = $DB->next_record();
144
 $GroupName = $GroupNameEng ? $GroupNameEng : ($GroupTitle2 ? $GroupTitle2 : $GroupNameJP);
137
 $GroupName = $GroupNameEng ? $GroupNameEng : ($GroupTitle2 ? $GroupTitle2 : $GroupNameJP);
145
 
138
 
146
 Misc::send_pm($UploaderID, 0, "Torrent Reported: $GroupName", "Your torrent, \"[url=".site_url()."torrents.php?torrentid=$TorrentID]".$GroupName."[/url]\", was reported for the reason \"".$ReportType['title']."\".\n\nThe reporter also said: \"$Extra\"\n\nIf you think this report was in error, please contact staff. Failure to challenge some types of reports in a timely manner will be regarded as a lack of defense and may result in the torrent being deleted.");
139
 Misc::send_pm($UploaderID, 0, "Torrent Reported: $GroupName", "Your torrent, \"[url=".site_url()."torrents.php?torrentid=$TorrentID]".$GroupName."[/url]\", was reported for the reason \"".$ReportType['title']."\".\n\nThe reporter also said: \"$Extra\"\n\nIf you think this report was in error, please contact staff. Failure to challenge some types of reports in a timely manner will be regarded as a lack of defense and may result in the torrent being deleted.");
147
 
140
 
148
 $Cache->delete_value("reports_torrent_$TorrentID");
141
 $Cache->delete_value("reports_torrent_$TorrentID");
149
-
150
 $Cache->increment('num_torrent_reportsv2');
142
 $Cache->increment('num_torrent_reportsv2');
143
+
151
 header("Location: torrents.php?torrentid=$TorrentID");
144
 header("Location: torrents.php?torrentid=$TorrentID");
152
-?>

+ 19
- 19
sections/reportsv2/takeresolve.php View File

74
     }
74
     }
75
   }
75
   }
76
 
76
 
77
-  $DB->query("
77
+  $DB->prepared_query("
78
     UPDATE reportsv2
78
     UPDATE reportsv2
79
     SET
79
     SET
80
       Status = 'Resolved',
80
       Status = 'Resolved',
116
   error();
116
   error();
117
 }
117
 }
118
 
118
 
119
-$DB->query("
119
+$DB->prepared_query("
120
   SELECT ID
120
   SELECT ID
121
   FROM torrents
121
   FROM torrents
122
   WHERE ID = $TorrentID");
122
   WHERE ID = $TorrentID");
123
 $TorrentExists = ($DB->has_results());
123
 $TorrentExists = ($DB->has_results());
124
 if (!$TorrentExists) {
124
 if (!$TorrentExists) {
125
-  $DB->query("
125
+  $DB->prepared_query("
126
     UPDATE reportsv2
126
     UPDATE reportsv2
127
     SET Status = 'Resolved',
127
     SET Status = 'Resolved',
128
       LastChangeTime = NOW(),
128
       LastChangeTime = NOW(),
135
 
135
 
136
 if ($Report) {
136
 if ($Report) {
137
   //Resolve with a parallel check
137
   //Resolve with a parallel check
138
-  $DB->query("
138
+  $DB->prepared_query("
139
     UPDATE reportsv2
139
     UPDATE reportsv2
140
     SET Status = 'Resolved',
140
     SET Status = 'Resolved',
141
       LastChangeTime = NOW(),
141
       LastChangeTime = NOW(),
159
   }
159
   }
160
 
160
 
161
   if ($_POST['resolve_type'] == 'tags_lots') {
161
   if ($_POST['resolve_type'] == 'tags_lots') {
162
-    $DB->query("
162
+    $DB->prepared_query("
163
       INSERT IGNORE INTO torrents_bad_tags
163
       INSERT IGNORE INTO torrents_bad_tags
164
         (TorrentID, UserID, TimeAdded)
164
         (TorrentID, UserID, TimeAdded)
165
       VALUES
165
       VALUES
166
         ($TorrentID, ".$LoggedUser['ID']." , NOW())");
166
         ($TorrentID, ".$LoggedUser['ID']." , NOW())");
167
-    $DB->query("
167
+    $DB->prepared_query("
168
       SELECT GroupID
168
       SELECT GroupID
169
       FROM torrents
169
       FROM torrents
170
       WHERE ID = $TorrentID");
170
       WHERE ID = $TorrentID");
174
   }
174
   }
175
 
175
 
176
   if ($_POST['resolve_type'] == 'folders_bad') {
176
   if ($_POST['resolve_type'] == 'folders_bad') {
177
-    $DB->query("
177
+    $DB->prepared_query("
178
       INSERT IGNORE INTO torrents_bad_folders
178
       INSERT IGNORE INTO torrents_bad_folders
179
         (TorrentID, UserID, TimeAdded)
179
         (TorrentID, UserID, TimeAdded)
180
       VALUES
180
       VALUES
181
         ($TorrentID, ".$LoggedUser['ID'].", NOW())");
181
         ($TorrentID, ".$LoggedUser['ID'].", NOW())");
182
-    $DB->query("
182
+    $DB->prepared_query("
183
       SELECT GroupID
183
       SELECT GroupID
184
       FROM torrents
184
       FROM torrents
185
       WHERE ID = $TorrentID");
185
       WHERE ID = $TorrentID");
188
     $SendPM = true;
188
     $SendPM = true;
189
   }
189
   }
190
   if ($_POST['resolve_type'] == 'filename') {
190
   if ($_POST['resolve_type'] == 'filename') {
191
-    $DB->query("
191
+    $DB->prepared_query("
192
       INSERT IGNORE INTO torrents_bad_files
192
       INSERT IGNORE INTO torrents_bad_files
193
         (TorrentID, UserID, TimeAdded)
193
         (TorrentID, UserID, TimeAdded)
194
       VALUES
194
       VALUES
195
         ($TorrentID, ".$LoggedUser['ID'].", NOW())");
195
         ($TorrentID, ".$LoggedUser['ID'].", NOW())");
196
-    $DB->query("
196
+    $DB->prepared_query("
197
       SELECT GroupID
197
       SELECT GroupID
198
       FROM torrents
198
       FROM torrents
199
       WHERE ID = $TorrentID");
199
       WHERE ID = $TorrentID");
202
     $SendPM = true;
202
     $SendPM = true;
203
   }
203
   }
204
   if ($_POST['resolve_type'] == 'trump') {
204
   if ($_POST['resolve_type'] == 'trump') {
205
-    $DB->query("
205
+    $DB->prepared_query("
206
       SELECT
206
       SELECT
207
         r.ExtraID,
207
         r.ExtraID,
208
         HEX(t.info_hash)
208
         HEX(t.info_hash)
214
       $ExtraID = explode(' ', $ExtraID)[0];
214
       $ExtraID = explode(' ', $ExtraID)[0];
215
 
215
 
216
       $AffectedUsers = [];
216
       $AffectedUsers = [];
217
-      $DB->query("
217
+      $DB->prepared_query("
218
         SELECT UserID
218
         SELECT UserID
219
         FROM torrents
219
         FROM torrents
220
         WHERE ID = $TorrentID");
220
         WHERE ID = $TorrentID");
221
       if ($DB->has_results()) {
221
       if ($DB->has_results()) {
222
         list($AffectedUsers[]) = $DB->next_record();
222
         list($AffectedUsers[]) = $DB->next_record();
223
       }
223
       }
224
-      $DB->query("
224
+      $DB->prepared_query("
225
         SELECT uid
225
         SELECT uid
226
         FROM xbt_snatched
226
         FROM xbt_snatched
227
         WHERE fid = $TorrentID");
227
         WHERE fid = $TorrentID");
233
       $AffectedUsers = array_unique($AffectedUsers);
233
       $AffectedUsers = array_unique($AffectedUsers);
234
       foreach ($AffectedUsers as $UserID) {
234
       foreach ($AffectedUsers as $UserID) {
235
         Tracker::update_tracker('add_token', ['info_hash' => substr('%'.chunk_split($InfoHash,2,'%'),0,-1), 'userid' => $UserID]);
235
         Tracker::update_tracker('add_token', ['info_hash' => substr('%'.chunk_split($InfoHash,2,'%'),0,-1), 'userid' => $UserID]);
236
-        $DB->query("
236
+        $DB->prepared_query("
237
           INSERT INTO users_freeleeches (UserID, TorrentID, Time, Uses)
237
           INSERT INTO users_freeleeches (UserID, TorrentID, Time, Uses)
238
           VALUES ($UserID, $ExtraID, NOW(), 0)
238
           VALUES ($UserID, $ExtraID, NOW(), 0)
239
           ON DUPLICATE KEY UPDATE
239
           ON DUPLICATE KEY UPDATE
248
 
248
 
249
   //Log and delete
249
   //Log and delete
250
   if (isset($Escaped['delete']) && check_perms('torrents_delete')) {
250
   if (isset($Escaped['delete']) && check_perms('torrents_delete')) {
251
-    $DB->query("
251
+    $DB->prepared_query("
252
       SELECT Username
252
       SELECT Username
253
       FROM users_main
253
       FROM users_main
254
       WHERE ID = $UploaderID");
254
       WHERE ID = $UploaderID");
258
     if (isset($Escaped['log_message']) && $Escaped['log_message'] != '') {
258
     if (isset($Escaped['log_message']) && $Escaped['log_message'] != '') {
259
       $Log .= ' ( '.$Escaped['log_message'].' )';
259
       $Log .= ' ( '.$Escaped['log_message'].' )';
260
     }
260
     }
261
-    $DB->query("
261
+    $DB->prepared_query("
262
       SELECT GroupID, hex(info_hash)
262
       SELECT GroupID, hex(info_hash)
263
       FROM torrents
263
       FROM torrents
264
       WHERE ID = $TorrentID");
264
       WHERE ID = $TorrentID");
280
     $Cache->update_row(false, array('DisableUpload' => '1'));
280
     $Cache->update_row(false, array('DisableUpload' => '1'));
281
     $Cache->commit_transaction(0);
281
     $Cache->commit_transaction(0);
282
 
282
 
283
-    $DB->query("
283
+    $DB->prepared_query("
284
       UPDATE users_info
284
       UPDATE users_info
285
       SET DisableUpload = '1'
285
       SET DisableUpload = '1'
286
       WHERE UserID = $UploaderID");
286
       WHERE UserID = $UploaderID");
312
     if ($AdminComment) {
312
     if ($AdminComment) {
313
       $AdminComment = date('Y-m-d') . " - $AdminComment\n\n";
313
       $AdminComment = date('Y-m-d') . " - $AdminComment\n\n";
314
 
314
 
315
-      $DB->query("
315
+      $DB->prepared_query("
316
         UPDATE users_info
316
         UPDATE users_info
317
         SET AdminComment = CONCAT('".db_string($AdminComment)."', AdminComment)
317
         SET AdminComment = CONCAT('".db_string($AdminComment)."', AdminComment)
318
         WHERE UserID = '".db_string($UploaderID)."'");
318
         WHERE UserID = '".db_string($UploaderID)."'");
360
 
360
 
361
   // Now we've done everything, update the DB with values
361
   // Now we've done everything, update the DB with values
362
   if ($Report) {
362
   if ($Report) {
363
-    $DB->query("
363
+    $DB->prepared_query("
364
       UPDATE reportsv2
364
       UPDATE reportsv2
365
       SET
365
       SET
366
         Type = '".$Escaped['resolve_type']."',
366
         Type = '".$Escaped['resolve_type']."',

+ 7
- 7
sections/reportsv2/views.php View File

13
 
13
 
14
 
14
 
15
 //Grab owner's ID, just for examples
15
 //Grab owner's ID, just for examples
16
-$DB->query("
16
+$DB->prepared_query("
17
   SELECT ID, Username
17
   SELECT ID, Username
18
   FROM users_main
18
   FROM users_main
19
   ORDER BY ID ASC
19
   ORDER BY ID ASC
29
 <div class="float_clear">
29
 <div class="float_clear">
30
   <div class="two_columns pad">
30
   <div class="two_columns pad">
31
 <?
31
 <?
32
-$DB->query("
32
+$DB->prepared_query("
33
   SELECT
33
   SELECT
34
     um.ID,
34
     um.ID,
35
     um.Username,
35
     um.Username,
65
 ?>
65
 ?>
66
     </table>
66
     </table>
67
 <?
67
 <?
68
-$DB->query("
68
+$DB->prepared_query("
69
   SELECT
69
   SELECT
70
     um.ID,
70
     um.ID,
71
     um.Username,
71
     um.Username,
101
 ?>
101
 ?>
102
     </table>
102
     </table>
103
 <?
103
 <?
104
-$DB->query("
104
+$DB->prepared_query("
105
   SELECT
105
   SELECT
106
     um.ID,
106
     um.ID,
107
     um.Username,
107
     um.Username,
137
 ?>
137
 ?>
138
     </table>
138
     </table>
139
 <?
139
 <?
140
-$DB->query("
140
+$DB->prepared_query("
141
   SELECT
141
   SELECT
142
     um.ID,
142
     um.ID,
143
     um.Username,
143
     um.Username,
232
   </div>
232
   </div>
233
   <div class="two_columns pad">
233
   <div class="two_columns pad">
234
 <?
234
 <?
235
-  $DB->query("
235
+  $DB->prepared_query("
236
     SELECT
236
     SELECT
237
       r.ResolverID,
237
       r.ResolverID,
238
       um.Username,
238
       um.Username,
268
     </table>
268
     </table>
269
     <h3>Different view modes by report type</h3>
269
     <h3>Different view modes by report type</h3>
270
 <?
270
 <?
271
-  $DB->query("
271
+  $DB->prepared_query("
272
     SELECT
272
     SELECT
273
       Type,
273
       Type,
274
       COUNT(ID) AS Count
274
       COUNT(ID) AS Count

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

97
 
97
 
98
 View::show_header(
98
 View::show_header(
99
     ($NewRequest ? 'Create Request' : 'Edit Request'),
99
     ($NewRequest ? 'Create Request' : 'Edit Request'),
100
-    'bbcode,requests,upload,form_validate,vendor/easymde.min',
100
+    'requests,upload,form_validate,vendor/easymde.min',
101
     'vendor/easymde.min'
101
     'vendor/easymde.min'
102
 );
102
 );
103
 ?>
103
 ?>

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

71
 
71
 
72
 View::show_header(
72
 View::show_header(
73
     "View request: $Title",
73
     "View request: $Title",
74
-    'comments,requests,bbcode,subscriptions,vendor/easymde.min',
74
+    'comments,requests,subscriptions,vendor/easymde.min',
75
     'vendor/easymde.min'
75
     'vendor/easymde.min'
76
 );
76
 );
77
 ?>
77
 ?>

+ 1
- 1
sections/staffpm/viewconv.php View File

33
 
33
 
34
     View::show_header(
34
     View::show_header(
35
         'Staff PM',
35
         'Staff PM',
36
-        'staffpm,bbcode,vendor/easymde.min',
36
+        'staffpm,vendor/easymde.min',
37
         'vendor/easymde.min'
37
         'vendor/easymde.min'
38
     );
38
     );
39
 
39
 

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

58
 $SQL .= "
58
 $SQL .= "
59
   ORDER BY d.Time DESC
59
   ORDER BY d.Time DESC
60
   LIMIT $Limit";
60
   LIMIT $Limit";
61
-$DB->query($SQL);
61
+$DB->prepared_query($SQL);
62
 $Donations = $DB->to_array();
62
 $Donations = $DB->to_array();
63
 
63
 
64
-$DB->query('SELECT FOUND_ROWS()');
64
+$DB->prepared_query('SELECT FOUND_ROWS()');
65
 list($Results) = $DB->next_record();
65
 list($Results) = $DB->next_record();
66
 
66
 
67
-$DB->query("SELECT SUM(Amount) FROM donations");
67
+$DB->prepared_query("SELECT SUM(Amount) FROM donations");
68
 list($Total) = $DB->next_record();
68
 list($Total) = $DB->next_record();
69
 
69
 
70
 /*
70
 /*
71
 if (empty($_GET['email']) && empty($_GET['username']) && empty($_GET['source']) && !isset($_GET['page']) && !$DonationTimeline = $Cache->get_value('donation_timeline')) {
71
 if (empty($_GET['email']) && empty($_GET['username']) && empty($_GET['source']) && !isset($_GET['page']) && !$DonationTimeline = $Cache->get_value('donation_timeline')) {
72
     include(SERVER_ROOT.'/classes/charts.class.php');
72
     include(SERVER_ROOT.'/classes/charts.class.php');
73
 
73
 
74
-    $DB->query("
74
+    $DB->prepared_query("
75
     SELECT DATE_FORMAT(Time,'%b \'%y') AS Month, SUM(Amount)
75
     SELECT DATE_FORMAT(Time,'%b \'%y') AS Month, SUM(Amount)
76
     FROM donations
76
     FROM donations
77
     GROUP BY Month
77
     GROUP BY Month

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

14
 
14
 
15
 $Title = "Donor Rewards";
15
 $Title = "Donor Rewards";
16
 
16
 
17
-$DB->query("
17
+$DB->prepared_query("
18
   SELECT
18
   SELECT
19
     SQL_CALC_FOUND_ROWS
19
     SQL_CALC_FOUND_ROWS
20
     u.Username,
20
     u.Username,
35
   LIMIT $Limit");
35
   LIMIT $Limit");
36
 
36
 
37
 $Users = $DB->to_array();
37
 $Users = $DB->to_array();
38
-$DB->query('SELECT FOUND_ROWS()');
38
+$DB->prepared_query('SELECT FOUND_ROWS()');
39
 list($Results) = $DB->next_record();
39
 list($Results) = $DB->next_record();
40
 $Pages = Format::get_pages($Page, $Results, USERS_PER_PAGE, 9);
40
 $Pages = Format::get_pages($Page, $Results, USERS_PER_PAGE, 9);
41
 
41
 

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

80
     include SERVER_ROOT.'/sections/tools/managers/enable_requests.php';
80
     include SERVER_ROOT.'/sections/tools/managers/enable_requests.php';
81
     break;
81
     break;
82
 
82
 
83
-  case 'expunge_requests':
84
-    include SERVER_ROOT.'/sections/tools/managers/expunge_requests.php';
85
-    break;
86
-
87
   case 'ajax_take_enable_request':
83
   case 'ajax_take_enable_request':
88
     if (FEATURE_EMAIL_REENABLE) {
84
     if (FEATURE_EMAIL_REENABLE) {
89
         include SERVER_ROOT.'/sections/tools/managers/ajax_take_enable_request.php';
85
         include SERVER_ROOT.'/sections/tools/managers/ajax_take_enable_request.php';

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

11
     authorize();
11
     authorize();
12
 
12
 
13
     $IPA = substr($_POST['start'], 0, strcspn($_POST['start'], '.'));
13
     $IPA = substr($_POST['start'], 0, strcspn($_POST['start'], '.'));
14
-    if ($_POST['submit'] == 'Delete') { //Delete
15
-        if (!is_number($_POST['id']) || $_POST['id'] == '') {
14
+    if ($_POST['submit'] === 'Delete') { //Delete
15
+        if (!is_number($_POST['id']) || $_POST['id'] === '') {
16
             error(0);
16
             error(0);
17
         }
17
         }
18
         $DB->query('DELETE FROM ip_bans WHERE ID='.$_POST['id']);
18
         $DB->query('DELETE FROM ip_bans WHERE ID='.$_POST['id']);
30
         $Start = Tools::ip_to_unsigned($_POST['start']); //Sanitized by Validation regex
30
         $Start = Tools::ip_to_unsigned($_POST['start']); //Sanitized by Validation regex
31
     $End = Tools::ip_to_unsigned($_POST['end']); //See above
31
     $End = Tools::ip_to_unsigned($_POST['end']); //See above
32
 
32
 
33
-    if ($_POST['submit'] == 'Edit') { //Edit
33
+    if ($_POST['submit'] === 'Edit') { //Edit
34
         if (empty($_POST['id']) || !is_number($_POST['id'])) {
34
         if (empty($_POST['id']) || !is_number($_POST['id'])) {
35
             error(404);
35
             error(404);
36
         }
36
         }

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

20
   }
20
   }
21
   $Where .= " Comment LIKE '%$Comment%'";
21
   $Where .= " Comment LIKE '%$Comment%'";
22
 }
22
 }
23
-$DB->query("
23
+$DB->prepared_query("
24
   SELECT
24
   SELECT
25
     SQL_CALC_FOUND_ROWS
25
     SQL_CALC_FOUND_ROWS
26
     ID,
26
     ID,
33
   ORDER BY Time DESC
33
   ORDER BY Time DESC
34
   LIMIT $Limit");
34
   LIMIT $Limit");
35
 $Results = $DB->to_array(false, MYSQLI_ASSOC, false);
35
 $Results = $DB->to_array(false, MYSQLI_ASSOC, false);
36
-$DB->query('SELECT FOUND_ROWS()');
36
+$DB->prepared_query('SELECT FOUND_ROWS()');
37
 list ($NumResults) = $DB->next_record();
37
 list ($NumResults) = $DB->next_record();
38
 ?>
38
 ?>
39
 <div class="header">
39
 <div class="header">

+ 3
- 3
sections/tools/managers/email_blacklist_alter.php View File

9
   if (!is_number($_POST['id']) || $_POST['id'] === '') {
9
   if (!is_number($_POST['id']) || $_POST['id'] === '') {
10
     error(0);
10
     error(0);
11
   }
11
   }
12
-  $DB->query("
12
+  $DB->prepared_query("
13
     DELETE FROM email_blacklist
13
     DELETE FROM email_blacklist
14
     WHERE ID = $_POST[id]");
14
     WHERE ID = $_POST[id]");
15
 } else { // Edit & Create, Shared Validation
15
 } else { // Edit & Create, Shared Validation
27
     if (!is_number($_POST['id']) || $_POST['id'] === '') {
27
     if (!is_number($_POST['id']) || $_POST['id'] === '') {
28
       error(0);
28
       error(0);
29
     }
29
     }
30
-    $DB->query("
30
+    $DB->prepared_query("
31
       UPDATE email_blacklist
31
       UPDATE email_blacklist
32
       SET
32
       SET
33
         Email = '$P[email]',
33
         Email = '$P[email]',
36
         Time = NOW()
36
         Time = NOW()
37
       WHERE ID = '$P[id]'");
37
       WHERE ID = '$P[id]'");
38
   } else { // Create
38
   } else { // Create
39
-    $DB->query("
39
+    $DB->prepared_query("
40
       INSERT INTO email_blacklist (Email, Comment, UserID, Time)
40
       INSERT INTO email_blacklist (Email, Comment, UserID, Time)
41
       VALUES ('$P[email]', '$P[comment]', '$LoggedUser[ID]', NOW())");
41
       VALUES ('$P[email]', '$P[comment]', '$LoggedUser[ID]', NOW())");
42
   }
42
   }

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

10
   $JSON['status'] = 'success';
10
   $JSON['status'] = 'success';
11
 }
11
 }
12
 
12
 
13
-$DB->query("
13
+$DB->prepared_query("
14
   SELECT
14
   SELECT
15
     ID,
15
     ID,
16
     UserID,
16
     UserID,

+ 0
- 108
sections/tools/managers/expunge_requests.php View File

1
-<?php
2
-#declare(strict_types=1);
3
-
4
-if (!check_perms('users_mod')) {
5
-  error(403);
6
-}
7
-
8
-$QueryID = $DB->query("
9
-  SELECT SQL_CALC_FOUND_ROWS *
10
-  FROM deletion_requests");
11
-
12
-$DB->query("SELECT FOUND_ROWS()");
13
-list($NumResults) = $DB->next_record();
14
-$DB->set_query_id($QueryID);
15
-
16
-$Requests = $DB->to_array();
17
-
18
-if (isset($_GET['deny']) && isset($_GET['type']) && isset($_GET['value'])) {
19
-  authorize();
20
-
21
-  $Deny = ($_GET['deny'] == 'true');
22
-  $Type = $_GET['type'] == 'email' ? 'Email' : ($_GET['type'] == 'ip' ? 'IP' : '');
23
-  $Value = db_string($_GET['value']);
24
-
25
-  $DB->query("
26
-    DELETE FROM deletion_requests
27
-    WHERE Value = '$Value'");
28
-
29
-  $DB->query("
30
-    SELECT UserID
31
-    FROM users_history_".strtolower($Type)."s
32
-    WHERE $Type = '$Value'");
33
-  if ($DB->has_results()) {
34
-    list($UserID) = $DB->next_record();
35
-    if ($UserID != $_GET['userid']) {
36
-      $Err = "The specified UserID is incorrect.";
37
-    }
38
-  } else {
39
-    $Err = "That $Type doesn't exist.";
40
-  }
41
-
42
-  if (empty($Err)) {
43
-    if (!$Deny) {
44
-      $DB->query("
45
-        SELECT $Type
46
-        FROM users_history_".strtolower($Type)."s
47
-        WHERE UserID = '$UserID'");
48
-      $ToDelete = [];
49
-      while (list($EncValue) = $DB->next_record()) {
50
-        if (Crypto::decrypt($Value) == Crypto::decrypt($EncValue)) {
51
-          $ToDelete[] = $EncValue;
52
-        }
53
-      }
54
-      forEach ($ToDelete as $DelValue) {
55
-        $DB->query("
56
-          DELETE FROM users_history_".strtolower($Type)."s
57
-          WHERE UserID = $UserID
58
-            AND $Type = '$DelValue'");
59
-      }
60
-      $Succ = "$Type deleted.";
61
-      Misc::send_pm($UserID, 0, "$Type Deletion Request Accepted.", "Your deletion request has been accepted. What $Type? I don't know! We don't have it anymore!");
62
-    } else {
63
-      $Succ = "Request denied.";
64
-      Misc::send_pm($UserID, 0, "$Type Deletion Request Denied.", "Your deletion request has been denied.\n\nIf you wish to discuss this matter further, please create a staff PM, or join ".HELP_CHAN." on IRC to speak with a staff member.");
65
-    }
66
-  }
67
-
68
-  $Cache->delete_value('num_deletion_requests');
69
-}
70
-
71
-View::show_header("Expunge Requests");
72
-
73
-?>
74
-
75
-<div class="header">
76
-  <h2>Expunge Requests</h2>
77
-</div>
78
-
79
-<? if (isset($Err)) { ?>
80
-<span>Error: <?=$Err?></span>
81
-<? } elseif (isset($Succ)) { ?>
82
-<span>Success: <?=$Succ?></span>
83
-<? } ?>
84
-
85
-<div>
86
-  <table width="100%">
87
-    <tr class="colhead">
88
-      <td>User</td>
89
-      <td>Type</td>
90
-      <td>Value</td>
91
-      <td>Reason</td>
92
-      <td>Accept</td>
93
-      <td>Deny</td>
94
-    </tr>
95
-<? foreach ($Requests as $Request) { ?>
96
-    <tr>
97
-      <td><?=Users::format_username($Request['UserID'])?></td>
98
-      <td><?=$Request['Type']?></td>
99
-      <td><?=Crypto::decrypt($Request['Value'])?></td>
100
-      <td><?=display_str($Request['Reason'])?></td>
101
-      <td><a href="tools.php?action=expunge_requests&auth=<?=$LoggedUser['AuthKey']?>&type=<?=strtolower($Request['Type'])?>&value=<?=urlencode($Request['Value'])?>&userid=<?=$Request['UserID']?>&deny=false" class="brackets">Accept</a></td>
102
-      <td><a href="tools.php?action=expunge_requests&auth=<?=$LoggedUser['AuthKey']?>&type=<?=strtolower($Request['Type'])?>&value=<?=urlencode($Request['Value'])?>&userid=<?=$Request['UserID']?>&deny=true" class="brackets">Deny</a></td>
103
-    </tr>
104
-<? } ?>
105
-  </table>
106
-</div>
107
-
108
-<? View::show_footer(); ?>

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

12
 
12
 
13
 View::show_header(
13
 View::show_header(
14
     'Compose Mass PM',
14
     'Compose Mass PM',
15
-    'inbox,bbcode,vendor/jquery.validate.min,form_validate'
15
+    'inbox,vendor/jquery.validate.min,form_validate'
16
 ); ?>
16
 ); ?>
17
 
17
 
18
 <main>
18
 <main>

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

8
 
8
 
9
 View::show_header(
9
 View::show_header(
10
     'Manage news',
10
     'Manage news',
11
-    'bbcode,vendor/easymde.min',
11
+    'vendor/easymde.min',
12
     'vendor/easymde.min'
12
     'vendor/easymde.min'
13
 );
13
 );
14
 
14
 

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

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

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

15
 $Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10;
15
 $Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10;
16
 
16
 
17
 $IsMod = check_perms("users_mod");
17
 $IsMod = check_perms("users_mod");
18
-$DB->query("
18
+$DB->prepared_query("
19
 SELECT
19
 SELECT
20
   `UserID`,
20
   `UserID`,
21
   `TotalRank`,
21
   `TotalRank`,

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

66
 
66
 
67
     $Details = $Cache->get_value("top10_history_$SQLTime");
67
     $Details = $Cache->get_value("top10_history_$SQLTime");
68
     if ($Details === false) {
68
     if ($Details === false) {
69
-        $DB->query("
69
+        $DB->prepared_query("
70
         SELECT
70
         SELECT
71
           tht.`Rank`,
71
           tht.`Rank`,
72
           tht.`TitleString`,
72
           tht.`TitleString`,

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

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

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

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

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

48
 
48
 
49
   if ($Details == 'all' || $Details == 'ul') {
49
   if ($Details == 'all' || $Details == 'ul') {
50
       if (!$TopUserUploads = $Cache->get_value('topuser_ul_'.$Limit)) {
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
           $TopUserUploads = $DB->to_array();
52
           $TopUserUploads = $DB->to_array();
53
           $Cache->cache_value('topuser_ul_'.$Limit, $TopUserUploads, 3600 * 12);
53
           $Cache->cache_value('topuser_ul_'.$Limit, $TopUserUploads, 3600 * 12);
54
       }
54
       }
57
 
57
 
58
   if ($Details == 'all' || $Details == 'dl') {
58
   if ($Details == 'all' || $Details == 'dl') {
59
       if (!$TopUserDownloads = $Cache->get_value('topuser_dl_'.$Limit)) {
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
           $TopUserDownloads = $DB->to_array();
61
           $TopUserDownloads = $DB->to_array();
62
           $Cache->cache_value('topuser_dl_'.$Limit, $TopUserDownloads, 3600 * 12);
62
           $Cache->cache_value('topuser_dl_'.$Limit, $TopUserDownloads, 3600 * 12);
63
       }
63
       }
66
 
66
 
67
   if ($Details == 'all' || $Details == 'numul') {
67
   if ($Details == 'all' || $Details == 'numul') {
68
       if (!$TopUserNumUploads = $Cache->get_value('topuser_numul_'.$Limit)) {
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
           $TopUserNumUploads = $DB->to_array();
70
           $TopUserNumUploads = $DB->to_array();
71
           $Cache->cache_value('topuser_numul_'.$Limit, $TopUserNumUploads, 3600 * 12);
71
           $Cache->cache_value('topuser_numul_'.$Limit, $TopUserNumUploads, 3600 * 12);
72
       }
72
       }
75
 
75
 
76
   if ($Details == 'all' || $Details == 'uls') {
76
   if ($Details == 'all' || $Details == 'uls') {
77
       if (!$TopUserUploadSpeed = $Cache->get_value('topuser_ulspeed_'.$Limit)) {
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
           $TopUserUploadSpeed = $DB->to_array();
79
           $TopUserUploadSpeed = $DB->to_array();
80
           $Cache->cache_value('topuser_ulspeed_'.$Limit, $TopUserUploadSpeed, 3600 * 12);
80
           $Cache->cache_value('topuser_ulspeed_'.$Limit, $TopUserUploadSpeed, 3600 * 12);
81
       }
81
       }
84
 
84
 
85
   if ($Details == 'all' || $Details == 'dls') {
85
   if ($Details == 'all' || $Details == 'dls') {
86
       if (!$TopUserDownloadSpeed = $Cache->get_value('topuser_dlspeed_'.$Limit)) {
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
           $TopUserDownloadSpeed = $DB->to_array();
88
           $TopUserDownloadSpeed = $DB->to_array();
89
           $Cache->cache_value('topuser_dlspeed_'.$Limit, $TopUserDownloadSpeed, 3600 * 12);
89
           $Cache->cache_value('topuser_dlspeed_'.$Limit, $TopUserDownloadSpeed, 3600 * 12);
90
       }
90
       }

+ 1
- 1
sections/torrents/details.php View File

118
 // Start output
118
 // Start output
119
 View::show_header(
119
 View::show_header(
120
     $Title,
120
     $Title,
121
-    'browse,comments,torrent,bbcode,recommend,cover_art,subscriptions,vendor/easymde.min',
121
+    'browse,comments,torrent,recommend,cover_art,subscriptions,vendor/easymde.min',
122
     'vendor/easymde.min'
122
     'vendor/easymde.min'
123
 );
123
 );
124
 ?>
124
 ?>

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

92
  * Commenting only to see it better.
92
  * Commenting only to see it better.
93
  */
93
  */
94
 
94
 
95
-View::show_header('Edit torrent', 'upload,torrent,bbcode');
95
+View::show_header('Edit torrent', 'upload,torrent');
96
 $TorrentForm = new TorrentForm(
96
 $TorrentForm = new TorrentForm(
97
     $Torrent = $Properties,
97
     $Torrent = $Properties,
98
     $Error = $Err,
98
     $Error = $Err,

+ 1
- 1
sections/torrents/editgroup.php View File

70
 
70
 
71
 View::show_header(
71
 View::show_header(
72
     'Edit torrent group',
72
     'Edit torrent group',
73
-    'upload,bbcode,vendor/easymde.min',
73
+    'upload,vendor/easymde.min',
74
     'vendor/easymde.min'
74
     'vendor/easymde.min'
75
 ); ?>
75
 ); ?>
76
 
76
 

+ 7
- 3
sections/torrents/index.php View File

197
             break;
197
             break;
198
             
198
             
199
         case 'fix_group':
199
         case 'fix_group':
200
-            if ((check_perms('users_mod') || check_perms('torrents_fix_ghosts')) && authorize() && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
201
-                $DB->prepare_query("
200
+            if ((check_perms('users_mod') || check_perms('torrents_fix_ghosts'))
201
+              && !empty($_GET['groupid'])
202
+              && is_number($_GET['groupid'])
203
+                ) {
204
+                authorize();
205
+
206
+                $DB->prepared_query("
202
                 SELECT
207
                 SELECT
203
                   COUNT(`ID`)
208
                   COUNT(`ID`)
204
                 FROM
209
                 FROM
206
                 WHERE
211
                 WHERE
207
                   `GroupID` = '$_GET[groupid]'
212
                   `GroupID` = '$_GET[groupid]'
208
                 ");
213
                 ");
209
-                $DB->exec_prepared_query();
210
                 list($Count) = $DB->next_record();
214
                 list($Count) = $DB->next_record();
211
                 
215
                 
212
                 if ($Count === 0) {
216
                 if ($Count === 0) {

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

14
 
14
 
15
 View::show_header(
15
 View::show_header(
16
     'Upload',
16
     'Upload',
17
-    'upload,bbcode,vendor/easymde.min',
17
+    'upload,vendor/easymde.min',
18
     'vendor/easymde.min'
18
     'vendor/easymde.min'
19
 );
19
 );
20
 
20
 

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

69
  */
69
  */
70
 View::show_header(
70
 View::show_header(
71
     "$Username $ENV->CRUMB Settings",
71
     "$Username $ENV->CRUMB Settings",
72
-    'user,password_validate,validate,cssgallery,preview_paranoia,bbcode,user_settings,donor_titles,vendor/easymde.min',
72
+    'user,password_validate,validate,cssgallery,preview_paranoia,user_settings,vendor/easymde.min',
73
     'vendor/easymde.min'
73
     'vendor/easymde.min'
74
 );
74
 );
75
 
75
 

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

233
 
233
 
234
 View::show_header(
234
 View::show_header(
235
     $Username,
235
     $Username,
236
-    'vendor/imagesloaded.min,user,bbcode,requests,comments,info_paster,wall'
236
+    'vendor/imagesloaded.min,user,requests,comments,info_paster,wall'
237
 );
237
 );
238
 
238
 
239
 ?>
239
 ?>

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

23
 $UserInfo = Users::user_info($UserID);
23
 $UserInfo = Users::user_info($UserID);
24
 extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));
24
 extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));
25
 
25
 
26
-View::show_header("Post history for $Username", 'subscriptions,comments,bbcode');
26
+View::show_header("Post history for $Username", 'subscriptions,comments');
27
 
27
 
28
 $ViewingOwn = ($UserID == $LoggedUser['ID']);
28
 $ViewingOwn = ($UserID == $LoggedUser['ID']);
29
 $ShowUnread = ($ViewingOwn && (!isset($_GET['showunread']) || !!$_GET['showunread']));
29
 $ShowUnread = ($ViewingOwn && (!isset($_GET['showunread']) || !!$_GET['showunread']));

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

12
 }
12
 }
13
 list($Page, $Limit) = Format::page_limit($PerPage);
13
 list($Page, $Limit) = Format::page_limit($PerPage);
14
 
14
 
15
-View::show_header('Subscriptions', 'subscriptions,bbcode');
15
+View::show_header('Subscriptions', 'subscriptions');
16
 
16
 
17
 $ShowUnread = (!isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread']);
17
 $ShowUnread = (!isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread']);
18
 $ShowCollapsed = (!isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse']);
18
 $ShowCollapsed = (!isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse']);

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

49
 $TextBody = Text::full_format($Body, false);
49
 $TextBody = Text::full_format($Body, false);
50
 $TOC = Text::parse_toc(0);
50
 $TOC = Text::parse_toc(0);
51
 
51
 
52
-View::show_header($Title, 'wiki,bbcode');
52
+View::show_header($Title, 'wiki');
53
 ?>
53
 ?>
54
 
54
 
55
 <div>
55
 <div>

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

3
 
3
 
4
 View::show_header(
4
 View::show_header(
5
     'Create an article',
5
     'Create an article',
6
-    'bbcode,vendor/easymde.min',
6
+    'vendor/easymde.min',
7
     'vendor/easymde.min'
7
     'vendor/easymde.min'
8
 );
8
 );
9
 ?>
9
 ?>

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

15
 
15
 
16
 View::show_header(
16
 View::show_header(
17
     'Edit '.$Title,
17
     'Edit '.$Title,
18
-    'bbcode,vendor/easymde.min',
18
+    'vendor/easymde.min',
19
     'vendor/easymde.min'
19
     'vendor/easymde.min'
20
 );
20
 );
21
 ?>
21
 ?>

+ 6
- 0
static/common/symbols/external-link-ltr-icon.svg View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12">
3
+	<path fill="#fff" stroke="#36c" d="M1.5 4.518h5.982V10.5H1.5z"/>
4
+	<path fill="#36c" d="M5.765 1H11v5.39L9.427 7.937l-1.31-1.31L5.393 9.35l-2.69-2.688 2.81-2.808L4.2 2.544z"/>
5
+	<path fill="#fff" d="m9.995 2.004.022 4.885L8.2 5.07 5.32 7.95 4.09 6.723l2.882-2.88-1.85-1.852z"/>
6
+</svg>

BIN
static/common/symbols/external.png View File


+ 0
- 142
static/functions/bbcode.js View File

1
-/**
2
- * BBSpoiler
3
- */
4
-function BBSpoiler(link) {
5
-  if ($(link.nextSibling).has_class('hidden')) {
6
-    $(link.nextSibling).gshow();
7
-    $(link).html('Hide');
8
-
9
-    if ($(link).attr("value")) {
10
-      $(link).attr("value", "Hide" + $(link).attr("value").substring(4))
11
-    }
12
-  } else {
13
-    $(link.nextSibling).ghide();
14
-    $(link).html('Show');
15
-
16
-    if ($(link).attr("value")) {
17
-      $(link).attr("value", "Show" + $(link).attr("value").substring(4))
18
-    }
19
-  }
20
-}
21
-
22
-/**
23
- * wrapSelected
24
- */
25
-function wrapSelected(box, wrap, offset) {
26
-  if (!Array.isArray(wrap)) wrap = [wrap, wrap]
27
-  if (wrap.length < 2) wrap[1] = wrap[0]
28
-
29
-  var s = box.selectionStart
30
-  var e = box.selectionEnd
31
-  var v = box.value
32
-
33
-  box.value = v.slice(0, s) + wrap[0] + v.slice(s, e) + wrap[1] + v.slice(e)
34
-  box.focus()
35
-  box.selectionEnd = (offset !== undefined ? s + offset : e + wrap[0].length)
36
-}
37
-
38
-/**
39
- * EmojiBox
40
- */
41
-function EmojiBox(box) {
42
-  /*
43
-  let opened = false
44
-  let emojis = ['😀', '😁', '😂', '🤣', '😃', '😄', '😅', '😆', '😉', '😊', '😋', '😎', '😍', '😘', '😗', '😙', '😚', '🙂', '🤗', '🤔', '😐', '😑', '😶', '🙄', '😏', '😣', '😥', '😮', '🤐', '😯', '😪', '😫', '😴', '😌', '😛', '😜', '😝', '🤤', '😒', '😓', '😔', '😕', '🙃', '🤑', '😲', '🙁', '😖', '😞', '😟', '😤', '😢', '😭', '😦', '😧', '😨', '😩', '😬', '😰', '😱', '😳', '😵', '😡', '😠', '😷', '🤒', '🤕', '🤢', '🤧', '😇', '🤠', '🤡', '🤥', '🤓', '\n', '😈', '👿', '👹', '👺', '💀', '👻', '👽', '🤖', '💩', '😺', '😸', '😹', '😻', '😼', '😽', '🙀', '😿', '😾', '\n', '🍇', '🍈', '🍉', '🍊', '🍋', '🍌', '🍍', '🍎', '🍏', '🍐', '🍑', '🍒', '🍓', '🥝', '🍅', '🥑', '🍆', '🥔', '🥕', '🌽', '🌶', '🥒', '🍄', '🥜', '🌰', '🍞', '🥐', '🥖', '🥞', '🧀', '🍖', '🍗', '🥓', '🍔', '🍟', '🍕', '🌭', '🌮', '🌯', '🍳', '🍲', '🥗', '🍿', '🍱', '🍘', '🍙', '🍚', '🍛', '🍜', '🍝', '🍠', '🍢', '🍣', '🍤', '🍥', '🍡', '🍦', '🍧', '🍨', '🍩', '🍪', '🎂', '🍰', '🍫', '🍬', '🍭', '🍮', '🍯', '🍼', '🥛', '🍵', '🍶', '🍾', '🍷', '🍸', '🍹', '🍺', '🍻', '🥂', '🥃', '🍽', '🍴', '🥄', '\n', '🛀', '🛌', '💌', '💣', '🕳', '🛍', '📿', '💎', '🔪', '🏺', '🗺', '💈', '🛢', '🛎', '⌛', '⏳', '⌚', '⏰', '⏱', '⏲', '🕰', '🌡', '⛱', '🎈', '🎉', '🎊', '🎎', '🎏', '🎐', '🎀', '🎁', '🔮', '🕹', '🖼', '📯', '🎙', '🎚', '🎛', '📻', '📱', '📲', '📞', '📟', '📠', '🔋', '🔌', '💻', '🖥', '🖨', '🖱', '🖲', '💽', '💾', '💿', '📀', '🎥', '🎞', '📽', '📺', '📷', '📸', '📹', '📼', '🔍', '🔎', '🕯', '💡', '🔦', '🏮', '📔', '📕', '📖', '📗', '📘', '📙', '📚', '📓', '📃', '📜', '📄', '📰', '🗞', '📑', '🔖', '🏷', '💰', '💴', '💵', '💶', '💷', '💸', '💳', '📧', '📨', '📩', '📤', '📥', '📦', '📫', '📪', '📬', '📭', '📮', '🗳', '🖋', '🖊', '🖌', '🖍', '📝', '📁', '📂', '🗂', '📅', '📆', '🗒', '🗓', '📇', '📈', '📉', '📊', '📋', '📌', '📍', '📎', '🖇', '📏', '📐', '🗃', '🗄', '🗑', '🔒', '🔓', '🔏', '🔐', '🔑', '🗝', '🔨', '⛏', '🛠', '🗡', '🔫', '🛡', '🔧', '🔩', '🗜', '🔗', '⛓', '🔬', '🔭', '📡', '💉', '💊', '🚪', '🛏', '🛋', '🚽', '🚿', '🛁', '🚬', '🗿', '🚰', '\n', '💪', '👈', '👉', '👆', '🖕', '👇', '🤞', '🖖', '🤘', '🖐', '✋', '👌', '👍', '👎', '✊', '👊', '🤛', '🤜', '🤚', '👋', '👏', '👐', '🙌', '🙏', '🤝']
45
-  let ebox = document.createElement('div')
46
-  ebox.className = 'emoji_box border'
47
-
48
-  for (let emoji of emojis) {
49
-    if (emoji === '\n') {
50
-      let br = document.createElement('br')
51
-      ebox.appendChild(br)
52
-      continue;
53
-    }
54
-
55
-    let a = document.createElement('a')
56
-    a.innerHTML = emoji
57
-    a.addEventListener('click', e => {
58
-      wrapSelected(box, [emoji, ''])
59
-      e.stopPropagation()
60
-    })
61
-    ebox.appendChild(a)
62
-  }
63
-
64
-  return event => {
65
-    if (!opened) {
66
-      event.target.parentElement.appendChild(ebox)
67
-
68
-      let f = e => {
69
-        event.target.nextSibling.remove()
70
-        opened = false
71
-        document.removeEventListener('click', f)
72
-      }
73
-
74
-      window.setTimeout(_ => document.addEventListener('click', f), 1)
75
-      opened = true
76
-    }
77
-  }
78
-  */
79
-}
80
-
81
-/**
82
- * BBEditor
83
- */
84
-function BBEditor(box) {
85
-  /*
86
-  // todo: Integrate BioJS functions here
87
-  if (box.previousSibling && box.previousSibling.className == 'bbcode_bar') return
88
-
89
-  let buttons = [
90
-    { short: 'B', name: 'Bold', wrap: ['[b]', '[/b]'] },
91
-    { short: 'I', name: 'Italic', wrap: ['[i]', '[/i]'] },
92
-    { short: 'U', name: 'Underline', wrap: ['[u]', '[/u]'] },
93
-    { short: 'S', name: 'Strikethrough', wrap: ['[s]', '[/s]'] },
94
-    { short: 'Left', name: 'Align Left', wrap: ['[align=left]', '[/align]'] },
95
-    { short: 'Center', name: 'Align Center', wrap: ['[align=center]', '[/align]'] },
96
-    { short: 'Right', name: 'Align Right', wrap: ['[align=right]', '[/align]'] },
97
-    { short: 'Pre', name: 'Preformatted', wrap: ['[pre]', '[/pre]'] },
98
-    { short: 'H1', name: 'Subheading 1', wrap: '==' },
99
-    { short: 'H2', name: 'Subheading 2', wrap: '===' },
100
-    { short: 'H3', name: 'Subheading 3', wrap: '====' },
101
-    { short: 'Color', name: 'Color', wrap: ['[color=]', '[/color]'], offset: 7 },
102
-    { short: 'TeX', name: 'LaTeX', wrap: ['[tex]', '[/tex]'] },
103
-    { short: 'Quote', name: 'Quote', wrap: ['[quote]', '[/quote]'] },
104
-    { short: 'List', name: 'List', wrap: ['[*]', ''] },
105
-    { short: 'Hide', name: 'Spoiler', wrap: ['[spoiler]', '[/spoiler]'] },
106
-    { short: 'Img', name: 'Image', wrap: ['[img]', '[/img]'] },
107
-    { short: 'Vid', name: 'Video', wrap: ['[embed]', '[/embed]'] },
108
-    { short: 'Link', name: 'Link', wrap: ['[url]', '[/url]'] },
109
-    { short: 'Torr', name: 'Torrent', wrap: ['[torrent]', '[/torrent]'] },
110
-    { short: '😃', name: 'Emoji', func: EmojiBox(box) }
111
-  ]
112
-
113
-  let bar = document.createElement('ul')
114
-  bar.className = "bbcode_bar"
115
-  bar.style.width = box.offsetWidth + 'px'
116
-
117
-  // Let the DOM update and then snap the size again (twice)
118
-  setTimeout(function () {
119
-    bar.style.width = box.offsetWidth + 'px'
120
-    bar.style.width = box.offsetWidth + 'px'
121
-  }, 1)
122
-
123
-  for (let button of buttons) {
124
-    li = document.createElement('li')
125
-    b = document.createElement('a')
126
-    b.setAttribute('title', button.name)
127
-    b.innerHTML = button.short
128
-
129
-    if (button.wrap) b.addEventListener('click', e => wrapSelected(box, button.wrap, button.offset))
130
-    else if (button.func) b.addEventListener('click', button.func)
131
-
132
-    li.appendChild(b)
133
-    bar.appendChild(li)
134
-  }
135
-  box.parentNode.insertBefore(bar, box)
136
-  */
137
-}
138
-
139
-$(function () {
140
-  $('.bbcode_editor').each((i, el) => BBEditor(el))
141
-  $(document).on('click', '.spoilerButton', e => BBSpoiler(e.target))
142
-})

+ 0
- 33
static/functions/donor_titles.js View File

1
-$(document).ready(function() {
2
-  if ($('#donor_title_prefix_preview').length === 0) {
3
-    return;
4
-  }
5
-  $('#donor_title_prefix_preview').text($('#donor_title_prefix').val().trim() + ' ');
6
-  $('#donor_title_suffix_preview').text(' ' + $('#donor_title_suffix').val().trim());
7
-
8
-  if ($('#donor_title_comma').attr('checked')) {
9
-    $('#donor_title_comma_preview').text('');
10
-  } else {
11
-    $('#donor_title_comma_preview').text(', ');
12
-  }
13
-
14
-  $('#donor_title_prefix').keyup(function() {
15
-    if ($(this).val().length <= 30) {
16
-      $('#donor_title_prefix_preview').text($(this).val().trim() + ' ');
17
-    }
18
-  });
19
-
20
-  $('#donor_title_suffix').keyup(function() {
21
-    if ($(this).val().length <= 30) {
22
-      $('#donor_title_suffix_preview').text(' ' + $(this).val().trim());
23
-    }
24
-  });
25
-
26
-  $('#donor_title_comma').change(function() {
27
-    if ($(this).attr('checked')) {
28
-      $('#donor_title_comma_preview').text('');
29
-    } else {
30
-      $('#donor_title_comma_preview').text(', ');
31
-    }
32
-  });
33
-});

+ 8
- 6
static/styles/bookish/scss/colors.scss View File

72
 }
72
 }
73
 
73
 
74
 .alertbar {
74
 .alertbar {
75
-    @include alertbar(silver);
76
-    /* @include alertbar($lb100); */
75
+    &.modbar {
76
+        @include alertbar(silver);
77
+        /* @include alertbar($lb100); */
78
+    }
77
 
79
 
78
-    .warning {
79
-        background: orange;
80
+    &.warning {
81
+        @include alertbar(orange);
80
         /* background: #ffe0b2; */
82
         /* background: #ffe0b2; */
81
     }
83
     }
82
 
84
 
83
-    .error {
84
-        background: red;
85
+    &.error {
86
+        @include alertbar(red);
85
         /* background: #ffcdd2; */
87
         /* background: #ffcdd2; */
86
     }
88
     }
87
 }
89
 }

+ 8
- 0
static/styles/global/scss/fonts.scss View File

3
     line-height: 1.6;
3
     line-height: 1.6;
4
 }
4
 }
5
 
5
 
6
+/* Wikipedia-style external links */
7
+a.external {
8
+    background-image: url(/static/common/symbols/external-link-ltr-icon.svg);
9
+    background-position: center right;
10
+    background-repeat: no-repeat;
11
+    padding-right: 13px;
12
+}
13
+
6
 /*
14
 /*
7
  * Spacing classes
15
  * Spacing classes
8
  */
16
  */

+ 38
- 0
templates/legal/about.html View File

1
+<h2>About BioTorrents.de</h2>
2
+
3
+<section class="tldr">
4
+  <p>
5
+    BioTorrents.de is a functional experiment in comfy data distribution.
6
+  </p>
7
+
8
+  <p>
9
+    It indexes a wide variety of biology data and serves it on a fast BitTorrent network.
10
+    The semantic website promotes organic content discovery and community annotations.
11
+    Other interfaces include a JSON API, RSS feeds, and IRC channels.
12
+  </p>
13
+
14
+  <p>
15
+    BioTorrents.de provides an open platform for disadvantaged researchers to host their data.
16
+    More importantly, it provides the necessary tools for others to find and cite it later.
17
+    It's a place for the Google Drives, FTP folders, and network shares that may not be accepted elsewhere.
18
+  </p>
19
+
20
+  <p>
21
+    A mature software product and draft publication are expected by Easter 2023.
22
+    Thank you for your curiosity, patience, and support as we grow the service.
23
+  </p>
24
+
25
+  <p>
26
+    <strong>
27
+      Email
28
+    </strong>
29
+    <br />
30
+    help at biotorrents dot de
31
+  </p>
32
+
33
+  <p>
34
+    Please use
35
+    <a href="/sections/legal/pubkey.txt">GPG A1D095A5DEC74A8B</a>
36
+    if you wish.
37
+  </p>
38
+</section>

+ 3
- 3
templates/legal/dmca.html View File

74
 
74
 
75
   <p>
75
   <p>
76
     Remember that under
76
     Remember that under
77
-    <a href="https://www.law.cornell.edu/uscode/text/17/512">17 USC 512(f)</a>,
77
+    <a class="external" href="https://www.law.cornell.edu/uscode/text/17/512">17 USC 512(f)</a>,
78
     anyone who knowingly materially misrepresents infringement may be subject to liability.
78
     anyone who knowingly materially misrepresents infringement may be subject to liability.
79
     Also see
79
     Also see
80
-    <a href="https://www.law.cornell.edu/uscode/text/17/107">17 USC 107</a> and
81
-    <a href="https://www.law.cornell.edu/uscode/text/17/108">17 USC 108</a>.
80
+    <a class="external" href="https://www.law.cornell.edu/uscode/text/17/107">17 USC 107</a> and
81
+    <a class="external" href="https://www.law.cornell.edu/uscode/text/17/108">17 USC 108</a>.
82
   </p>
82
   </p>
83
 
83
 
84
   <p>
84
   <p>

+ 5
- 5
templates/legal/privacy.html View File

41
   <p>
41
   <p>
42
     We don't collect cross-origin data.
42
     We don't collect cross-origin data.
43
     Also, we don't access
43
     Also, we don't access
44
-    <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy#directives">browser features</a>
44
+    <a class="external" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy#directives">browser features</a>
45
     such as camera, microphone, and sensors.
45
     such as camera, microphone, and sensors.
46
   </p>
46
   </p>
47
 
47
 
102
   </h3>
102
   </h3>
103
 
103
 
104
   <p>
104
   <p>
105
-    <a href="https://gdpr-info.eu/art-14-gdpr/">Art. 14 GDPR ¶ 5(a) and (b)</a>, and
106
-    <a href="https://gdpr-info.eu/art-27-gdpr/">Art. 27 ¶ 2</a> apply.
105
+    <a class="external" href="https://gdpr-info.eu/art-14-gdpr/">Art. 14 GDPR ¶ 5(a) and (b)</a>, and
106
+    <a class="external" href="https://gdpr-info.eu/art-27-gdpr/">Art. 27 ¶ 2</a> apply.
107
     Accordingly, we haven't designated an EU representative.
107
     Accordingly, we haven't designated an EU representative.
108
     Generally, we don't collect any personal data as defined in
108
     Generally, we don't collect any personal data as defined in
109
-    <a href="https://gdpr-info.eu/art-4-gdpr/">Art. 4</a>
109
+    <a class="external" href="https://gdpr-info.eu/art-4-gdpr/">Art. 4</a>
110
     except what you voluntarily provide us.
110
     except what you voluntarily provide us.
111
   </p>
111
   </p>
112
 
112
 
124
 
124
 
125
   <p>
125
   <p>
126
     We're exempt from the California Consumer Privacy Act pursuant to
126
     We're exempt from the California Consumer Privacy Act pursuant to
127
-    <a href="https://ccpa-info.com/home/1798-140-definitions/">CIV 1798.140(c)(1)(A)</a>.
127
+    <a class="external" href="https://ccpa-info.com/home/1798-140-definitions/">CIV 1798.140(c)(1)(A)</a>.
128
     Nonetheless, we'll be happy to delete your information
128
     Nonetheless, we'll be happy to delete your information
129
     to the extent you don't enter into a business relationship with us.
129
     to the extent you don't enter into a business relationship with us.
130
   </p>
130
   </p>

+ 0
- 29
templates/staffblog/edit.twig View File

1
-<div class="box box2 thin">
2
-    <div class="head">
3
-        {{ verb|ucfirst }} a staff blog post
4
-        <span style="float: right;">
5
-            <a href="#" onclick="$('#postform').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">{{
6
-                show_form ? 'Show' : 'Hide' }}</a>
7
-        </span>
8
-    </div>
9
-    <form class="{{ verb }}_form" name="blog_post" action="staffblog.php" method="post">
10
-        <div id="postform" class="pad{{ show_form ? ' hidden' : '' }}">
11
-            <input type="hidden" name="action" value="{{ verb == 'create' ? 'takenewblog' : 'takeeditblog' }}" />
12
-            <input type="hidden" name="auth" value="{{ auth }}" />
13
-{% if verb == 'edit' %}
14
-            <input type="hidden" name="blogid" value="{{ blog.blogId }}" />
15
-{% endif %}
16
-            <div class="field_div">
17
-                <h3>Title</h3>
18
-                <input type="text" name="title" size="95" value="{{ blog.title }}" />
19
-            </div>
20
-            <div class="field_div">
21
-                <h3>Body</h3>
22
-                <textarea name="body" cols="95" rows="15">{{ blog.body }}</textarea> <br />
23
-            </div>
24
-            <div class="submit_div center">
25
-                <input type="submit" value="{{ verb|ucfirst }} blog post" />
26
-            </div>
27
-        </div>
28
-    </form>
29
-</div>

+ 0
- 16
templates/staffblog/list.twig View File

1
-<div class="thin">
2
-{% for entry in list %}
3
-    <div id="blog{{ entry.id }}" class="box box2 blog_post">
4
-        <div class="head">
5
-            <strong>{{ entry.title }}</strong> - posted {{ entry.created|time_diff }} by {{ entry.author }}
6
-    {% if editor %}
7
-            - <a href="staffblog.php?action=editblog&amp;id={{ entry.id }}" class="brackets">Edit</a>
8
-            <a href="staffblog.php?action=deleteblog&amp;id={{ entry.id }}&amp;auth={{ auth }}" onclick="return confirm('Do you want to delete this?');" class="brackets">Delete</a>
9
-    {% endif %}
10
-        </div>
11
-        <div class="pad">
12
-            {{ entry.body|bb_format }}
13
-        </div>
14
-    </div>
15
-{% endfor %}
16
-</div>

Loading…
Cancel
Save