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(); $QueryID = G::$DB->get_query_id();
G::$DB->query(" G::$DB->query("
SELECT SELECT
r.ID, ID,
r.ReporterID, ReporterID,
r.Type, Type,
r.UserComment, UserComment,
r.ReportedTime ReportedTime
FROM reportsv2 AS r FROM reportsv2
WHERE TorrentID = $TorrentID WHERE TorrentID = $TorrentID
AND Type != 'edited'
AND Status != 'Resolved'"); AND Status != 'Resolved'");
$Reports = G::$DB->to_array(); $Reports = G::$DB->to_array(false, MYSQLI_ASSOC, false);
G::$DB->set_query_id($QueryID); G::$DB->set_query_id($QueryID);
G::$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0); 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; return $Reports;
} }
} }

View File

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

View File

@ -555,40 +555,12 @@ function filelist($Str) {
$Reported = false; $Reported = false;
unset($ReportedTimes); unset($ReportedTimes);
$Reports = $Cache->get_value("reports_torrent_$TorrentID"); $Reports = Torrents::get_reports($TorrentID);
if ($Reports === false) { $NumReports = count($Reports);
$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);
}
// used to see if we have any non-"edited log" reports to display if ($NumReports > 0) {
$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)) {
$Reported = true; $Reported = true;
include(SERVER_ROOT.'/sections/reportsv2/array.php'); include(SERVER_ROOT.'/sections/reportsv2/array.php');
$NumReports = check_perms('admin_reports') ? count($Reports) : $NumNonEditedLogReports;
$ReportInfo = ' $ReportInfo = '
<table class="reportinfo_table"> <table class="reportinfo_table">
<tr class="colhead_dark" style="font-weight: bold;"> <tr class="colhead_dark" style="font-weight: bold;">
@ -596,28 +568,27 @@ function filelist($Str) {
</tr>"; </tr>";
foreach ($Reports as $Report) { foreach ($Reports as $Report) {
list($ReportID, $ReporterID, $ReportType, $ReportReason, $ReportedTime) = $Report; if (check_perms('admin_reports')) {
$ReporterID = $Report['ReporterID'];
$Reporter = Users::user_info($ReporterID); $Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username']; $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>";
if ($ReportType == 'edited' && !check_perms('admin_reports')) { } else {
// Edited Log report and the viewing user does not have adequate permission $ReportLinks = 'Someone reported it';
continue;
} }
if (array_key_exists($ReportType, $Types[$GroupCategoryID])) { if (isset($Types[$GroupCategoryID][$Report['Type']])) {
$ReportType = $Types[$GroupCategoryID][$ReportType]; $ReportType = $Types[$GroupCategoryID][$Report['Type']];
} elseif (array_key_exists($ReportType, $Types['master'])) { } elseif (isset($Types['master'][$Report['Type']])) {
$ReportType = $Types['master'][$ReportType]; $ReportType = $Types['master'][$Report['Type']];
} else { } else {
//There was a type but it wasn't an option! //There was a type but it wasn't an option!
$ReportType = $Types['master']['other']; $ReportType = $Types['master']['other'];
} }
$ReportInfo .= " $ReportInfo .= "
<tr> <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'] . '": <td>$ReportLinks ".time_diff($Report['ReportedTime'], 2, true, true).' for the reason "'.$ReportType['title'].'":
<blockquote>'.$Text->full_format($ReportReason).'</blockquote> <blockquote>'.$Text->full_format($Report['UserComment']).'</blockquote>
</td> </td>
</tr>'; </tr>';
} }

View File

@ -283,45 +283,44 @@ function filelist($Str) {
$Reported = false; $Reported = false;
unset($ReportedTimes); unset($ReportedTimes);
$Reports = $Cache->get_value("reports_torrent_$TorrentID"); $Reports = Torrents::get_reports($TorrentID);
if ($Reports === false) { $NumReports = count($Reports);
$DB->query("
SELECT if ($NumReports > 0) {
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) {
$Reported = true; $Reported = true;
include(SERVER_ROOT . '/sections/reportsv2/array.php'); 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>"; $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) { 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); if (isset($Types[$GroupCategoryID][$Report['Type']])) {
$ReporterName = $Reporter['Username']; $ReportType = $Types[$GroupCategoryID][$Report['Type']];
} elseif (isset($Types['master'][$Report['Type']])) {
if (array_key_exists($ReportType, $Types[$GroupCategoryID])) { $ReportType = $Types['master'][$Report['Type']];
$ReportType = $Types[$GroupCategoryID][$ReportType];
} elseif (array_key_exists($ReportType, $Types['master'])) {
$ReportType = $Types['master'][$ReportType];
} else { } else {
//There was a type but it wasn't an option! //There was a type but it wasn't an option!
$ReportType = $Types['master']['other']; $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 .= "
$ReportInfo .= "\n\t\t\t<blockquote>" . $Text->full_format($ReportReason) . "</blockquote>\n\t\t</td>\n\t</tr>"; <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))); $CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));

View File

@ -1,36 +1,33 @@
(function ($) { $(document).ready(function() {
var remove_comma = false; if ($('#donor_title_prefix_preview').size() === 0) {
$(document).ready(function() { return;
$("#donor_title_prefix_preview").text($("#donor_title_prefix").val().trim() + " "); }
$("#donor_title_suffix_preview").text(" " + $("#donor_title_suffix").val().trim()); $('#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($('#donor_title_comma').attr('checked')) {
if(remove_comma) { $('#donor_title_comma_preview').text('');
$("#donor_title_comma_preview").text(""); } else {
} else { $('#donor_title_comma_preview').text(', ');
$("#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(", ");
}
});
$('#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(', ');
}
});
});