Browse Source

Allow anonymous uploads

Also hide some who-did-this information from normal users

Requires database change
Invalidates caches
spaghetti 7 years ago
parent
commit
e5f97629bb

+ 1
- 5
classes/revisionhistory.class.php View File

7
    * @return array
7
    * @return array
8
    */
8
    */
9
   public static function get_revision_history($Page, $PageID) {
9
   public static function get_revision_history($Page, $PageID) {
10
-    if ($Page == 'artists') {
11
-      $Table = 'wiki_artists';
12
-    } else {
13
-      $Table = 'wiki_torrents';
14
-    }
10
+    $Table = ($Page == 'artists') ? 'wiki_artists' : 'wiki_torrents';
15
     $QueryID = G::$DB->get_query_id();
11
     $QueryID = G::$DB->get_query_id();
16
     G::$DB->query("
12
     G::$DB->query("
17
       SELECT
13
       SELECT

+ 4
- 0
classes/revisionhistoryview.class.php View File

11
     <tr class="colhead">
11
     <tr class="colhead">
12
       <td>Revision</td>
12
       <td>Revision</td>
13
       <td>Date</td>
13
       <td>Date</td>
14
+<? if (check_perms('users_mod')) { ?>
14
       <td>User</td>
15
       <td>User</td>
16
+<? } ?>
15
       <td>Summary</td>
17
       <td>Summary</td>
16
     </tr>
18
     </tr>
17
 <?
19
 <?
25
       <td>
27
       <td>
26
         <?=$Time?>
28
         <?=$Time?>
27
       </td>
29
       </td>
30
+<? if (check_perms('users_mod')) { ?>
28
       <td>
31
       <td>
29
         <?=Users::format_username($UserID, false, false, false)?>
32
         <?=Users::format_username($UserID, false, false, false)?>
30
       </td>
33
       </td>
34
+<? } ?>
31
       <td>
35
       <td>
32
         <?=($Summary ? $Summary : '(empty)')?>
36
         <?=($Summary ? $Summary : '(empty)')?>
33
       </td>
37
       </td>

+ 4
- 0
classes/torrent_form.class.php View File

184
       }
184
       }
185
     }
185
     }
186
 ?>
186
 ?>
187
+      <tr>
188
+        <td class="label tooltip" title="Checking this will hide your username from other users on the torrent details page. Stats will still be attributed to you.">Upload Anonymously:</td>
189
+        <td><input type="checkbox" name="anonymous" value="1" <?=(($Torrent['Anonymous'] ?? false) ? 'checked ' : '')?>/></td>
190
+      </tr>
187
       <tr>
191
       <tr>
188
         <td colspan="2" style="text-align: center;">
192
         <td colspan="2" style="text-align: center;">
189
           <p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>. Not doing this will result in a <strong class="important_text">warning</strong> or <strong class="important_text">worse</strong>.</p>
193
           <p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>. Not doing this will result in a <strong class="important_text">warning</strong> or <strong class="important_text">worse</strong>.</p>

+ 1
- 0
gazelle.sql View File

1083
   `Subbing` varchar(10) DEFAULT NULL,
1083
   `Subbing` varchar(10) DEFAULT NULL,
1084
   `Language` varchar(20) DEFAULT NULL,
1084
   `Language` varchar(20) DEFAULT NULL,
1085
   `Censored` tinyint(1) NOT NULL DEFAULT '1',
1085
   `Censored` tinyint(1) NOT NULL DEFAULT '1',
1086
+  `Anonymous` tinyint(1) NOT NULL DEFAULT '0',
1086
   `info_hash` blob NOT NULL,
1087
   `info_hash` blob NOT NULL,
1087
   `FileCount` int(6) NOT NULL,
1088
   `FileCount` int(6) NOT NULL,
1088
   `FileList` mediumtext,
1089
   `FileList` mediumtext,

+ 2
- 2
sections/ajax/torrent.php View File

103
   'mediaInfo'   => $Torrent['MediaInfo'],
103
   'mediaInfo'   => $Torrent['MediaInfo'],
104
   'fileList'    => $FileList,
104
   'fileList'    => $FileList,
105
   'filePath'    => $Torrent['FilePath'],
105
   'filePath'    => $Torrent['FilePath'],
106
-  'userId'      => (int)$Torrent['UserID'],
107
-  'username'    => $Userinfo['Username']
106
+  'userId'      => (int)($Torrent['Anonymous'] ? 0 : $Torrent['UserID']),
107
+  'username'    => ($Torrent['Anonymous'] ? 'Anonymous' : $Userinfo['Username'])
108
 ];
108
 ];
109
 
109
 
110
 json_die("success", ['group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)]);
110
 json_die("success", ['group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)]);

+ 2
- 2
sections/ajax/torrentgroup.php View File

97
     'mediaInfo'   => $Torrent['MediaInfo'],
97
     'mediaInfo'   => $Torrent['MediaInfo'],
98
     'fileList'    => $FileList,
98
     'fileList'    => $FileList,
99
     'filePath'    => $Torrent['FilePath'],
99
     'filePath'    => $Torrent['FilePath'],
100
-    'userId'      => (int)$Torrent['UserID'],
101
-    'username'    => $Userinfo['Username']
100
+    'userId'      => (int)($Torrent['Anonymous'] ? 0 : $Torrent['UserID']),
101
+    'username'    => ($Torrent['Anonymous'] ? 'Anonymous' : $Userinfo['Username'])
102
   ];
102
   ];
103
 }
103
 }
104
 
104
 

+ 8
- 4
sections/torrents/details.php View File

364
 
364
 
365
 foreach ($TorrentList as $Torrent) {
365
 foreach ($TorrentList as $Torrent) {
366
   list($TorrentID, $Media, $Container, $Codec, $Resolution, $AudioFormat, $Subbing,
366
   list($TorrentID, $Media, $Container, $Codec, $Resolution, $AudioFormat, $Subbing,
367
-    $Subber, $Language, $Censored, $Archive, $FileCount, $Size, $Seeders, $Leechers,
367
+    $Subber, $Language, $Censored, $Anonymous, $Archive, $FileCount, $Size, $Seeders, $Leechers,
368
     $Snatched, $FreeTorrent, $FreeLeechType, $TorrentTime, $Description, $MediaInfo, $FileList,
368
     $Snatched, $FreeTorrent, $FreeLeechType, $TorrentTime, $Description, $MediaInfo, $FileList,
369
     $FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles,
369
     $FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles,
370
     $LastReseedRequest, $LogInDB, $HasFile, $PersonalFL, $IsSnatched, $IsSeeding, $IsLeeching
370
     $LastReseedRequest, $LogInDB, $HasFile, $PersonalFL, $IsSnatched, $IsSeeding, $IsLeeching
541
         <td colspan="5">
541
         <td colspan="5">
542
           <div id="release_<?=$TorrentID?>" class="no_overflow">
542
           <div id="release_<?=$TorrentID?>" class="no_overflow">
543
             <blockquote>
543
             <blockquote>
544
-              Uploaded by <?=Users::format_username($UserID, false, false, false)?> <?=time_diff($TorrentTime);?>
544
+              Uploaded by <?=($Anonymous ? 'Anonymous' : Users::format_username($UserID, false, false, false))?> <?=time_diff($TorrentTime);?>
545
 <?  if ($Seeders == 0) {
545
 <?  if ($Seeders == 0) {
546
     if ($LastActive && time() - strtotime($LastActive) >= 1209600) { ?>
546
     if ($LastActive && time() - strtotime($LastActive) >= 1209600) { ?>
547
             <br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
547
             <br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
775
       <div class="body torrent_screenshots hidden">
775
       <div class="body torrent_screenshots hidden">
776
 <?
776
 <?
777
     foreach($Screenshots as $Screenshot) {
777
     foreach($Screenshots as $Screenshot) {
778
-      $SSURL = ImageTools::process($Screenshot['Image'], false)
779
-      ?><img class='tooltip lightbox-init' title='<?=Users::format_username($Screenshot['UserID'], false, false, false)?> - <?=time_diff($Screenshot['Time'])?>' src="<?=$SSURL?>" /><?
778
+      $SSURL = ImageTools::process($Screenshot['Image'], false);
779
+      if (check_perms('users_mod')) {
780
+        ?><img class='tooltip lightbox-init' title='<?=Users::format_username($Screenshot['UserID'], false, false, false)?> - <?=time_diff($Screenshot['Time'])?>' src="<?=$SSURL?>" /><?
781
+      } else {
782
+        ?><img class='tooltip lightbox-init' title='Added <?=time_diff($Screenshot['Time'])?>' src="<?=$SSURL?>" /><?
783
+      }
780
     }
784
     }
781
 ?>
785
 ?>
782
       </div>
786
       </div>

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

26
     t.Language,
26
     t.Language,
27
     t.Subber,
27
     t.Subber,
28
     t.Censored,
28
     t.Censored,
29
+    t.Anonymous,
29
     t.Archive,
30
     t.Archive,
30
     t.FreeTorrent,
31
     t.FreeTorrent,
31
     t.FreeLeechType,
32
     t.FreeLeechType,
66
 
67
 
67
 View::show_header('Edit torrent', 'upload,torrent');
68
 View::show_header('Edit torrent', 'upload,torrent');
68
 
69
 
69
-if (!($Properties['Remastered'] && !$Properties['RemasterYear']) || check_perms('edit_unknowns')) {
70
-  $TorrentForm = new TORRENT_FORM($Properties, $Err, false);
70
+$TorrentForm = new TORRENT_FORM($Properties, $Err, false);
71
 
71
 
72
-  $TorrentForm->head();
73
-  switch ($UploadForm) {
74
-    case 'Movies':
75
-      $TorrentForm->movies_form('');
76
-      break;
77
-    case 'Anime':
78
-      $TorrentForm->anime_form('');
79
-      break;
80
-    case 'Manga':
81
-      $TorrentForm->manga_form('');
82
-      break;
83
-    case 'Games':
84
-      $TorrentForm->game_form('');
85
-      break;
86
-    case 'Other':
87
-      $TorrentForm->simple_form();
88
-      break;
89
-    default:
90
-      $TorrentForm->movies_form('');
91
-  }
92
-  $TorrentForm->foot();
72
+$TorrentForm->head();
73
+switch ($UploadForm) {
74
+  case 'Movies':
75
+    $TorrentForm->movies_form('');
76
+    break;
77
+  case 'Anime':
78
+    $TorrentForm->anime_form('');
79
+    break;
80
+  case 'Manga':
81
+    $TorrentForm->manga_form('');
82
+    break;
83
+  case 'Games':
84
+    $TorrentForm->game_form('');
85
+    break;
86
+  case 'Other':
87
+    $TorrentForm->simple_form();
88
+    break;
89
+  default:
90
+    $TorrentForm->movies_form('');
93
 }
91
 }
94
-if (check_perms('torrents_edit') && (check_perms('users_mod') || $Properties['CategoryID'] == 1)) {
92
+$TorrentForm->foot();
93
+
94
+if (check_perms('torrents_edit') || check_perms('users_mod')) {
95
 ?>
95
 ?>
96
 <div class="thin">
96
 <div class="thin">
97
 <?
97
 <?

+ 1
- 0
sections/torrents/functions.php View File

79
         t.Subber,
79
         t.Subber,
80
         t.Language,
80
         t.Language,
81
         t.Censored,
81
         t.Censored,
82
+        t.Anonymous,
82
         t.Archive,
83
         t.Archive,
83
         t.FileCount,
84
         t.FileCount,
84
         t.Size,
85
         t.Size,

+ 10
- 4
sections/torrents/grouplog.php View File

6
 
6
 
7
 View::show_header("History for Group $GroupID");
7
 View::show_header("History for Group $GroupID");
8
 
8
 
9
-$Groups = Torrents::get_groups(array($GroupID), true, true, false);
9
+$Groups = Torrents::get_groups([$GroupID], true, true, false);
10
 if (!empty($Groups[$GroupID])) {
10
 if (!empty($Groups[$GroupID])) {
11
   $Group = $Groups[$GroupID];
11
   $Group = $Groups[$GroupID];
12
-  $Title = Artists::display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$GroupID.'">'.$Group['Name'].'</a>';
12
+  $Title = Artists::display_artists($Group['ExtendedArtists']).'<a href="torrents.php?id='.$GroupID.'">'.($Group['Name'] ? $Group['Name'] : ($Group['NameRJ'] ? $Group['NameRJ']: $Group['NameJP'])).'</a>';
13
 } else {
13
 } else {
14
   $Title = "Group $GroupID";
14
   $Title = "Group $GroupID";
15
 }
15
 }
28
       <td>Info</td>
28
       <td>Info</td>
29
     </tr>
29
     </tr>
30
 <?
30
 <?
31
+  $AnonTorrents = [];
31
   $Log = $DB->query("
32
   $Log = $DB->query("
32
       SELECT TorrentID, UserID, Info, Time
33
       SELECT TorrentID, UserID, Info, Time
33
       FROM group_log
34
       FROM group_log
36
   $LogEntries = $DB->to_array(false, MYSQLI_NUM);
37
   $LogEntries = $DB->to_array(false, MYSQLI_NUM);
37
   foreach ($LogEntries AS $LogEntry) {
38
   foreach ($LogEntries AS $LogEntry) {
38
     list($TorrentID, $UserID, $Info, $Time) = $LogEntry;
39
     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
+    }
39
 ?>
45
 ?>
40
     <tr class="row">
46
     <tr class="row">
41
       <td><?=$Time?></td>
47
       <td><?=$Time?></td>
61
 <?        }
67
 <?        }
62
       } else { ?>
68
       } else { ?>
63
         <td></td>
69
         <td></td>
64
-<?      }  ?>
65
-      <td><?=Users::format_username($UserID, false, false, false)?></td>
70
+<?      } ?>
71
+      <td><?=($UserID == $AnonTorrents[$TorrentID])?'Anonymous':Users::format_username($UserID, false, false, false)?></td>
66
       <td><?=$Info?></td>
72
       <td><?=$Info?></td>
67
     </tr>
73
     </tr>
68
 <?
74
 <?

+ 6
- 8
sections/torrents/takeedit.php View File

50
 $Properties['Language'] = $_POST['lang'];
50
 $Properties['Language'] = $_POST['lang'];
51
 $Properties['Subber']= $_POST['subber'];
51
 $Properties['Subber']= $_POST['subber'];
52
 $Properties['Censored'] = (isset($_POST['censored'])) ? 1 : 0;
52
 $Properties['Censored'] = (isset($_POST['censored'])) ? 1 : 0;
53
+$Properties['Anonymous'] = (isset($_POST['anonymous'])) ? 1 : 0;
53
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
54
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
54
 
55
 
55
 if ($_POST['album_desc']) {
56
 if ($_POST['album_desc']) {
241
 }
242
 }
242
 
243
 
243
 $T['Censored'] = $Properties['Censored'];
244
 $T['Censored'] = $Properties['Censored'];
245
+$T['Anonymous'] = $Properties['Anonymous'];
244
 
246
 
245
 
247
 
246
 //******************************************************************************//
248
 //******************************************************************************//
247
 //--------------- Start database stuff -----------------------------------------//
249
 //--------------- Start database stuff -----------------------------------------//
248
 
250
 
249
 $DBTorVals = [];
251
 $DBTorVals = [];
250
-/*
251
-$DB->query("
252
-  SELECT Media, Format, Encoding, RemasterYear, Remastered, RemasterTItle, RemasterRecordLabel, RemasterCatalogueNumber, Scene, Description
253
-  FROM torrents
254
-  WHERE ID = $TorrentID");
255
-  */
256
 $DB->query("
252
 $DB->query("
257
-  SELECT Media, Container, Codec, Resolution, AudioFormat, Subbing, Language, Description, MediaInfo, Censored, Archive, Subber
253
+  SELECT Media, Container, Codec, Resolution, AudioFormat, Subbing, Language, Description, MediaInfo, Censored, Anonymous, Archive, Subber
258
   FROM torrents
254
   FROM torrents
259
   WHERE ID = $TorrentID");
255
   WHERE ID = $TorrentID");
260
 $DBTorVals = $DB->to_array(false, MYSQLI_ASSOC);
256
 $DBTorVals = $DB->to_array(false, MYSQLI_ASSOC);
277
   }
273
   }
278
 }
274
 }
279
 $T['Censored'] = $Properties['Censored'];
275
 $T['Censored'] = $Properties['Censored'];
276
+$T['Anonymous'] = $Properties['Anonymous'];
280
 
277
 
281
 // Update info for the torrent
278
 // Update info for the torrent
282
 /*
279
 /*
307
     Subber = $T[Subber],
304
     Subber = $T[Subber],
308
     Archive = $T[Archive],
305
     Archive = $T[Archive],
309
     MediaInfo = $T[MediaInfo],
306
     MediaInfo = $T[MediaInfo],
310
-    Censored = $T[Censored],";
307
+    Censored = $T[Censored],
308
+    Anonymous = $T[Anonymous],";
311
 
309
 
312
 if (check_perms('torrents_freeleech')) {
310
 if (check_perms('torrents_freeleech')) {
313
   $SQL .= "FreeTorrent = $T[FreeLeech],";
311
   $SQL .= "FreeTorrent = $T[FreeLeech],";

+ 4
- 2
sections/upload/upload_handle.php View File

62
 $Properties['Subber'] = isset($_POST['subber']) ? $_POST['subber'] : '';
62
 $Properties['Subber'] = isset($_POST['subber']) ? $_POST['subber'] : '';
63
 $Properties['DLsiteID'] = (isset($_POST['dlsiteid'])) ? $_POST['dlsiteid'] : '';
63
 $Properties['DLsiteID'] = (isset($_POST['dlsiteid'])) ? $_POST['dlsiteid'] : '';
64
 $Properties['Censored'] = (isset($_POST['censored'])) ? 1 : 0;
64
 $Properties['Censored'] = (isset($_POST['censored'])) ? 1 : 0;
65
+$Properties['Anonymous'] = (isset($_POST['anonymous'])) ? 1 : 0;
65
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
66
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
66
 if (isset($_POST['library_image'])) $Properties['LibraryImage'] = $_POST['library_image'];
67
 if (isset($_POST['library_image'])) $Properties['LibraryImage'] = $_POST['library_image'];
67
 if (isset($_POST['tags'])) $Properties['TagList'] = implode(',',array_unique(explode(',', str_replace(' ','',$_POST['tags']))));
68
 if (isset($_POST['tags'])) $Properties['TagList'] = implode(',',array_unique(explode(',', str_replace(' ','',$_POST['tags']))));
254
 }
255
 }
255
 
256
 
256
 $T['Censored'] = $Properties['Censored'];
257
 $T['Censored'] = $Properties['Censored'];
258
+$T['Anonymous'] = $Properties['Anonymous'];
257
 
259
 
258
 
260
 
259
 //******************************************************************************//
261
 //******************************************************************************//
564
 $DB->query("
566
 $DB->query("
565
   INSERT INTO torrents
567
   INSERT INTO torrents
566
     (GroupID, UserID, Media, Container, Codec, Resolution, AudioFormat,
568
     (GroupID, UserID, Media, Container, Codec, Resolution, AudioFormat,
567
-    Subbing, Language, Subber, Censored, Archive, info_hash, FileCount, FileList,
569
+    Subbing, Language, Subber, Censored, Anonymous, Archive, info_hash, FileCount, FileList,
568
     FilePath, Size, Time, Description, MediaInfo, FreeTorrent, FreeLeechType)
570
     FilePath, Size, Time, Description, MediaInfo, FreeTorrent, FreeLeechType)
569
   VALUES
571
   VALUES
570
     ($GroupID, $LoggedUser[ID], $T[Media], $T[Container], $T[Codec], $T[Resolution], $T[AudioFormat],
572
     ($GroupID, $LoggedUser[ID], $T[Media], $T[Container], $T[Codec], $T[Resolution], $T[AudioFormat],
571
-    $T[Subbing], $T[Language], $T[Subber], $T[Censored], $T[Archive],'".db_string($InfoHash)."', $NumFiles, '$FileString',
573
+    $T[Subbing], $T[Language], $T[Subber], $T[Censored], $T[Anonymous], $T[Archive],'".db_string($InfoHash)."', $NumFiles, '$FileString',
572
     '$FilePath', $TotalSize, '".sqltime()."', $T[TorrentDescription], $T[MediaInfo], '$T[FreeTorrent]', '$T[FreeLeechType]')");
574
     '$FilePath', $TotalSize, '".sqltime()."', $T[TorrentDescription], $T[MediaInfo], '$T[FreeTorrent]', '$T[FreeLeechType]')");
573
 
575
 
574
 $Cache->increment('stats_torrent_count');
576
 $Cache->increment('stats_torrent_count');

Loading…
Cancel
Save