Browse Source

Draft the About page and use prepared queries on reportsv2

biotorrents 3 years ago
parent
commit
49cffc7ca5

+ 1
- 1
design/publicfooter.php View File

@@ -9,7 +9,7 @@ echo <<<HTML
9 9
 <footer>
10 10
   <a href="/legal.php?p=privacy">Privacy</a>
11 11
   <a href="/legal.php?p=dmca">DMCA</a>
12
-  <a class="external" href="https://github.com/biotorrents/gazelle" target="_blank">GitHub</a>
12
+  <a class="external" href="https://github.com/biotorrents" target="_blank">GitHub</a>
13 13
   <a class="external" href="https://patreon.com/biotorrents" target="_blank">Patreon</a>
14 14
 </footer>
15 15
 

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

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

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

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

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

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

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

@@ -10,7 +10,7 @@ if (!check_perms('admin_reports')) {
10 10
 }
11 11
 
12 12
 
13
-$DB->query("
13
+$DB->prepared_query("
14 14
   SELECT
15 15
     r.ID,
16 16
     r.ReporterID,
@@ -79,7 +79,7 @@ $DB->query("
79 79
 
80 80
     if (!$GroupID) {
81 81
       //Torrent already deleted
82
-      $DB->query("
82
+      $DB->prepared_query("
83 83
         UPDATE reportsv2
84 84
         SET
85 85
           Status = 'Resolved',
@@ -94,7 +94,7 @@ $DB->query("
94 94
 <?
95 95
       error();
96 96
     }
97
-    $DB->query("
97
+    $DB->prepared_query("
98 98
       UPDATE reportsv2
99 99
       SET Status = 'InProgress',
100 100
         ResolverID = ".$LoggedUser['ID']."
@@ -155,7 +155,7 @@ $DB->query("
155 155
               uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
156 156
               <br />
157 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 159
             SELECT r.ID
160 160
             FROM reportsv2 AS r
161 161
               LEFT JOIN torrents AS t ON t.ID = r.TorrentID
@@ -167,7 +167,7 @@ $DB->query("
167 167
               <div style="text-align: right;">
168 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 169
               </div>
170
-<?php $DB->query("
170
+<?php $DB->prepared_query("
171 171
             SELECT t.UserID
172 172
             FROM reportsv2 AS r
173 173
               JOIN torrents AS t ON t.ID = r.TorrentID
@@ -181,7 +181,7 @@ $DB->query("
181 181
               </div>
182 182
 <?php }
183 183
 
184
-        $DB->query("
184
+        $DB->prepared_query("
185 185
             SELECT DISTINCT req.ID,
186 186
               req.FillerID,
187 187
               um.Username,
@@ -242,7 +242,7 @@ $DB->query("
242 242
         $First = true;
243 243
         $Extras = explode(' ', $ExtraIDs);
244 244
         foreach ($Extras as $ExtraID) {
245
-            $DB->query("
245
+            $DB->prepared_query("
246 246
                 SELECT
247 247
                   tg.Name,
248 248
                   tg.ID,

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

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

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

@@ -30,7 +30,7 @@ if (!array_key_exists($NewType, $TypeList)) {
30 30
   error();
31 31
 }
32 32
 
33
-$DB->query("
33
+$DB->prepared_query("
34 34
   UPDATE reportsv2
35 35
   SET Type = '$NewType'
36 36
   WHERE ID = $ReportID");

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

@@ -17,7 +17,7 @@ if (!isset($_GET['id']) || !is_number($_GET['id'])) {
17 17
     }
18 18
 } else {
19 19
     $TorrentID = $_GET['id'];
20
-    $DB->query("
20
+    $DB->prepared_query("
21 21
     SELECT tg.`category_id`, t.`GroupID`, u.`Username`
22 22
     FROM `torrents_group` AS tg
23 23
       LEFT JOIN `torrents` AS t ON t.`GroupID` = tg.`id`

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

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

+ 5
- 5
sections/reportsv2/takereport.php View File

@@ -88,7 +88,7 @@ if (!empty($_POST['extra'])) {
88 88
     $Err = 'As useful as blank reports are, could you be a tiny bit more helpful? (Leave a comment)';
89 89
 }
90 90
 
91
-$DB->query("
91
+$DB->prepared_query("
92 92
   SELECT `GroupID`
93 93
   FROM `torrents`
94 94
   WHERE `ID` = '$TorrentID'
@@ -104,7 +104,7 @@ if (!empty($Err)) {
104 104
     error();
105 105
 }
106 106
 
107
-$DB->query("
107
+$DB->prepared_query("
108 108
   SELECT `ID`
109 109
   FROM `reportsv2`
110 110
   WHERE `TorrentID` = '$TorrentID'
@@ -115,7 +115,7 @@ if ($DB->has_results()) {
115 115
     error();
116 116
 }
117 117
 
118
-$DB->query("
118
+$DB->prepared_query("
119 119
   INSERT INTO `reportsv2`
120 120
     (`ReporterID`, `TorrentID`, `Type`, `UserComment`, `Status`, `ReportedTime`, `Track`, `Image`, `ExtraID`, `Link`)
121 121
   VALUES
@@ -123,12 +123,12 @@ $DB->query("
123 123
 
124 124
 $ReportID = $DB->inserted_id();
125 125
 
126
-$DB->query("
126
+$DB->prepared_query("
127 127
   SELECT `UserID`
128 128
   FROM `torrents`
129 129
   WHERE `ID` = $TorrentID");
130 130
 list($UploaderID) = $DB->next_record();
131
-$DB->query("
131
+$DB->prepared_query("
132 132
   SELECT `title`, `subject`, `object`
133 133
   FROM `torrents_group`
134 134
   WHERE `id` = '$GroupID'

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

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

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

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

+ 2
- 2
static/styles/public/scss/public.scss View File

@@ -226,8 +226,8 @@ main {
226 226
 
227 227
 /* Legal */
228 228
 .tldr {
229
-    max-width: 1000%;
229
+    width: 200%;
230 230
     height: 500px;
231
-    margin: auto;
231
+    margin-left: -50%;
232 232
     overflow-y: scroll;
233 233
 }

+ 21
- 2
templates/legal/about.html View File

@@ -2,11 +2,30 @@
2 2
 
3 3
 <section class="tldr">
4 4
   <p>
5
-    BioTorrents.de is a functional experiment in convenient data distribution.
5
+    BioTorrents.de is a functional experiment in comfy data distribution.
6 6
   </p>
7 7
 
8 8
   <p>
9
-    <strong> Email </strong>
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>
10 29
     <br />
11 30
     help at biotorrents dot de
12 31
   </p>

Loading…
Cancel
Save