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
                     if (in_array($Match, $SearchMe[1])) {
55
                     if (in_array($Match, $SearchMe[1])) {
56
                         return $SearchMe[0];
56
                         return $SearchMe[0];
57
                         break;
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

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
                     if (in_array($Match, $SearchMe[1])) {
220
                     if (in_array($Match, $SearchMe[1])) {
221
                         return $SearchMe[0];
221
                         return $SearchMe[0];
222
                         break;
222
                         break;
223
+                    } else {
224
+                        return 'Other';
225
+                    break;
223
                     }
226
                     }
224
                 }
227
                 }
225
             }
228
             }

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

22
     <p>
22
     <p>
23
       <?= SITE_NAME ?> has no advertisements, is not sponsored, and
23
       <?= SITE_NAME ?> has no advertisements, is not sponsored, and
24
       provides its services free of charge.
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
       only be met with the help of voluntary user donations.
26
       only be met with the help of voluntary user donations.
27
       Supporting <?= SITE_NAME ?> is and will always remain
27
       Supporting <?= SITE_NAME ?> is and will always remain
28
       voluntary.
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
       bills by donating.
30
       bills by donating.
31
     </p>
31
     </p>
32
 
32
 
42
       As a donor, your financial support is exclusively applied to operating costs.
42
       As a donor, your financial support is exclusively applied to operating costs.
43
       When you donate you are paying <?= SITE_NAME ?>'s bills.
43
       When you donate you are paying <?= SITE_NAME ?>'s bills.
44
     </p>
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
   </div>
52
   </div>
46
 
53
 
47
   <span class="donation_info_title">What you will receive for donating</span>
54
   <span class="donation_info_title">What you will receive for donating</span>

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

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

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

1
-<?
1
+<?php
2
+
2
 /*
3
 /*
3
  * This is the frontend of reporting a torrent, it's what users see when
4
  * This is the frontend of reporting a torrent, it's what users see when
4
  * they visit reportsv2.php?id=xxx
5
  * they visit reportsv2.php?id=xxx
6
 
7
 
7
 include(SERVER_ROOT.'/sections/torrents/functions.php');
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
 if (!isset($_GET['id']) || !is_number($_GET['id'])) {
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
 } else {
15
 } else {
15
-  $TorrentID = $_GET['id'];
16
-  $DB->query("
16
+    $TorrentID = $_GET['id'];
17
+    $DB->query("
17
     SELECT tg.CategoryID, t.GroupID, u.Username
18
     SELECT tg.CategoryID, t.GroupID, u.Username
18
     FROM torrents_group AS tg
19
     FROM torrents_group AS tg
19
       LEFT JOIN torrents AS t ON t.GroupID = tg.ID
20
       LEFT JOIN torrents AS t ON t.GroupID = tg.ID
20
       LEFT JOIN users_main AS u ON t.UserID = u.ID
21
       LEFT JOIN users_main AS u ON t.UserID = u.ID
21
     WHERE t.ID = " . $_GET['id']);
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
     $GroupYear, $GroupStudio, $GroupSeries, $GroupCatalogueNumber,
38
     $GroupYear, $GroupStudio, $GroupSeries, $GroupCatalogueNumber,
37
     $GroupCategoryID, $GroupDLSite, $GroupTime, $TorrentTags, $TorrentTagIDs,
39
     $GroupCategoryID, $GroupDLSite, $GroupTime, $TorrentTags, $TorrentTagIDs,
38
     $TorrentTagUserIDs, $Screenshots, $GroupFlags) = array_values($GroupDetails);
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
   $WikiBody = Text::full_format($WikiBody);
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
 View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
67
 View::show_header('Report', 'reportsv2,browse,torrent,bbcode,recommend');
87
           <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>
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
         </td>
90
         </td>
89
       </tr>
91
       </tr>
90
-      <?
92
+      <?php
91
       $LangName = $GroupName ? $GroupName : ($GroupNameRJ ? $GroupNameRJ : $GroupNameJP);
93
       $LangName = $GroupName ? $GroupName : ($GroupNameRJ ? $GroupNameRJ : $GroupNameJP);
92
       build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $LangName, $GroupCategoryID, $TorrentList, $Types, $Username);
94
       build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $LangName, $GroupCategoryID, $TorrentList, $Types, $Username);
93
       ?>
95
       ?>
106
     <div class="box pad">
108
     <div class="box pad">
107
       <table class="layout">
109
       <table class="layout">
108
         <tr>
110
         <tr>
109
-          <td class="label">Reason:</td>
111
+          <td class="label">Reason</td>
110
           <td>
112
           <td>
111
             <select id="type" name="type" class="change_report_type">
113
             <select id="type" name="type" class="change_report_type">
112
-<?
114
+<?php
113
         if (!empty($Types[$CategoryID])) {
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
         } else {
122
         } else {
121
-          $TypeList = $Types['master'];
123
+            $TypeList = $Types['master'];
122
         }
124
         }
123
         foreach ($TypeList as $Type => $Data) {
125
         foreach ($TypeList as $Type => $Data) {
124
-          ?>
126
+            ?>
125
               <option value="<?=($Type)?>"><?=($Data['title'])?></option>
127
               <option value="<?=($Type)?>"><?=($Data['title'])?></option>
126
-<?        } ?>
128
+<?php
129
+        } ?>
127
             </select>
130
             </select>
128
           </td>
131
           </td>
129
         </tr>
132
         </tr>
130
       </table>
133
       </table>
131
       <p>Fields that contain lists of values (for example, listing more than one track number) should be separated by a space.</p>
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
       <div id="dynamic_form">
137
       <div id="dynamic_form">
137
-<?
138
+<?php
138
         /*
139
         /*
139
          * THIS IS WHERE SEXY AJAX COMES IN
140
          * THIS IS WHERE SEXY AJAX COMES IN
140
          * The following malarky is needed so that if you get sent back here, the fields are filled in.
141
          * The following malarky is needed so that if you get sent back here, the fields are filled in.
147
         <input id="extra" type="hidden" name="extra" value="<?=(!empty($_POST['extra']) ? display_str($_POST['extra']) : '')?>" />
148
         <input id="extra" type="hidden" name="extra" value="<?=(!empty($_POST['extra']) ? display_str($_POST['extra']) : '')?>" />
148
       </div>
149
       </div>
149
     </div>
150
     </div>
150
-  <input type="submit" value="Submit report" />
151
+  <input type="submit" value="Report" />
151
   </form>
152
   </form>
152
 </div>
153
 </div>
153
-<?
154
+<?php
154
 View::show_footer();
155
 View::show_footer();
155
-?>

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

261
                 <?php  foreach ($Containers as $Key => $Container) { ?>
261
                 <?php  foreach ($Containers as $Key => $Container) { ?>
262
                 <option value="<?=display_str($Key);?>" <?Format::selected('container', $Key)?>><?=display_str($Key);?>
262
                 <option value="<?=display_str($Key);?>" <?Format::selected('container', $Key)?>><?=display_str($Key);?>
263
                 </option>
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
                 <option value="<?=display_str($Key);?>" <?Format::selected('container', $Key)?>><?=display_str($Key);?>
270
                 <option value="<?=display_str($Key);?>" <?Format::selected('container', $Key)?>><?=display_str($Key);?>
266
                 </option>
271
                 </option>
267
                 <?php  } ?>
272
                 <?php  } ?>

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

32
     t.FreeTorrent,
32
     t.FreeTorrent,
33
     t.FreeLeechType,
33
     t.FreeLeechType,
34
     t.Description AS TorrentDescription,
34
     t.Description AS TorrentDescription,
35
+    t.FileList,
35
     t.MediaInfo,
36
     t.MediaInfo,
36
     tg.CategoryID,
37
     tg.CategoryID,
37
     tg.Name AS Title,
38
     tg.Name AS Title,
62
 
63
 
63
 $UploadForm = $Categories[$Properties['CategoryID'] - 1];
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
     error(403);
67
     error(403);
67
 }
68
 }
68
 
69
 
73
 $TorrentForm->upload_form();
74
 $TorrentForm->upload_form();
74
 
75
 
75
 if (check_perms('torrents_edit') || check_perms('users_mod')) {
76
 if (check_perms('torrents_edit') || check_perms('users_mod')) {
77
+    # Start the HTML edit form
76
     ?>
78
     ?>
77
 <div class="thin">
79
 <div class="thin">
78
   <?php
80
   <?php
79
-  if ($Properties['CategoryID'] != 5) {
81
+  #if ($Properties['CategoryID'] !== 5) {
80
       ?>
82
       ?>
83
+
84
+  <br />
81
   <div class="header">
85
   <div class="header">
82
     <h2>Change Group</h2>
86
     <h2>Change Group</h2>
83
   </div>
87
   </div>
107
       </table>
111
       </table>
108
     </form>
112
     </form>
109
   </div>
113
   </div>
114
+  <br />
115
+
110
   <h2>Split off into new group</h2>
116
   <h2>Split off into new group</h2>
111
   <div class="box pad">
117
   <div class="box pad">
112
     <form class="split_form" name="torrent_group" action="torrents.php" method="post">
118
     <form class="split_form" name="torrent_group" action="torrents.php" method="post">
158
     </form>
164
     </form>
159
   </div>
165
   </div>
160
   <br />
166
   <br />
167
+
161
   <?php
168
   <?php
162
-  }
169
+  #}
163
     if (check_perms('users_mod')) { ?>
170
     if (check_perms('users_mod')) { ?>
164
   <h2>Change Category</h2>
171
   <h2>Change Category</h2>
165
   <div class="box pad">
172
   <div class="box pad">
186
               <?php    } ?>
193
               <?php    } ?>
187
             </select>
194
             </select>
188
           </td>
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
         <tr id="split_artist">
197
         <tr id="split_artist">
201
           <td class="label">Artist</td>
198
           <td class="label">Artist</td>
202
           <td>
199
           <td>

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

25
 $Type = $Categories[$TypeID-1];
25
 $Type = $Categories[$TypeID-1];
26
 $TorrentID = (int)$_POST['torrentid'];
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
 $Properties['Remastered'] = (isset($_POST['remaster']))? 1 : 0;
28
 $Properties['Remastered'] = (isset($_POST['remaster']))? 1 : 0;
50
 if ($Properties['Remastered']) {
29
 if ($Properties['Remastered']) {
51
     $Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0;
30
     $Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0;
76
 
55
 
77
 $Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
56
 $Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
78
 $Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
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
 if ($_POST['album_desc']) {
60
 if ($_POST['album_desc']) {
82
     $Properties['GroupDescription'] = $_POST['album_desc'];
61
     $Properties['GroupDescription'] = $_POST['album_desc'];
126
     error(403);
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
 if ($Remastered === '1' && !$RemasterYear && !check_perms('edit_unknowns')) {
110
 if ($Remastered === '1' && !$RemasterYear && !check_perms('edit_unknowns')) {
131
   error(403);
111
   error(403);
132
 }
112
 }
281
 }
261
 }
282
 
262
 
283
 // Strip out Amazon's padding
263
 // Strip out Amazon's padding
284
-/*
285
 $AmazonReg = '/(http:\/\/ecx.images-amazon.com\/images\/.+)(\._.*_\.jpg)/i';
264
 $AmazonReg = '/(http:\/\/ecx.images-amazon.com\/images\/.+)(\._.*_\.jpg)/i';
286
 $Matches = [];
265
 $Matches = [];
287
 if (preg_match($RegX, $Properties['Image'], $Matches)) {
266
 if (preg_match($RegX, $Properties['Image'], $Matches)) {
288
     $Properties['Image'] = $Matches[1].'.jpg';
267
     $Properties['Image'] = $Matches[1].'.jpg';
289
 }
268
 }
290
 ImageTools::blacklisted($Properties['Image']);
269
 ImageTools::blacklisted($Properties['Image']);
291
-*/
292
 
270
 
293
 if ($Err) { // Show the upload form, with the data the user entered
271
 if ($Err) { // Show the upload form, with the data the user entered
294
     if (check_perms('site_debug')) {
272
     if (check_perms('site_debug')) {
312
 $T['Censored'] = $Properties['Censored'];
290
 $T['Censored'] = $Properties['Censored'];
313
 $T['Anonymous'] = $Properties['Anonymous'];
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
 //--------------- Start database stuff -----------------------------------------//
344
 //--------------- Start database stuff -----------------------------------------//

Loading…
Cancel
Save