Browse Source

Respect anonymous uploads in log

spaghetti 7 years ago
parent
commit
82c06f7d3d
3 changed files with 14 additions and 8 deletions
  1. 10
    4
      sections/log/index.php
  2. 2
    2
      sections/torrents/takeedit.php
  3. 2
    2
      sections/upload/upload_handle.php

+ 10
- 4
sections/log/index.php View File

105
             $UserID = $MessageParts[++$i];
105
             $UserID = $MessageParts[++$i];
106
           }
106
           }
107
           $URL = "user $UserID (<a href=\"user.php?id=$UserID\">".substr($MessageParts[++$i], 1, -1).'</a>)';
107
           $URL = "user $UserID (<a href=\"user.php?id=$UserID\">".substr($MessageParts[++$i], 1, -1).'</a>)';
108
-        } elseif (in_array($MessageParts[$i - 1], array('deleted', 'uploaded', 'edited', 'created', 'recovered'))) {
108
+        } elseif (in_array($MessageParts[$i - 1], ['deleted', 'uploaded', 'edited', 'created', 'recovered'])) {
109
           $User = $MessageParts[++$i];
109
           $User = $MessageParts[++$i];
110
           if (substr($User, -1) == ':') {
110
           if (substr($User, -1) == ':') {
111
             $User = substr($User, 0, -1);
111
             $User = substr($User, 0, -1);
115
             $DB->query("
115
             $DB->query("
116
               SELECT ID
116
               SELECT ID
117
               FROM users_main
117
               FROM users_main
118
-              WHERE Username = _utf8 '" . db_string($User) . "'
119
-              COLLATE utf8_bin");
118
+              WHERE Username = ?", $User);
120
             list($UserID) = $DB->next_record();
119
             list($UserID) = $DB->next_record();
121
             $Usernames[$User] = $UserID ? $UserID : '';
120
             $Usernames[$User] = $UserID ? $UserID : '';
122
           } else {
121
           } else {
123
             $UserID = $Usernames[$User];
122
             $UserID = $Usernames[$User];
124
           }
123
           }
125
-          $DB->set_query_id($Log);
126
           $URL = $Usernames[$User] ? "<a href=\"user.php?id=$UserID\">$User</a>".($Colon ? ':' : '') : $User;
124
           $URL = $Usernames[$User] ? "<a href=\"user.php?id=$UserID\">$User</a>".($Colon ? ':' : '') : $User;
125
+          if (in_array($MessageParts[$i - 2], ['uploaded', 'edited'])) {
126
+            $DB->query("SELECT UserID, Anonymous FROM torrents WHERE ID = ?", $MessageParts[1]);
127
+            if ($DB->has_results()) {
128
+              list($UploaderID, $AnonTorrent) = $DB->next_record();
129
+              if ($AnonTorrent && $UploaderID == $UserID) $URL = '<em>Anonymous</em>';
130
+            }
131
+          }
132
+          $DB->set_query_id($Log);
127
         }
133
         }
128
         $Message = "$Message by $URL";
134
         $Message = "$Message by $URL";
129
         break;
135
         break;

+ 2
- 2
sections/torrents/takeedit.php View File

49
 $Properties['Subbing'] = $_POST['sub'];
49
 $Properties['Subbing'] = $_POST['sub'];
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;
53
-$Properties['Anonymous'] = (isset($_POST['anonymous'])) ? 1 : 0;
52
+$Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
53
+$Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
54
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
54
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
55
 
55
 
56
 if ($_POST['album_desc']) {
56
 if ($_POST['album_desc']) {

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

61
 $Properties['Language'] = isset($_POST['lang']) ? $_POST['lang'] : '';
61
 $Properties['Language'] = isset($_POST['lang']) ? $_POST['lang'] : '';
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;
65
-$Properties['Anonymous'] = (isset($_POST['anonymous'])) ? 1 : 0;
64
+$Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
65
+$Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
66
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
66
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
67
 if (isset($_POST['library_image'])) $Properties['LibraryImage'] = $_POST['library_image'];
67
 if (isset($_POST['library_image'])) $Properties['LibraryImage'] = $_POST['library_image'];
68
 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']))));

Loading…
Cancel
Save