Browse Source

Partial implementation of extra resolution metadata

biotorrents 4 years ago
parent
commit
6f8e8f00dc

+ 87
- 39
classes/config.template View File

133
  */
133
  */
134
 
134
 
135
 # Pre-shared key for generating hmacs for the image proxy
135
 # Pre-shared key for generating hmacs for the image proxy
136
-define('IMAGE_PSK', '00000000000000000000000000000000');
137
 ENV::setPriv('IMAGE_PSK', '00000000000000000000000000000000');
136
 ENV::setPriv('IMAGE_PSK', '00000000000000000000000000000000');
138
 
137
 
139
  # Production
138
  # Production
470
  * Found in the `permissions` table.
469
  * Found in the `permissions` table.
471
  */
470
  */
472
 
471
 
473
-#      Name of class     Class ID (not level)
474
-define('ADMIN', '1');
475
-define('USER', '2');
476
-define('MEMBER', '3');
477
-define('POWER', '4');
478
-define('ELITE', '5');
479
-define('LEGEND', '8');
480
-define('MOD', '11');
481
-define('SYSOP', '15');
482
-define('ARTIST', '19');
483
-define('DONOR', '20');
484
-define('VIP', '21');
472
+#       Name of class     Class ID (not level)
473
+define('ADMIN',          '1');
474
+define('USER',           '2');
475
+define('MEMBER',         '3');
476
+define('POWER',          '4');
477
+define('ELITE',          '5');
478
+define('LEGEND',         '8');
479
+define('MOD',            '11');
480
+define('SYSOP',          '15');
481
+define('ARTIST',         '19');
482
+define('DONOR',          '20');
483
+define('VIP',            '21');
485
 define('TORRENT_MASTER', '23');
484
 define('TORRENT_MASTER', '23');
486
-define('POWER_TM', '24');
487
-define('FLS_TEAM', '33');
488
-define('FORUM_MOD', '9001');
485
+define('POWER_TM',       '24');
486
+define('FLS_TEAM',       '33');
487
+define('FORUM_MOD',      '9001');
489
 
488
 
490
 
489
 
491
 /**
490
 /**
525
 
524
 
526
 # Ratio requirements, in descending order
525
 # Ratio requirements, in descending order
527
 define('RATIO_REQUIREMENTS', [
526
 define('RATIO_REQUIREMENTS', [
528
- # Downloaded     Req (0% seeded) Req (100% seeded)
529
-  [200 * 1024**3, 0.60,           0.60],
530
-  [160 * 1024**3, 0.60,           0.50],
531
-  [120 * 1024**3, 0.50,           0.40],
532
-  [100 * 1024**3, 0.40,           0.30],
533
-  [80  * 1024**3, 0.30,           0.20],
534
-  [60  * 1024**3, 0.20,           0.10],
535
-  [40  * 1024**3, 0.15,           0.00],
536
-  [20  * 1024**3, 0.10,           0.00],
537
-  [10  * 1024**3, 0.05,           0.00],
527
+ # Downloaded     Req (0% seed) Req (100% seed)
528
+  [200 * 1024**3, 0.60,         0.60],
529
+  [160 * 1024**3, 0.60,         0.50],
530
+  [120 * 1024**3, 0.50,         0.40],
531
+  [100 * 1024**3, 0.40,         0.30],
532
+  [80  * 1024**3, 0.30,         0.20],
533
+  [60  * 1024**3, 0.20,         0.10],
534
+  [40  * 1024**3, 0.15,         0.00],
535
+  [20  * 1024**3, 0.10,         0.00],
536
+  [10  * 1024**3, 0.05,         0.00],
538
 ]);
537
 ]);
539
 
538
 
540
 # God I wish I didn't have to do this but I just don't care anymore
539
 # God I wish I didn't have to do this but I just don't care anymore
548
     '256'  => 15,
547
     '256'  => 15,
549
     '512'  => 16,
548
     '512'  => 16,
550
     '1024' => 17,
549
     '1024' => 17,
551
-    '2048' => 18
550
+    '2048' => 18,
552
   ],
551
   ],
553
 
552
 
554
   'UL' => [
553
   'UL' => [
560
     '512'  => 25,
559
     '512'  => 25,
561
     '1024' => 26,
560
     '1024' => 26,
562
     '2048' => 27,
561
     '2048' => 27,
563
-    '4096' => 28
562
+    '4096' => 28,
564
   ],
563
   ],
565
 
564
 
566
   'Posts' => [
565
   'Posts' => [
572
     '250'  => 65,
571
     '250'  => 65,
573
     '500'  => 66,
572
     '500'  => 66,
574
     '1000' => 67,
573
     '1000' => 67,
575
-    '2500' => 68
574
+    '2500' => 68,
576
   ]
575
   ]
577
 ];
576
 ];
578
 ENV::setPub(
577
 ENV::setPub(
667
   'Documents',
666
   'Documents',
668
   'Machine Data',
667
   'Machine Data',
669
 ];
668
 ];
670
-
671
 $GroupedCategories = $Categories;
669
 $GroupedCategories = $Categories;
672
-#$CategoryIcons = ['music.png', 'apps.png', 'ebook.png', 'audiobook.png', 'elearning.png', 'comedy.png', 'comics.png'];
673
 
670
 
674
 # Plain Formats
671
 # Plain Formats
675
 $PlainFormats = [
672
 $PlainFormats = [
687
 
684
 
688
 # Platforms
685
 # Platforms
689
 $SeqPlatforms = [
686
 $SeqPlatforms = [
690
-#$Media = [
691
   # DNA
687
   # DNA
692
   'Complete Genomics',
688
   'Complete Genomics',
693
   'cPAS-BGI/MGI',
689
   'cPAS-BGI/MGI',
712
 # Sequence Formats
708
 # Sequence Formats
713
 # https://www.ncbi.nlm.nih.gov/sra/docs/submitformats/
709
 # https://www.ncbi.nlm.nih.gov/sra/docs/submitformats/
714
 $SeqFormats = [
710
 $SeqFormats = [
715
-#$Containers = [
716
   'BAM'        => ['bam'],
711
   'BAM'        => ['bam'],
717
   'CRAM'       => ['cram'],
712
   'CRAM'       => ['cram'],
718
   'EMBL'       => ['embl'],
713
   'EMBL'       => ['embl'],
738
 # DON'T PARSE RAW FILES. TOO MANY COMPETING VENDORS
733
 # DON'T PARSE RAW FILES. TOO MANY COMPETING VENDORS
739
 # https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3518119/
734
 # https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3518119/
740
 $ProtFormats = [
735
 $ProtFormats = [
741
-#$ContainersProt = [
742
   'ABI/Sciex'      => ['t2d', 'wiff'],
736
   'ABI/Sciex'      => ['t2d', 'wiff'],
743
   'APML'           => ['apml'],
737
   'APML'           => ['apml'],
744
   'ASF'            => ['asf'],
738
   'ASF'            => ['asf'],
829
 
823
 
830
 # Image Platforms
824
 # Image Platforms
831
 $ImgPlatforms = [
825
 $ImgPlatforms = [
832
-#$MediaManga = [
833
   'CT/CAT',
826
   'CT/CAT',
834
   'ECG',
827
   'ECG',
835
   'Elastography',
828
   'Elastography',
848
 # Image Formats
841
 # Image Formats
849
 # https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3948928/
842
 # https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3948928/
850
 $ImgFormats = [
843
 $ImgFormats = [
851
-#$ContainersGames = [
852
   'Analyze'   => ['hdr', 'img'],
844
   'Analyze'   => ['hdr', 'img'],
853
   'Interfile' => ['h33'],
845
   'Interfile' => ['h33'],
854
   'DICOM'     => ['dcm', 'dicom'],
846
   'DICOM'     => ['dcm', 'dicom'],
968
   'gzip'     => ['gz', 'gzip', 'tgz', 'tpz'],
960
   'gzip'     => ['gz', 'gzip', 'tgz', 'tpz'],
969
   'Pickle'   => ['pickle', 'pkl'],
961
   'Pickle'   => ['pickle', 'pkl'],
970
   'RAR'      => ['rar', 'rev'],
962
   'RAR'      => ['rar', 'rev'],
963
+  'tar'      => ['tar'],
971
   'ZIP'      => ['zip', 'zipx'],
964
   'ZIP'      => ['zip', 'zipx'],
972
   'None'     => [''],
965
   'None'     => [''],
973
 ];
966
 ];
995
   'Other',
988
   'Other',
996
 ];
989
 ];
997
 
990
 
998
-# Scopes
991
+# Resolutions
999
 $Resolutions = [
992
 $Resolutions = [
993
+  'Nano',
994
+  'Micro',
995
+  'Milli',
996
+  'Centi',
997
+  'Kilo',
998
+  'Mega',
999
+  'Giga',
1000
+  'Tera',
1001
+];
1002
+
1003
+$SeqResolutions = [
1000
   'Contig',
1004
   'Contig',
1001
   'Scaffold',
1005
   'Scaffold',
1002
   'Chromosome',
1006
   'Chromosome',
1003
-  'Whole Genome',
1004
-  'Other',
1007
+  'Genome',
1008
+  'Proteome',
1009
+  'Transcriptome',
1010
+];
1011
+
1012
+$LocResolutions = [
1013
+  'Organization',
1014
+  'Locality',
1015
+  'State',
1016
+  'Province',
1017
+  'Country',
1018
+  'Continent',
1019
+  'World',
1020
+];
1021
+
1022
+$XmlResolutions = [
1023
+  'Value',
1024
+  'Attribute',
1025
+  'Group',
1026
+  'Element',
1027
+  'Schema',
1028
+];
1029
+
1030
+$ScalarResolutions = [
1031
+  'Area',
1032
+  'Density',
1033
+  'Distance',
1034
+  'Energy',
1035
+  'Mass',
1036
+  'Speed',
1037
+  'Temperature',
1038
+  'Time',
1039
+  'Volume',
1040
+  'Work',
1041
+];
1042
+
1043
+$VectorResolutions = [
1044
+  'Acceleration',
1045
+  'Displacement',
1046
+  'Force',
1047
+  'Polarization',
1048
+  'Momentum',
1049
+  'Position',
1050
+  'Thrust',
1051
+  'Velocity',
1052
+  'Weight',
1005
 ];
1053
 ];
1006
 
1054
 
1007
 # Collage categories
1055
 # Collage categories

+ 3
- 2
classes/imagetools.class.php View File

16
     public static function process($Url = '', $Thumb = false)
16
     public static function process($Url = '', $Thumb = false)
17
     {
17
     {
18
         $ENV = ENV::go();
18
         $ENV = ENV::go();
19
+        $Psk = $ENV->getPriv('IMAGE_PSK');
19
 
20
 
20
         if (!$Url) {
21
         if (!$Url) {
21
             return '';
22
             return '';
22
         }
23
         }
23
         
24
         
24
-        if (preg_match('/^https:\/\/('.SITE_DOMAIN.'|'.$ENV->IMAGE_DOMAIN.')\//', $Url) || $Url[0] === '/') {
25
+        if (preg_match('/^https:\/\/('.$ENV->SITE_DOMAIN.'|'.$ENV->IMAGE_DOMAIN.')\//', $Url) || $Url[0] === '/') {
25
             if (strpos($Url, '?') === false) {
26
             if (strpos($Url, '?') === false) {
26
                 $Url .= '?';
27
                 $Url .= '?';
27
             }
28
             }
31
             . $ENV->IMAGE_DOMAIN
32
             . $ENV->IMAGE_DOMAIN
32
             . ($Thumb?"/$Thumb/":'/')
33
             . ($Thumb?"/$Thumb/":'/')
33
             . '?h='
34
             . '?h='
34
-            . rawurlencode(base64_encode(hash_hmac('sha256', $Url, IMAGE_PSK, true)))
35
+            . rawurlencode(base64_encode(hash_hmac('sha256', $Url, $Psk, true)))
35
             . '&i='
36
             . '&i='
36
             . urlencode($Url);
37
             . urlencode($Url);
37
         }
38
         }

+ 0
- 1492
classes/torrent_form.class.NEW.2020-12-10.php
File diff suppressed because it is too large
View File


+ 9
- 24
classes/torrent_form.class.php View File

82
         $this->ImgPlatforms = $ImgPlatforms;
82
         $this->ImgPlatforms = $ImgPlatforms;
83
         $this->DocPlatforms = $DocPlatforms;
83
         $this->DocPlatforms = $DocPlatforms;
84
         $this->RawPlatforms = $RawPlatforms;
84
         $this->RawPlatforms = $RawPlatforms;
85
-        #$this->Media = $Media;
86
-        #$this->MediaManga = $MediaManga;
87
        
85
        
88
         # Formats
86
         # Formats
89
         # See classes/config.php
87
         # See classes/config.php
97
         $this->BinDocFormats = $BinDocFormats;
95
         $this->BinDocFormats = $BinDocFormats;
98
         $this->CpuGenFormats = $CpuGenFormats;
96
         $this->CpuGenFormats = $CpuGenFormats;
99
         $this->PlainFormats = $PlainFormats;
97
         $this->PlainFormats = $PlainFormats;
100
-        #$this->Containers = $Containers;
101
-        #$this->ContainersGames = $ContainersGames;
102
-        #$this->ContainersProt = $ContainersProt;
103
-        #$this->ContainersExtra = $ContainersExtra;
104
         
98
         
105
         # Misc
99
         # Misc
106
         $this->Codecs = $Codecs;
100
         $this->Codecs = $Codecs;
107
         $this->Archives = $Archives;
101
         $this->Archives = $Archives;
108
         $this->Resolutions = $Resolutions;
102
         $this->Resolutions = $Resolutions;
109
 
103
 
110
-        # Deprecated
111
-        #$this->ArchivesManga = $ArchivesManga;
112
-        #$this->Formats = $Formats;
113
-        #$this->Bitrates = $Bitrates;
114
-        #$this->Platform = $Platform;
115
-
116
         # Quick constructor test
104
         # Quick constructor test
117
         if ($this->Torrent && $this->Torrent['GroupID']) {
105
         if ($this->Torrent && $this->Torrent['GroupID']) {
118
             $this->Disabled = ' readonly="readonly"';
106
             $this->Disabled = ' readonly="readonly"';
263
         <input type="hidden" name="submit" value="true" />
251
         <input type="hidden" name="submit" value="true" />
264
         <input type="hidden" name="auth" value="$AuthKey" />
252
         <input type="hidden" name="auth" value="$AuthKey" />
265
 HTML;
253
 HTML;
266
-        
267
-        
254
+
268
         if (!$this->NewTorrent) {
255
         if (!$this->NewTorrent) {
269
             # Edit form hidden fields
256
             # Edit form hidden fields
270
             $TorrentID = display_str($this->TorrentID);
257
             $TorrentID = display_str($this->TorrentID);
296
 HTML;
283
 HTML;
297
             }
284
             }
298
         } # else
285
         } # else
299
-    
300
 
286
 
301
         /**
287
         /**
302
          * Start printing the torrent form
288
          * Start printing the torrent form
305
         return $HTML;
291
         return $HTML;
306
     }
292
     }
307
 
293
 
294
+
308
     /**
295
     /**
309
      * New torrent options: file
296
      * New torrent options: file
310
      */
297
      */
393
         $Torrent = $this->Torrent;
380
         $Torrent = $this->Torrent;
394
         echo '<table class="torrent_form>';
381
         echo '<table class="torrent_form>';
395
 
382
 
396
-
397
         /**
383
         /**
398
          * Freeleech type
384
          * Freeleech type
399
          */
385
          */
428
                 <select name="freeleechtype">
414
                 <select name="freeleechtype">
429
 HTML;
415
 HTML;
430
 
416
 
431
-
432
                 /**
417
                 /**
433
                  * Freeleech reasons
418
                  * Freeleech reasons
434
                  */
419
                  */
450
             }
435
             }
451
         } # fi !NewTorrent
436
         } # fi !NewTorrent
452
 
437
 
453
-
454
         /**
438
         /**
455
          * Rules notice
439
          * Rules notice
456
          */
440
          */
481
         
465
         
482
         echo '</aside></td></tr>';
466
         echo '</aside></td></tr>';
483
 
467
 
484
-
485
         /**
468
         /**
486
          * Submit button
469
          * Submit button
487
          */
470
          */
515
         $ENV = ENV::go();
498
         $ENV = ENV::go();
516
 
499
 
517
         $QueryID = G::$DB->get_query_id();
500
         $QueryID = G::$DB->get_query_id();
518
-        #$this->head();
519
-        #echo $this->basicInfo();
520
         $Torrent = $this->Torrent;
501
         $Torrent = $this->Torrent;
521
-        
502
+
503
+        # Moved to their own functions
504
+        #echo $this->head();
505
+        #echo $this->basicInfo();
506
+
522
         # Start printing the form
507
         # Start printing the form
523
         echo '<h2 class="header">Torrent Form</h2>';
508
         echo '<h2 class="header">Torrent Form</h2>';
524
         echo '<table class="torrent_form">';
509
         echo '<table class="torrent_form">';
525
 
510
 
526
-
511
+        
527
         /**
512
         /**
528
          * Accession Number
513
          * Accession Number
529
          *
514
          *
911
          * Takes an ID, label, torrent, and media list.
896
          * Takes an ID, label, torrent, and media list.
912
          * Returns a media select option as on upload.php.
897
          * Returns a media select option as on upload.php.
913
          */
898
          */
914
-        function mediaSelect($trID = '', $Label = '', $Torrent = [], $Media = [])
899
+        function mediaSelect($trID = '', $Label = '', $Torrent = [], $Media = [], $Desc = '')
915
         {
900
         {
916
             echo <<<HTML
901
             echo <<<HTML
917
                 <tr id="$trID">
902
                 <tr id="$trID">

+ 2
- 3
sections/ajax/torrentgroupalbumart.php View File

1
 <?php
1
 <?php
2
+declare(strict_types=1);
2
 
3
 
3
 require SERVER_ROOT.'/sections/torrents/functions.php';
4
 require SERVER_ROOT.'/sections/torrents/functions.php';
4
 
5
 
11
 $TorrentDetails = $TorrentDetails[0];
12
 $TorrentDetails = $TorrentDetails[0];
12
 $Image = $TorrentDetails['WikiImage'];
13
 $Image = $TorrentDetails['WikiImage'];
13
 
14
 
14
-/*
15
 // Handle no artwork
15
 // Handle no artwork
16
 if (!$Image) {
16
 if (!$Image) {
17
-    $Image = STATIC_SERVER.'common/noartwork/'.$CategoryIcons[$TorrentDetails['CategoryID'] - 1];
17
+    $Image = STATIC_SERVER.'common/noartwork/music.png';
18
 }
18
 }
19
-*/
20
 
19
 
21
 json_die('success', array(
20
 json_die('success', array(
22
   'picture' => $Image
21
   'picture' => $Image

+ 2
- 2
sections/bookmarks/torrents.php View File

255
     <?php if (!$WikiImage) {
255
     <?php if (!$WikiImage) {
256
         $WikiImage = STATIC_SERVER.'common/noartwork/music.png';
256
         $WikiImage = STATIC_SERVER.'common/noartwork/music.png';
257
     } ?>
257
     } ?>
258
-    
258
+
259
     <img class="tooltip"
259
     <img class="tooltip"
260
       src="<?=ImageTools::process($WikiImage, 'thumb')?>"
260
       src="<?=ImageTools::process($WikiImage, 'thumb')?>"
261
       alt="<?=$DisplayName?>"
261
       alt="<?=$DisplayName?>"
316
 <!--content-->
316
 <!--content-->
317
 <?php
317
 <?php
318
   View::show_footer();
318
   View::show_footer();
319
-  error();
320
 } ?>
319
 } ?>
320
+
321
 <div class="sidebar">
321
 <div class="sidebar">
322
   <div class="box box_info box_statistics_bookmarked_torrents">
322
   <div class="box box_info box_statistics_bookmarked_torrents">
323
     <div class="head"><strong>Stats</strong></div>
323
     <div class="head"><strong>Stats</strong></div>

+ 1
- 1
sections/index/private.php View File

3
 
3
 
4
 $ENV = ENV::go();
4
 $ENV = ENV::go();
5
 Text::$TOC = true;
5
 Text::$TOC = true;
6
-$NewsCount = 3;
6
+$NewsCount = 1;
7
 
7
 
8
 if (!$News = $Cache->get_value('news')) {
8
 if (!$News = $Cache->get_value('news')) {
9
     $DB->query("
9
     $DB->query("

+ 58
- 48
sections/tools/managers/bans.php View File

1
 <?php
1
 <?php
2
+#declare(strict_types=1);
3
+
4
+$ENV = ENV::go();
5
+
2
 if (!check_perms('admin_manage_ipbans')) {
6
 if (!check_perms('admin_manage_ipbans')) {
3
-  error(403);
7
+    error(403);
4
 }
8
 }
5
 
9
 
6
 if (isset($_POST['submit'])) {
10
 if (isset($_POST['submit'])) {
7
-  authorize();
11
+    authorize();
8
 
12
 
9
-  $IPA = substr($_POST['start'], 0, strcspn($_POST['start'], '.'));
10
-  if ($_POST['submit'] == 'Delete') { //Delete
11
-    if (!is_number($_POST['id']) || $_POST['id'] == '') {
12
-      error(0);
13
-    }
14
-    $DB->query('DELETE FROM ip_bans WHERE ID='.$_POST['id']);
15
-    $Cache->delete_value('ip_bans_'.$IPA);
16
-  } else { //Edit & Create, Shared Validation
17
-    $Val->SetFields('start', '1','regex','You must include the starting IP address.',array('regex'=>'/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/i'));
18
-    $Val->SetFields('end', '1','regex','You must include the ending IP address.',array('regex'=>'/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/i'));
19
-    $Val->SetFields('notes', '1','string','You must include the reason for the ban.');
20
-    $Err=$Val->ValidateForm($_POST); // Validate the form
21
-    if ($Err) {
22
-      error($Err);
23
-    }
13
+    $IPA = substr($_POST['start'], 0, strcspn($_POST['start'], '.'));
14
+    if ($_POST['submit'] == 'Delete') { //Delete
15
+        if (!is_number($_POST['id']) || $_POST['id'] == '') {
16
+            error(0);
17
+        }
18
+        $DB->query('DELETE FROM ip_bans WHERE ID='.$_POST['id']);
19
+        $Cache->delete_value('ip_bans_'.$IPA);
20
+    } else { //Edit & Create, Shared Validation
21
+        $Val->SetFields('start', '1', 'regex', 'You must include the starting IP address.', array('regex'=>'/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/i'));
22
+        $Val->SetFields('end', '1', 'regex', 'You must include the ending IP address.', array('regex'=>'/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/i'));
23
+        $Val->SetFields('notes', '1', 'string', 'You must include the reason for the ban.');
24
+        $Err=$Val->ValidateForm($_POST); // Validate the form
25
+        if ($Err) {
26
+            error($Err);
27
+        }
24
 
28
 
25
-    $Notes = db_string($_POST['notes']);
26
-    $Start = Tools::ip_to_unsigned($_POST['start']); //Sanitized by Validation regex
29
+        $Notes = db_string($_POST['notes']);
30
+        $Start = Tools::ip_to_unsigned($_POST['start']); //Sanitized by Validation regex
27
     $End = Tools::ip_to_unsigned($_POST['end']); //See above
31
     $End = Tools::ip_to_unsigned($_POST['end']); //See above
28
 
32
 
29
     if ($_POST['submit'] == 'Edit') { //Edit
33
     if ($_POST['submit'] == 'Edit') { //Edit
30
-      if (empty($_POST['id']) || !is_number($_POST['id'])) {
31
-        error(404);
32
-      }
33
-      $DB->query("
34
+        if (empty($_POST['id']) || !is_number($_POST['id'])) {
35
+            error(404);
36
+        }
37
+        $DB->query("
34
         UPDATE ip_bans
38
         UPDATE ip_bans
35
         SET
39
         SET
36
           FromIP=$Start,
40
           FromIP=$Start,
38
           Reason='$Notes'
42
           Reason='$Notes'
39
         WHERE ID='".$_POST['id']."'");
43
         WHERE ID='".$_POST['id']."'");
40
     } else { //Create
44
     } else { //Create
41
-      $DB->query("
45
+        $DB->query("
42
         INSERT INTO ip_bans
46
         INSERT INTO ip_bans
43
           (FromIP, ToIP, Reason)
47
           (FromIP, ToIP, Reason)
44
         VALUES
48
         VALUES
45
           ('$Start','$End', '$Notes')");
49
           ('$Start','$End', '$Notes')");
46
     }
50
     }
47
-    $Cache->delete_value('ip_bans_'.$IPA);
48
-  }
51
+        $Cache->delete_value('ip_bans_'.$IPA);
52
+    }
49
 }
53
 }
50
 
54
 
51
 define('BANS_PER_PAGE', '20');
55
 define('BANS_PER_PAGE', '20');
61
   FROM ip_bans ";
65
   FROM ip_bans ";
62
 
66
 
63
 if (!empty($_REQUEST['notes'])) {
67
 if (!empty($_REQUEST['notes'])) {
64
-  $sql .= "WHERE Reason LIKE '%".db_string($_REQUEST['notes'])."%' ";
68
+    $sql .= "WHERE Reason LIKE '%".db_string($_REQUEST['notes'])."%' ";
65
 }
69
 }
66
 
70
 
67
-if (!empty($_REQUEST['ip']) && preg_match('/'.IP_REGEX.'/', $_REQUEST['ip'])) {
68
-  if (!empty($_REQUEST['notes'])) {
69
-    $sql .= "AND '".Tools::ip_to_unsigned($_REQUEST['ip'])."' BETWEEN FromIP AND ToIP ";
70
-  } else {
71
-    $sql .= "WHERE '".Tools::ip_to_unsigned($_REQUEST['ip'])."' BETWEEN FromIP AND ToIP ";
72
-  }
71
+if (!empty($_REQUEST['ip']) && preg_match('/'.$ENV->IP_REGEX.'/', $_REQUEST['ip'])) {
72
+    if (!empty($_REQUEST['notes'])) {
73
+        $sql .= "AND '".Tools::ip_to_unsigned($_REQUEST['ip'])."' BETWEEN FromIP AND ToIP ";
74
+    } else {
75
+        $sql .= "WHERE '".Tools::ip_to_unsigned($_REQUEST['ip'])."' BETWEEN FromIP AND ToIP ";
76
+    }
73
 }
77
 }
74
 
78
 
75
 $sql .= "ORDER BY FromIP ASC";
79
 $sql .= "ORDER BY FromIP ASC";
95
         <td class="label"><label for="ip">IP address:</label></td>
99
         <td class="label"><label for="ip">IP address:</label></td>
96
         <td>
100
         <td>
97
           <input type="hidden" name="action" value="ip_ban" />
101
           <input type="hidden" name="action" value="ip_ban" />
98
-          <input type="search" id="ip" name="ip" size="20" value="<?=(!empty($_GET['ip']) ? display_str($_GET['ip']) : '')?>" />
102
+          <input type="search" id="ip" name="ip" size="20"
103
+            value="<?=(!empty($_GET['ip']) ? display_str($_GET['ip']) : '')?>" />
99
         </td>
104
         </td>
100
         <td class="label"><label for="notes">Notes:</label></td>
105
         <td class="label"><label for="notes">Notes:</label></td>
101
         <td>
106
         <td>
102
           <input type="hidden" name="action" value="ip_ban" />
107
           <input type="hidden" name="action" value="ip_ban" />
103
-          <input type="search" id="notes" name="notes" size="60" value="<?=(!empty($_GET['notes']) ? display_str($_GET['notes']) : '')?>" />
108
+          <input type="search" id="notes" name="notes" size="60"
109
+            value="<?=(!empty($_GET['notes']) ? display_str($_GET['notes']) : '')?>" />
104
         </td>
110
         </td>
105
         <td>
111
         <td>
106
           <input type="submit" value="Search" />
112
           <input type="submit" value="Search" />
113
 
119
 
114
 <h3>Manage</h3>
120
 <h3>Manage</h3>
115
 <div class="linkbox">
121
 <div class="linkbox">
116
-<?=$PageLinks?>
122
+  <?=$PageLinks?>
117
 </div>
123
 </div>
118
 <table width="100%">
124
 <table width="100%">
119
   <tr class="colhead">
125
   <tr class="colhead">
120
     <td colspan="2">
126
     <td colspan="2">
121
-      <span class="tooltip" title="The IP addresses specified are &#42;inclusive&#42;. The left box is the beginning of the IP address range, and the right box is the end of the IP address range.">Range</span>
127
+      <span class="tooltip"
128
+        title="The IP addresses specified are &#42;inclusive&#42;. The left box is the beginning of the IP address range, and the right box is the end of the IP address range.">Range</span>
122
     </td>
129
     </td>
123
     <td>Notes</td>
130
     <td>Notes</td>
124
     <td>Submit</td>
131
     <td>Submit</td>
126
   <tr class="row">
133
   <tr class="row">
127
     <form class="create_form" name="ban" action="" method="post">
134
     <form class="create_form" name="ban" action="" method="post">
128
       <input type="hidden" name="action" value="ip_ban" />
135
       <input type="hidden" name="action" value="ip_ban" />
129
-      <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
136
+      <input type="hidden" name="auth"
137
+        value="<?=$LoggedUser['AuthKey']?>" />
130
       <td colspan="2">
138
       <td colspan="2">
131
         <input type="text" size="12" name="start" />
139
         <input type="text" size="12" name="start" />
132
         <input type="text" size="12" name="end" />
140
         <input type="text" size="12" name="end" />
139
       </td>
147
       </td>
140
     </form>
148
     </form>
141
   </tr>
149
   </tr>
142
-<?
150
+  <?php
143
 while (list($ID, $Start, $End, $Reason) = $DB->next_record()) {
151
 while (list($ID, $Start, $End, $Reason) = $DB->next_record()) {
144
-  $Start = long2ip($Start);
145
-  $End = long2ip($End);
146
-?>
152
+    $Start = long2ip($Start);
153
+    $End = long2ip($End); ?>
147
   <tr class="row">
154
   <tr class="row">
148
     <form class="manage_form" name="ban" action="" method="post">
155
     <form class="manage_form" name="ban" action="" method="post">
149
       <input type="hidden" name="id" value="<?=$ID?>" />
156
       <input type="hidden" name="id" value="<?=$ID?>" />
150
       <input type="hidden" name="action" value="ip_ban" />
157
       <input type="hidden" name="action" value="ip_ban" />
151
-      <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
158
+      <input type="hidden" name="auth"
159
+        value="<?=$LoggedUser['AuthKey']?>" />
152
       <td colspan="2">
160
       <td colspan="2">
153
-        <input type="text" size="12" name="start" value="<?=$Start?>" />
161
+        <input type="text" size="12" name="start"
162
+          value="<?=$Start?>" />
154
         <input type="text" size="12" name="end" value="<?=$End?>" />
163
         <input type="text" size="12" name="end" value="<?=$End?>" />
155
       </td>
164
       </td>
156
       <td>
165
       <td>
157
-        <input type="text" size="72" name="notes" value="<?=$Reason?>" />
166
+        <input type="text" size="72" name="notes"
167
+          value="<?=$Reason?>" />
158
       </td>
168
       </td>
159
       <td>
169
       <td>
160
         <input type="submit" name="submit" value="Edit" />
170
         <input type="submit" name="submit" value="Edit" />
162
       </td>
172
       </td>
163
     </form>
173
     </form>
164
   </tr>
174
   </tr>
165
-<?
175
+  <?php
166
 }
176
 }
167
 ?>
177
 ?>
168
 </table>
178
 </table>
169
 <div class="linkbox">
179
 <div class="linkbox">
170
-<?=$PageLinks?>
180
+  <?=$PageLinks?>
171
 </div>
181
 </div>
172
-<? View::show_footer(); ?>
182
+<?php View::show_footer();

+ 0
- 4
sections/upload/upload_handle.php View File

8
 // the data to the database and the torrent to the disk.                      //
8
 // the data to the database and the torrent to the disk.                      //
9
 //****************************************************************************//
9
 //****************************************************************************//
10
 
10
 
11
-// https://php.net/upload-max-filesize
12
-ini_set('upload_max_filesize', 2097152); // 2 MiB
13
-ini_set('max_file_uploads', 10000);
14
-
15
 include SERVER_ROOT.'/classes/validate.class.php';
11
 include SERVER_ROOT.'/classes/validate.class.php';
16
 include SERVER_ROOT.'/classes/feed.class.php';
12
 include SERVER_ROOT.'/classes/feed.class.php';
17
 include SERVER_ROOT.'/sections/torrents/functions.php';
13
 include SERVER_ROOT.'/sections/torrents/functions.php';

+ 3
- 1
sections/user/advancedsearch.php View File

1
 <?php
1
 <?php
2
 #declare(strict_types = 1);
2
 #declare(strict_types = 1);
3
 
3
 
4
+$ENV = ENV::go();
5
+
4
 if (!empty($_GET['search'])) {
6
 if (!empty($_GET['search'])) {
5
-    if (preg_match('/^'.IP_REGEX.'$/', $_GET['search'])) {
7
+    if (preg_match('/^'.$ENV->IP_REGEX.'$/', $_GET['search'])) {
6
         $_GET['ip'] = $_GET['search'];
8
         $_GET['ip'] = $_GET['search'];
7
     } elseif (preg_match('/^'.EMAIL_REGEX.'$/i', $_GET['search'])) {
9
     } elseif (preg_match('/^'.EMAIL_REGEX.'$/i', $_GET['search'])) {
8
         $_GET['email'] = $_GET['search'];
10
         $_GET['email'] = $_GET['search'];

+ 3
- 107
static/functions/upload.js View File

17
     'series', // Location
17
     'series', // Location
18
     'year', // Year
18
     'year', // Year
19
     'codec', // License
19
     'codec', // License
20
-    // Platform changes below
21
-    'resolution', // Scope
22
-    // Format changes below
20
+    // Platform *changes below*
21
+    'resolution', // Scope *changes below*
22
+    // Format *changes below*
23
     'archive', // Archive
23
     'archive', // Archive
24
     'tags', // Tags
24
     'tags', // Tags
25
     'cover', // Picture
25
     'cover', // Picture
118
 }
118
 }
119
 
119
 
120
 
120
 
121
-/**
122
- * Bitrate
123
- */
124
-function Bitrate() {
125
-  /*
126
-  $('#other_bitrate').raw().value = '';
127
-  if ($('#bitrate').raw().options[$('#bitrate').raw().selectedIndex].value == 'Other') {
128
-    $('#other_bitrate_span').gshow();
129
-  } else {
130
-    $('#other_bitrate_span').ghide();
131
-  }
132
-  */
133
-}
134
-
135
-
136
-/**
137
- * AltBitrate
138
- */
139
-function AltBitrate() {
140
-  /*
141
-  if ($('#other_bitrate').raw().value >= 320) {
142
-    $('#vbr').raw().disabled = true;
143
-    $('#vbr').raw().checked = false;
144
-  } else {
145
-    $('#vbr').raw().disabled = false;
146
-  }
147
-  */
148
-}
149
-
150
-
151
 /**
121
 /**
152
  * add_tag
122
  * add_tag
153
  */
123
  */
419
 }
389
 }
420
 
390
 
421
 
391
 
422
-/**
423
- * CheckVA
424
- */
425
-function CheckVA() {
426
-  /*
427
-  if ($('#artist').raw().value.toLowerCase().trim().match(/^(va|various(\sa|a)rtis(t|ts)|various)$/)) {
428
-    $('#vawarning').gshow();
429
-  } else {
430
-    $('#vawarning').ghide();
431
-  }
432
-  */
433
-}
434
-
435
-
436
-/**
437
- * CheckYear
438
- */
439
-function CheckYear() {
440
-  /*
441
-  var media = $('#media').raw().options[$('#media').raw().selectedIndex].text;
442
-  if (media == "---" || media == "Vinyl" || media == "Soundboard" || media == "Cassette") {
443
-    media = "old";
444
-  }
445
-  var year = $('#year').val();
446
-  var unknown = $('#unknown').prop('checked');
447
-  if (year < 1982 && year != '' && media != "old" && !unknown) {
448
-    $('#yearwarning').gshow();
449
-    $('#remaster').raw().checked = true;
450
-    $('#remaster_true').gshow();
451
-  } else if (unknown) {
452
-    $('#remaster').raw().checked = true;
453
-    $('#yearwarning').ghide();
454
-    $('#remaster_true').gshow();
455
-  } else {
456
-    $('#yearwarning').ghide();
457
-  }
458
-  */
459
-}
460
-
461
-
462
-/**
463
- * ToggleUnknown
464
- */
465
-function ToggleUnknown() {
466
-  /*
467
-  if ($('#unknown').raw().checked) {
468
-    $('#remaster_year').raw().value = "";
469
-    $('#remaster_title').raw().value = "";
470
-    $('#remaster_record_label').raw().value = "";
471
-    $('#remaster_catalogue_number').raw().value = "";
472
-
473
-    if ($('#groupremasters').raw()) {
474
-      $('#groupremasters').raw().selectedIndex = 0;
475
-      $('#groupremasters').raw().disabled = true;
476
-    }
477
-
478
-    $('#remaster_year').raw().disabled = true;
479
-    $('#remaster_title').raw().disabled = true;
480
-    $('#remaster_record_label').raw().disabled = true;
481
-    $('#remaster_catalogue_number').raw().disabled = true;
482
-  } else {
483
-    $('#remaster_year').raw().disabled = false;
484
-    $('#remaster_title').raw().disabled = false;
485
-    $('#remaster_record_label').raw().disabled = false;
486
-    $('#remaster_catalogue_number').raw().disabled = false;
487
-
488
-    if ($('#groupremasters').raw()) {
489
-      $('#groupremasters').raw().disabled = false;
490
-    }
491
-  }
492
-  */
493
-}
494
-
495
-
496
 /**
392
 /**
497
  * AnimeAutofill
393
  * AnimeAutofill
498
  */
394
  */

Loading…
Cancel
Save