Empty commit

This commit is contained in:
Git 2013-11-07 08:00:43 +00:00
parent 529f8a9d01
commit b824718969
6 changed files with 93 additions and 122 deletions

View File

@ -936,19 +936,27 @@ public static function get_reports($TorrentID) {
$QueryID = G::$DB->get_query_id();
G::$DB->query("
SELECT
r.ID,
r.ReporterID,
r.Type,
r.UserComment,
r.ReportedTime
FROM reportsv2 AS r
ID,
ReporterID,
Type,
UserComment,
ReportedTime
FROM reportsv2
WHERE TorrentID = $TorrentID
AND Type != 'edited'
AND Status != 'Resolved'");
$Reports = G::$DB->to_array();
$Reports = G::$DB->to_array(false, MYSQLI_ASSOC, false);
G::$DB->set_query_id($QueryID);
G::$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0);
}
if (!check_perms('admin_reports')) {
$Return = array();
foreach ($Reports as $Report) {
if ($Report['Type'] !== 'edited') {
$Return[] = $Report;
}
}
return $Return;
}
return $Reports;
}
}

View File

@ -87,11 +87,7 @@
$FileList = implode('|||', $FileList);
$Userinfo = Users::user_info($Torrent['UserID']);
$Reports = Torrents::get_reports($Torrent['ID']);
if (count($Reports) > 0) {
$Torrent['Reported'] = true;
} else {
$Torrent['Reported'] = false;
}
$Torrent['Reported'] = count($Reports) > 0;
$JsonTorrentList[] = array(
'id' => (int)$Torrent['ID'],
'media' => $Torrent['Media'],

View File

@ -396,7 +396,7 @@
<li id="r2.6.7"><a href="#h2.6"><strong>&uarr;_</strong></a> <a href="#r2.6.7">2.6.7.</a> <strong>Include lineage information for each soundboard recording (see <a href="#r2.3.10">2.3.10</a>).</strong>
<ul>
<li id="r2.6.7.1"><a href="#r2.6.7"><strong>&uarr;_</strong></a> <a href="#r2.6.7.1">2.6.7.1.</a> <strong>Lineage information for a soundboard recording is highly recommended.</strong> </li>
<li id="r2.6.7.2"><a href="#r2.6.7"><strong>&uarr;_</strong></a> <a href="#r2.6.7.2">2.6.7.2.</a> <strong>If a soundboard is uploaded without a lineage, and a lineage is later found that contains or more than one tape or CD-R generation, then the uploader will be warned and the torrent deleted.</strong></li>
<li id="r2.6.7.2"><a href="#r2.6.7"><strong>&uarr;_</strong></a> <a href="#r2.6.7.2">2.6.7.2.</a> <strong>If a soundboard is uploaded without a lineage, and a lineage is later found that contains more than one tape or CD-R generation, then the uploader will be warned and the torrent deleted.</strong></li>
<li id="r2.6.7.3"><a href="#r2.6.7"><strong>&uarr;_</strong></a> <a href="#r2.6.7.3">2.6.7.3.</a> <strong>No lineage editing or misrepresentation will be tolerated.</strong> Doing so will result in the loss of upload privileges. If you are unsure of a lineage, then do not provide it. Do NOT guess.</li>
</ul>
</li>

View File

@ -555,40 +555,12 @@ function filelist($Str) {
$Reported = false;
unset($ReportedTimes);
$Reports = $Cache->get_value("reports_torrent_$TorrentID");
if ($Reports === false) {
$DB->query("
SELECT
r.ID,
r.ReporterID,
r.Type,
r.UserComment,
r.ReportedTime
FROM reportsv2 AS r
WHERE TorrentID = $TorrentID
AND Status != 'Resolved'");
$Reports = $DB->to_array();
$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0);
}
$Reports = Torrents::get_reports($TorrentID);
$NumReports = count($Reports);
// used to see if we have any non-"edited log" reports to display
$NumNonEditedLogReports = 0;
foreach ($Reports as $Report) {
if ($Report['Type'] != 'edited') {
$NumNonEditedLogReports += 1;
}
}
/* for regular users, don't display the torrent reports table if there
* are 0 non-"edited log" reports.
* always let staff (e.g. permission "admin_reports") view "edited
* log" reports.
*/
if ($NumNonEditedLogReports > 0 || (check_perms('admin_reports') && $Reports)) {
if ($NumReports > 0) {
$Reported = true;
include(SERVER_ROOT.'/sections/reportsv2/array.php');
$NumReports = check_perms('admin_reports') ? count($Reports) : $NumNonEditedLogReports;
$ReportInfo = '
<table class="reportinfo_table">
<tr class="colhead_dark" style="font-weight: bold;">
@ -596,28 +568,27 @@ function filelist($Str) {
</tr>";
foreach ($Reports as $Report) {
list($ReportID, $ReporterID, $ReportType, $ReportReason, $ReportedTime) = $Report;
$Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username'];
if ($ReportType == 'edited' && !check_perms('admin_reports')) {
// Edited Log report and the viewing user does not have adequate permission
continue;
if (check_perms('admin_reports')) {
$ReporterID = $Report['ReporterID'];
$Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username'];
$ReportLinks = "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$Report[ID]\">reported it</a>";
} else {
$ReportLinks = 'Someone reported it';
}
if (array_key_exists($ReportType, $Types[$GroupCategoryID])) {
$ReportType = $Types[$GroupCategoryID][$ReportType];
} elseif (array_key_exists($ReportType, $Types['master'])) {
$ReportType = $Types['master'][$ReportType];
if (isset($Types[$GroupCategoryID][$Report['Type']])) {
$ReportType = $Types[$GroupCategoryID][$Report['Type']];
} elseif (isset($Types['master'][$Report['Type']])) {
$ReportType = $Types['master'][$Report['Type']];
} else {
//There was a type but it wasn't an option!
$ReportType = $Types['master']['other'];
}
$ReportInfo .= "
<tr>
<td>".(check_perms('admin_reports') ? "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":
<blockquote>'.$Text->full_format($ReportReason).'</blockquote>
<td>$ReportLinks ".time_diff($Report['ReportedTime'], 2, true, true).' for the reason "'.$ReportType['title'].'":
<blockquote>'.$Text->full_format($Report['UserComment']).'</blockquote>
</td>
</tr>';
}

View File

@ -283,45 +283,44 @@ function filelist($Str) {
$Reported = false;
unset($ReportedTimes);
$Reports = $Cache->get_value("reports_torrent_$TorrentID");
if ($Reports === false) {
$DB->query("
SELECT
r.ID,
r.ReporterID,
r.Type,
r.UserComment,
r.ReportedTime
FROM reportsv2 AS r
WHERE TorrentID = $TorrentID
AND Type != 'edited'
AND Status != 'Resolved'");
$Reports = $DB->to_array();
$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0);
}
if (count($Reports) > 0) {
$Reports = Torrents::get_reports($TorrentID);
$NumReports = count($Reports);
if ($NumReports > 0) {
$Reported = true;
include(SERVER_ROOT . '/sections/reportsv2/array.php');
$ReportInfo = "\n<table>\n\t<tr class=\"colhead_dark\" style=\"font-weight: bold;\">\n\t\t<td>This torrent has " . count($Reports) . ' active ' . (count($Reports) > 1 ? 'reports' : 'report') . ":</td>\n\t</tr>";
include(SERVER_ROOT.'/sections/reportsv2/array.php');
$ReportInfo = '
<table class="reportinfo_table">
<tr class="colhead_dark" style="font-weight: bold;">
<td>This torrent has '.$NumReports.' active '.($NumReports === 1 ? 'report' : 'reports').":</td>
</tr>";
foreach ($Reports as $Report) {
list($ReportID, $ReporterID, $ReportType, $ReportReason, $ReportedTime) = $Report;
if (check_perms('admin_reports')) {
$ReporterID = $Report['ReporterID'];
$Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username'];
$ReportLinks = "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$Report[ID]\">reported it</a>";
} else {
$ReportLinks = 'Someone reported it';
}
$Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username'];
if (array_key_exists($ReportType, $Types[$GroupCategoryID])) {
$ReportType = $Types[$GroupCategoryID][$ReportType];
} elseif (array_key_exists($ReportType, $Types['master'])) {
$ReportType = $Types['master'][$ReportType];
if (isset($Types[$GroupCategoryID][$Report['Type']])) {
$ReportType = $Types[$GroupCategoryID][$Report['Type']];
} elseif (isset($Types['master'][$Report['Type']])) {
$ReportType = $Types['master'][$Report['Type']];
} else {
//There was a type but it wasn't an option!
$ReportType = $Types['master']['other'];
}
$ReportInfo .= "\n\t<tr>\n\t\t<td>" . (check_perms('admin_reports') ? "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":';
$ReportInfo .= "\n\t\t\t<blockquote>" . $Text->full_format($ReportReason) . "</blockquote>\n\t\t</td>\n\t</tr>";
$ReportInfo .= "
<tr>
<td>$ReportLinks ".time_diff($Report['ReportedTime'], 2, true, true).' for the reason "'.$ReportType['title'].'":
<blockquote>'.$Text->full_format($Report['UserComment']).'</blockquote>
</td>
</tr>';
}
$ReportInfo .= "\n</table>";
$ReportInfo .= "\n\t\t</table>";
}
$CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));

View File

@ -1,36 +1,33 @@
(function ($) {
var remove_comma = false;
$(document).ready(function() {
$("#donor_title_prefix_preview").text($("#donor_title_prefix").val().trim() + " ");
$("#donor_title_suffix_preview").text(" " + $("#donor_title_suffix").val().trim());
$(document).ready(function() {
if ($('#donor_title_prefix_preview').size() === 0) {
return;
}
$('#donor_title_prefix_preview').text($('#donor_title_prefix').val().trim() + ' ');
$('#donor_title_suffix_preview').text(' ' + $('#donor_title_suffix').val().trim());
remove_comma = $("#donor_title_comma").attr("checked");
if(remove_comma) {
$("#donor_title_comma_preview").text("");
} else {
$("#donor_title_comma_preview").text(", ");
}
$("#donor_title_prefix").keyup(function() {
if($(this).val().length <= 30) {
$("#donor_title_prefix_preview").text($(this).val().trim() + " ");
}
});
$("#donor_title_suffix").keyup(function() {
if($(this).val().length <= 30) {
$("#donor_title_suffix_preview").text(" " + $(this).val().trim());
}
});
$("#donor_title_comma").change(function() {
remove_comma = $(this).attr("checked");
if(remove_comma) {
$("#donor_title_comma_preview").text("");
} else {
$("#donor_title_comma_preview").text(", ");
}
});
if($('#donor_title_comma').attr('checked')) {
$('#donor_title_comma_preview').text('');
} else {
$('#donor_title_comma_preview').text(', ');
}
$('#donor_title_prefix').keyup(function() {
if($(this).val().length <= 30) {
$('#donor_title_prefix_preview').text($(this).val().trim() + ' ');
}
});
}(jQuery));
$('#donor_title_suffix').keyup(function() {
if($(this).val().length <= 30) {
$('#donor_title_suffix_preview').text(' ' + $(this).val().trim());
}
});
$('#donor_title_comma').change(function() {
if($(this).attr('checked')) {
$('#donor_title_comma_preview').text('');
} else {
$('#donor_title_comma_preview').text(', ');
}
});
});