Browse Source

Consider group edits anonymous if user has uploaded a member torrent anonymously

spaghetti 7 years ago
parent
commit
b18ee05bb8
1 changed files with 7 additions and 17 deletions
  1. 7
    17
      sections/torrents/grouplog.php

+ 7
- 17
sections/torrents/grouplog.php View File

28
       <td>Info</td>
28
       <td>Info</td>
29
     </tr>
29
     </tr>
30
 <?
30
 <?
31
-  $AnonTorrents = [];
31
+  $DB->query("SELECT UserID FROM torrents WHERE GroupID = ? AND Anonymous='1'", $GroupID);
32
+  $AnonUsers = $DB->collect("UserID");
32
   $Log = $DB->query("
33
   $Log = $DB->query("
33
       SELECT TorrentID, UserID, Info, Time
34
       SELECT TorrentID, UserID, Info, Time
34
       FROM group_log
35
       FROM group_log
35
-      WHERE GroupID = $GroupID
36
-      ORDER BY Time DESC");
36
+      WHERE GroupID = ?
37
+      ORDER BY Time DESC", $GroupID);
37
   $LogEntries = $DB->to_array(false, MYSQLI_NUM);
38
   $LogEntries = $DB->to_array(false, MYSQLI_NUM);
38
   foreach ($LogEntries AS $LogEntry) {
39
   foreach ($LogEntries AS $LogEntry) {
39
     list($TorrentID, $UserID, $Info, $Time) = $LogEntry;
40
     list($TorrentID, $UserID, $Info, $Time) = $LogEntry;
40
-    if (!isset($AnonTorrents[$TorrentID])) {
41
-      $DB->query("SELECT UserID, Anonymous FROM torrents WHERE ID=$TorrentID");
42
-      list($AnonUser, $IsAnon) = $DB->next_record();
43
-      $AnonTorrents[$TorrentID] = $IsAnon ? $AnonUser : -1;
44
-    }
45
 ?>
41
 ?>
46
     <tr class="row">
42
     <tr class="row">
47
       <td><?=$Time?></td>
43
       <td><?=$Time?></td>
48
 <?
44
 <?
49
       if ($TorrentID != 0) {
45
       if ($TorrentID != 0) {
50
-      /*
51
-        $DB->query("
52
-          SELECT Media, Format, Encoding
53
-          FROM torrents
54
-          WHERE ID = $TorrentID");
55
-      */
56
         $DB->query("
46
         $DB->query("
57
           SELECT Container, AudioFormat, Media
47
           SELECT Container, AudioFormat, Media
58
           FROM torrents
48
           FROM torrents
64
           <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td><?
54
           <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a></td><?
65
         } else { ?>
55
         } else { ?>
66
           <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (<?=$Container?>/<?=$AudioFormat?>/<?=$Media?>)</td>
56
           <td><a href="torrents.php?torrentid=<?=$TorrentID?>"><?=$TorrentID?></a> (<?=$Container?>/<?=$AudioFormat?>/<?=$Media?>)</td>
67
-<?        }
57
+<?      }
68
       } else { ?>
58
       } else { ?>
69
         <td></td>
59
         <td></td>
70
-<?      } ?>
71
-      <td><?=($UserID == $AnonTorrents[$TorrentID])?'Anonymous':Users::format_username($UserID, false, false, false)?></td>
60
+<?    } ?>
61
+      <td><?=in_array($UserID, $AnonUsers)?'Anonymous':Users::format_username($UserID, false, false, false)?></td>
72
       <td><?=$Info?></td>
62
       <td><?=$Info?></td>
73
     </tr>
63
     </tr>
74
 <?
64
 <?

Loading…
Cancel
Save