Browse Source

This is a good place to stop

pjc 5 years ago
parent
commit
ca22a65cbc

+ 18
- 17
classes/artists.class.php View File

@@ -95,29 +95,30 @@ class Artists
95 95
         if (!empty($Artists)) {
96 96
             $ampersand = ($Escape) ? ' & ' : ' & ';
97 97
             $link = '';
98
-
98
+    
99 99
             switch (count($Artists)) {
100
-        case 0:
101
-          break;
102
-        case 3:
103
-          $link .= Artists::display_artist($Artists[2], $MakeLink, $Escape). ", ";
104
-        break;
105
-        case 2:
106
-          $link .= Artists::display_artist($Artists[1], $MakeLink, $Escape). ", ";
107
-        break;
108
-        case 1:
109
-          $link .= Artists::display_artist($Artists[0], $MakeLink, $Escape).($IncludeHyphen?' – ':'');
110
-          break;
111
-        default:
112
-        $link = Artists::display_artist($Artists[0], $MakeLink, $Escape).' et al.'.($IncludeHyphen?' – ':'');
113
-      }
114
-
100
+            case 0:
101
+              break;
102
+            case 3:
103
+              $link .= Artists::display_artist($Artists[2], $MakeLink, $Escape). ", ";
104
+              // no break
105
+            case 2:
106
+              $link .= Artists::display_artist($Artists[1], $MakeLink, $Escape). ", ";
107
+              // no break
108
+            case 1:
109
+              $link .= Artists::display_artist($Artists[0], $MakeLink, $Escape).($IncludeHyphen? ' – ':'');
110
+              break;
111
+            default:
112
+            $link = Artists::display_artist($Artists[0], $MakeLink, $Escape).'  et al.'.($IncludeHyphen? ' – ':'');
113
+            #$link = "Various".($IncludeHyphen?' – ':'');
114
+        }
115
+    
115 116
             return $link;
116 117
         } else {
117 118
             return '';
118 119
         }
119 120
     }
120
-
121
+    
121 122
     /**
122 123
      * Formats a single artist name.
123 124
      *

+ 77
- 60
classes/torrent_form.class.php View File

@@ -13,6 +13,7 @@ class TorrentForm
13 13
     public $MediaManga = [];
14 14
     public $Containers = [];
15 15
     public $ContainersGames = [];
16
+    public $ContainersProt = [];
16 17
     public $Codecs = [];
17 18
     public $Resolutions = [];
18 19
     #var $AudioFormats = [];
@@ -32,7 +33,7 @@ class TorrentForm
32 33
         $this->Torrent = $Torrent;
33 34
         $this->Error = $Error;
34 35
 
35
-        global $UploadForm, $Categories, $Media,  $MediaManga, $TorrentID, $Containers, $ContainersGames, $Codecs, $Resolutions, $Archives;
36
+        global $UploadForm, $Categories, $Media,  $MediaManga, $TorrentID, $Containers, $ContainersGames, $ContainersProt, $Codecs, $Resolutions, $Archives;
36 37
         #global $UploadForm, $Categories, $Formats, $Bitrates, $Media, $MediaManga, $TorrentID, $Containers, $ContainersGames, $Codecs, $Resolutions, $AudioFormats, $Subbing, $Languages, $Platform, $Archives, $ArchivesManga;
37 38
 
38 39
         $this->UploadForm = $UploadForm;
@@ -43,6 +44,7 @@ class TorrentForm
43 44
         $this->MediaManga = $MediaManga;
44 45
         $this->Containers = $Containers;
45 46
         $this->ContainersGames = $ContainersGames;
47
+        $this->ContainersProt = $ContainersProt;
46 48
         $this->Codecs = $Codecs;
47 49
         $this->Resolutions = $Resolutions;
48 50
         #$this->AudioFormats = $AudioFormats;
@@ -153,10 +155,7 @@ class TorrentForm
153 155
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
154 156
 
155 157
       <tr>
156
-        <td class="label">
157
-          Torrent File
158
-          <strong class="important_text">*</strong>
159
-        </td>
158
+        <td class="label">Torrent File</td>
160 159
         <td><input id="file" type="file" name="file_input" size="50" /><br />
161 160
           Use the above announce URL and set the private flag in your BitTorrent client, e.g.,
162 161
           <code>mktorrent -p -a &lt;announce&gt; &lt;target folder&gt;</code>
@@ -164,10 +163,7 @@ class TorrentForm
164 163
       </tr>
165 164
 
166 165
       <tr>
167
-        <td class="label">
168
-          Type
169
-          <strong class="important_text">*</strong>
170
-        </td>
166
+        <td class="label">Type</td>
171 167
         <td>
172 168
           <select id="categories" name="type" onchange="Categories()" <?= ($this->DisabledFlag) ? ' disabled="disabled"' : '' ?>>
173 169
             <?php
@@ -419,9 +415,32 @@ class TorrentForm
419 415
       Original publication year
420 416
     </td>
421 417
   </tr>
418
+  <?php } # Ends if NewTorrent line 256?>
419
+
420
+    <!-- Encoding -->
421
+    <tr id="codec_tr">
422
+    <td class="label">
423
+      License
424
+      <strong class="important_text">*</strong>
425
+    </td>
426
+    <td>
427
+      <select name="codec">
428
+        <option>---</option>
429
+        <?php
430
+          foreach ($this->Codecs as $Codec) {
431
+              echo "\t\t\t\t\t\t<option value=\"$Codec\"";
432
+              if ($Codec === ($Torrent['Codec'] ?? false)) {
433
+                  echo " selected";
434
+              }
435
+              echo ">$Codec</option>\n";
436
+          } ?>
437
+      </select><br />
438
+      Please see <a href="http://www.dcc.ac.uk/resources/how-guides/license-research-data" target="_blank">How to
439
+        License Research Data</a>
440
+    </td>
441
+  </tr>
422 442
 
423 443
   <!-- Media type -->
424
-  <?php } # Ends if NewTorrent line 256?>
425 444
   <tr id="media_tr">
426 445
     <td class="label">
427 446
       Platform
@@ -429,7 +448,6 @@ class TorrentForm
429 448
     </td>
430 449
     <td>
431 450
       <select name="media">
432
-        <option>---</option>
433 451
         <?php
434 452
           foreach ($this->Media as $Media) {
435 453
               echo "\t\t\t\t\t\t<option value=\"$Media\"";
@@ -465,6 +483,42 @@ class TorrentForm
465 483
     </td>
466 484
   </tr>
467 485
 
486
+    <!-- Resolution -->
487
+    <tr id="resolution_tr">
488
+    <td class="label">
489
+      Assembly Level
490
+      <strong class="important_text">*</strong>
491
+    </td>
492
+    <td>
493
+      <select id="ressel" name="ressel" onchange="SetResolution()">
494
+        <option value="">---</option>
495
+        <?php
496
+          foreach ($this->Resolutions as $Res) {
497
+              echo "\t\t\t\t\t\t<option value=\"$Res\"";
498
+              if ($Res === ($Torrent['Resolution'] ?? false)
499
+              || (!isset($FoundRes) && ($Torrent['Resolution'] ?? false)
500
+              && $Res === 'Other')) {
501
+                  echo " selected";
502
+                  $FoundRes = true;
503
+              }
504
+              echo ">$Res</option>\n";
505
+          } ?>
506
+      </select>
507
+
508
+      <input type="text" id="resolution" name="resolution" size="10" class="hidden"
509
+        value="<?= ($Torrent['Resolution']??'') ?>"
510
+        readonly>
511
+      </input>
512
+      <script>
513
+        if ($('#ressel').raw().value == "Other") {
514
+          $('#resolution').raw().readOnly = false
515
+          $('#resolution').gshow()
516
+        }
517
+      </script><br />
518
+      How complete the data is
519
+    </td>
520
+  </tr>
521
+
468 522
   <!-- Container -->
469 523
   <tr id="container_tr">
470 524
     <td class="label">
@@ -487,7 +541,7 @@ class TorrentForm
487 541
     </td>
488 542
   </tr>
489 543
 
490
-  <!-- Alternate container -->
544
+  <!-- Alternate container 1 -->
491 545
   <tr id="container_games_tr">
492 546
     <td class="label">
493 547
       Format
@@ -509,39 +563,25 @@ class TorrentForm
509 563
     </td>
510 564
   </tr>
511 565
 
512
-  <!-- Resolution -->
513
-  <tr id="resolution_tr">
566
+    <!-- Alternate container 2 -->
567
+    <tr id="container_prot_tr">
514 568
     <td class="label">
515
-      Assembly Level
569
+      Format
516 570
       <strong class="important_text">*</strong>
517 571
     </td>
518 572
     <td>
519
-      <select id="ressel" name="ressel" onchange="SetResolution()">
520
-        <option value="">---</option>
573
+      <select id="container" name="container">
574
+        <option value="Autofill">Autofill</option>
521 575
         <?php
522
-          foreach ($this->Resolutions as $Res) {
523
-              echo "\t\t\t\t\t\t<option value=\"$Res\"";
524
-              if ($Res === ($Torrent['Resolution'] ?? false)
525
-              || (!isset($FoundRes) && ($Torrent['Resolution'] ?? false)
526
-              && $Res === 'Other')) {
576
+          foreach ($this->ContainersProt as $Container) {
577
+              echo "\t\t\t\t\t\t<option value=\"$Container\"";
578
+              if ($Container === ($Torrent['Container'] ?? false)) {
527 579
                   echo " selected";
528
-                  $FoundRes = true;
529 580
               }
530
-              echo ">$Res</option>\n";
581
+              echo ">$Container</option>\n";
531 582
           } ?>
532
-      </select>
533
-
534
-      <input type="text" id="resolution" name="resolution" size="10" class="hidden"
535
-        value="<?= ($Torrent['Resolution']??'') ?>"
536
-        readonly>
537
-      </input>
538
-      <script>
539
-        if ($('#ressel').raw().value == "Other") {
540
-          $('#resolution').raw().readOnly = false
541
-          $('#resolution').gshow()
542
-        }
543
-      </script><br />
544
-      How complete the data is
583
+      </select><br />
584
+      Data file format, or detect from file list
545 585
     </td>
546 586
   </tr>
547 587
 
@@ -567,29 +607,6 @@ class TorrentForm
567 607
     </td>
568 608
   </tr>
569 609
 
570
-  <!-- Encoding -->
571
-  <tr id="codec_tr">
572
-    <td class="label">
573
-      License
574
-      <strong class="important_text">*</strong>
575
-    </td>
576
-    <td>
577
-      <select name="codec">
578
-        <option>---</option>
579
-        <?php
580
-          foreach ($this->Codecs as $Codec) {
581
-              echo "\t\t\t\t\t\t<option value=\"$Codec\"";
582
-              if ($Codec === ($Torrent['Codec'] ?? false)) {
583
-                  echo " selected";
584
-              }
585
-              echo ">$Codec</option>\n";
586
-          } ?>
587
-      </select><br />
588
-      Please see <a href="http://www.dcc.ac.uk/resources/how-guides/license-research-data" target="_blank">How to
589
-        License Research Data</a>
590
-    </td>
591
-  </tr>
592
-
593 610
   <!-- Tags -->
594 611
   <?php if ($this->NewTorrent) { ?>
595 612
   <tr id="tags_tr">

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

@@ -44,6 +44,7 @@ class Validate
44 44
         foreach ($this->Fields as $FieldKey => $Field) {
45 45
             $ValidateVar = $ValidateArray[$FieldKey];
46 46
 
47
+            # @todo Change this to a switch statement
47 48
             if ($ValidateVar !== '' || !empty($Field['Required']) || $Field['Type'] === 'date') {
48 49
                 if ($Field['Type'] === 'string') {
49 50
                     if (isset($Field['MaxLength'])) {

+ 49
- 38
gazelle.sql View File

@@ -1,3 +1,14 @@
1
+-- Please see the limits for kinds of fields below.
2
+--
3
+--   * Gazelle ID numbers: int(10)
4
+--   * Accession numbers:  varchar(50)
5
+--   * Gazelle titles:     varchar(50)
6
+--   * Torrent titles:     varchar(255)
7
+--   * Ocelot tokens:      char(32)
8
+--   * Tag lists:          varchar(500)
9
+--
10
+-- @todo Finish explaining the schema
11
+
1 12
 SET FOREIGN_KEY_CHECKS = 0;
2 13
 
3 14
 CREATE DATABASE gazelle_production CHARACTER SET utf8mb4;
@@ -7,7 +18,7 @@ USE gazelle_production;
7 18
 CREATE TABLE `api_applications` (
8 19
   `ID` int(10) NOT NULL AUTO_INCREMENT,
9 20
   `UserID` int(10) NOT NULL,
10
-  `Token` char(32) NOT NULL,
21
+  `Token` char(32) NOT NULL, -- Ocelot 32-character limit
11 22
   `Name` varchar(50) NOT NULL,
12 23
   PRIMARY KEY (`ID`)
13 24
 ) ENGINE=InnoDB CHARSET=utf8mb4;
@@ -15,7 +26,7 @@ CREATE TABLE `api_applications` (
15 26
 CREATE TABLE `api_users` (
16 27
   `UserID` int(10) NOT NULL,
17 28
   `AppID` int(10) NOT NULL,
18
-  `Token` char(32) NOT NULL,
29
+  `Token` char(32) NOT NULL, -- Ocelot 32-character limit
19 30
   `State` enum('0','1','2') NOT NULL DEFAULT '0',
20 31
   `Time` datetime,
21 32
   `Access` text,
@@ -677,7 +688,7 @@ CREATE TABLE `reportsv2` (
677 688
   `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
678 689
   `ReporterID` int(10) unsigned NOT NULL DEFAULT '0',
679 690
   `TorrentID` int(10) unsigned NOT NULL DEFAULT '0',
680
-  `Type` varchar(20) DEFAULT '',
691
+  `Type` varchar(25) DEFAULT '',
681 692
   `UserComment` text,
682 693
   `ResolverID` int(10) unsigned NOT NULL DEFAULT '0',
683 694
   `Status` enum('New','InProgress','Resolved') DEFAULT 'New',
@@ -822,9 +833,9 @@ CREATE TABLE `sphinx_delta` (
822 833
   `Resolution` varchar(255) DEFAULT NULL,
823 834
   `AudioFormat` varchar(255) DEFAULT NULL,
824 835
   `Subbing` varchar(255) DEFAULT NULL,
825
-  `Studio` varchar(80) DEFAULT NULL,
826
-  `Series` varchar(80) DEFAULT NULL,
827
-  `DLsiteID` varchar(20) DEFAULT NULL,
836
+  `Studio` varchar(100) DEFAULT NULL,
837
+  `Series` varchar(100) DEFAULT NULL,
838
+  `DLsiteID` varchar(25) DEFAULT NULL,
828 839
   `Language` varchar(255) DEFAULT NULL,
829 840
   `Censored` tinyint(1) NOT NULL DEFAULT '1',
830 841
   `FileList` mediumtext,
@@ -834,7 +845,7 @@ CREATE TABLE `sphinx_delta` (
834 845
   PRIMARY KEY (`ID`),
835 846
   KEY `GroupID` (`GroupID`),
836 847
   KEY `Size` (`Size`)
837
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
848
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
838 849
 
839 850
 CREATE TABLE `sphinx_index_last_pos` (
840 851
   `Type` varchar(16) NOT NULL DEFAULT '',
@@ -911,13 +922,13 @@ CREATE TABLE `sphinx_t` (
911 922
   `leechers` int(11) NOT NULL,
912 923
   `time` int(11) NOT NULL,
913 924
   `freetorrent` tinyint(4) NOT NULL,
914
-  `media` varchar(15) NOT NULL,
915
-  `container` varchar(15) NOT NULL,
916
-  `resolution` varchar(15) NOT NULL,
917
-  `codec` varchar(15) NOT NULL,
918
-  `audioformat` varchar(15) NOT NULL,
919
-  `subbing` varchar(15) NOT NULL,
920
-  `language` varchar(15) NOT NULL,
925
+  `media` varchar(25) NOT NULL,
926
+  `container` varchar(25) NOT NULL,
927
+  `resolution` varchar(25) NOT NULL,
928
+  `codec` varchar(25) NOT NULL,
929
+  `audioformat` varchar(25) NOT NULL,
930
+  `subbing` varchar(25) NOT NULL,
931
+  `language` varchar(25) NOT NULL,
921 932
   `filelist` mediumtext,
922 933
   `description` text,
923 934
   `subber` varchar(30) NOT NULL,
@@ -928,14 +939,14 @@ CREATE TABLE `sphinx_t` (
928 939
 
929 940
 CREATE TABLE `sphinx_tg` (
930 941
   `id` int(11) NOT NULL,
931
-  `name` varchar(300) DEFAULT NULL,
932
-  `namerj` varchar(300) DEFAULT NULL,
933
-  `namejp` varchar(500) DEFAULT NULL,
942
+  `name` varchar(255) DEFAULT NULL,
943
+  `namerj` varchar(255) DEFAULT NULL,
944
+  `namejp` varchar(255) DEFAULT NULL,
934 945
   `tags` varchar(500) DEFAULT NULL,
935 946
   `year` smallint(6) DEFAULT NULL,
936
-  `cnumber` varchar(80) DEFAULT NULL,
937
-  `studio` varchar(300) DEFAULT NULL,
938
-  `series` varchar(300) DEFAULT NULL,
947
+  `cnumber` varchar(50) DEFAULT NULL,
948
+  `studio` varchar(255) DEFAULT NULL,
949
+  `series` varchar(255) DEFAULT NULL,
939 950
   `catid` smallint(6) DEFAULT NULL,
940 951
   `dlsid` varchar(15) NOT NULL,
941 952
   PRIMARY KEY (`id`)
@@ -1069,13 +1080,13 @@ CREATE TABLE `torrents` (
1069 1080
   `ID` int(10) NOT NULL AUTO_INCREMENT,
1070 1081
   `GroupID` int(10) NOT NULL DEFAULT '0',
1071 1082
   `UserID` int(10) DEFAULT NULL,
1072
-  `Media` varchar(20) DEFAULT NULL,
1073
-  `Container` varchar(20) DEFAULT NULL,
1074
-  `Codec` varchar(20) DEFAULT NULL,
1075
-  `Resolution` varchar(20) DEFAULT NULL,
1083
+  `Media` varchar(25) DEFAULT NULL,
1084
+  `Container` varchar(25) DEFAULT NULL,
1085
+  `Codec` varchar(25) DEFAULT NULL,
1086
+  `Resolution` varchar(25) DEFAULT NULL,
1076 1087
   `AudioFormat` varchar(10) DEFAULT NULL,
1077 1088
   `Subbing` varchar(10) DEFAULT NULL,
1078
-  `Language` varchar(20) DEFAULT NULL,
1089
+  `Language` varchar(25) DEFAULT NULL,
1079 1090
   `Censored` tinyint(1) NOT NULL DEFAULT '1',
1080 1091
   `Anonymous` tinyint(1) NOT NULL DEFAULT '0',
1081 1092
   `info_hash` blob NOT NULL,
@@ -1094,7 +1105,7 @@ CREATE TABLE `torrents` (
1094 1105
   `Snatched` int(10) unsigned NOT NULL DEFAULT '0',
1095 1106
   `balance` bigint(20) NOT NULL DEFAULT '0',
1096 1107
   `LastReseedRequest` datetime,
1097
-  `Subber` varchar(300) NOT NULL DEFAULT '',
1108
+  `Subber` varchar(255) NOT NULL DEFAULT '',
1098 1109
   `Archive` varchar(10) NOT NULL DEFAULT '',
1099 1110
   PRIMARY KEY (`ID`),
1100 1111
   UNIQUE KEY `InfoHash` (`info_hash`(40)),
@@ -1153,16 +1164,16 @@ CREATE TABLE `torrents_group` (
1153 1164
   `NameRJ` varchar(255) DEFAULT NULL,
1154 1165
   `NameJP` varchar(255) DEFAULT NULL,
1155 1166
   `Year` int(4) DEFAULT NULL,
1156
-  `Studio` varchar(80) NOT NULL DEFAULT '',
1157
-  `Series` varchar(80) NOT NULL DEFAULT '',
1158
-  `CatalogueNumber` varchar(80) NOT NULL DEFAULT '',
1167
+  `Studio` varchar(100) NOT NULL DEFAULT '',
1168
+  `Series` varchar(100) NOT NULL DEFAULT '',
1169
+  `CatalogueNumber` varchar(50) NOT NULL DEFAULT '',
1159 1170
   `Pages` smallint(5) unsigned DEFAULT NULL,
1160 1171
   `TagList` varchar(500) NOT NULL DEFAULT '',
1161 1172
   `Time` datetime,
1162 1173
   `RevisionID` int(12) DEFAULT NULL,
1163 1174
   `WikiBody` text,
1164 1175
   `WikiImage` varchar(255) NOT NULL,
1165
-  `DLsiteID` varchar(20) NOT NULL DEFAULT '',
1176
+  `DLsiteID` varchar(25) NOT NULL DEFAULT '',
1166 1177
   PRIMARY KEY (`ID`),
1167 1178
   KEY `CategoryID` (`CategoryID`),
1168 1179
   KEY `Name` (`Name`(255)),
@@ -1195,7 +1206,7 @@ CREATE TABLE `torrents_peerlists` (
1195 1206
   PRIMARY KEY (`TorrentID`),
1196 1207
   KEY `GroupID` (`GroupID`),
1197 1208
   KEY `Stats` (`TorrentID`,`Seeders`,`Leechers`,`Snatches`)
1198
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
1209
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
1199 1210
 
1200 1211
 CREATE TABLE `torrents_peerlists_compare` (
1201 1212
   `TorrentID` int(11) NOT NULL,
@@ -1206,7 +1217,7 @@ CREATE TABLE `torrents_peerlists_compare` (
1206 1217
   PRIMARY KEY (`TorrentID`),
1207 1218
   KEY `GroupID` (`GroupID`),
1208 1219
   KEY `Stats` (`TorrentID`,`Seeders`,`Leechers`,`Snatches`)
1209
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
1220
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
1210 1221
 
1211 1222
 CREATE TABLE `torrents_recommended` (
1212 1223
   `GroupID` int(10) NOT NULL,
@@ -1460,7 +1471,7 @@ CREATE TABLE `users_levels` (
1460 1471
 
1461 1472
 CREATE TABLE `users_main` (
1462 1473
   `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
1463
-  `Username` varchar(20) NOT NULL,
1474
+  `Username` varchar(25) NOT NULL,
1464 1475
   `Email` varchar(255) NOT NULL,
1465 1476
   `PassHash` varchar(60) NOT NULL,
1466 1477
   `TwoFactor` varchar(255) DEFAULT NULL,
@@ -1720,8 +1731,8 @@ CREATE TABLE `wiki_torrents` (
1720 1731
 
1721 1732
 CREATE TABLE `xbt_client_whitelist` (
1722 1733
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
1723
-  `peer_id` varchar(20) DEFAULT NULL,
1724
-  `vstring` varchar(200) DEFAULT '',
1734
+  `peer_id` varchar(25) DEFAULT NULL,
1735
+  `vstring` varchar(255) DEFAULT '',
1725 1736
   PRIMARY KEY (`id`),
1726 1737
   UNIQUE KEY `peer_id` (`peer_id`)
1727 1738
 ) ENGINE=InnoDB CHARSET=utf8mb4;
@@ -1743,7 +1754,7 @@ CREATE TABLE `xbt_files_users` (
1743 1754
   `peer_id` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
1744 1755
   `fid` int(11) NOT NULL,
1745 1756
   `mtime` int(11) NOT NULL,
1746
-  `ip` varchar(15) NOT NULL DEFAULT '',
1757
+  `ip` varchar(15) NOT NULL DEFAULT '', -- Max IPv4 address length
1747 1758
   `seeder` tinyint(1) NOT NULL DEFAULT '0',
1748 1759
   PRIMARY KEY (`peer_id`,`fid`,`uid`),
1749 1760
   KEY `remaining_idx` (`remaining`),
@@ -1756,7 +1767,7 @@ CREATE TABLE `xbt_snatched` (
1756 1767
   `uid` int(11) NOT NULL DEFAULT '0',
1757 1768
   `tstamp` int(11) NOT NULL,
1758 1769
   `fid` int(11) NOT NULL,
1759
-  `IP` varchar(15) NOT NULL,
1770
+  `IP` varchar(15) NOT NULL, -- Max IPv4 address length
1760 1771
   `seedtime` int(11) NOT NULL DEFAULT '0',
1761 1772
   KEY `fid` (`fid`),
1762 1773
   KEY `tstamp` (`tstamp`),
@@ -1777,7 +1788,7 @@ INSERT INTO wiki_revisions (ID, Revision, Title, Body, Date, Author) VALUES (1,
1777 1788
 
1778 1789
 INSERT INTO forums (ID, CategoryID, Sort, Name, Description, MinClassRead, MinClassWrite, MinClassCreate, NumTopics, NumPosts, LastPostID, LastPostAuthorID, LastPostTopicID, LastPostTime) VALUES (1, 1, 20, 'Your Site', 'Totally rad forum', 100, 100, 100, 0, 0, 0, 0, 0, NULL), (2, 5, 30, 'Chat', 'Expect this to fill up with spam', 100, 100, 100, 0, 0, 0, 0, 0, NULL), (3, 10, 40, 'Help!', 'I fell down and I cant get up', 100, 100, 100, 0, 0, 0, 0, 0, NULL), (4, 20, 100, 'Trash', 'Every thread ends up here eventually', 100, 500, 500, 0, 0, 0, 0, 0, NULL);
1779 1790
 
1780
-INSERT INTO tags (ID, Name, TagType, Uses, UserID) VALUES (1, 'foo', 'genre', 0, 1),(2, 'bar', 'genre', 0, 1),(3, 'baz', 'genre', 0, 1);
1791
+INSERT INTO tags (ID, Name, TagType, Uses, UserID) VALUES (1, 'one', 'genre', 0, 1),(2, 'two', 'genre', 0, 1),(3, 'three', 'genre', 0, 1),(3, 'four', 'genre', 0, 1),(3, 'five', 'genre', 0, 1);
1781 1792
 
1782 1793
 INSERT INTO schedule (NextHour, NextDay, NextBiWeekly) VALUES (0,0,0);
1783 1794
 

+ 39
- 39
sections/collages/new_handle.php View File

@@ -1,84 +1,85 @@
1 1
 <?php
2
-authorize();
3 2
 
3
+authorize();
4 4
 include(SERVER_ROOT.'/classes/validate.class.php');
5
+
5 6
 $Val = new Validate;
6 7
 
7 8
 $P = [];
8 9
 $P = db_array($_POST);
9 10
 
10 11
 if ($P['category'] > 0 || check_perms('site_collages_renamepersonal')) {
11
-  $Val->SetFields('name', '1', 'string', 'The name must be between 3 and 100 characters', array('maxlength' => 100, 'minlength' => 3));
12
+    $Val->SetFields('name', '1', 'string', 'The name must be between 5 and 255 characters.', array('maxlength' => 255, 'minlength' => 5));
12 13
 } else {
13
-  // Get a collage name and make sure it's unique
14
-  $name = $LoggedUser['Username']."'s personal collage";
15
-  $P['name'] = db_string($name);
16
-  $DB->query("
14
+    // Get a collage name and make sure it's unique
15
+    $name = $LoggedUser['Username']."'s personal collage";
16
+    $P['name'] = db_string($name);
17
+    $DB->query("
17 18
     SELECT ID
18 19
     FROM collages
19 20
     WHERE Name = '".$P['name']."'");
20
-  $i = 2;
21
-  while ($DB->has_results()) {
22
-    $P['name'] = db_string("$name no. $i");
23
-    $DB->query("
21
+    $i = 2;
22
+    while ($DB->has_results()) {
23
+        $P['name'] = db_string("$name no. $i");
24
+        $DB->query("
24 25
       SELECT ID
25 26
       FROM collages
26 27
       WHERE Name = '".$P['name']."'");
27
-    $i++;
28
-  }
28
+        $i++;
29
+    }
29 30
 }
30
-$Val->SetFields('description', '1', 'string', 'The description must be between 10 and 65535 characters', array('maxlength' => 65535, 'minlength' => 10));
31
+$Val->SetFields('description', '1', 'string', 'The description must be between 10 and 65535 characters.', array('maxlength' => 65535, 'minlength' => 10));
31 32
 
32 33
 $Err = $Val->ValidateForm($_POST);
33 34
 
34 35
 if (!$Err && $P['category'] === '0') {
35
-  $DB->query("
36
+    $DB->query("
36 37
     SELECT COUNT(ID)
37 38
     FROM collages
38 39
     WHERE UserID = '$LoggedUser[ID]'
39 40
       AND CategoryID = '0'
40 41
       AND Deleted = '0'");
41
-  list($CollageCount) = $DB->next_record();
42
-  if (($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) || !check_perms('site_collages_personal')) {
43
-    $Err = 'You may not create a personal collage.';
44
-  } elseif (check_perms('site_collages_renamepersonal') && !stristr($P['name'], $LoggedUser['Username'])) {
45
-    $Err = 'Your personal collage\'s title must include your username.';
46
-  }
42
+    list($CollageCount) = $DB->next_record();
43
+    if (($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) || !check_perms('site_collages_personal')) {
44
+        $Err = 'You may not create a personal collage.';
45
+    } elseif (check_perms('site_collages_renamepersonal') && !stristr($P['name'], $LoggedUser['Username'])) {
46
+        $Err = "Your personal collage's title must include your username.";
47
+    }
47 48
 }
48 49
 
49 50
 if (!$Err) {
50
-  $DB->query("
51
+    $DB->query("
51 52
     SELECT ID, Deleted
52 53
     FROM collages
53 54
     WHERE Name = '$P[name]'");
54
-  if ($DB->has_results()) {
55
-    list($ID, $Deleted) = $DB->next_record();
56
-    if ($Deleted) {
57
-      $Err = 'That collection already exists but needs to be recovered; please <a href="staffpm.php">contact</a> the staff team!';
58
-    } else {
59
-      $Err = "That collection already exists: <a href=\"/collages.php?id=$ID\">$ID</a>.";
55
+    if ($DB->has_results()) {
56
+        list($ID, $Deleted) = $DB->next_record();
57
+        if ($Deleted) {
58
+            $Err = 'That collection already exists but needs to be recovered. Please <a href="staffpm.php">contact</a> the staff team.';
59
+        } else {
60
+            $Err = "That collection already exists: <a href='/collages.php?id=$ID'>$ID</a>.";
61
+        }
60 62
     }
61
-  }
62 63
 }
63 64
 
64 65
 if (!$Err) {
65
-  if (empty($CollageCats[$P['category']])) {
66
-    $Err = 'Please select a category';
67
-  }
66
+    if (empty($CollageCats[$P['category']])) {
67
+        $Err = 'Please select a category';
68
+    }
68 69
 }
69 70
 
70 71
 if ($Err) {
71
-  $Name = $_POST['name'];
72
-  $Category = $_POST['category'];
73
-  $Tags = $_POST['tags'];
74
-  $Description = $_POST['description'];
75
-  include(SERVER_ROOT.'/sections/collages/new.php');
76
-  die();
72
+    $Name = $_POST['name'];
73
+    $Category = $_POST['category'];
74
+    $Tags = $_POST['tags'];
75
+    $Description = $_POST['description'];
76
+    include(SERVER_ROOT.'/sections/collages/new.php');
77
+    die();
77 78
 }
78 79
 
79 80
 $TagList = explode(',', $_POST['tags']);
80 81
 foreach ($TagList as $ID => $Tag) {
81
-  $TagList[$ID] = Misc::sanitize_tag($Tag);
82
+    $TagList[$ID] = Misc::sanitize_tag($Tag);
82 83
 }
83 84
 $TagList = implode(' ', $TagList);
84 85
 
@@ -92,4 +93,3 @@ $CollageID = $DB->inserted_id();
92 93
 $Cache->delete_value("collage_$CollageID");
93 94
 Misc::write_log("Collage $CollageID (".$_POST['name'].') was created by '.$LoggedUser['Username']);
94 95
 header("Location: collages.php?id=$CollageID");
95
-?>

+ 47
- 38
sections/requests/new_edit.php View File

@@ -100,7 +100,8 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
100 100
 <!-- HTML title -->
101 101
 <div class="thin">
102 102
   <div class="header">
103
-    <h2><?= ($NewRequest ? 'Create Request' : 'Edit Request') ?></h2>
103
+    <h2><?= ($NewRequest ? 'Create Request' : 'Edit Request') ?>
104
+    </h2>
104 105
   </div>
105 106
 
106 107
   <!-- New request hidden fields -->
@@ -120,7 +121,8 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
120 121
       <!-- Main table -->
121 122
       <table class="layout">
122 123
         <tr>
123
-          <td colspan="2" class="center">Please make sure your request follows <a href="rules.php?p=requests">the request rules</a>!</td>
124
+          <td colspan="2" class="center">Please make sure your request follows <a href="rules.php?p=requests">the
125
+              request rules</a>!</td>
124 126
         </tr>
125 127
         <?php  if ($NewRequest || $CanEdit) { ?>
126 128
 
@@ -183,7 +185,7 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
183 185
               <?= $Disabled ?>/>
184 186
           </td>
185 187
         </tr>
186
-        <?php  } # Ends if NewRequest line 123 ?>
188
+        <?php  } # Ends if NewRequest line 123?>
187 189
 
188 190
         <!-- Multiple artists -->
189 191
         <tr id="artist_tr">
@@ -191,33 +193,31 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
191 193
           <td id="artistfields">
192 194
             <?php
193 195
               if (!empty($ArtistForm)) {
194
-                $First = true;
195
-                foreach ($ArtistForm as $Artist) {
196
-                  # Cycle autocomplete
197
-            ?>
196
+                  $First = true;
197
+                  foreach ($ArtistForm as $Artist) {
198
+                      # Cycle autocomplete?>
198 199
             <input type="text" id="artist_0" name="artists[]" <?php Users::has_autocomplete_enabled('other'); ?>
199 200
             size="45" value="<?= display_str($Artist['name']) ?>" <?= $Disabled ?>/>
200 201
             <?php
201 202
               if (empty($Disabled)) {
202
-                if ($First) { ?>
203
+                  if ($First) { ?>
203 204
             <a class="add_artist_button brackets">+</a>
204 205
             <a class="remove_artist_button brackets">&minus;</a>
205 206
             <?php
206 207
                 }
207
-                $First = false;
208
-              }
209
-            ?>
208
+                  $First = false;
209
+              } ?>
210 210
             <br />
211 211
             <?php
212
-                }
212
+                  }
213 213
               } else {
214
-            ?>
214
+                  ?>
215 215
             <input type="text" id="artist_0" name="artists[]" <?php Users::has_autocomplete_enabled('other'); ?>
216 216
             size="45" <?= $Disabled ?>/>
217 217
             <?php if (empty($Disabled)) { ?>
218 218
             <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
219 219
             <?php
220
-                } 
220
+                }
221 221
               }
222 222
             ?>
223 223
           </td>
@@ -242,30 +242,31 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
242 242
             <?php
243 243
               $GenreTags = $Cache->get_value('genre_tags');
244 244
                 if (!$GenreTags) {
245
-                  $DB->query('
245
+                    $DB->query('
246 246
                     SELECT Name
247 247
                     FROM tags
248 248
                     WHERE TagType = \'genre\'
249 249
                     ORDER BY Name');
250
-                  $GenreTags = $DB->collect('Name');
251
-                  $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
250
+                    $GenreTags = $DB->collect('Name');
251
+                    $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
252 252
                 }
253 253
 
254 254
                 if (!empty($Disabled)) {
255
-            ?>
255
+                    ?>
256 256
             <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" disabled="disabled">
257
-            <?php } else { ?>
258
-            <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;">
259
-              <?php } ?>
260
-              <option>---</option>
261
-              <?php foreach (Misc::display_array($GenreTags) as $Genre) { ?>
262
-              <option value="<?= $Genre ?>"><?= $Genre ?>
263
-              </option>
264
-              <?php  } ?>
265
-            </select>
266
-            <input type="text" id="tags" name="tags" size="45"
267
-              value="<?= (!empty($Tags) ? display_str($Tags) : '') ?>"
268
-              <?php Users::has_autocomplete_enabled('other'); ?>
257
+              <?php
258
+                } else { ?>
259
+              <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;">
260
+                <?php } ?>
261
+                <option>---</option>
262
+                <?php foreach (Misc::display_array($GenreTags) as $Genre) { ?>
263
+                <option value="<?= $Genre ?>"><?= $Genre ?>
264
+                </option>
265
+                <?php  } ?>
266
+              </select>
267
+              <input type="text" id="tags" name="tags" size="45"
268
+                value="<?= (!empty($Tags) ? display_str($Tags) : '') ?>"
269
+                <?php Users::has_autocomplete_enabled('other'); ?>
269 270
               <?= $Disabled ?>/>
270 271
           </td>
271 272
         </tr>
@@ -283,7 +284,8 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
283 284
         <tr>
284 285
           <td class="label">Torrent Group</td>
285 286
           <td>
286
-            If this request matches a torrent group <strong>already existing</strong> on the site, please indicate that here.<br />
287
+            If this request matches a torrent group <strong>already existing</strong> on the site, please indicate that
288
+            here.<br />
287 289
             <?= site_url() ?>torrents.php?id=<input type="text"
288 290
               name="groupid"
289 291
               value="<?= isset($GroupID)?$GroupID:'' ?>"
@@ -295,17 +297,20 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
295 297
             #&& ($CategoryID !== 5) # ?
296 298
             #&& ($CategoryID !== 0) # ?
297 299
             ) {
298
-        ?>
300
+              ?>
299 301
 
300 302
         <!-- Torrent group admin -->
301 303
         <tr>
302 304
           <td class="label">Torrent Group</td>
303 305
           <td>
304 306
             <a href="torrents.php?id=<?= $GroupID ?>"><?= site_url() ?>torrents.php?id=<?= $GroupID ?></a><br />
305
-            This request <?= ($NewRequest ? 'will be' : 'is') ?> associated with the above torrent group.
307
+            This request <?= ($NewRequest ? 'will be' : 'is') ?>
308
+            associated with the above torrent group.
306 309
             <?php if (!$NewRequest) { ?>
307 310
             If this is incorrect, please
308
-            <a href="reports.php?action=report&amp;type=request&amp;id=<?= $RequestID ?>">report this request</a>
311
+            <a
312
+              href="reports.php?action=report&amp;type=request&amp;id=<?= $RequestID ?>">report
313
+              this request</a>
309 314
             so that staff can fix it.
310 315
             <?php } ?>
311 316
             <input type="hidden" name="groupid"
@@ -314,7 +319,8 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
314 319
         </tr>
315 320
 
316 321
         <!-- Bounty -->
317
-        <?php  } if ($NewRequest) { ?>
322
+        <?php
323
+          } if ($NewRequest) { ?>
318 324
         <tr id="voting">
319 325
           <td class="label">Bounty</td>
320 326
           <td>
@@ -328,7 +334,8 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
328 334
               </option>
329 335
             </select>
330 336
             <input type="button" value="Preview" onclick="Calculate();" />
331
-            <strong>The system deducts <?= ($RequestTax * 100) ?>% as tax</strong>
337
+            <strong>The system deducts <?= ($RequestTax * 100) ?>% as
338
+              tax</strong>
332 339
           </td>
333 340
         </tr>
334 341
 
@@ -345,8 +352,10 @@ View::show_header(($NewRequest ? 'Create Request' : 'Edit Request'), 'bbcode,req
345 352
             <ul>
346 353
               <!-- @todo Return this feature
347 354
               <li><strong>Bounty:</strong> <span id="bounty_after_tax">90.00 MB</span></li> -->
348
-              <li><strong>Uploaded:</strong> <span id="new_uploaded"><?= Format::get_size($LoggedUser['BytesUploaded']) ?></span></li>
349
-              <li><strong>Ratio:</strong> <span id="new_ratio"><?= Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded']) ?></span></li>
355
+              <li><strong>Uploaded:</strong> <span id="new_uploaded"><?= Format::get_size($LoggedUser['BytesUploaded']) ?></span>
356
+              </li>
357
+              <li><strong>Ratio:</strong> <span id="new_ratio"><?= Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded']) ?></span>
358
+              </li>
350 359
             </ul>
351 360
           </td>
352 361
         </tr>

+ 19
- 12
sections/torrents/details.php View File

@@ -33,7 +33,7 @@ if (!$GroupName) {
33 33
     }
34 34
 }
35 35
 
36
-$DisplayName = "<span dir=\"ltr\">$GroupName</span><br />";
36
+$DisplayName = "<span dir='ltr'>$GroupName</span><br />";
37 37
 $AltName = $GroupName; // Goes in the alt text of the image
38 38
 $Title = $GroupName; // Goes in <title>
39 39
 $WikiBody = Text::full_format($WikiBody);
@@ -41,11 +41,11 @@ $WikiBody = Text::full_format($WikiBody);
41 41
 $Artists = Artists::get_artist($GroupID);
42 42
 
43 43
 if ($GroupNameRJ && $GroupNameRJ != $GroupName) {
44
-    $DisplayName .= "<span dir=\"ltr\">$GroupNameRJ</span><br />";
44
+    $DisplayName .= "<span dir='ltr'>$GroupNameRJ</span><br />";
45 45
 }
46 46
 
47 47
 if ($GroupNameJP && $GroupNameJP != $GroupName) {
48
-    $DisplayName .= "<span dir=\"ltr\">$GroupNameJP</span><br />";
48
+    $DisplayName .= "<span dir='ltr'>$GroupNameJP</span><br />";
49 49
 }
50 50
 
51 51
 if ($Artists) {
@@ -446,7 +446,7 @@ foreach ($TorrentList as $Torrent) {
446 446
                 $ReporterID = $Report['ReporterID'];
447 447
                 $Reporter = Users::user_info($ReporterID);
448 448
                 $ReporterName = $Reporter['Username'];
449
-                $ReportLinks = "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$Report[ID]\">reported it</a>";
449
+                $ReportLinks = "<a href='user.php?id=$ReporterID'>$ReporterName</a> <a href='reportsv2.php?view=report&amp;id=$Report[ID]'>reported it</a>";
450 450
             } else {
451 451
                 $ReportLinks = 'Someone reported it';
452 452
             }
@@ -456,7 +456,7 @@ foreach ($TorrentList as $Torrent) {
456 456
             } elseif (isset($Types['master'][$Report['Type']])) {
457 457
                 $ReportType = $Types['master'][$Report['Type']];
458 458
             } else {
459
-                //There was a type but it wasn't an option!
459
+                // There was a type but it wasn't an option!
460 460
                 $ReportType = $Types['master']['other'];
461 461
             }
462 462
             $ReportInfo .= "
@@ -492,13 +492,13 @@ foreach ($TorrentList as $Torrent) {
492 492
                 $Name = str_replace(' ', '&nbsp;', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
493 493
             }
494 494
             $FileSize = substr($File, $NameEnd + 3, -3);
495
-            $FileTable .= sprintf("\n<tr class=\"row\"><td>%s</td><td class=\"number_column nobr\">%s</td></tr>", $Name, Format::get_size($FileSize));
495
+            $FileTable .= sprintf("\n<tr class='row'><td>%s</td><td class='number_column nobr'>%s</td></tr>", $Name, Format::get_size($FileSize));
496 496
         }
497 497
     } else {
498 498
         $FileListSplit = explode("\n", $FileList);
499 499
         foreach ($FileListSplit as $File) {
500 500
             $FileInfo = Torrents::filelist_get_file($File);
501
-            $FileTable .= sprintf("\n<tr class=\"row\"><td>%s</td><td class=\"number_column nobr\">%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
501
+            $FileTable .= sprintf("\n<tr class='row'><td>%s</td><td class='number_column nobr'>%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
502 502
         }
503 503
     }
504 504
     $FileTable .= '
@@ -507,8 +507,8 @@ foreach ($TorrentList as $Torrent) {
507 507
     $ExtraInfo = ''; // String that contains information on the torrent (e.g. format and encoding)
508 508
   $AddExtra = ''; // Separator between torrent properties
509 509
 
510
-  // similar to Torrents::torrent_info()
511
-    if ($Media && $GroupCategoryID != 5) {
510
+  // Similar to Torrents::torrent_info()
511
+    if ($Media) {
512 512
         $ExtraInfo.=display_str($Media);
513 513
         $AddExtra=" / ";
514 514
     }
@@ -524,11 +524,16 @@ foreach ($TorrentList as $Torrent) {
524 524
         $ExtraInfo.=$AddExtra.display_str($Resolution);
525 525
         $AddExtra=' / ';
526 526
     }
527
-    #if ($AudioFormat) { $ExtraInfo.=$AddExtra.display_str($AudioFormat); $AddExtra=' / '; }
527
+    /*
528
+    if ($AudioFormat) {
529
+      $ExtraInfo.=$AddExtra.display_str($AudioFormat);
530
+      $AddExtra=' / '; }
531
+      */
528 532
     /*
529 533
     if ($Language) {
530 534
       if ($Subber && ($GroupCategoryID == 3 || $GroupCategoryID == 4)) {
531
-        $ExtraInfo.=$AddExtra.display_str($Language.' ('.$Subber.')'); $AddExtra=' / ';
535
+        $ExtraInfo.=$AddExtra.display_str($Language.' ('.$Subber.')');
536
+        $AddExtra=' / ';
532 537
       } else {
533 538
         $ExtraInfo.=$AddExtra.display_str($Language); $AddExtra=' / ';
534 539
       }
@@ -556,7 +561,7 @@ foreach ($TorrentList as $Torrent) {
556 561
         $ExtraInfo .= $AddExtra.display_str('Unaligned');
557 562
         $AddExtra=' / ';
558 563
     }
559
-    if (!$ExtraInfo || $GroupCategoryID == 5) {
564
+    if (!$ExtraInfo) {
560 565
         $ExtraInfo = $GroupName;
561 566
         $AddExtra=' / ';
562 567
     }
@@ -737,6 +742,7 @@ foreach ($TorrentList as $Torrent) {
737 742
     if (!empty($Description)) {
738 743
         echo "\n<blockquote>".Text::full_format($Description).'</blockquote>';
739 744
     }
745
+    
740 746
     /*
741 747
     if (!empty($MediaInfo) || $MediaInfo === 'nil') { # Kludge
742 748
         $parsed = MediaInfo::parse($MediaInfo);
@@ -745,6 +751,7 @@ foreach ($TorrentList as $Torrent) {
745 751
             echo $parsed;
746 752
         } else {
747 753
           */
754
+
748 755
     echo "\n<blockquote>"; ?>
749 756
             <div class="spoilerContainer hideContainer">
750 757
               <?php

+ 94
- 31
sections/upload/upload_handle.php View File

@@ -13,8 +13,8 @@ ini_set('upload_max_filesize', 2097152); // 2 MiB
13 13
 
14 14
 # Allow many uncompressed files,
15 15
 # e.g., http://academictorrents.com/details/5a447ff50062194bd58dd11c0fedead59e6d873c/tech
16
-ini_set('max_file_uploads', 65535);
17
-define('MAX_FILENAME_LENGTH', 180);
16
+ini_set('max_file_uploads', 10000);
17
+define('MAX_FILENAME_LENGTH', 255);
18 18
 
19 19
 include(SERVER_ROOT.'/classes/validate.class.php');
20 20
 include(SERVER_ROOT.'/classes/feed.class.php');
@@ -30,9 +30,9 @@ $Feed = new Feed;
30 30
 //*****************************************************************************//
31 31
 //--------------- Set $Properties array ---------------------------------------//
32 32
 // This is used if the form doesn't validate, and when the time comes to enter //
33
-// it into the database.                                                       //
34
-// Haha wow god i'm trying to restrict the database to only have fields for    //
35
-// movies and not add anything for other categories but this is fucking dumb   //
33
+// it into the database.                 
34
+// @todo Do something about this mess
35
+//****************************************************************************//
36 36
 
37 37
 $Properties = [];
38 38
 $Type = $Categories[(int)$_POST['type']];
@@ -44,21 +44,18 @@ $Properties['Title'] = $_POST['title'];
44 44
 $Properties['TitleRJ'] = $_POST['title_rj'];
45 45
 $Properties['TitleJP'] = $_POST['title_jp'];
46 46
 $Properties['Year'] = $_POST['year'];
47
-
48 47
 $Properties['Studio'] = isset($_POST['studio']) ? $_POST['studio'] : '';
49
-
50 48
 $Properties['Series'] = isset($_POST['series']) ? $_POST['series'] : '';
51
-
52 49
 $Properties['CatalogueNumber'] = isset($_POST['catalogue']) ? $_POST['catalogue'] : '';
53 50
 $Properties['Pages'] = isset($_POST['pages']) ? $_POST['pages'] : 0;
54 51
 $Properties['Container'] = isset($_POST['container']) ? $_POST['container'] : '';
55
-
56 52
 $Properties['Media'] = $_POST['media'];
57
-
58 53
 $Properties['Codec'] = isset($_POST['codec']) ? $_POST['codec'] : '';
54
+
59 55
 if (!($_POST['resolution'] ?? false)) {
60 56
     $_POST['resolution'] = $_POST['ressel'] ?? '';
61 57
 }
58
+
62 59
 $Properties['Resolution'] = $_POST['resolution'] ?? '';
63 60
 $Properties['AudioFormat'] = 'nil';
64 61
 $Properties['Subbing'] = 'nil';
@@ -68,12 +65,15 @@ $Properties['DLsiteID'] = (isset($_POST['dlsiteid'])) ? $_POST['dlsiteid'] : '';
68 65
 $Properties['Censored'] = (isset($_POST['censored'])) ? '1' : '0';
69 66
 $Properties['Anonymous'] = (isset($_POST['anonymous'])) ? '1' : '0';
70 67
 $Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] !== '---') ? $_POST['archive'] : '';
68
+
71 69
 if (isset($_POST['library_image'])) {
72 70
     $Properties['LibraryImage'] = $_POST['library_image'];
73 71
 }
72
+
74 73
 if (isset($_POST['tags'])) {
75 74
     $Properties['TagList'] = implode(',', array_unique(explode(',', str_replace(' ', '', $_POST['tags']))));
76 75
 }
76
+
77 77
 if (isset($_POST['image'])) {
78 78
     $Properties['Image'] = $_POST['image'];
79 79
 }
@@ -122,6 +122,7 @@ if (!empty($_POST['requestid'])) {
122 122
 //******************************************************************************//
123 123
 //--------------- Validate data in upload form ---------------------------------//
124 124
 
125
+# torrents_group.CategoryID
125 126
 $Validate->SetFields(
126 127
     'type',
127 128
     '1',
@@ -130,24 +131,27 @@ $Validate->SetFields(
130 131
     array('inarray' => array_keys($Categories))
131 132
 );
132 133
 
134
+# @todo Remove the switch statement
133 135
 switch ($Type) {
134 136
     /*
135 137
   case 'Imaging':
136 138
     if (!isset($_POST['groupid']) || !$_POST['groupid']) {
137
-        $Validate->SetFields( # torrents.Media
139
+        # torrents.Media
140
+        $Validate->SetFields(
138 141
             'media',
139 142
             '1',
140 143
             'inarray',
141 144
             'Please select a valid platform.',
142
-            array('inarray'=>array_merge($Media, $MediaManga, $Platform))
145
+            array('inarray' => array_merge($Media, $MediaManga, $Platform))
143 146
         );
144 147
 
145
-        $Validate->SetFields( # torrents.Container
148
+        # torrents.Container
149
+        $Validate->SetFields(
146 150
             'container',
147 151
             '1',
148 152
             'inarray',
149 153
             'Please select a valid format.',
150
-            array('inarray'=>array_merge($Containers, $ContainersGames))
154
+            array('inarray' => array_merge($Containers, $ContainersGames))
151 155
         );
152 156
     }
153 157
 break;
@@ -155,63 +159,122 @@ break;
155 159
 
156 160
 default:
157 161
     if (!isset($_POST['groupid']) || !$_POST['groupid']) {
158
-        $Validate->SetFields( # torrents_group.Name
162
+        # torrents_group.CatalogueNumber
163
+        $Validate->SetFields(
164
+            'catalogue',
165
+            '0',
166
+            'string',
167
+            'Accession Number must be between 0 and 50 characters.',
168
+            array('maxlength' => 50, 'minlength' => 0)
169
+        );
170
+
171
+        # torrents_group.Name
172
+        $Validate->SetFields(
159 173
             'title',
160 174
             '1',
161 175
             'string',
162
-            'Torrent Title must be between 1 and 255 characters.',
163
-            array('maxlength'=>255, 'minlength'=>1)
176
+            'Torrent Title must be between 5 and 255 characters.',
177
+            array('maxlength' => 255, 'minlength' => 5)
164 178
         );
165 179
 
166
-        $Validate->SetFields( # torrents_group.NameRJ
180
+        # torrents_group.NameRJ
181
+        $Validate->SetFields(
167 182
             'title_rj',
168 183
             '0',
169 184
             'string',
170 185
             'Organism must be between 0 and 255 characters.',
171
-            array('maxlength'=>255, 'minlength'=>0)
186
+            array('maxlength' => 255, 'minlength' => 0)
172 187
         );
173 188
 
174
-        $Validate->SetFields( # torrents_group.NameJP
189
+        # torrents_group.NameJP
190
+        $Validate->SetFields(
175 191
             'title_jp',
176 192
             '0',
177 193
             'string',
178 194
             'Strain/Variety must be between 0 and 255 characters.',
179
-            array('maxlength'=>255, 'minlength'=>0)
195
+            array('maxlength' => 255, 'minlength' => 0)
196
+        );
197
+
198
+        # torrents_group.Studio
199
+        $Validate->SetFields(
200
+           'studio',
201
+            '0',
202
+            'string',
203
+            'Department/Lab must be between 0 and 100 characters.',
204
+            array('maxlength' => 100, 'minlength' => 0)
180 205
         );
181 206
 
182
-        $Validate->SetFields( # torrents_group.Year
207
+        # torrents_group.Series
208
+        $Validate->SetFields(
209
+            'series',
210
+            '0',
211
+            'string',
212
+            'Location must be between 0 and 100 characters.',
213
+            array('maxlength' => 100, 'minlength' => 0)
214
+        );
215
+
216
+        # torrents_group.Year
217
+        $Validate->SetFields(
183 218
             'year',
184 219
             '1',
185 220
             'number',
186 221
             'The year of the original release must be entered.',
187
-            array('maxlength'=>4, 'minlength'=>4)
222
+            array('maxlength' => 4, 'minlength' => 4)
223
+        );
224
+
225
+        # torrents.Media
226
+        $Validate->SetFields(
227
+            'media',
228
+            '1',
229
+            'inarray',
230
+            'Please select a valid platform.',
231
+            array('inarray' => array_merge($Media, $MediaManga, $Platform))
188 232
         );
189 233
 
190
-        $Validate->SetFields( # torrents_group.TagList
234
+        # torrents.Container
235
+        $Validate->SetFields(
236
+            'container',
237
+            '1',
238
+            'inarray',
239
+            'Please select a valid format.',
240
+            array('inarray' => array_merge($Containers, $ContainersGames))
241
+        );
242
+
243
+        # torrents_group.TagList
244
+        $Validate->SetFields(
191 245
             'tags',
192 246
             '1',
193 247
             'string',
194 248
             'You must enter at least five tags. Maximum length is 500 characters.',
195
-            array('maxlength'=>500, 'minlength'=>5)
249
+            array('maxlength' => 500, 'minlength' => 10)
196 250
         );
197 251
 
198
-        $Validate->SetFields( # torrents_group.WikiImage
252
+        # torrents_group.WikiImage
253
+        $Validate->SetFields(
199 254
             'image',
200 255
             '0',
201 256
             'link',
202 257
             'The image URL you entered was invalid.',
203
-            array('maxlength'=>255, 'minlength'=>10)
258
+            array('maxlength' => 255, 'minlength' => 10) # x.yz/a.bc
204 259
         );
205 260
     }
206 261
 
207
-    $Validate->SetFields( # torrents_group.WikiBody
262
+    # torrents_group.WikiBody
263
+    $Validate->SetFields(
208 264
         'album_desc',
209 265
         '1',
210 266
         'string',
211
-        'The description has a minimum length of 10 characters.',
212
-        array('maxlength'=>1000000, 'minlength'=>10)
267
+        'The description must be between 10 and 65535 characters.',
268
+        array('maxlength' => 65535, 'minlength' => 10)
269
+    );
270
+
271
+    # torrents_group.ID
272
+    $Validate->SetFields(
273
+        'groupid',
274
+        '0',
275
+        'number',
276
+        'Group ID was not numeric.'
213 277
     );
214
-    #$Validate->SetFields('groupid', '0', 'number', 'Group ID was not numeric.');
215 278
 }
216 279
 
217 280
 $Err = $Validate->ValidateForm($_POST); // Validate the form

+ 1
- 0
static/functions/bbcode.js View File

@@ -61,6 +61,7 @@ function EmojiBox(box) {
61 61
 }
62 62
 
63 63
 function BBEditor(box) {
64
+  // @todo Integrate BioJS functions here
64 65
   if (box.previousSibling && box.previousSibling.className == 'bbcode_bar') return
65 66
   let buttons = [
66 67
     {short:'B', name:'Bold', wrap:['[b]','[/b]']},

+ 1335
- 0
static/functions/biojs/ntseq.js
File diff suppressed because it is too large
View File


+ 1
- 1
static/functions/upload.js View File

@@ -43,7 +43,7 @@ function Categories() {
43 43
       'studio': {},
44 44
       'series': {},
45 45
       'media': {},
46
-      'container': {},
46
+      'container_prot': {},
47 47
       'resolution': {},
48 48
       'archive': {},
49 49
       'codec': {},

Loading…
Cancel
Save