Browse Source

API: Fix torrent group errors

spaghetti 8 years ago
parent
commit
5d3aa1059b
2 changed files with 12 additions and 20 deletions
  1. 5
    9
      sections/ajax/torrent.php
  2. 7
    11
      sections/ajax/torrentgroup.php

+ 5
- 9
sections/ajax/torrent.php View File

@@ -1,10 +1,6 @@
1 1
 <?
2 2
 require(SERVER_ROOT.'/sections/torrents/functions.php');
3 3
 
4
-// What do these two variables even do?
5
-$GroupAllowed = array('WikiBody', 'WikiImage', 'ID', 'Name', 'Year', 'CatalogueNumber', 'ReleaseType', 'CategoryID', 'Time');
6
-$TorrentAllowed = array('ID', 'Media', 'Format', 'Encoding', 'FileCount', 'Size', 'Seeders', 'Leechers', 'Snatched', 'FreeTorrent', 'Time', 'Description', 'FileList', 'FilePath', 'UserID', 'Username');
7
-
8 4
 $TorrentID = (int)$_GET['id'];
9 5
 $TorrentHash = (string)$_GET['hash'];
10 6
 
@@ -51,7 +47,7 @@ if ($TorrentDetails['CategoryID'] == 0) {
51 47
 
52 48
 $TagList = explode('|', $TorrentDetails['GROUP_CONCAT(DISTINCT tags.Name SEPARATOR \'|\')']);
53 49
 
54
-$JsonTorrentDetails = array(
50
+$JsonTorrentDetails = [
55 51
   'wikiBody'        => Text::full_format($TorrentDetails['WikiBody']),
56 52
   'wikiImage'       => $TorrentDetails['WikiImage'],
57 53
   'id'              => (int)$TorrentDetails['ID'],
@@ -67,7 +63,7 @@ $JsonTorrentDetails = array(
67 63
   'time'            => $TorrentDetails['Time'],
68 64
   'isBookmarked'    => Bookmarks::has_bookmarked('torrent', $GroupID),
69 65
   'tags'            => $TagList
70
-);
66
+];
71 67
 
72 68
 $Torrent = $TorrentList[$TorrentID];
73 69
 
@@ -82,7 +78,7 @@ foreach ($FileList as &$File) {
82 78
 unset($File);
83 79
 $FileList = implode('|||', $FileList);
84 80
 $Userinfo = Users::user_info($Torrent['UserID']);
85
-$JsonTorrentList[] = array(
81
+$JsonTorrentList[] = [
86 82
   'id'          => (int)$Torrent['ID'],
87 83
   'infoHash'    => $Torrent['InfoHash'],
88 84
   'media'       => $Torrent['Media'],
@@ -109,6 +105,6 @@ $JsonTorrentList[] = array(
109 105
   'filePath'    => $Torrent['FilePath'],
110 106
   'userId'      => (int)$Torrent['UserID'],
111 107
   'username'    => $Userinfo['Username']
112
-);
108
+];
113 109
 
114
-json_die("success", array('group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)));
110
+json_die("success", ['group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)]);

+ 7
- 11
sections/ajax/torrentgroup.php View File

@@ -2,10 +2,6 @@
2 2
 
3 3
 require(SERVER_ROOT.'/sections/torrents/functions.php');
4 4
 
5
-// Seriously what the hell do these do
6
-$GroupAllowed = array('WikiBody', 'WikiImage', 'ID', 'Name', 'Year', 'RecordLabel', 'CatalogueNumber', 'ReleaseType', 'CategoryID', 'Time', 'VanityHouse');
7
-$TorrentAllowed = array('ID', 'Media', 'Format', 'Encoding', 'Remastered', 'RemasterYear', 'RemasterTitle', 'RemasterRecordLabel', 'RemasterCatalogueNumber', 'Scene', 'HasLog', 'HasCue', 'LogScore', 'FileCount', 'Size', 'Seeders', 'Leechers', 'Snatched', 'FreeTorrent', 'Time', 'Description', 'FileList', 'FilePath', 'UserID', 'Username');
8
-
9 5
 $GroupID = (int)$_GET['id'];
10 6
 $TorrentHash = (string)$_GET['hash'];
11 7
 
@@ -36,7 +32,7 @@ if (!$TorrentCache) {
36 32
 
37 33
 list($TorrentDetails, $TorrentList) = $TorrentCache;
38 34
 
39
-$Artiss = pullmediainfo(Artists::get_artist($GroupID));
35
+$Artists = pullmediainfo(Artists::get_artist($GroupID));
40 36
 
41 37
 if ($TorrentDetails['CategoryID'] == 0) {
42 38
   $CategoryName = 'Unknown';
@@ -46,7 +42,7 @@ if ($TorrentDetails['CategoryID'] == 0) {
46 42
 
47 43
 $TagList = explode('|', $TorrentDetails['GROUP_CONCAT(DISTINCT tags.Name SEPARATOR \'|\')']);
48 44
 
49
-$JsonTorrentDetails = array(
45
+$JsonTorrentDetails = [
50 46
   'wikiBody'        => Text::full_format($TorrentDetails['WikiBody']),
51 47
   'wikiImage'       => $TorrentDetails['WikiImage'],
52 48
   'id'              => (int)$TorrentDetails['ID'],
@@ -62,7 +58,7 @@ $JsonTorrentDetails = array(
62 58
   'time'            => $TorrentDetails['Time'],
63 59
   'isBookmarked'    => Bookmarks::has_bookmarked('torrent', $GroupID),
64 60
   'tags'            => $TagList
65
-);
61
+];
66 62
 
67 63
 $JsonTorrentList = [];
68 64
 foreach ($TorrentList as $Torrent) {
@@ -76,7 +72,7 @@ foreach ($TorrentList as $Torrent) {
76 72
   $Userinfo = Users::user_info($Torrent['UserID']);
77 73
   $Reports = Torrents::get_reports($Torrent['ID']);
78 74
   $Torrent['Reported'] = count($Reports) > 0;
79
-  $JsonTorrentList[] = array(
75
+  $JsonTorrentList[] = [
80 76
     'id'          => (int)$Torrent['ID'],
81 77
     'infoHash'    => $Torrent['InfoHash'],
82 78
     'media'       => $Torrent['Media'],
@@ -85,7 +81,7 @@ foreach ($TorrentList as $Torrent) {
85 81
     'resolution'  => $Torrent['Resolution'],
86 82
     'audioFormat' => $Torrent['AudioFormat'],
87 83
     'subbing'     => $Torrent['Subbing'],
88
-    'subber'      => $Torrent['Subber']
84
+    'subber'      => $Torrent['Subber'],
89 85
     'language'    => $Torrent['Language'],
90 86
     'censored'    => (bool)$Torrent['Censored'],
91 87
     'archive'     => $Torrent['Archive'],
@@ -103,7 +99,7 @@ foreach ($TorrentList as $Torrent) {
103 99
     'filePath'    => $Torrent['FilePath'],
104 100
     'userId'      => (int)$Torrent['UserID'],
105 101
     'username'    => $Userinfo['Username']
106
-  );
102
+  ];
107 103
 }
108 104
 
109
-json_die("success", array('group' => $JsonTorrentDetails, 'torrents' => $JsonTorrentList));
105
+json_die("success", ['group' => $JsonTorrentDetails, 'torrents' => $JsonTorrentList]);

Loading…
Cancel
Save