Browse Source

Finalize the extension parser stuff

pjc 5 years ago
parent
commit
be110b750a

+ 1
- 11
_packages/extension-parser/classes/config.php View File

101
   'Plain'            => ['csv', 'txt'],
101
   'Plain'            => ['csv', 'txt'],
102
   'Other'            => [],
102
   'Other'            => [],
103
 ];
103
 ];
104
-
105
-$Archives = [
106
-  '7z'       => ['7z'],
107
-  'bzip2'    => ['bz2', 'bzip2'],
108
-  'gzip'     => ['gz', 'gzip', 'tgz', 'tpz'],
109
-  'Pickle'   => ['pickle', 'pkl'],
110
-  'RAR'      => ['rar', 'rev'],
111
-  'ZIP'      => ['zip', 'zipx'],
112
-  'None'     => [],
113
-];
114
-# Line 331
104
+# Line 321

+ 106
- 90
_packages/extension-parser/classes/torrent_form.class.php View File

20
 ?>
20
 ?>
21
 
21
 
22
 <!-- Line 510 -->
22
 <!-- Line 510 -->
23
-<!-- Multiple container fields -->
24
-<tr id="container_tr">
25
-  <td class="label">
26
-    Format
27
-    <strong class="important_text">*</strong>
28
-  </td>
29
-  <td>
30
-    <select name="container">
31
-      <option value="Autofill">Autofill</option>
32
-      <?php
33
-        foreach ($this->Containers as $Name => $Container) {
34
-            echo "<option value='$Name'>$Name</option>\n";
35
-        } ?>
36
-    </select><br />
37
-    Data file format, or detect from file list
38
-  </td>
39
-</tr>
23
+  <!-- Multiple container fields -->
24
+  <tr id="container_tr">
25
+    <td class="label">
26
+      Format
27
+      <strong class="important_text">*</strong>
28
+    </td>
29
+    <td>
30
+      <select id="container" name="container">
31
+        <option value="Autofill">Autofill</option>
32
+        <?php
33
+            foreach ($this->Containers as $Name => $Container) {
34
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
35
+                if ($Name === ($Torrent['Container'] ?? false)) {
36
+                    echo " selected";
37
+                }
38
+                echo ">$Name</option>\n";
39
+            } ?>
40
+      </select><br />
41
+      Data file format, or detect from file list
42
+    </td>
43
+  </tr>
40
 
44
 
41
-<!-- 2 -->
42
-<tr id="container_games_tr">
43
-  <td class="label">
44
-    Format
45
-    <strong class="important_text">*</strong>
46
-  </td>
47
-  <td>
48
-    <select id="container" name="container">
49
-      <option value="Autofill">Autofill</option>
50
-      <?php
51
-        foreach ($this->ContainersGames as $Name => $Container) {
52
-            echo "<option value='$Name'>$Name</option>\n";
53
-        } ?>
54
-    </select><br />
55
-    Data file format, or detect from file list
56
-  </td>
57
-</tr>
45
+  <!-- 2 -->
46
+  <tr id="container_games_tr">
47
+    <td class="label">
48
+      Format
49
+      <strong class="important_text">*</strong>
50
+    </td>
51
+    <td>
52
+      <select id="container" name="container">
53
+        <option value="Autofill">Autofill</option>
54
+        <?php
55
+            foreach ($this->ContainersGames as $Name => $Container) {
56
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
57
+                if ($Name === ($Torrent['Container'] ?? false)) {
58
+                    echo " selected";
59
+                }
60
+                echo ">$Name</option>\n";
61
+            } ?>
62
+      </select><br />
63
+      Data file format, or detect from file list
64
+    </td>
65
+  </tr>
58
 
66
 
59
-<!-- 3 -->
60
-<tr id="container_prot_tr">
61
-  <td class="label">
62
-    Format
63
-    <strong class="important_text">*</strong>
64
-  </td>
65
-  <td>
66
-    <select id="container" name="container">
67
-      <option value="Autofill">Autofill</option>
68
-      <?php
69
-        foreach ($this->ContainersProt as $Name => $Container) {
70
-            echo "<option value='$Name'>$Name</option>\n";
71
-        } ?>
72
-    </select><br />
73
-    Data file format, or detect from file list
74
-  </td>
75
-</tr>
67
+  <!-- 3 -->
68
+  <tr id="container_prot_tr">
69
+    <td class="label">
70
+      Format
71
+      <strong class="important_text">*</strong>
72
+    </td>
73
+    <td>
74
+      <select id="container" name="container">
75
+        <option value="Autofill">Autofill</option>
76
+        <?php
77
+            foreach ($this->ContainersProt as $Name => $Container) {
78
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
79
+                if ($Name === ($Torrent['Container'] ?? false)) {
80
+                    echo " selected";
81
+                }
82
+                echo ">$Name</option>\n";
83
+            } ?>
84
+      </select><br />
85
+      Data file format, or detect from file list
86
+    </td>
87
+  </tr>
76
 
88
 
77
-<!-- 4 -->
78
-<tr id="container_extra_tr">
79
-  <td class="label">
80
-    Format
81
-    <strong class="important_text">*</strong>
82
-  </td>
83
-  <td>
84
-    <select id="container" name="container">
85
-      <option value="Autofill">Autofill</option>
86
-      <?php
87
-        foreach ($this->ContainersExtra as $Name => $Container) {
88
-            echo "<option value='$Name'>$Name</option>\n";
89
-        } ?>
90
-    </select><br />
91
-    Data file format, or detect from file list
92
-  </td>
93
-</tr>
89
+  <!-- 4 -->
90
+  <tr id="container_extra_tr">
91
+    <td class="label">
92
+      Format
93
+      <strong class="important_text">*</strong>
94
+    </td>
95
+    <td>
96
+      <select id="container" name="container">
97
+        <option value="Autofill">Autofill</option>
98
+        <?php
99
+            foreach ($this->ContainersExtra as $Name => $Container) {
100
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
101
+                if ($Name === ($Torrent['Container'] ?? false)) {
102
+                    echo " selected";
103
+                }
104
+                echo ">$Name</option>\n";
105
+            } ?>
106
+      </select><br />
107
+      Data file format, or detect from file list
108
+    </td>
109
+  </tr>
94
 
110
 
95
-<!-- Compression -->
96
-<tr id="archive_tr">
97
-  <td class="label">
98
-    Archive
99
-    <strong class="important_text">*</strong>
100
-  </td>
101
-  <td>
102
-    <select name='archive'>
103
-      <option value="Autofill">Autofill</option>
104
-      <?php
105
-        foreach ($this->Archives as $Name => $Archive) {
106
-            echo "\t\t\t\t\t\t<option value=\"$Name\"";
107
-            if ($Archive === ($Torrent['Archive'] ?? false)) {
108
-                echo ' selected';
109
-            }
110
-            echo ">$Name</option>\n";
111
-        } ?>
112
-    </select><br />
113
-    Compression algorithm, or detect from file list
114
-  </td>
115
-</tr>
116
-<!-- Line 607 -->
111
+  <!-- Compression -->
112
+  <tr id="archive_tr">
113
+    <td class="label">
114
+      Archive
115
+      <strong class="important_text">*</strong>
116
+    </td>
117
+    <td>
118
+      <select id="archive" name="archive">
119
+        <option value="Autofill">Autofill</option>
120
+        <?php
121
+            foreach ($this->Archives as $Name => $Archive) {
122
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
123
+                if ($Name === ($Torrent['Archive'] ?? false)) {
124
+                    echo " selected";
125
+                }
126
+                echo ">$Name</option>\n";
127
+            } ?>
128
+      </select><br />
129
+      Compression algorithm, or detect from file list
130
+    </td>
131
+  </tr>
132
+<!-- Line 618 -->

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

63
             }
63
             }
64
         }
64
         }
65
     }
65
     }
66
-    # Line 227
66
+    # Line 230

+ 31
- 2
_packages/extension-parser/readme.md View File

4
 If a user leaves the container or archive dropdown blank, this tool:
4
 If a user leaves the container or archive dropdown blank, this tool:
5
   * Adds the file sizes of each extension
5
   * Adds the file sizes of each extension
6
   * Sorts the torrent file list by size
6
   * Sorts the torrent file list by size
7
-  * Returns the first matching extension value
7
+  * Returns the first matching extension key
8
 
8
 
9
 ## In this repo
9
 ## In this repo
10
 Please find all the snippets you need to implement a similar feature on your own tracker.
10
 Please find all the snippets you need to implement a similar feature on your own tracker.
11
-The file and folder structure mirrors what Oppaitime Gazelle uses.
11
+See `classes/config.php` for an idea of how the each format is associated with an array of file extensions.
12
+I'll reproduce an example below so you can see how powerful a general extension parser can be.
13
+
14
+```php
15
+$ContainersExtra = [
16
+  'Docker'           => ['dockerfile'],
17
+  'Hard Disk'        => ['fvd', 'dmg', 'esd', 'qcow', 'qcow2', 'qcow3', 'smi', 'swm', 'vdi', 'vhd', 'vhdx', 'vmdk', 'wim'],
18
+  'Optical Disc'     => ['bin', 'ccd', 'cso', 'cue', 'daa', 'isz', 'mdf', 'mds', 'mdx', 'nrg', 'uif'],
19
+  'Python'           => ['pxd', 'py', 'py3', 'pyc', 'pyd', 'pyde', 'pyi', 'pyo', 'pyp', 'pyt', 'pyw', 'pywz', 'pyx', 'pyz', 'rpy', 'xpy'],
20
+  'Jupyter Notebook' => ['ipynb'],
21
+  'Ontology'         => ['cgif', 'cl', 'clif', 'csv', 'htm', 'html', 'kif', 'obo', 'owl', 'rdf', 'rdfa', 'rdfs', 'rif', 'tsv', 'xcl', 'xht', 'xhtml', 'xml'],
22
+  'OpenDocument'     => ['odt', 'fodt', 'ods', 'fods', 'odp', 'fodp', 'odg', 'fodg', 'odf'],
23
+  'Word'             => ['doc', 'dot', 'wbk', 'docx', 'docm', 'dotx', 'dotm', 'docb'],
24
+  'Excel'            => ['xls', 'xlt', 'xlm', 'xlsx', 'xlsm', 'xltx', 'xltm', 'xlsb', 'xla', 'xlam', 'xll', 'xlw'],
25
+  'PowerPoint'       => ['ppt', 'pot', 'pps', 'pptx', 'pptm', 'potx', 'potm', 'ppam', 'ppsx', 'ppsm', 'sldx', 'sldm'],
26
+  'PDF'              => ['pdf', 'fdf', 'xfdf'],
27
+  'Plain'            => ['csv', 'txt'],
28
+  'Other'            => [],
29
+];
30
+```
31
+
32
+## Caveats and todos
33
+Test thoroughly before implementing to ensure the behavior is what you expect!
34
+You don't want to ruin the database with unextected "Autofill" formats.
35
+
36
+For this reason, extension parsing is disabled on the torrent edit handler for now.
37
+The FileList stored in the database, available to the edit form, is a bencoded string instead of a nested array.
38
+$Validate->ParseExtensions currently only works with the $Tor->FileList object before its bencoded.
39
+
40
+That's all for now.

+ 3
- 0
_packages/extension-parser/sections/torrents/edit.php View File

1
+<?php
2
+
3
+# todo

+ 15
- 56
_packages/extension-parser/sections/torrents/takeedit.php View File

1
 <?php
1
 <?php
2
 
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'];
3
+# Line 58
4
+$Properties['Container'] = (isset($_POST['container']) && $_POST['container'] !== '---') ? $_POST['container'] : 'Other';
5
+$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] !== '---') ? $_POST['archive'] : 'None';
6
+# Line 59
31
 
7
 
8
+# Line 294
32
 //******************************************************************************//
9
 //******************************************************************************//
33
 //--------------- Autofill format and archive ----------------------------------//
10
 //--------------- Autofill format and archive ----------------------------------//
34
 
11
 
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'],
12
+# Load FileList in lieu of $Tor object
13
+# todo: Format the output for  $Validate->ParseExtensions()
14
+#var_dump($T['FileList']);
59
 
15
 
60
-        # $FileTypes
61
-        $T['ArchiveTypes'],
62
-    );
16
+# Disable the extension parser for edits
17
+# todo: Make this work with $T['FileList']
18
+if ($T['Container'] === 'Autofill'
19
+|| $T['Archive'] === 'Autofill') {
20
+    $Err = "Extension parsing is only possible for new uploads";
21
+    error($Err);
63
 }
22
 }
64
-# Line 347
23
+# Line 307

+ 16
- 10
_packages/extension-parser/sections/upload/upload_handle.php View File

7
 #   'GazelleName' => [$Name, $Icon, $Description, $Containers],
7
 #   'GazelleName' => [$Name, $Icon, $Description, $Containers],
8
 #    ...
8
 #    ...
9
 #  ];
9
 #  ];
10
-$Properties['Archives'] = $Archives;
11
-$Properties['Containers'] = [
10
+$Properties['FileTypes'] = [
12
     'DNA'      => $Containers,
11
     'DNA'      => $Containers,
13
     'RNA'      => $Containers,
12
     'RNA'      => $Containers,
14
     'Proteins' => $ContainersProt,
13
     'Proteins' => $ContainersProt,
15
     'Imaging'  => $ContainersGames,
14
     'Imaging'  => $ContainersGames,
16
     'Extras'   => $ContainersExtra
15
     'Extras'   => $ContainersExtra
17
 ];
16
 ];
18
-# Line 57
17
+$Properties['ArchiveTypes'] = [
18
+    'DNA'      => $Archives,
19
+    'RNA'      => $Archives,
20
+    'Proteins' => $Archives,
21
+    'Imaging'  => $Archives,
22
+    'Extras'   => $Archives
23
+];
24
+# Line 63
19
 
25
 
20
-# Line 421
26
+# Line 427
21
 //******************************************************************************//
27
 //******************************************************************************//
22
 //--------------- Autofill format and archive ----------------------------------//
28
 //--------------- Autofill format and archive ----------------------------------//
23
 
29
 
24
 if ($T['Container'] === 'Autofill') {
30
 if ($T['Container'] === 'Autofill') {
25
-
26
     # torrents.Container
31
     # torrents.Container
27
-    $Validate->ParseExtensions(
32
+    $T['Container'] = $Validate->ParseExtensions(
33
+
28
         # $FileList
34
         # $FileList
29
         $Tor->file_list(),
35
         $Tor->file_list(),
30
 
36
 
37
 }
43
 }
38
 
44
 
39
 if ($T['Archive'] === 'Autofill') {
45
 if ($T['Archive'] === 'Autofill') {
40
-
41
     # torrents.Archive
46
     # torrents.Archive
42
-    $Validate->ParseExtensions(
47
+    $T['Archive'] = $Validate->ParseExtensions(
48
+
43
         # $FileList
49
         # $FileList
44
         $Tor->file_list(),
50
         $Tor->file_list(),
45
 
51
 
47
         $T['CategoryName'],
53
         $T['CategoryName'],
48
 
54
 
49
         # $FileTypes
55
         # $FileTypes
50
-        $T['FileTypes'],
56
+        $T['ArchiveTypes'],
51
     );
57
     );
52
 }
58
 }
53
-# Line 452
59
+# Line 458

+ 39
- 23
classes/torrent_form.class.php View File

471
     </td>
471
     </td>
472
     <td>
472
     <td>
473
       <select name="media">
473
       <select name="media">
474
-        <option value="">---</option>
474
+        <option>---</option>
475
         <?php
475
         <?php
476
           foreach ($this->Media as $Media) {
476
           foreach ($this->Media as $Media) {
477
               echo "\t\t\t\t\t\t<option value=\"$Media\"";
477
               echo "\t\t\t\t\t\t<option value=\"$Media\"";
514
       <strong class="important_text">*</strong>
514
       <strong class="important_text">*</strong>
515
     </td>
515
     </td>
516
     <td>
516
     <td>
517
-      <select name="container">
517
+      <select id="container" name="container">
518
         <option value="Autofill">Autofill</option>
518
         <option value="Autofill">Autofill</option>
519
         <?php
519
         <?php
520
-          foreach ($this->Containers as $Name => $Container) {
521
-              echo "<option value='$Name'>$Name</option>\n";
522
-          } ?>
520
+            foreach ($this->Containers as $Name => $Container) {
521
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
522
+                if ($Name === ($Torrent['Container'] ?? false)) {
523
+                    echo " selected";
524
+                }
525
+                echo ">$Name</option>\n";
526
+            } ?>
523
       </select><br />
527
       </select><br />
524
       Data file format, or detect from file list
528
       Data file format, or detect from file list
525
     </td>
529
     </td>
535
       <select id="container" name="container">
539
       <select id="container" name="container">
536
         <option value="Autofill">Autofill</option>
540
         <option value="Autofill">Autofill</option>
537
         <?php
541
         <?php
538
-          foreach ($this->ContainersGames as $Name => $Container) {
539
-              echo "<option value='$Name'>$Name</option>\n";
540
-          } ?>
542
+            foreach ($this->ContainersGames as $Name => $Container) {
543
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
544
+                if ($Name === ($Torrent['Container'] ?? false)) {
545
+                    echo " selected";
546
+                }
547
+                echo ">$Name</option>\n";
548
+            } ?>
541
       </select><br />
549
       </select><br />
542
       Data file format, or detect from file list
550
       Data file format, or detect from file list
543
     </td>
551
     </td>
553
       <select id="container" name="container">
561
       <select id="container" name="container">
554
         <option value="Autofill">Autofill</option>
562
         <option value="Autofill">Autofill</option>
555
         <?php
563
         <?php
556
-          foreach ($this->ContainersProt as $Name => $Container) {
557
-              echo "<option value='$Name'>$Name</option>\n";
558
-          } ?>
564
+            foreach ($this->ContainersProt as $Name => $Container) {
565
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
566
+                if ($Name === ($Torrent['Container'] ?? false)) {
567
+                    echo " selected";
568
+                }
569
+                echo ">$Name</option>\n";
570
+            } ?>
559
       </select><br />
571
       </select><br />
560
       Data file format, or detect from file list
572
       Data file format, or detect from file list
561
     </td>
573
     </td>
571
       <select id="container" name="container">
583
       <select id="container" name="container">
572
         <option value="Autofill">Autofill</option>
584
         <option value="Autofill">Autofill</option>
573
         <?php
585
         <?php
574
-          foreach ($this->ContainersExtra as $Name => $Container) {
575
-              echo "<option value='$Name'>$Name</option>\n";
576
-          } ?>
586
+            foreach ($this->ContainersExtra as $Name => $Container) {
587
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
588
+                if ($Name === ($Torrent['Container'] ?? false)) {
589
+                    echo " selected";
590
+                }
591
+                echo ">$Name</option>\n";
592
+            } ?>
577
       </select><br />
593
       </select><br />
578
       Data file format, or detect from file list
594
       Data file format, or detect from file list
579
     </td>
595
     </td>
586
       <strong class="important_text">*</strong>
602
       <strong class="important_text">*</strong>
587
     </td>
603
     </td>
588
     <td>
604
     <td>
589
-      <select name='archive'>
605
+      <select id="archive" name="archive">
590
         <option value="Autofill">Autofill</option>
606
         <option value="Autofill">Autofill</option>
591
         <?php
607
         <?php
592
-          foreach ($this->Archives as $Name => $Archive) {
593
-              echo "\t\t\t\t\t\t<option value=\"$Name\"";
594
-              if ($Archive === ($Torrent['Archive'] ?? false)) {
595
-                  echo ' selected';
596
-              }
597
-              echo ">$Name</option>\n";
598
-          } ?>
608
+            foreach ($this->Archives as $Name => $Archive) {
609
+                echo "\t\t\t\t\t\t<option value=\"$Name\"";
610
+                if ($Name === ($Torrent['Archive'] ?? false)) {
611
+                    echo " selected";
612
+                }
613
+                echo ">$Name</option>\n";
614
+            } ?>
599
       </select><br />
615
       </select><br />
600
       Compression algorithm, or detect from file list
616
       Compression algorithm, or detect from file list
601
     </td>
617
     </td>
609
     </td>
625
     </td>
610
     <td>
626
     <td>
611
       <select id="ressel" name="ressel" onchange="SetResolution()">
627
       <select id="ressel" name="ressel" onchange="SetResolution()">
612
-        <option value="">---</option>
628
+        <option>---</option>
613
         <?php
629
         <?php
614
           foreach ($this->Resolutions as $Res) {
630
           foreach ($this->Resolutions as $Res) {
615
               echo "\t\t\t\t\t\t<option value=\"$Res\"";
631
               echo "\t\t\t\t\t\t<option value=\"$Res\"";

+ 1
- 1
sections/torrents/edit.php View File

193
               <?php    } ?>
193
               <?php    } ?>
194
             </select>
194
             </select>
195
           </td>
195
           </td>
196
-          </tr>
196
+        </tr>
197
         <tr id="split_artist">
197
         <tr id="split_artist">
198
           <td class="label">Artist</td>
198
           <td class="label">Artist</td>
199
           <td>
199
           <td>

+ 16
- 49
sections/torrents/takeedit.php View File

45
 $Properties['TorrentDescription'] = $_POST['release_desc'];
45
 $Properties['TorrentDescription'] = $_POST['release_desc'];
46
 $Properties['MediaInfo'] = $_POST['mediainfo'];
46
 $Properties['MediaInfo'] = $_POST['mediainfo'];
47
 $Properties['Name'] = $_POST['title'];
47
 $Properties['Name'] = $_POST['title'];
48
-$Properties['Container'] = $_POST['container'];
49
 $Properties['Codec'] = $_POST['codec'];
48
 $Properties['Codec'] = $_POST['codec'];
50
 $Properties['Resolution'] = $_POST['resolution'];
49
 $Properties['Resolution'] = $_POST['resolution'];
51
 $Properties['AudioFormat'] = $_POST['audioformat'];
50
 $Properties['AudioFormat'] = $_POST['audioformat'];
55
 
54
 
56
 $Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
55
 $Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
57
 $Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
56
 $Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
58
-$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] !== '---') ? $_POST['archive'] : '';
57
+
58
+$Properties['Container'] = (isset($_POST['container']) && $_POST['container'] !== '---') ? $_POST['container'] : 'Other';
59
+$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] !== '---') ? $_POST['archive'] : 'None';
59
 
60
 
60
 if ($_POST['album_desc']) {
61
 if ($_POST['album_desc']) {
61
     $Properties['GroupDescription'] = $_POST['album_desc'];
62
     $Properties['GroupDescription'] = $_POST['album_desc'];
294
 //--------------- Autofill format and archive ----------------------------------//
295
 //--------------- Autofill format and archive ----------------------------------//
295
 
296
 
296
 # Load FileList in lieu of $Tor object
297
 # 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
-    );
298
+# todo: Format the output for  $Validate->ParseExtensions()
299
+#var_dump($T['FileList']);
300
+
301
+# Disable the extension parser for edits
302
+# todo: Make this work with $T['FileList']
303
+if ($T['Container'] === 'Autofill'
304
+|| $T['Archive'] === 'Autofill') {
305
+    $Err = "Extension parsing is only possible for new uploads";
306
+    error($Err);
335
 }
307
 }
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'], );
342
-
308
+    
343
 //******************************************************************************//
309
 //******************************************************************************//
344
 //--------------- Start database stuff -----------------------------------------//
310
 //--------------- Start database stuff -----------------------------------------//
345
 
311
 
408
 }
374
 }
409
 
375
 
410
 if (check_perms('users_mod')) {
376
 if (check_perms('users_mod')) {
411
-    /*  if ($T[Format] != "'FLAC'") {
377
+    /*
378
+    if ($T[Format] !== "'FLAC'") {
412
         $SQL .= "
379
         $SQL .= "
413
           HasLog = '0',
380
           HasLog = '0',
414
           HasCue = '0',";
381
           HasCue = '0',";
508
 
475
 
509
 // Competition
476
 // Competition
510
 if (strtotime($Time) > 1241352173) {
477
 if (strtotime($Time) > 1241352173) {
511
-    if ($_POST['log_score'] == '100') {
478
+    if ($_POST['log_score'] === '100') {
512
         $DB->query("
479
         $DB->query("
513
       INSERT IGNORE into users_points (GroupID, UserID, Points)
480
       INSERT IGNORE into users_points (GroupID, UserID, Points)
514
       VALUES ('$GroupID', '$UserID', '1')");
481
       VALUES ('$GroupID', '$UserID', '1')");

Loading…
Cancel
Save