Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

static.php 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. <?php
  2. /*
  3. * This page is used for viewing reports in every viewpoint except auto.
  4. * It doesn't AJAX grab a new report when you resolve each one, use auto
  5. * for that (reports.php). If you wanted to add a new view, you'd simply
  6. * add to the case statement(s) below and add an entry to views.php to
  7. * explain it.
  8. * Any changes made to this page within the foreach loop should probably be
  9. * replicated on the auto page (reports.php).
  10. */
  11. if (!check_perms('admin_reports')) {
  12. error(403);
  13. }
  14. include(SERVER_ROOT.'/classes/reports.class.php');
  15. define('REPORTS_PER_PAGE', '10');
  16. list($Page, $Limit) = Format::page_limit(REPORTS_PER_PAGE);
  17. if (isset($_GET['view'])) {
  18. $View = $_GET['view'];
  19. } else {
  20. error(404);
  21. }
  22. if (isset($_GET['id'])) {
  23. if (!is_number($_GET['id']) && $View !== 'type') {
  24. error(404);
  25. } else {
  26. $ID = db_string($_GET['id']);
  27. }
  28. } else {
  29. $ID = '';
  30. }
  31. $Order = 'ORDER BY r.ReportedTime ASC';
  32. if (!$ID) {
  33. switch ($View) {
  34. case 'resolved':
  35. $Title = 'All the old smelly reports';
  36. $Where = "WHERE r.Status = 'Resolved'";
  37. $Order = 'ORDER BY r.LastChangeTime DESC';
  38. break;
  39. case 'unauto':
  40. $Title = 'New reports, not auto assigned!';
  41. $Where = "WHERE r.Status = 'New'";
  42. break;
  43. default:
  44. error(404);
  45. break;
  46. }
  47. } else {
  48. switch ($View) {
  49. case 'staff':
  50. $DB->query("
  51. SELECT Username
  52. FROM users_main
  53. WHERE ID = $ID");
  54. list($Username) = $DB->next_record();
  55. if ($Username) {
  56. $Title = "$Username's in-progress reports";
  57. } else {
  58. $Title = "$ID's in-progress reports";
  59. }
  60. $Where = "
  61. WHERE r.Status = 'InProgress'
  62. AND r.ResolverID = $ID";
  63. break;
  64. case 'resolver':
  65. $DB->query("
  66. SELECT Username
  67. FROM users_main
  68. WHERE ID = $ID");
  69. list($Username) = $DB->next_record();
  70. if ($Username) {
  71. $Title = "$Username's resolved reports";
  72. } else {
  73. $Title = "$ID's resolved reports";
  74. }
  75. $Where = "
  76. WHERE r.Status = 'Resolved'
  77. AND r.ResolverID = $ID";
  78. $Order = 'ORDER BY r.LastChangeTime DESC';
  79. break;
  80. case 'group':
  81. $Title = "Unresolved reports for the group $ID";
  82. $Where = "
  83. WHERE r.Status != 'Resolved'
  84. AND tg.ID = $ID";
  85. break;
  86. case 'torrent':
  87. $Title = "All reports for the torrent $ID";
  88. $Where = "WHERE r.TorrentID = $ID";
  89. break;
  90. case 'report':
  91. $Title = "Viewing resolution of report $ID";
  92. $Where = "WHERE r.ID = $ID";
  93. break;
  94. case 'reporter':
  95. $DB->query("
  96. SELECT Username
  97. FROM users_main
  98. WHERE ID = $ID");
  99. list($Username) = $DB->next_record();
  100. if ($Username) {
  101. $Title = "All torrents reported by $Username";
  102. } else {
  103. $Title = "All torrents reported by user $ID";
  104. }
  105. $Where = "WHERE r.ReporterID = $ID";
  106. $Order = 'ORDER BY r.ReportedTime DESC';
  107. break;
  108. case 'uploader':
  109. $DB->query("
  110. SELECT Username
  111. FROM users_main
  112. WHERE ID = $ID");
  113. list($Username) = $DB->next_record();
  114. if ($Username) {
  115. $Title = "All reports for torrents uploaded by $Username";
  116. } else {
  117. $Title = "All reports for torrents uploaded by user $ID";
  118. }
  119. $Where = "
  120. WHERE r.Status != 'Resolved'
  121. AND t.UserID = $ID";
  122. break;
  123. case 'type':
  124. $Title = 'All new reports for the chosen type';
  125. $Where = "
  126. WHERE r.Status = 'New'
  127. AND r.Type = '$ID'";
  128. break;
  129. break;
  130. default:
  131. error(404);
  132. break;
  133. }
  134. }
  135. /*
  136. $DB->query("
  137. SELECT
  138. SQL_CALC_FOUND_ROWS
  139. r.ID,
  140. r.ReporterID,
  141. reporter.Username,
  142. r.TorrentID,
  143. r.Type,
  144. r.UserComment,
  145. r.ResolverID,
  146. resolver.Username,
  147. r.Status,
  148. r.ReportedTime,
  149. r.LastChangeTime,
  150. r.ModComment,
  151. r.Track,
  152. r.Image,
  153. r.ExtraID,
  154. r.Link,
  155. r.LogMessage,
  156. tg.Name,
  157. tg.ID,
  158. CASE COUNT(ta.GroupID)
  159. WHEN 1 THEN aa.ArtistID
  160. WHEN 0 THEN '0'
  161. ELSE '0'
  162. END AS ArtistID,
  163. CASE COUNT(ta.GroupID)
  164. WHEN 1 THEN aa.Name
  165. WHEN 0 THEN ''
  166. ELSE 'Various Artists'
  167. END AS ArtistName,
  168. tg.Year,
  169. tg.CategoryID,
  170. t.Time,
  171. t.Remastered,
  172. t.RemasterTitle,
  173. t.RemasterYear,
  174. t.Media,
  175. t.Format,
  176. t.Encoding,
  177. t.Size,
  178. t.HasCue,
  179. t.HasLog,
  180. t.LogScore,
  181. t.UserID AS UploaderID,
  182. uploader.Username
  183. FROM reportsv2 AS r
  184. LEFT JOIN torrents AS t ON t.ID = r.TorrentID
  185. LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
  186. LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID AND ta.Importance = '1'
  187. LEFT JOIN artists_alias AS aa ON aa.AliasID = ta.AliasID
  188. LEFT JOIN users_main AS resolver ON resolver.ID = r.ResolverID
  189. LEFT JOIN users_main AS reporter ON reporter.ID = r.ReporterID
  190. LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID
  191. $Where
  192. GROUP BY r.ID
  193. $Order
  194. LIMIT $Limit");
  195. */
  196. $DB->query("
  197. SELECT
  198. SQL_CALC_FOUND_ROWS
  199. r.ID,
  200. r.ReporterID,
  201. reporter.Username,
  202. r.TorrentID,
  203. r.Type,
  204. r.UserComment,
  205. r.ResolverID,
  206. resolver.Username,
  207. r.Status,
  208. r.ReportedTime,
  209. r.LastChangeTime,
  210. r.ModComment,
  211. r.Track,
  212. r.Image,
  213. r.ExtraID,
  214. r.Link,
  215. r.LogMessage,
  216. tg.Name,
  217. tg.ID,
  218. CASE COUNT(ta.GroupID)
  219. WHEN 1 THEN ag.ArtistID
  220. ELSE '0'
  221. END AS ArtistID,
  222. CASE COUNT(ta.GroupID)
  223. WHEN 1 THEN ag.Name
  224. WHEN 0 THEN ''
  225. ELSE 'Various Artists'
  226. END AS ArtistName,
  227. tg.Year,
  228. tg.CategoryID,
  229. t.Time,
  230. t.Media,
  231. t.Size,
  232. t.UserID AS UploaderID,
  233. uploader.Username
  234. FROM reportsv2 AS r
  235. LEFT JOIN torrents AS t ON t.ID = r.TorrentID
  236. LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
  237. LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID
  238. LEFT JOIN artists_group AS ag ON ag.ArtistID = ta.ArtistID
  239. LEFT JOIN users_main AS resolver ON resolver.ID = r.ResolverID
  240. LEFT JOIN users_main AS reporter ON reporter.ID = r.ReporterID
  241. LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID
  242. $Where
  243. GROUP BY r.ID
  244. $Order
  245. LIMIT $Limit");
  246. $Reports = $DB->to_array();
  247. $DB->query('SELECT FOUND_ROWS()');
  248. list($Results) = $DB->next_record();
  249. $PageLinks = Format::get_pages($Page, $Results, REPORTS_PER_PAGE, 11);
  250. View::show_header('Reports V2!', 'reportsv2,bbcode');
  251. ?>
  252. <div class="header">
  253. <h2><?=$Title?></h2>
  254. <? include('header.php'); ?>
  255. </div>
  256. <div class="buttonbox pad center">
  257. <? if ($View !== 'resolved') { ?>
  258. <span class="tooltip" title="Resolves *all* checked reports with their respective resolutions"><input type="button" onclick="MultiResolve();" value="Multi-resolve" /></span>
  259. <span class="tooltip" title="Assigns all of the reports on the page to you!"><input type="button" onclick="Grab();" value="Claim all" /></span>
  260. <? }
  261. if ($View === 'staff' && $LoggedUser['ID'] == $ID) { ?>
  262. | <span class="tooltip" title="Unclaim all of the reports currently displayed"><input type="button" onclick="GiveBack();" value="Unclaim all" /></span>
  263. <? } ?>
  264. </div>
  265. <? if ($PageLinks) { ?>
  266. <div class="linkbox">
  267. <?=$PageLinks?>
  268. </div>
  269. <? } ?>
  270. <div id="all_reports" style="width: 80%; margin-left: auto; margin-right: auto;">
  271. <?
  272. if (count($Reports) === 0) {
  273. ?>
  274. <div class="box pad center">
  275. <strong>No new reports</strong>
  276. </div>
  277. <?
  278. } else {
  279. foreach ($Reports as $Report) {
  280. list($ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment,
  281. $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime, $ModComment,
  282. $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID,
  283. $ArtistName, $Year, $CategoryID, $Time, $Media, $Size, $UploaderID,
  284. $UploaderName) = Misc::display_array($Report, array('ModComment'));
  285. if (!$GroupID && $Status != 'Resolved') {
  286. //Torrent already deleted
  287. $DB->query("
  288. UPDATE reportsv2
  289. SET
  290. Status = 'Resolved',
  291. LastChangeTime = NOW(),
  292. ModComment = 'Report already dealt with (torrent deleted)'
  293. WHERE ID = $ReportID");
  294. $Cache->decrement('num_torrent_reportsv2');
  295. ?>
  296. <div id="report<?=$ReportID?>" class="report box pad center" data-load-report="<?=$ReportID?>">
  297. <a href="reportsv2.php?view=report&amp;id=<?=$ReportID?>">Report <?=$ReportID?></a> for torrent <?=$TorrentID?> (deleted) has been automatically resolved. <input type="button" value="Hide" onclick="ClearReport(<?=$ReportID?>);" />
  298. </div>
  299. <?
  300. } else {
  301. if (!$CategoryID && false) {
  302. //Torrent was deleted
  303. } else {
  304. // if (array_key_exists($Type, $Types[$CategoryID])) {
  305. // $ReportType = $Types[$CategoryID][$Type];
  306. /* } else*/if (array_key_exists($Type, $Types['master'])) {
  307. $ReportType = $Types['master'][$Type];
  308. } else {
  309. //There was a type but it wasn't an option!
  310. $Type = 'other';
  311. $ReportType = $Types['master']['other'];
  312. }
  313. }
  314. // $RemasterDisplayString = Reports::format_reports_remaster_info($Remastered, $RemasterTitle, $RemasterYear);
  315. /*
  316. if ($ArtistID == 0 && empty($ArtistName)) {
  317. $RawName = $GroupName.($Year ? " ($Year)" : '').($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . $RemasterDisplayString . ($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
  318. $LinkName = "<a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\">".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . $RemasterDisplayString . '</a> '.($HasCue ? ' (Cue)' : '').($HasLog ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID\">(Log: {$LogScore}%)</a>" : '').' ('.number_format($Size / (1024 * 1024), 2)." MB)";
  319. $BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
  320. } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
  321. $RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]{$RemasterDisplayString}" . ($HasCue ? ' (Cue)' : '').($HasLog ? " (Log: {$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
  322. $LinkName = "Various Artists - <a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\"> [$Format/$Encoding/$Media]$RemasterDisplayString</a> ".($HasCue ? ' (Cue)' : '').($HasLog ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID\">(Log: {$LogScore}%)</a>" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
  323. $BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] ".($HasCue ? ' (Cue)' : '').($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
  324. } else {
  325. */
  326. $RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Media] (".number_format($Size / (1024 * 1024), 2).' MB)';
  327. $LinkName = "<a href=\"artist.php?id=$ArtistID\">$ArtistName</a> - <a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\"> [$Media]</a> (".number_format($Size / (1024 * 1024), 2).' MB)';
  328. $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Media][/url] ".' ('.number_format($Size / (1024 * 1024), 2).' MB)';
  329. // }
  330. ?>
  331. <div id="report<?=$ReportID?>" data-load-report="<?=$ReportID?>">
  332. <form class="manage_form" name="report" id="reportform_<?=$ReportID?>" action="reports.php" method="post">
  333. <?
  334. /*
  335. * Some of these are for takeresolve, namely the ones that aren't inputs, some for the JavaScript.
  336. */
  337. ?>
  338. <div>
  339. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  340. <input type="hidden" id="reportid<?=$ReportID?>" name="reportid" value="<?=$ReportID?>" />
  341. <input type="hidden" id="torrentid<?=$ReportID?>" name="torrentid" value="<?=$TorrentID?>" />
  342. <input type="hidden" id="uploader<?=$ReportID?>" name="uploader" value="<?=$UploaderName?>" />
  343. <input type="hidden" id="uploaderid<?=$ReportID?>" name="uploaderid" value="<?=$UploaderID?>" />
  344. <input type="hidden" id="reporterid<?=$ReportID?>" name="reporterid" value="<?=$ReporterID?>" />
  345. <input type="hidden" id="report_reason<?=$ReportID?>" name="report_reason" value="<?=$UserComment?>" />
  346. <input type="hidden" id="raw_name<?=$ReportID?>" name="raw_name" value="<?=$RawName?>" />
  347. <input type="hidden" id="type<?=$ReportID?>" name="type" value="<?=$Type?>" />
  348. <input type="hidden" id="categoryid<?=$ReportID?>" name="categoryid" value="<?=$CategoryID?>" />
  349. </div>
  350. <div class="box pad">
  351. <table class="layout" cellpadding="5">
  352. <tr>
  353. <td class="label"><a href="reportsv2.php?view=report&amp;id=<?=$ReportID?>">Reported</a> torrent:</td>
  354. <td colspan="3">
  355. <? if (!$GroupID) { ?>
  356. <a href="log.php?search=Torrent+<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)
  357. <? } else { ?>
  358. <?=$LinkName?>
  359. <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets tooltip">DL</a>
  360. uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
  361. <br />
  362. <? if ($ReporterName == '') {
  363. $ReporterName = 'System';
  364. } ?>
  365. <div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
  366. <? if ($Status != 'Resolved') {
  367. $DB->query("
  368. SELECT r.ID
  369. FROM reportsv2 AS r
  370. LEFT JOIN torrents AS t ON t.ID = r.TorrentID
  371. WHERE r.Status != 'Resolved'
  372. AND t.GroupID = $GroupID");
  373. $GroupOthers = ($DB->record_count() - 1);
  374. if ($GroupOthers > 0) { ?>
  375. <div style="text-align: right;">
  376. <a href="reportsv2.php?view=group&amp;id=<?=$GroupID?>">There <?=(($GroupOthers > 1) ? "are $GroupOthers other reports" : "is 1 other report")?> for torrent(s) in this group</a>
  377. </div>
  378. <? }
  379. $DB->query("
  380. SELECT t.UserID
  381. FROM reportsv2 AS r
  382. JOIN torrents AS t ON t.ID = r.TorrentID
  383. WHERE r.Status != 'Resolved'
  384. AND t.UserID = $UploaderID");
  385. $UploaderOthers = ($DB->record_count() - 1);
  386. if ($UploaderOthers > 0) { ?>
  387. <div style="text-align: right;">
  388. <a href="reportsv2.php?view=uploader&amp;id=<?=$UploaderID?>">There <?=(($UploaderOthers > 1) ? "are $UploaderOthers other reports" : "is 1 other report")?> for torrent(s) uploaded by this user</a>
  389. </div>
  390. <? }
  391. $DB->query("
  392. SELECT DISTINCT req.ID,
  393. req.FillerID,
  394. um.Username,
  395. req.TimeFilled
  396. FROM requests AS req
  397. LEFT JOIN torrents AS t ON t.ID = req.TorrentID
  398. LEFT JOIN reportsv2 AS rep ON rep.TorrentID = t.ID
  399. JOIN users_main AS um ON um.ID = req.FillerID
  400. WHERE rep.Status != 'Resolved'
  401. AND req.TimeFilled > '2010-03-04 02:31:49'
  402. AND req.TorrentID = $TorrentID");
  403. $Requests = ($DB->has_results());
  404. if ($Requests > 0) {
  405. while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
  406. ?>
  407. <div style="text-align: right;">
  408. <strong class="important_text"><a href="user.php?id=<?=$FillerID?>"><?=$FillerName?></a> used this torrent to fill <a href="requests.php?action=view&amp;id=<?=$RequestID?>">this request</a> <?=time_diff($FilledTime)?></strong>
  409. </div>
  410. <? }
  411. }
  412. }
  413. }
  414. ?>
  415. </td>
  416. </tr>
  417. <? if ($Tracks) { ?>
  418. <tr>
  419. <td class="label">Relevant tracks:</td>
  420. <td colspan="3">
  421. <?=str_replace(' ', ', ', $Tracks)?>
  422. </td>
  423. </tr>
  424. <?
  425. }
  426. if ($Links) { ?>
  427. <tr>
  428. <td class="label">Relevant links:</td>
  429. <td colspan="3">
  430. <?
  431. $Links = explode(' ', $Links);
  432. foreach ($Links as $Link) {
  433. if ($local_url = Text::local_url($Link)) {
  434. $Link = $local_url;
  435. }
  436. ?>
  437. <a href="<?=$Link?>"><?=$Link?></a>
  438. <? } ?>
  439. </td>
  440. </tr>
  441. <?
  442. }
  443. if ($ExtraIDs) { ?>
  444. <tr>
  445. <td class="label">Relevant other torrents:</td>
  446. <td colspan="3">
  447. <?
  448. $First = true;
  449. $Extras = explode(' ', $ExtraIDs);
  450. foreach ($Extras as $ExtraID) {
  451. /*
  452. $DB->query("
  453. SELECT
  454. tg.Name,
  455. tg.ID,
  456. CASE COUNT(ta.GroupID)
  457. WHEN 1 THEN aa.ArtistID
  458. WHEN 0 THEN '0'
  459. ELSE '0'
  460. END AS ArtistID,
  461. CASE COUNT(ta.GroupID)
  462. WHEN 1 THEN aa.Name
  463. WHEN 0 THEN ''
  464. ELSE 'Various Artists'
  465. END AS ArtistName,
  466. tg.Year,
  467. t.Time,
  468. t.Remastered,
  469. t.RemasterTitle,
  470. t.RemasterYear,
  471. t.Media,
  472. t.Format,
  473. t.Encoding,
  474. t.Size,
  475. t.HasCue,
  476. t.HasLog,
  477. t.LogScore,
  478. t.UserID AS UploaderID,
  479. uploader.Username
  480. FROM torrents AS t
  481. LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
  482. LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID AND ta.Importance = '1'
  483. LEFT JOIN artists_alias AS aa ON aa.AliasID = ta.AliasID
  484. LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID
  485. WHERE t.ID = '$ExtraID'
  486. GROUP BY tg.ID");
  487. */
  488. $DB->query("
  489. SELECT
  490. tg.Name,
  491. tg.ID,
  492. ta.ArtistID,
  493. CASE COUNT(ta.GroupID)
  494. WHEN 1 THEN ag.Name
  495. WHEN 0 THEN ''
  496. ELSE 'Various Artists'
  497. END AS ArtistName,
  498. tg.Year,
  499. t.Time,
  500. t.Media,
  501. t.Size,
  502. t.UserID AS UploaderID,
  503. uploader.Username
  504. FROM torrents AS t
  505. LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
  506. LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID
  507. LEFT JOIN artists_group AS ag ON ag.ArtistID = ta.ArtistID
  508. LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID
  509. WHERE t.ID = '$ExtraID'
  510. GROUP BY tg.ID");
  511. list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime,
  512. $ExtraMedia, $ExtraSize, $ExtraUploaderID, $ExtraUploaderName) = Misc::display_array($DB->next_record());
  513. if ($ExtraGroupName) {
  514. if ($ArtistID == 0 && empty($ArtistName)) {
  515. $ExtraLinkName = "<a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]</a> ".' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
  516. } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
  517. $ExtraLinkName = "Various Artists - <a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]</a> (".number_format($ExtraSize / (1024 * 1024), 2).' MB)';
  518. } else {
  519. $ExtraLinkName = "<a href=\"artist.php?id=$ExtraArtistID\">$ExtraArtistName</a> - <a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [//$ExtraMedia]</a> (".number_format($ExtraSize / (1024 * 1024), 2).' MB)';
  520. }
  521. ?>
  522. <?=($First ? '' : '<br />')?>
  523. <?=$ExtraLinkName?>
  524. <a href="torrents.php?action=download&amp;id=<?=$ExtraID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets tooltip">DL</a>
  525. uploaded by <a href="user.php?id=<?=$ExtraUploaderID?>"><?=$ExtraUploaderName?></a> <?=time_diff($ExtraTime)?> <a href="#" onclick="Switch(<?=$ReportID?>, <?=$TorrentID?>, <?=$ExtraID?>); return false;" class="brackets">Switch</a>
  526. <?
  527. $First = false;
  528. }
  529. }
  530. ?>
  531. </td>
  532. </tr>
  533. <?
  534. }
  535. if ($Images) {
  536. ?>
  537. <tr>
  538. <td class="label">Relevant images:</td>
  539. <td colspan="3">
  540. <?
  541. $Images = explode(' ', $Images);
  542. foreach ($Images as $Image) {
  543. ?>
  544. <img style="max-width: 200px;" class="lightbox-init" src="<?=ImageTools::process($Image)?>" alt="Relevant image" />
  545. <? } ?>
  546. </td>
  547. </tr>
  548. <?
  549. } ?>
  550. <tr>
  551. <td class="label">User comment:</td>
  552. <td colspan="3" class="wrap_overflow"><?=Text::full_format($UserComment)?></td>
  553. </tr>
  554. <? // END REPORTED STUFF :|: BEGIN MOD STUFF
  555. if ($Status == 'InProgress') { ?>
  556. <tr>
  557. <td class="label">In progress by:</td>
  558. <td colspan="3">
  559. <a href="user.php?id=<?=$ResolverID?>"><?=$ResolverName?></a>
  560. </td>
  561. </tr>
  562. <? }
  563. if ($Status != 'Resolved') { ?>
  564. <tr>
  565. <td class="label">Report comment:</td>
  566. <td colspan="3">
  567. <input type="text" name="comment" id="comment<?=$ReportID?>" size="70" value="<?=$ModComment?>" />
  568. <input type="button" value="Update now" onclick="UpdateComment(<?=$ReportID?>);" />
  569. </td>
  570. </tr>
  571. <tr>
  572. <td class="label">
  573. <a href="javascript:Load('<?=$ReportID?>')" class="tooltip" title="Click here to reset the resolution options to their default values.">Resolve</a>:
  574. </td>
  575. <td colspan="3">
  576. <select name="resolve_type" id="resolve_type<?=$ReportID?>" onchange="ChangeResolve(<?=$ReportID?>);">
  577. <?
  578. $TypeList = $Types['master'] /* + $Types[$CategoryID] */ ;
  579. $Priorities = [];
  580. foreach ($TypeList as $Key => $Value) {
  581. $Priorities[$Key] = $Value['priority'];
  582. }
  583. array_multisort($Priorities, SORT_ASC, $TypeList);
  584. foreach ($TypeList as $Type => $Data) { ?>
  585. <option value="<?=$Type?>"><?=$Data['title']?></option>
  586. <? } ?>
  587. </select>
  588. <span id="options<?=$ReportID?>">
  589. <? if (check_perms('torrents_delete')) { ?>
  590. <span class="tooltip" title="Delete torrent?">
  591. <label for="delete<?=$ReportID?>"><strong>Delete</strong></label>
  592. <input type="checkbox" name="delete" id="delete<?=$ReportID?>" />
  593. </span>
  594. <? } ?>
  595. <span class="tooltip" title="Warning length in weeks">
  596. <label for="warning<?=$ReportID?>"><strong>Warning</strong></label>
  597. <select name="warning" id="warning<?=$ReportID?>">
  598. <? for ($i = 0; $i < 9; $i++) { ?>
  599. <option value="<?=$i?>"><?=$i?></option>
  600. <? } ?>
  601. </select>
  602. </span>
  603. <span class="tooltip" title="Remove upload privileges?">
  604. <label for="upload<?=$ReportID?>"><strong>Remove upload privileges</strong></label>
  605. <input type="checkbox" name="upload" id="upload<?=$ReportID?>" />
  606. </span>
  607. &nbsp;&nbsp;
  608. <span class="tooltip" title="Update resolve type">
  609. <input type="button" name="update_resolve" id="update_resolve<?=$ReportID?>" value="Update now" onclick="UpdateResolve(<?=$ReportID?>);" />
  610. </span>
  611. </span>
  612. </td>
  613. </tr>
  614. <tr>
  615. <td class="label tooltip" title="Uploader: Appended to the regular message unless using &quot;Send now&quot;. Reporter: Must be used with &quot;Send now&quot;.">
  616. PM
  617. <select name="pm_type" id="pm_type<?=$ReportID?>">
  618. <option value="Uploader">Uploader</option>
  619. <option value="Reporter">Reporter</option>
  620. </select>:
  621. </td>
  622. <td colspan="3">
  623. <textarea name="uploader_pm" id="uploader_pm<?=$ReportID?>" cols="50" rows="1"></textarea>
  624. <input type="button" value="Send now" onclick="SendPM(<?=$ReportID?>);" />
  625. </td>
  626. </tr>
  627. <tr>
  628. <td class="label"><strong>Extra</strong> log message:</td>
  629. <td>
  630. <input type="text" name="log_message" id="log_message<?=$ReportID?>" size="40"<?
  631. if ($ExtraIDs) {
  632. $Extras = explode(' ', $ExtraIDs);
  633. $Value = '';
  634. foreach ($Extras as $ExtraID) {
  635. $Value .= site_url()."torrents.php?torrentid=$ExtraID ";
  636. }
  637. echo ' value="'.trim($Value).'"';
  638. } ?>
  639. />
  640. </td>
  641. <td class="label"><strong>Extra</strong> staff notes:</td>
  642. <td>
  643. <input type="text" name="admin_message" id="admin_message<?=$ReportID?>" size="40" />
  644. </td>
  645. </tr>
  646. <tr>
  647. <td colspan="4" style="text-align: center;">
  648. <input type="button" value="Invalidate report" onclick="Dismiss(<?=$ReportID?>);" />
  649. <input type="button" value="Resolve report manually" onclick="ManualResolve(<?=$ReportID?>);" />
  650. <? if ($Status == 'InProgress' && $LoggedUser['ID'] == $ResolverID) { ?>
  651. | <input type="button" value="Unclaim" onclick="GiveBack(<?=$ReportID?>);" />
  652. <? } else { ?>
  653. | <input id="grab<?=$ReportID?>" type="button" value="Claim" onclick="Grab(<?=$ReportID?>);" />
  654. <? } ?>
  655. | Multi-resolve <input type="checkbox" name="multi" id="multi<?=$ReportID?>" checked="checked" />
  656. | <input type="button" id="submit_<?=$ReportID?>" value="Submit" onclick="TakeResolve(<?=$ReportID?>);" />
  657. </td>
  658. </tr>
  659. <? } else { ?>
  660. <tr>
  661. <td class="label">Resolver:</td>
  662. <td colspan="3">
  663. <a href="user.php?id=<?=$ResolverID?>"><?=$ResolverName?></a>
  664. </td>
  665. </tr>
  666. <tr>
  667. <td class="label">Resolve time:</td>
  668. <td colspan="3">
  669. <?=time_diff($LastChangeTime); echo "\n"; ?>
  670. </td>
  671. </tr>
  672. <tr>
  673. <td class="label">Report comments:</td>
  674. <td colspan="3">
  675. <?=$ModComment; echo "\n"; ?>
  676. </td>
  677. </tr>
  678. <tr>
  679. <td class="label">Log message:</td>
  680. <td colspan="3">
  681. <?=$LogMessage; echo "\n"; ?>
  682. </td>
  683. </tr>
  684. <? if ($GroupID) { ?>
  685. <tr>
  686. <td colspan="4" style="text-align: center;">
  687. <input id="grab<?=$ReportID?>" type="button" value="Claim" onclick="Grab(<?=$ReportID?>);" />
  688. </td>
  689. </tr>
  690. <? }
  691. } ?>
  692. </table>
  693. </div>
  694. </form>
  695. </div>
  696. <?
  697. }
  698. }
  699. }
  700. ?>
  701. </div>
  702. <? if ($PageLinks) { ?>
  703. <div class="linkbox pager"><?=$PageLinks?></div>
  704. <? } ?>
  705. <? View::show_footer(); ?>