Browse Source

Donate and report pages mostly

pjc 5 years ago
parent
commit
89bab24d98

+ 3
- 0
_packages/extension-parser/classes/validate.class.php View File

@@ -55,6 +55,9 @@ class Validate
55 55
                     if (in_array($Match, $SearchMe[1])) {
56 56
                         return $SearchMe[0];
57 57
                         break;
58
+                    } else {
59
+                        return 'Other';
60
+                    break;
58 61
                     }
59 62
                 }
60 63
             }

+ 64
- 0
_packages/extension-parser/sections/torrents/takeedit.php View File

@@ -0,0 +1,64 @@
1
+<?php
2
+
3
+# Line 28
4
+# todo: Associate containers with categories beforehand
5
+# It may have to happen structurally in config.php, e.g.,
6
+# $Categories = [
7
+#   'GazelleName' => [$Name, $Icon, $Description, $Containers],
8
+#    ...
9
+#  ];
10
+$Properties['CategoryID'] = $TypeID;
11
+$Properties['CategoryName'] = $Type;
12
+$Properties['FileTypes'] = [
13
+  'DNA'      => $Containers,
14
+  'RNA'      => $Containers,
15
+  'Proteins' => $ContainersProt,
16
+  'Imaging'  => $ContainersGames,
17
+  'Extras'   => $ContainersExtra
18
+];
19
+$Properties['ArchiveTypes'] = [
20
+  'DNA'      => $Archives,
21
+  'RNA'      => $Archives,
22
+  'Proteins' => $Archives,
23
+  'Imaging'  => $Archives,
24
+  'Extras'   => $Archives
25
+];
26
+# Line 49
27
+
28
+# Line 313
29
+$T['FileTypes'] = $Properties['FileTypes'];
30
+$T['ArchiveTypes'] = $Properties['FileTypes'];
31
+
32
+//******************************************************************************//
33
+//--------------- Autofill format and archive ----------------------------------//
34
+
35
+if ($T['Container'] === 'Autofill') {
36
+    # torrents.Container
37
+    $T['Container'] = $Validate->ParseExtensions(
38
+
39
+        # $FileList
40
+        $Tor->file_list(),
41
+
42
+        # $Category
43
+        $T['CategoryName'],
44
+
45
+        # $FileTypes
46
+        $T['FileTypes'],
47
+    );
48
+}
49
+
50
+if ($T['Archive'] === 'Autofill') {
51
+    # torrents.Archive
52
+    $T['Archive'] = $Validate->ParseExtensions(
53
+
54
+        # $FileList
55
+        $Tor->file_list(),
56
+
57
+        # $Category
58
+        $T['CategoryName'],
59
+
60
+        # $FileTypes
61
+        $T['ArchiveTypes'],
62
+    );
63
+}
64
+# Line 347

+ 3
- 0
classes/validate.class.php View File

@@ -220,6 +220,9 @@ class Validate
220 220
                     if (in_array($Match, $SearchMe[1])) {
221 221
                         return $SearchMe[0];
222 222
                         break;
223
+                    } else {
224
+                        return 'Other';
225
+                    break;
223 226
                     }
224 227
                 }
225 228
             }

+ 9
- 2
sections/donate/donate.php View File

@@ -22,11 +22,11 @@ View::show_header('Donate');
22 22
     <p>
23 23
       <?= SITE_NAME ?> has no advertisements, is not sponsored, and
24 24
       provides its services free of charge.
25
-      For these reasons, <?= SITE_NAME ?>'s financial obligations can
25
+      For these reasons, its financial obligations can
26 26
       only be met with the help of voluntary user donations.
27 27
       Supporting <?= SITE_NAME ?> is and will always remain
28 28
       voluntary.
29
-      If you are financially able, please help pay <?= SITE_NAME ?>'s
29
+      If you are financially able, please help pay its
30 30
       bills by donating.
31 31
     </p>
32 32
 
@@ -42,6 +42,13 @@ View::show_header('Donate');
42 42
       As a donor, your financial support is exclusively applied to operating costs.
43 43
       When you donate you are paying <?= SITE_NAME ?>'s bills.
44 44
     </p>
45
+
46
+    <p>
47
+    If you prefer to make a tax-deductible donation to an organization beyond my financial grasp, donations to the
48
+    <a href="https://www.boslab.org/donate" target="_blank">Boston Open Science Laboratory (BosLab)</a>
49
+    are honored the same as direct donations.
50
+    Please note in the comment field that your donation is on behalf of <?= SITE_NAME ?> from your username.
51
+    </p>
45 52
   </div>
46 53
 
47 54
   <span class="donation_info_title">What you will receive for donating</span>

+ 25
- 24
sections/reportsv2/ajax_report.php View File

@@ -1,4 +1,5 @@
1
-<?
1
+<?php
2
+
2 3
 /*
3 4
  * The backend to changing the report type when making a report.
4 5
  * It prints out the relevant report_messages from the array, then
@@ -8,81 +9,81 @@ authorize();
8 9
 
9 10
 ?>
10 11
 <ul>
11
-<?
12
+<?php
12 13
 $CategoryID = $_POST['categoryid'];
13 14
 
14 15
 if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
15
-  $ReportType = $Types[$CategoryID][$_POST['type']];
16
-} elseif (array_key_exists($_POST['type'],$Types['master'])) {
17
-  $ReportType = $Types['master'][$_POST['type']];
16
+    $ReportType = $Types[$CategoryID][$_POST['type']];
17
+} elseif (array_key_exists($_POST['type'], $Types['master'])) {
18
+    $ReportType = $Types['master'][$_POST['type']];
18 19
 } else {
19
-  echo 'HAX IN REPORT TYPE';
20
-  die();
20
+    echo 'HAX IN REPORT TYPE';
21
+    die();
21 22
 }
22 23
 
23 24
 foreach ($ReportType['report_messages'] as $Message) {
24
-?>
25
+    ?>
25 26
   <li><?=$Message?></li>
26
-<?
27
+<?php
27 28
 }
28 29
 ?>
29 30
 </ul>
30 31
 <br />
31 32
 <table class="layout" cellpadding="3" cellspacing="1" border="0" width="100%">
32
-<?
33
+<?php
33 34
 if (array_key_exists('image', $ReportType['report_fields'])) {
34
-?>
35
+    ?>
35 36
   <tr>
36 37
     <td class="label">
37
-      Image(s)<?=($ReportType['report_fields']['image'] == '1' ? ' <strong class="important_text">(Required)</strong>:' : '')?>
38
+      Image(s)<?=($ReportType['report_fields']['image'] === '1' ? ' <strong class="important_text">*</strong>' : '')?>
38 39
     </td>
39 40
     <td>
40 41
       <input id="image" type="text" name="image" size="50" value="<?=(!empty($_POST['image']) ? display_str($_POST['image']) : '')?>" />
41 42
     </td>
42 43
   </tr>
43
-<?
44
+<?php
44 45
 }
45 46
 if (array_key_exists('track', $ReportType['report_fields'])) {
46
-?>
47
+    ?>
47 48
   <tr>
48 49
     <td class="label">
49
-      Track Number(s)<?=($ReportType['report_fields']['track'] == '1' || $ReportType['report_fields']['track'] == '2' ? ' <strong class="important_text">(Required)</strong>:' : '')?>
50
+      Track Number(s)<?=($ReportType['report_fields']['track'] === '1' || $ReportType['report_fields']['track'] === '2' ? ' <strong class="important_text">*</strong>' : '')?>
50 51
     </td>
51 52
     <td>
52
-      <input id="track" type="text" name="track" size="8" value="<?=(!empty($_POST['track']) ? display_str($_POST['track']) : '')?>" /><?=($ReportType['report_fields']['track'] == '1' ? '<input id="all_tracks" type="checkbox" onclick="AllTracks()" /> All' : '')?>
53
+      <input id="track" type="text" name="track" size="8" value="<?=(!empty($_POST['track']) ? display_str($_POST['track']) : '')?>" /><?=($ReportType['report_fields']['track'] === '1' ? '<input id="all_tracks" type="checkbox" onclick="AllTracks()" /> All' : '')?>
53 54
     </td>
54 55
   </tr>
55
-<?
56
+<?php
56 57
 }
57 58
 if (array_key_exists('link', $ReportType['report_fields'])) {
58
-?>
59
+    ?>
59 60
   <tr>
60 61
     <td class="label">
61
-      Link(s) to external source<?=($ReportType['report_fields']['link'] == '1' ? ' <strong class="important_text">(Required)</strong>:' : '')?>
62
+      Link(s) to external source<?=($ReportType['report_fields']['link'] === '1' ? ' <strong class="important_text">*</strong>' : '')?>
62 63
     </td>
63 64
     <td>
64 65
       <input id="link" type="text" name="link" size="50" value="<?=(!empty($_POST['link']) ? display_str($_POST['link']) : '')?>" />
65 66
     </td>
66 67
   </tr>
67
-<?
68
+<?php
68 69
 }
69 70
 if (array_key_exists('sitelink', $ReportType['report_fields'])) {
70
-?>
71
+    ?>
71 72
   <tr>
72 73
     <td class="label">
73
-      Permalink to <strong>other relevant</strong> torrent(s)<?=($ReportType['report_fields']['sitelink'] == '1' ? ' <strong class="important_text">(Required)</strong>:' : '')?>
74
+      Permalink to <strong>other relevant</strong> torrent(s)<?=($ReportType['report_fields']['sitelink'] === '1' ? ' <strong class="important_text">*</strong>' : '')?>
74 75
     </td>
75 76
     <td>
76 77
       <input id="sitelink" type="text" name="sitelink" size="50" value="<?=(!empty($_POST['sitelink']) ? display_str($_POST['sitelink']) : '')?>" />
77 78
     </td>
78 79
   </tr>
79 80
 
80
-<?
81
+<?php
81 82
 }
82 83
 ?>
83 84
   <tr>
84 85
     <td class="label">
85
-      Comments <strong class="important_text">(Required)</strong>:
86
+      Comments <strong class="important_text">*</strong>
86 87
     </td>
87 88
     <td>
88 89
       <textarea id="extra" rows="5" cols="60" name="extra"><?=display_str($_POST['extra'])?></textarea>

+ 60
- 60
sections/reportsv2/report.php View File

@@ -1,4 +1,5 @@
1
-<?
1
+<?php
2
+
2 3
 /*
3 4
  * This is the frontend of reporting a torrent, it's what users see when
4 5
  * they visit reportsv2.php?id=xxx
@@ -6,60 +7,61 @@
6 7
 
7 8
 include(SERVER_ROOT.'/sections/torrents/functions.php');
8 9
 
9
-//If we're not coming from torrents.php, check we're being returned because of an error.
10
+// If we're not coming from torrents.php, check we're being returned because of an error.
10 11
 if (!isset($_GET['id']) || !is_number($_GET['id'])) {
11
-  if (!isset($Err)) {
12
-    error(404);
13
-  }
12
+    if (!isset($Err)) {
13
+        error(404);
14
+    }
14 15
 } else {
15
-  $TorrentID = $_GET['id'];
16
-  $DB->query("
16
+    $TorrentID = $_GET['id'];
17
+    $DB->query("
17 18
     SELECT tg.CategoryID, t.GroupID, u.Username
18 19
     FROM torrents_group AS tg
19 20
       LEFT JOIN torrents AS t ON t.GroupID = tg.ID
20 21
       LEFT JOIN users_main AS u ON t.UserID = u.ID
21 22
     WHERE t.ID = " . $_GET['id']);
22
-  list($CategoryID, $GroupID, $Username) = $DB->next_record();
23
-  $Artists = Artists::get_artist($GroupID);
24
-  $TorrentCache = get_group_info($GroupID, true);
25
-  $GroupDetails = $TorrentCache[0];
26
-  $TorrentList = $TorrentCache[1];
27
-  // Resolve the torrentlist to the one specific torrent being reported
28
-  foreach ($TorrentList as &$Torrent) {
29
-  // Remove unneeded entries
30
-  if ($Torrent['ID'] != $TorrentID)
31
-    unset($TorrentList[$Torrent['ID']]);
32
-  }
23
+    list($CategoryID, $GroupID, $Username) = $DB->next_record();
24
+    $Artists = Artists::get_artist($GroupID);
25
+    $TorrentCache = get_group_info($GroupID, true);
26
+    $GroupDetails = $TorrentCache[0];
27
+    $TorrentList = $TorrentCache[1];
28
+    // Resolve the torrentlist to the one specific torrent being reported
29
+    foreach ($TorrentList as &$Torrent) {
30
+        // Remove unneeded entries
31
+        if ($Torrent['ID'] != $TorrentID) {
32
+            unset($TorrentList[$Torrent['ID']]);
33
+        }
34
+    }
33 35
 
34
-  // Group details
35
-  list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupNameRJ, $GroupNameJP,
36
+    // Group details
37
+    list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupNameRJ, $GroupNameJP,
36 38
     $GroupYear, $GroupStudio, $GroupSeries, $GroupCatalogueNumber,
37 39
     $GroupCategoryID, $GroupDLSite, $GroupTime, $TorrentTags, $TorrentTagIDs,
38 40
     $TorrentTagUserIDs, $Screenshots, $GroupFlags) = array_values($GroupDetails);
39 41
 
40
-  $DisplayName = $GroupName;
41
-  $AltName = $GroupName; // Goes in the alt text of the image
42
-  $Title = $GroupName; // goes in <title>
42
+    $DisplayName = $GroupName;
43
+    $AltName = $GroupName; // Goes in the alt text of the image
44
+  $Title = $GroupName; // Goes in <title>
43 45
   $WikiBody = Text::full_format($WikiBody);
44 46
 
45
-  //Get the artist name, group name etc.
46
-  $Artists = Artists::get_artist($GroupID);
47
-  if ($Artists) {
48
-    $DisplayName = '<span dir="ltr">' . Artists::display_artists($Artists, true) . "<a href=\"torrents.php?torrentid=$TorrentID\">$DisplayName</a></span>";
49
-    $AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
50
-    $Title = $AltName;
51
-  }
52
-  if ($GroupYear > 0) {
53
-    $DisplayName .= " [$GroupYear]";
54
-    $AltName .= " [$GroupYear]";
55
-    $Title .= " [$GroupYear]";
56
-  }
57
-/*
58
-  if ($GroupCategoryID == 1) {
59
-    $DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
60
-    $AltName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
61
-  }
62
-*/
47
+    // Get the artist name, group name etc.
48
+    $Artists = Artists::get_artist($GroupID);
49
+    if ($Artists) {
50
+        $DisplayName = '<span dir="ltr">' . Artists::display_artists($Artists, true) . "<a href=\"torrents.php?torrentid=$TorrentID\">$DisplayName</a></span>";
51
+        $AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
52
+        $Title = $AltName;
53
+    }
54
+    if ($GroupYear > 0) {
55
+        $DisplayName .= " [$GroupYear]";
56
+        $AltName .= " [$GroupYear]";
57
+        $Title .= " [$GroupYear]";
58
+    }
59
+    /*
60
+      if ($GroupCategoryID === 1) {
61
+        $DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
62
+        $AltName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
63
+      }
64
+    */
63 65
 }
64 66
 
65 67
 View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
@@ -87,7 +89,7 @@ View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
87 89
           <a><svg width="11" height="15" fill="black" class="tooltip" alt="Leechers" title="Leechers"><polygon points="0,8 5.5,15 11,8 8,8 8,0 3,0 3,8"></polygon></svg></a>
88 90
         </td>
89 91
       </tr>
90
-      <?
92
+      <?php
91 93
       $LangName = $GroupName ? $GroupName : ($GroupNameRJ ? $GroupNameRJ : $GroupNameJP);
92 94
       build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $LangName, $GroupCategoryID, $TorrentList, $Types, $Username);
93 95
       ?>
@@ -106,35 +108,34 @@ View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
106 108
     <div class="box pad">
107 109
       <table class="layout">
108 110
         <tr>
109
-          <td class="label">Reason:</td>
111
+          <td class="label">Reason</td>
110 112
           <td>
111 113
             <select id="type" name="type" class="change_report_type">
112
-<?
114
+<?php
113 115
         if (!empty($Types[$CategoryID])) {
114
-          $TypeList = $Types['master'] + $Types[$CategoryID];
115
-          $Priorities = [];
116
-          foreach ($TypeList as $Key => $Value) {
117
-            $Priorities[$Key] = $Value['priority'];
118
-          }
119
-          array_multisort($Priorities, SORT_ASC, $TypeList);
116
+            $TypeList = $Types['master'] + $Types[$CategoryID];
117
+            $Priorities = [];
118
+            foreach ($TypeList as $Key => $Value) {
119
+                $Priorities[$Key] = $Value['priority'];
120
+            }
121
+            array_multisort($Priorities, SORT_ASC, $TypeList);
120 122
         } else {
121
-          $TypeList = $Types['master'];
123
+            $TypeList = $Types['master'];
122 124
         }
123 125
         foreach ($TypeList as $Type => $Data) {
124
-          ?>
126
+            ?>
125 127
               <option value="<?=($Type)?>"><?=($Data['title'])?></option>
126
-<?        } ?>
128
+<?php
129
+        } ?>
127 130
             </select>
128 131
           </td>
129 132
         </tr>
130 133
       </table>
131 134
       <p>Fields that contain lists of values (for example, listing more than one track number) should be separated by a space.</p>
132
-      <br />
133
-      <p><strong>Following the below report type specific guidelines will help the moderators deal with your report in a timely fashion. </strong></p>
134
-      <br />
135
+      <p><strong>Following the below report type specific guidelines will help the moderators deal with your report in a timely fashion.</strong></p>
135 136
 
136 137
       <div id="dynamic_form">
137
-<?
138
+<?php
138 139
         /*
139 140
          * THIS IS WHERE SEXY AJAX COMES IN
140 141
          * The following malarky is needed so that if you get sent back here, the fields are filled in.
@@ -147,9 +148,8 @@ View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
147 148
         <input id="extra" type="hidden" name="extra" value="<?=(!empty($_POST['extra']) ? display_str($_POST['extra']) : '')?>" />
148 149
       </div>
149 150
     </div>
150
-  <input type="submit" value="Submit report" />
151
+  <input type="submit" value="Report" />
151 152
   </form>
152 153
 </div>
153
-<?
154
+<?php
154 155
 View::show_footer();
155
-?>

+ 6
- 1
sections/torrents/browse.php View File

@@ -261,7 +261,12 @@ View::show_header('Browse Torrents', 'browse');
261 261
                 <?php  foreach ($Containers as $Key => $Container) { ?>
262 262
                 <option value="<?=display_str($Key);?>" <?Format::selected('container', $Key)?>><?=display_str($Key);?>
263 263
                 </option>
264
-                <?php  } foreach ($ContainersProt as $Key => $ContainerProt) { ?>
264
+                <?php  } ?>
265
+              </select>
266
+
267
+              <select id=" container" name="container" class="ft_container fti_advanced">
268
+                <option value="">Prot Format</option>
269
+                <?php  foreach ($Containers as $Key => $Container) { ?>
265 270
                 <option value="<?=display_str($Key);?>" <?Format::selected('container', $Key)?>><?=display_str($Key);?>
266 271
                 </option>
267 272
                 <?php  } ?>

+ 11
- 14
sections/torrents/edit.php View File

@@ -32,6 +32,7 @@ $DB->query("
32 32
     t.FreeTorrent,
33 33
     t.FreeLeechType,
34 34
     t.Description AS TorrentDescription,
35
+    t.FileList,
35 36
     t.MediaInfo,
36 37
     tg.CategoryID,
37 38
     tg.Name AS Title,
@@ -62,7 +63,7 @@ if (!$Properties) {
62 63
 
63 64
 $UploadForm = $Categories[$Properties['CategoryID'] - 1];
64 65
 
65
-if (($LoggedUser['ID'] != $Properties['UserID'] && !check_perms('torrents_edit')) || $LoggedUser['DisableWiki']) {
66
+if (($LoggedUser['ID'] !== $Properties['UserID'] && !check_perms('torrents_edit')) || $LoggedUser['DisableWiki']) {
66 67
     error(403);
67 68
 }
68 69
 
@@ -73,11 +74,14 @@ $TorrentForm = new TorrentForm($Properties, $Err, false);
73 74
 $TorrentForm->upload_form();
74 75
 
75 76
 if (check_perms('torrents_edit') || check_perms('users_mod')) {
77
+    # Start the HTML edit form
76 78
     ?>
77 79
 <div class="thin">
78 80
   <?php
79
-  if ($Properties['CategoryID'] != 5) {
81
+  #if ($Properties['CategoryID'] !== 5) {
80 82
       ?>
83
+
84
+  <br />
81 85
   <div class="header">
82 86
     <h2>Change Group</h2>
83 87
   </div>
@@ -107,6 +111,8 @@ if (check_perms('torrents_edit') || check_perms('users_mod')) {
107 111
       </table>
108 112
     </form>
109 113
   </div>
114
+  <br />
115
+
110 116
   <h2>Split off into new group</h2>
111 117
   <div class="box pad">
112 118
     <form class="split_form" name="torrent_group" action="torrents.php" method="post">
@@ -158,8 +164,9 @@ if (check_perms('torrents_edit') || check_perms('users_mod')) {
158 164
     </form>
159 165
   </div>
160 166
   <br />
167
+
161 168
   <?php
162
-  }
169
+  #}
163 170
     if (check_perms('users_mod')) { ?>
164 171
   <h2>Change Category</h2>
165 172
   <div class="box pad">
@@ -186,17 +193,7 @@ if (check_perms('torrents_edit') || check_perms('users_mod')) {
186 193
               <?php    } ?>
187 194
             </select>
188 195
           </td>
189
-        <tr id="split_releasetype">
190
-          <td class="label">Release type</td>
191
-          <td>
192
-            <select name="releasetype">
193
-              <?php    foreach ($ReleaseTypes as $RTID => $ReleaseType) { ?>
194
-              <option value="<?=($RTID)?>"><?=($ReleaseType)?>
195
-              </option>
196
-              <?php    } ?>
197
-            </select>
198
-          </td>
199
-        </tr>
196
+          </tr>
200 197
         <tr id="split_artist">
201 198
           <td class="label">Artist</td>
202 199
           <td>

+ 52
- 25
sections/torrents/takeedit.php View File

@@ -25,27 +25,6 @@ $TypeID = (int)$_POST['type'];
25 25
 $Type = $Categories[$TypeID-1];
26 26
 $TorrentID = (int)$_POST['torrentid'];
27 27
 
28
-# todo: Associate containers with categories beforehand
29
-# It may have to happen structurally in config.php, e.g.,
30
-# $Categories = [
31
-#   'GazelleName' => [$Name, $Icon, $Description, $Containers],
32
-#    ...
33
-#  ];
34
-$Properties['FileTypes'] = [
35
-  'DNA'      => $Containers,
36
-  'RNA'      => $Containers,
37
-  'Proteins' => $ContainersProt,
38
-  'Imaging'  => $ContainersGames,
39
-  'Extras'   => $ContainersExtra
40
-];
41
-$Properties['ArchiveTypes'] = [
42
-  'DNA'      => $Archives,
43
-  'RNA'      => $Archives,
44
-  'Proteins' => $Archives,
45
-  'Imaging'  => $Archives,
46
-  'Extras'   => $Archives
47
-];
48
-
49 28
 $Properties['Remastered'] = (isset($_POST['remaster']))? 1 : 0;
50 29
 if ($Properties['Remastered']) {
51 30
     $Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0;
@@ -76,7 +55,7 @@ $Properties['Subber']= $_POST['subber'];
76 55
 
77 56
 $Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
78 57
 $Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
79
-$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] != '---') ? $_POST['archive'] : '';
58
+$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] !== '---') ? $_POST['archive'] : '';
80 59
 
81 60
 if ($_POST['album_desc']) {
82 61
     $Properties['GroupDescription'] = $_POST['album_desc'];
@@ -126,7 +105,8 @@ if ($LoggedUser['ID'] != $UserID && !check_perms('torrents_edit')) {
126 105
     error(403);
127 106
 }
128 107
 
129
-/* todo: Check strict equality and untangle features
108
+/*
109
+todo: Check strict equality and untangle features
130 110
 if ($Remastered === '1' && !$RemasterYear && !check_perms('edit_unknowns')) {
131 111
   error(403);
132 112
 }
@@ -281,14 +261,12 @@ if ($Properties['Remastered'] && !$Properties['RemasterYear']) {
281 261
 }
282 262
 
283 263
 // Strip out Amazon's padding
284
-/*
285 264
 $AmazonReg = '/(http:\/\/ecx.images-amazon.com\/images\/.+)(\._.*_\.jpg)/i';
286 265
 $Matches = [];
287 266
 if (preg_match($RegX, $Properties['Image'], $Matches)) {
288 267
     $Properties['Image'] = $Matches[1].'.jpg';
289 268
 }
290 269
 ImageTools::blacklisted($Properties['Image']);
291
-*/
292 270
 
293 271
 if ($Err) { // Show the upload form, with the data the user entered
294 272
     if (check_perms('site_debug')) {
@@ -312,6 +290,55 @@ foreach ($Properties as $Key => $Value) {
312 290
 $T['Censored'] = $Properties['Censored'];
313 291
 $T['Anonymous'] = $Properties['Anonymous'];
314 292
 
293
+//******************************************************************************//
294
+//--------------- Autofill format and archive ----------------------------------//
295
+
296
+# Load FileList in lieu of $Tor object
297
+$T['FileList'] = $DB->query("
298
+  SELECT FileList
299
+  FROM torrents
300
+  WHERE ID = $TorrentID");
301
+
302
+if (!$DB->has_results()) {
303
+    error(404);
304
+}
305
+
306
+# Call the extension parser
307
+if ($T['Container'] === 'Autofill') {
308
+    # torrents.Container
309
+    $T['Container'] = $Validate->ParseExtensions(
310
+
311
+        # $FileList
312
+        $T['FileList'],
313
+
314
+        # $Category
315
+        $T['CategoryName'],
316
+
317
+        # $FileTypes
318
+        $T['FileTypes'],
319
+    );
320
+}
321
+
322
+if ($T['Archive'] === 'Autofill') {
323
+    # torrents.Archive
324
+    $T['Archive'] = $Validate->ParseExtensions(
325
+
326
+        # $FileList
327
+        $Tor->file_list(),
328
+
329
+        # $Category
330
+        $T['CategoryName'],
331
+
332
+        # $FileTypes
333
+        $T['ArchiveTypes'],
334
+    );
335
+}
336
+
337
+print_r('<pre>');
338
+var_dump($T['FileList']);
339
+var_dump($T['CategoryName'],);
340
+var_dump($T['FileTypes'],);
341
+var_dump($T['ArchiveTypes'],);
315 342
 
316 343
 //******************************************************************************//
317 344
 //--------------- Start database stuff -----------------------------------------//

Loading…
Cancel
Save