Browse Source

PHP CS Fixer

pjc 5 years ago
parent
commit
f68240386f
1 changed files with 411 additions and 359 deletions
  1. 411
    359
      classes/torrent_form.class.php

+ 411
- 359
classes/torrent_form.class.php View File

1
-<?
1
+<?php
2
 
2
 
3
 // This class is used in upload.php to display the upload form, and the edit
3
 // This class is used in upload.php to display the upload form, and the edit
4
 // section of torrents.php to display a shortened version of the same form
4
 // section of torrents.php to display a shortened version of the same form
5
 
5
 
6
-class TorrentForm {
7
-  var $UploadForm = '';
8
-  var $Categories = [];
9
-  #var $Formats = [];
10
-  #var $Bitrates = [];
11
-  var $Media = [];
12
-  #var $MediaManga = [];
13
-  var $Containers = [];
14
-  #var $ContainersGames = [];
15
-  var $Codecs = [];
16
-  var $Resolutions = [];
17
-  #var $AudioFormats = [];
18
-  #var $Subbing = [];
19
-  #var $Languages = [];
20
-  #var $Platform = [];
21
-  var $NewTorrent = false;
22
-  var $Torrent = [];
23
-  var $Error = false;
24
-  var $TorrentID = false;
25
-  var $Disabled = '';
26
-  var $DisabledFlag = false;
6
+class TorrentForm
7
+{
8
+    public $UploadForm = '';
9
+    public $Categories = [];
10
+    #var $Formats = [];
11
+    #var $Bitrates = [];
12
+    public $Media = [];
13
+    #var $MediaManga = [];
14
+    public $Containers = [];
15
+    #var $ContainersGames = [];
16
+    public $Codecs = [];
17
+    public $Resolutions = [];
18
+    #var $AudioFormats = [];
19
+    #var $Subbing = [];
20
+    #var $Languages = [];
21
+    #var $Platform = [];
22
+    public $NewTorrent = false;
23
+    public $Torrent = [];
24
+    public $Error = false;
25
+    public $TorrentID = false;
26
+    public $Disabled = '';
27
+    public $DisabledFlag = false;
27
 
28
 
28
-  function __construct($Torrent = false, $Error = false, $NewTorrent = true) {
29
+    public function __construct($Torrent = false, $Error = false, $NewTorrent = true)
30
+    {
31
+        $this->NewTorrent = $NewTorrent;
32
+        $this->Torrent = $Torrent;
33
+        $this->Error = $Error;
29
 
34
 
30
-    $this->NewTorrent = $NewTorrent;
31
-    $this->Torrent = $Torrent;
32
-    $this->Error = $Error;
35
+        global $UploadForm, $Categories, $Media, $TorrentID, $Containers, $Codecs, $Resolutions, $Archives;
36
+        #global $UploadForm, $Categories, $Formats, $Bitrates, $Media, $MediaManga, $TorrentID, $Containers, $ContainersGames, $Codecs, $Resolutions, $AudioFormats, $Subbing, $Languages, $Platform, $Archives, $ArchivesManga;
33
 
37
 
34
-    global $UploadForm, $Categories, $Media, $TorrentID, $Containers, $Codecs, $Resolutions, $Archives;
35
-    #global $UploadForm, $Categories, $Formats, $Bitrates, $Media, $MediaManga, $TorrentID, $Containers, $ContainersGames, $Codecs, $Resolutions, $AudioFormats, $Subbing, $Languages, $Platform, $Archives, $ArchivesManga;
38
+        $this->UploadForm = $UploadForm;
39
+        $this->Categories = $Categories;
40
+        #$this->Formats = $Formats;
41
+        #$this->Bitrates = $Bitrates;
42
+        $this->Media = $Media;
43
+        #$this->MediaManga = $MediaManga;
44
+        $this->Containers = $Containers;
45
+        #$this->ContainersGames = $ContainersGames;
46
+        $this->Codecs = $Codecs;
47
+        $this->Resolutions = $Resolutions;
48
+        #$this->AudioFormats = $AudioFormats;
49
+        #$this->Subbing = $Subbing;
50
+        #$this->Languages = $Languages;
51
+        $this->TorrentID = $TorrentID;
52
+        #$this->Platform = $Platform;
53
+        $this->Archives = $Archives;
54
+        #$this->ArchivesManga = $ArchivesManga;
36
 
55
 
37
-    $this->UploadForm = $UploadForm;
38
-    $this->Categories = $Categories;
39
-    #$this->Formats = $Formats;
40
-    #$this->Bitrates = $Bitrates;
41
-    $this->Media = $Media;
42
-    #$this->MediaManga = $MediaManga;
43
-    $this->Containers = $Containers;
44
-    #$this->ContainersGames = $ContainersGames;
45
-    $this->Codecs = $Codecs;
46
-    $this->Resolutions = $Resolutions;
47
-    #$this->AudioFormats = $AudioFormats;
48
-    #$this->Subbing = $Subbing;
49
-    #$this->Languages = $Languages;
50
-    $this->TorrentID = $TorrentID;
51
-    #$this->Platform = $Platform;
52
-    $this->Archives = $Archives;
53
-    #$this->ArchivesManga = $ArchivesManga;
54
-
55
-    if ($this->Torrent && $this->Torrent['GroupID']) {
56
-      $this->Disabled = ' readonly="readonly"';
57
-      $this->DisabledFlag = true;
56
+        if ($this->Torrent && $this->Torrent['GroupID']) {
57
+            $this->Disabled = ' readonly="readonly"';
58
+            $this->DisabledFlag = true;
59
+        }
58
     }
60
     }
59
-  }
60
 
61
 
61
-  function head() {
62
-    G::$DB->query("
62
+    public function head()
63
+    {
64
+        G::$DB->query("
63
       SELECT COUNT(ID)
65
       SELECT COUNT(ID)
64
       FROM torrents
66
       FROM torrents
65
       WHERE UserID = ?", G::$LoggedUser['ID']);
67
       WHERE UserID = ?", G::$LoggedUser['ID']);
66
-    list($Uploads) = G::$DB->next_record();
67
-?>
68
+        list($Uploads) = G::$DB->next_record(); ?>
68
 
69
 
69
 <div class="thin">
70
 <div class="thin">
70
-<?    if ($this->NewTorrent) { ?>
71
+  <?php    if ($this->NewTorrent) { ?>
71
   <p style="text-align: center;">
72
   <p style="text-align: center;">
72
     If you would like to use your own torrent file, add the following to it:<br />
73
     If you would like to use your own torrent file, add the following to it:<br />
73
-<?      $Announces = call_user_func_array('array_merge', ANNOUNCE_URLS);
74
+    <?php      $Announces = call_user_func_array('array_merge', ANNOUNCE_URLS);
74
         foreach ($Announces as $Announce) {
75
         foreach ($Announces as $Announce) {
75
-?>
76
-    Announce: <input type="text" value="<?=$Announce . '/' . G::$LoggedUser['torrent_pass'] . '/announce'?>" size="74" onclick="this.select();" readonly="readonly" /> <br />
77
-<?      } ?>
78
-Source: <input type="text" value="<?=Users::get_upload_sources()[0]?>" size="20" onclick="this.select();" readonly="readonly" />
76
+            ?>
77
+    Announce: <input type="text"
78
+      value="<?=$Announce . '/' . G::$LoggedUser['torrent_pass'] . '/announce'?>"
79
+      size="74" onclick="this.select();" readonly="readonly" /> <br />
80
+    <?php
81
+        } ?>
82
+    Source: <input type="text"
83
+      value="<?=Users::get_upload_sources()[0]?>" size="20"
84
+      onclick="this.select();" readonly="readonly" />
79
     <p style="text-align: center;">
85
     <p style="text-align: center;">
80
-        Otherwise, add none of it and simply redownload the torrent file after uploading it. All of the above data will be added to it by the site.<br /><br />
81
-    <strong<?=((!$Uploads)?' class="important_text"':'')?>>
82
-        If you never have before, be sure to read this list of <a href="wiki.php?action=article&name=uploadingpitfalls">uploading pitfalls</a>
83
-      </strong>
86
+      Otherwise, add none of it and simply redownload the torrent file after uploading it. All of the above data will be
87
+      added to it by the site.<br /><br />
88
+      <strong<?=((!$Uploads)?' class="important_text"':'')?>>
89
+        If you never have before, be sure to read this list of <a
90
+          href="wiki.php?action=article&name=uploadingpitfalls">uploading pitfalls</a>
91
+        </strong>
84
     </p>
92
     </p>
85
   </p>
93
   </p>
86
-<?    }
87
-    if ($this->Error) {
88
-      echo "\t".'<p style="color: red; text-align: center;">'.$this->Error."</p>\n";
89
-    }
90
-?>
91
-  <form class="create_form box pad" name="torrent" action="" enctype="multipart/form-data" method="post" onsubmit="$('#post').raw().disabled = 'disabled';">
94
+  <?php    }
95
+        if ($this->Error) {
96
+            echo "\t".'<p style="color: red; text-align: center;">'.$this->Error."</p>\n";
97
+        } ?>
98
+  <form class="create_form box pad" name="torrent" action="" enctype="multipart/form-data" method="post"
99
+    onsubmit="$('#post').raw().disabled = 'disabled';">
92
     <div>
100
     <div>
93
       <input type="hidden" name="submit" value="true" />
101
       <input type="hidden" name="submit" value="true" />
94
-      <input type="hidden" name="auth" value="<?=G::$LoggedUser['AuthKey']?>" />
95
-<?    if (!$this->NewTorrent) { ?>
102
+      <input type="hidden" name="auth"
103
+        value="<?=G::$LoggedUser['AuthKey']?>" />
104
+      <?php    if (!$this->NewTorrent) { ?>
96
       <input type="hidden" name="action" value="takeedit" />
105
       <input type="hidden" name="action" value="takeedit" />
97
-      <input type="hidden" name="torrentid" value="<?=display_str($this->TorrentID)?>" />
98
-      <input type="hidden" name="type" value="<?=display_str($this->Torrent['CategoryID']-1)?>" />
99
-<?
106
+      <input type="hidden" name="torrentid"
107
+        value="<?=display_str($this->TorrentID)?>" />
108
+      <input type="hidden" name="type"
109
+        value="<?=display_str($this->Torrent['CategoryID']-1)?>" />
110
+      <?php
100
     } else {
111
     } else {
101
-      if ($this->Torrent && $this->Torrent['GroupID']) {
102
-?>
103
-      <input type="hidden" name="groupid" value="<?=display_str($this->Torrent['GroupID'])?>" />
104
-      <input type="hidden" name="type" value="<?=display_str($this->Torrent['CategoryID']-1)?>" />
105
-<?
106
-      }
107
-      if ($this->Torrent && ($this->Torrent['RequestID'] ?? false)) {
108
-?>
109
-      <input type="hidden" name="requestid" value="<?=display_str($this->Torrent['RequestID'])?>" />
110
-<?
111
-      }
112
-    }
113
-?>
112
+        if ($this->Torrent && $this->Torrent['GroupID']) {
113
+            ?>
114
+      <input type="hidden" name="groupid"
115
+        value="<?=display_str($this->Torrent['GroupID'])?>" />
116
+      <input type="hidden" name="type"
117
+        value="<?=display_str($this->Torrent['CategoryID']-1)?>" />
118
+      <?php
119
+        }
120
+        if ($this->Torrent && ($this->Torrent['RequestID'] ?? false)) {
121
+            ?>
122
+      <input type="hidden" name="requestid"
123
+        value="<?=display_str($this->Torrent['RequestID'])?>" />
124
+      <?php
125
+        }
126
+    } ?>
114
     </div>
127
     </div>
115
-<?    if ($this->NewTorrent) { ?>
128
+    <?php    if ($this->NewTorrent) { ?>
116
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
129
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
117
       <tr>
130
       <tr>
118
-        <td class="label tooltip" title="Use the above announce URL and set the private flag in your BitTorrent client">Torrent File</td>
131
+        <td class="label tooltip" title="Use the above announce URL and set the private flag in your BitTorrent client">
132
+          Torrent File</td>
119
         <td><input id="file" type="file" name="file_input" size="50" /></td>
133
         <td><input id="file" type="file" name="file_input" size="50" /></td>
120
       </tr>
134
       </tr>
121
       <tr>
135
       <tr>
122
-        <td class="label tooltip" title="What alphabet the sequence uses, n.b., plasmids fit in the Other category">Type</td>
136
+        <td class="label tooltip" title="What alphabet the sequence uses, n.b., plasmids fit in the Other category">Type
137
+        </td>
123
         <td>
138
         <td>
124
-          <select id="categories" name="type" onchange="Categories()"<?=($this->DisabledFlag) ? ' disabled="disabled"' : ''?>>
125
-<?
139
+          <select id="categories" name="type" onchange="Categories()" <?=($this->DisabledFlag) ? ' disabled="disabled"' : ''?>>
140
+            <?php
126
       foreach (Misc::display_array($this->Categories) as $Index => $Cat) {
141
       foreach (Misc::display_array($this->Categories) as $Index => $Cat) {
127
-        echo "\t\t\t\t\t\t<option value=\"$Index\"";
128
-        if ($Cat == $this->Torrent['CategoryName']) {
129
-          echo ' selected="selected"';
130
-        }
131
-        echo ">$Cat</option>\n";
142
+          echo "\t\t\t\t\t\t<option value=\"$Index\"";
143
+          if ($Cat == $this->Torrent['CategoryName']) {
144
+              echo ' selected="selected"';
145
+          }
146
+          echo ">$Cat</option>\n";
132
       }
147
       }
133
 ?>
148
 ?>
134
           </select>
149
           </select>
135
         </td>
150
         </td>
136
       </tr>
151
       </tr>
137
     </table>
152
     </table>
138
-<?    }//if ?>
153
+    <?php    }//if?>
139
     <div id="dynamic_form">
154
     <div id="dynamic_form">
140
-<?
141
-  }
142
-
155
+      <?php
156
+    }
143
 
157
 
144
-  function foot() {
145
-    $Torrent = $this->Torrent;
146
-?>
158
+    public function foot()
159
+    {
160
+        $Torrent = $this->Torrent; ?>
147
     </div>
161
     </div>
148
     <table cellpadding="3" cellspacing="1" border="0" class="layout slice" width="100%">
162
     <table cellpadding="3" cellspacing="1" border="0" class="layout slice" width="100%">
149
-<?
163
+      <?php
150
     if (!$this->NewTorrent) {
164
     if (!$this->NewTorrent) {
151
-      if (check_perms('torrents_freeleech')) {
152
-?>
165
+        if (check_perms('torrents_freeleech')) {
166
+            ?>
153
       <tr id="freetorrent">
167
       <tr id="freetorrent">
154
         <td class="label">Freeleech</td>
168
         <td class="label">Freeleech</td>
155
         <td>
169
         <td>
156
           <select name="freeleech">
170
           <select name="freeleech">
157
-<?
171
+            <?php
158
         $FL = array("Normal", "Free", "Neutral");
172
         $FL = array("Normal", "Free", "Neutral");
159
-        foreach ($FL as $Key => $Name) {
160
-?>
161
-            <option value="<?=$Key?>"<?=($Key == $Torrent['FreeTorrent'] ? ' selected="selected"' : '')?>><?=$Name?></option>
162
-<?        } ?>
173
+            foreach ($FL as $Key => $Name) {
174
+                ?>
175
+            <option value="<?=$Key?>" <?=($Key == $Torrent['FreeTorrent'] ? ' selected="selected"' : '')?>><?=$Name?>
176
+            </option>
177
+            <?php
178
+            } ?>
163
           </select>
179
           </select>
164
           because
180
           because
165
           <select name="freeleechtype">
181
           <select name="freeleechtype">
166
-<?
182
+            <?php
167
         $FL = array("N/A", "Staff Pick", "Perma-FL", "Freeleechizer", "Site-Wide FL");
183
         $FL = array("N/A", "Staff Pick", "Perma-FL", "Freeleechizer", "Site-Wide FL");
168
-        foreach ($FL as $Key => $Name) {
169
-?>
170
-            <option value="<?=$Key?>"<?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$Name?></option>
171
-<?        } ?>
184
+            foreach ($FL as $Key => $Name) {
185
+                ?>
186
+            <option value="<?=$Key?>" <?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$Name?>
187
+            </option>
188
+            <?php
189
+            } ?>
172
           </select>
190
           </select>
173
         </td>
191
         </td>
174
       </tr>
192
       </tr>
175
-<?
176
-      }
177
-    }
178
-?>
193
+      <?php
194
+        }
195
+    } ?>
179
       <tr>
196
       <tr>
180
         <td colspan="2" style="text-align: center;">
197
         <td colspan="2" style="text-align: center;">
181
-          <p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>. Not doing this will result in a <strong class="important_text">warning</strong> or <strong class="important_text">worse</strong>.</p>
182
-<?    if ($this->NewTorrent) { ?>
183
-          <p>After uploading the torrent, you will have a one hour grace period during which no one other than you can fill requests with this torrent. Make use of this time wisely, and <a href="requests.php">search the list of requests</a>.</p>
184
-<?    } ?>
185
-        <input id="post" type="submit"<? if ($this->NewTorrent) { echo ' value="Upload torrent"'; } else { echo ' value="Edit torrent"';} ?> />
198
+          <p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>. Not
199
+            doing this will result in a <strong class="important_text">warning</strong> or <strong
200
+              class="important_text">worse</strong>.</p>
201
+          <?php    if ($this->NewTorrent) { ?>
202
+          <p>After uploading the torrent, you will have a one hour grace period during which no one other than you can
203
+            fill requests with this torrent. Make use of this time wisely, and <a href="requests.php">search the list of
204
+              requests</a>.</p>
205
+          <?php    } ?>
206
+          <input id="post" type="submit" <?php if ($this->NewTorrent) {
207
+        echo ' value="Upload torrent"';
208
+    } else {
209
+        echo ' value="Edit torrent"';
210
+    } ?>
211
+          />
186
         </td>
212
         </td>
187
       </tr>
213
       </tr>
188
     </table>
214
     </table>
189
   </form>
215
   </form>
190
 </div>
216
 </div>
191
-<?
192
-  }
193
-
194
-
195
-  function upload_form() {
196
-    $QueryID = G::$DB->get_query_id();
197
-    $this->head();
198
-    $Torrent = $this->Torrent;
199
-?>
200
-    <table cellpadding="3" cellspacing="1" border="0" class="layout slice" width="100%">
201
-<? if ($this->NewTorrent) { ?>
202
-      <tr id="javdb_tr">
203
-        <td class="label tooltip" title="RefSeq accession number, e.g., NM_001183340.1">Accession Number</td>
204
-        <td>
205
-          <input type="text" id="catalogue" name="catalogue" size="10" value="<?=display_str($Torrent['CatalogueNumber']) ?>" <?=$this->Disabled?>/>
206
-<? if (!$this->DisabledFlag) { ?>
207
-          <input type="button" autofill="jav" value="Autofill" style="background: lightgrey; pointer-events: none;"></input>
208
-<? } ?>
209
-        </td>
210
-      </tr>
211
-      <tr id="anidb_tr" class="hidden">
212
-        <td class="label">AniDB Autofill (optional)</td>
213
-        <td>
214
-          <input type="text" id="anidb" size="10" <?=$this->Disabled?>/>
215
-<? if (!$this->DisabledFlag) { ?>
216
-          <input type="button" autofill="anime" value="Autofill"/>
217
-<? } ?>
218
-        </td>
219
-      </tr>
220
-      <tr id="ehentai_tr" class="hidden">
221
-        <td class="label">e-hentai URL (optional)</td>
222
-        <td>
223
-          <input type="text" id="catalogue" size="50" <?=$this->Disabled?> />
224
-<? if (!$this->DisabledFlag) { ?>
225
-          <input type="button" autofill="douj" value="Autofill"/>
226
-<? } ?>
227
-        </td>
228
-      </tr>
229
-      <tr id="title_tr">
230
-        <td class="label tooltip" title="FASTA definition line, e.g., Alcohol dehydrogenase ADH1">Sequence Name</td>
231
-        <td><input type="text" id="title" name="title" size="60" value="<?=display_str($Torrent['Title']) ?>" <?=$this->Disabled?>/></td>
232
-      </tr>
233
-      <tr id="title_rj_tr">
234
-        <td class="label tooltip" title="FASTA organism line binomial nomenclature, e.g., Saccharomyces cerevisiae">Organism</td>
235
-        <td><input type="text" id="title_rj" name="title_rj" size="60" value="<?=display_str($Torrent['TitleRJ']) ?>" <?=$this->Disabled?>/></td>
236
-      </tr>
237
-      <tr id="title_jp_tr">
238
-        <td class="label tooltip" title="FASTA organism line if applicable, e.g., S288C">Strain/Variety</td>
239
-        <td><input type="text" id="title_jp" name="title_jp" size="60" value="<?=display_str($Torrent['TitleJP']) ?>" <?=$this->Disabled?>/></td>
240
-      </tr>
241
-      <tr id="idols_tr">
242
-        <td class="label tooltip" title="FASTA authors line, e.g., Robert K. Mortimer and David Schild">Collaborator(s)</td>
243
-        <td id="idolfields">
244
-<?      if (!empty($Torrent['Artists'])) {
245
-          foreach ($Torrent['Artists'] as $Num => $Artist) { ?>
246
-            <input type="text" id="idols_<?=$Num?>" name="idols[]" size="45" value="<?=display_str($Artist['name'])?>" <?=$this->Disabled?>/>
247
-            <? if ($Num == 0) { ?>
248
-              <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
249
-            <? }
250
-            }
251
-          } else { ?>
252
-            <input type="text" id="idols_0" name="idols[]" size="45" value="" <?=$this->Disabled?> />
253
-            <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
254
-<?        } ?>
255
-        </td>
256
-      </tr>
257
-      <tr id="studio_tr">
258
-        <td class="label tooltip" title="Who produced the sequence, e.g., Lawrence Berkeley Laboratory">Department/Lab</td>
259
-        <td><input type="text" id="studio" name="studio" size="60" value="<?=display_str($Torrent['Studio']) ?>" <?=$this->Disabled?>/></td>
260
-      </tr>
261
-      <tr id="series_tr">
262
-        <td class="label tooltip" title="Their physical location, e.g., Berkeley, CA">Location</td>
263
-        <td><input type="text" id="series" name="series" size="60" value="<?=display_str($Torrent['Series']) ?>" <?=$this->Disabled?>/></td>
264
-      </tr>
265
-      <tr id="year_tr">
266
-        <td class="label tooltip" title="What year they published the sequence in">Year</td>
267
-        <td><input type="text" id="year" name="year" maxlength="4" size="5" value="<?=display_str($Torrent['Year']) ?>" <?=$this->Disabled?>/></td>
268
-      </tr>
269
-<? } ?>
270
-      <tr id="media_tr">
271
-        <td class="label tooltip" title="What class of sequencing technology they used">Platform</td>
272
-        <td>
273
-          <select name="media">
274
-            <option>---</option>
275
-<?
276
-    foreach($this->Media as $Media) {
277
-      echo "\t\t\t\t\t\t<option value=\"$Media\"";
278
-      if ($Media == ($Torrent['Media'] ?? false)) {
279
-        echo " selected";
280
-      }
281
-      echo ">$Media</option>\n";
217
+<?php
282
     }
218
     }
283
-?>
284
-          </select>
285
-        </td>
286
-      </tr>
287
-      <tr id="archive_tr">
288
-        <td class="label tooltip" title="How the data is archived and compressed">Archive</td>
289
-        <td>
290
-          <select name='archive'>
291
-            <option>---</option>
292
-<?
293
-    foreach($this->Archives as $Archive) {
294
-      echo "\t\t\t\t\t\t<option value=\"$Archive\"";
295
-      if ($Archive == ($Torrent['Archive'] ?? false)) {
296
-        echo ' selected';
297
-      }
298
-      echo ">$Archive</option>\n";
299
-    }
300
-?>
301
-          </select>
302
-        </td>
303
-      </tr>
304
-      <tr id="container_tr">
305
-        <td class="label tooltip" title="What file format the sequence is in">Format</td>
306
-        <td>
307
-          <select name="container">
308
-            <option>---</option>
309
-<?
310
-    foreach($this->Containers as $Cont) {
311
-      echo "\t\t\t\t\t\t<option value=\"$Cont\"";
312
-      if ($Cont == ($Torrent['Container'] ?? false)) {
313
-        echo " selected";
314
-      }
315
-      echo ">$Cont</option>\n";
316
-    }
317
-?>
318
-          </select>
319
-        </td>
320
-      </tr>
321
-      <tr id="codec_tr">
322
-        <td class="label tooltip" title="What license the collaborators released the data under">License</td>
323
-        <td>
324
-          <select name="codec">
325
-            <option>---</option>
326
-<?
327
-    foreach($this->Codecs as $Codec) {
328
-      echo "\t\t\t\t\t\t<option value=\"$Codec\"";
329
-      if ($Codec == ($Torrent['Codec'] ?? false)) {
330
-        echo " selected";
331
-      }
332
-      echo ">$Codec</option>\n";
333
-    }
334
-?>
335
-          </select>
336
-        </td>
337
-      </tr>
338
-      <tr id="resolution_tr">
339
-        <td class="label tooltip" title="How complete the sequence data is">Assembly Level</td>
340
-        <td>
341
-          <select id="ressel" name="ressel" onchange="SetResolution()">
342
-            <option value="">---</option>
343
-<?
344
-    foreach($this->Resolutions as $Res) {
345
-      echo "\t\t\t\t\t\t<option value=\"$Res\"";
346
-      if ($Res == ($Torrent['Resolution'] ?? false) || (!isset($FoundRes) && ($Torrent['Resolution'] ?? false) && $Res == "Other")) {
347
-        echo " selected";
348
-        $FoundRes = true;
349
-      }
350
-      echo ">$Res</option>\n";
351
-    }
352
-?>
353
-          </select>
354
-          <input type="text" id="resolution" name="resolution" size="10" class="hidden tooltip" pattern="[0-9]+x[0-9]+" title='Enter "Other" resolutions in the form ###x###' value="<?=($Torrent['Resolution']??'')?>" readonly></input>
355
-          <script>
356
-            if ($('#ressel').raw().value == "Other") {
357
-              $('#resolution').raw().readOnly = false
358
-              $('#resolution').gshow()
219
+
220
+    public function upload_form()
221
+    {
222
+        $QueryID = G::$DB->get_query_id();
223
+        $this->head();
224
+        $Torrent = $this->Torrent; ?>
225
+<table cellpadding="3" cellspacing="1" border="0" class="layout slice" width="100%">
226
+  <?php if ($this->NewTorrent) { ?>
227
+  <tr id="javdb_tr">
228
+    <td class="label tooltip" title="RefSeq accession number, e.g., NM_001183340.1">Accession Number</td>
229
+    <td>
230
+      <input type="text" id="catalogue" name="catalogue" size="10"
231
+        value="<?=display_str($Torrent['CatalogueNumber']) ?>"
232
+        <?=$this->Disabled?>/>
233
+      <?php if (!$this->DisabledFlag) { ?>
234
+      <input type="button" autofill="jav" value="Autofill" style="background: lightgrey; pointer-events: none;"></input>
235
+      <?php } ?>
236
+    </td>
237
+  </tr>
238
+  <tr id="anidb_tr" class="hidden">
239
+    <td class="label">AniDB Autofill (optional)</td>
240
+    <td>
241
+      <input type="text" id="anidb" size="10" <?=$this->Disabled?>/>
242
+      <?php if (!$this->DisabledFlag) { ?>
243
+      <input type="button" autofill="anime" value="Autofill" />
244
+      <?php } ?>
245
+    </td>
246
+  </tr>
247
+  <tr id="ehentai_tr" class="hidden">
248
+    <td class="label">e-hentai URL (optional)</td>
249
+    <td>
250
+      <input type="text" id="catalogue" size="50" <?=$this->Disabled?> />
251
+      <?php if (!$this->DisabledFlag) { ?>
252
+      <input type="button" autofill="douj" value="Autofill" />
253
+      <?php } ?>
254
+    </td>
255
+  </tr>
256
+  <tr id="title_tr">
257
+    <td class="label tooltip" title="FASTA definition line, e.g., Alcohol dehydrogenase ADH1">Sequence Name</td>
258
+    <td><input type="text" id="title" name="title" size="60"
259
+        value="<?=display_str($Torrent['Title']) ?>"
260
+        <?=$this->Disabled?>/></td>
261
+  </tr>
262
+  <tr id="title_rj_tr">
263
+    <td class="label tooltip" title="FASTA organism line binomial nomenclature, e.g., Saccharomyces cerevisiae">Organism
264
+    </td>
265
+    <td><input type="text" id="title_rj" name="title_rj" size="60"
266
+        value="<?=display_str($Torrent['TitleRJ']) ?>"
267
+        <?=$this->Disabled?>/></td>
268
+  </tr>
269
+  <tr id="title_jp_tr">
270
+    <td class="label tooltip" title="FASTA organism line if applicable, e.g., S288C">Strain/Variety</td>
271
+    <td><input type="text" id="title_jp" name="title_jp" size="60"
272
+        value="<?=display_str($Torrent['TitleJP']) ?>"
273
+        <?=$this->Disabled?>/></td>
274
+  </tr>
275
+  <tr id="idols_tr">
276
+    <td class="label tooltip" title="FASTA authors line, e.g., Robert K. Mortimer and David Schild">Collaborator(s)</td>
277
+    <td id="idolfields">
278
+      <?php      if (!empty($Torrent['Artists'])) {
279
+            foreach ($Torrent['Artists'] as $Num => $Artist) { ?>
280
+      <input type="text" id="idols_<?=$Num?>" name="idols[]"
281
+        size="45"
282
+        value="<?=display_str($Artist['name'])?>"
283
+        <?=$this->Disabled?>/>
284
+      <?php if ($Num == 0) { ?>
285
+      <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
286
+      <?php }
359
             }
287
             }
360
-          </script>
361
-        </td>
362
-      </tr>
363
-<?    if ($this->NewTorrent) { ?>
364
-      <tr id="tags_tr">
365
-        <td class="label tooltip" title="Comma-seperated list of tags, n.b., use vanity.house for data you produced">Tags</td>
366
-        <td>
367
-<?
288
+        } else { ?>
289
+      <input type="text" id="idols_0" name="idols[]" size="45" value="" <?=$this->Disabled?> />
290
+      <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
291
+      <?php        } ?>
292
+    </td>
293
+  </tr>
294
+  <tr id="studio_tr">
295
+    <td class="label tooltip" title="Who produced the sequence, e.g., Lawrence Berkeley Laboratory">Department/Lab</td>
296
+    <td><input type="text" id="studio" name="studio" size="60"
297
+        value="<?=display_str($Torrent['Studio']) ?>"
298
+        <?=$this->Disabled?>/></td>
299
+  </tr>
300
+  <tr id="series_tr">
301
+    <td class="label tooltip" title="Their physical location, e.g., Berkeley, CA">Location</td>
302
+    <td><input type="text" id="series" name="series" size="60"
303
+        value="<?=display_str($Torrent['Series']) ?>"
304
+        <?=$this->Disabled?>/></td>
305
+  </tr>
306
+  <tr id="year_tr">
307
+    <td class="label tooltip" title="What year they published the sequence in">Year</td>
308
+    <td><input type="text" id="year" name="year" maxlength="4" size="5"
309
+        value="<?=display_str($Torrent['Year']) ?>"
310
+        <?=$this->Disabled?>/></td>
311
+  </tr>
312
+  <?php } ?>
313
+  <tr id="media_tr">
314
+    <td class="label tooltip" title="What class of sequencing technology they used">Platform</td>
315
+    <td>
316
+      <select name="media">
317
+        <option>---</option>
318
+        <?php
319
+    foreach ($this->Media as $Media) {
320
+        echo "\t\t\t\t\t\t<option value=\"$Media\"";
321
+        if ($Media == ($Torrent['Media'] ?? false)) {
322
+            echo " selected";
323
+        }
324
+        echo ">$Media</option>\n";
325
+    } ?>
326
+      </select>
327
+    </td>
328
+  </tr>
329
+  <tr id="archive_tr">
330
+    <td class="label tooltip" title="How the data is archived and compressed">Archive</td>
331
+    <td>
332
+      <select name='archive'>
333
+        <option>---</option>
334
+        <?php
335
+    foreach ($this->Archives as $Archive) {
336
+        echo "\t\t\t\t\t\t<option value=\"$Archive\"";
337
+        if ($Archive == ($Torrent['Archive'] ?? false)) {
338
+            echo ' selected';
339
+        }
340
+        echo ">$Archive</option>\n";
341
+    } ?>
342
+      </select>
343
+    </td>
344
+  </tr>
345
+  <tr id="container_tr">
346
+    <td class="label tooltip" title="What file format the sequence is in">Format</td>
347
+    <td>
348
+      <select name="container">
349
+        <option>---</option>
350
+        <?php
351
+    foreach ($this->Containers as $Cont) {
352
+        echo "\t\t\t\t\t\t<option value=\"$Cont\"";
353
+        if ($Cont == ($Torrent['Container'] ?? false)) {
354
+            echo " selected";
355
+        }
356
+        echo ">$Cont</option>\n";
357
+    } ?>
358
+      </select>
359
+    </td>
360
+  </tr>
361
+  <tr id="codec_tr">
362
+    <td class="label tooltip" title="What license the collaborators released the data under">License</td>
363
+    <td>
364
+      <select name="codec">
365
+        <option>---</option>
366
+        <?php
367
+    foreach ($this->Codecs as $Codec) {
368
+        echo "\t\t\t\t\t\t<option value=\"$Codec\"";
369
+        if ($Codec == ($Torrent['Codec'] ?? false)) {
370
+            echo " selected";
371
+        }
372
+        echo ">$Codec</option>\n";
373
+    } ?>
374
+      </select>
375
+    </td>
376
+  </tr>
377
+  <tr id="resolution_tr">
378
+    <td class="label tooltip" title="How complete the sequence data is">Assembly Level</td>
379
+    <td>
380
+      <select id="ressel" name="ressel" onchange="SetResolution()">
381
+        <option value="">---</option>
382
+        <?php
383
+    foreach ($this->Resolutions as $Res) {
384
+        echo "\t\t\t\t\t\t<option value=\"$Res\"";
385
+        if ($Res == ($Torrent['Resolution'] ?? false) || (!isset($FoundRes) && ($Torrent['Resolution'] ?? false) && $Res == "Other")) {
386
+            echo " selected";
387
+            $FoundRes = true;
388
+        }
389
+        echo ">$Res</option>\n";
390
+    } ?>
391
+      </select>
392
+      <input type="text" id="resolution" name="resolution" size="10" class="hidden tooltip" pattern="[0-9]+x[0-9]+"
393
+        title='Enter "Other" resolutions in the form ###x###'
394
+        value="<?=($Torrent['Resolution']??'')?>"
395
+        readonly></input>
396
+      <script>
397
+        if ($('#ressel').raw().value == "Other") {
398
+          $('#resolution').raw().readOnly = false
399
+          $('#resolution').gshow()
400
+        }
401
+      </script>
402
+    </td>
403
+  </tr>
404
+  <?php    if ($this->NewTorrent) { ?>
405
+  <tr id="tags_tr">
406
+    <td class="label tooltip" title="Comma-seperated list of tags, n.b., use vanity.house for data you produced">Tags
407
+    </td>
408
+    <td>
409
+      <?php
368
   $GenreTags = G::$Cache->get_value('genre_tags');
410
   $GenreTags = G::$Cache->get_value('genre_tags');
369
   if (!$GenreTags) {
411
   if (!$GenreTags) {
370
-    $DB->query("
412
+      $DB->query("
371
       SELECT Name
413
       SELECT Name
372
       FROM tags
414
       FROM tags
373
       WHERE TagType = 'genre'
415
       WHERE TagType = 'genre'
374
       ORDER BY Name");
416
       ORDER BY Name");
375
-    $GenreTags = $DB->collect('Name');
376
-    G::$Cache->cache_value('genre_tags', $GenreTags, 3600*6);
417
+      $GenreTags = $DB->collect('Name');
418
+      G::$Cache->cache_value('genre_tags', $GenreTags, 3600*6);
377
   }
419
   }
378
 ?>
420
 ?>
379
-          <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" <?=($this->DisabledFlag) ? ' disabled="disabled"' : ''?>>
380
-            <option>---</option>
381
-<? foreach (Misc::display_array($GenreTags) as $Genre) { ?>
382
-            <option value="<?=$Genre?>"><?=$Genre?></option>
383
-<? } ?>
384
-          </select>
385
-          <input type="text" id="tags" name="tags" size="60" value="<?=display_str(implode(', ', explode(',', $Torrent['TagList']))) ?>"<? Users::has_autocomplete_enabled('other'); ?> />
386
-          <p class="min_padding notes"></p>
387
-        </td>
388
-      </tr>
389
-      <tr id="cover_tr">
390
-        <td class="label tooltip" title="A meaningful picture, e.g., of the specimen">Picture</td>
391
-        <td><input type="text" id="image" name="image" size="60" value="<?=display_str($Torrent['Image']) ?>"<?=$this->Disabled?> /></td>
392
-      </tr>
393
-<? if (!$this->DisabledFlag && $this->NewTorrent) { ?>
394
-      <tr id="screenshots_tr">
395
-        <td class="label tooltip" title="Relevant publications that use the data">Publications</td>
396
-        <td>
397
-          <textarea rows="8" cols="60" name="screenshots" id="screenshots"><?=display_str($Torrent['Screenshots'])?></textarea>
398
-          <p>Enter up to 10 links to studies for the torrent, one per line. The system will automatically remove malformed or invalid links, as well as any links after the 10th. Remember to consult the <a href="/rules.php?p=upload#h1.4">rules for adding publications</a>.</p>
399
-          <p class="min_padding notes"></p>
400
-      </tr>
401
-<? } ?>
402
-<tr id="group_desc_tr">
403
-        <td class="label tooltip" title="General info about the gene or protein's function or significance">Torrent Group Description</td>
404
-        <td>
405
-          <p class="min_padding notes"></p>
406
-<?php new TEXTAREA_PREVIEW('album_desc', 'album_desc', display_str($Torrent['GroupDescription']), 60, 8, !$this->DisabledFlag, !$this->DisabledFlag, false, array($this->Disabled)); ?>
407
-        </td>
408
-      </tr>
409
-<?    } ?>
410
-      <tr id="release_desc_tr">
411
-        <td class="label tooltip" title="Specific info about what protocols and equipment helped generate the data">Torrent Description (optional)</td>
412
-        <td>
413
-          <p class="min_padding notes"></p>
414
-<?php new TEXTAREA_PREVIEW('release_desc', 'release_desc', display_str($Torrent['TorrentDescription']??''), 60, 8); ?>
415
-        </td>
416
-      </tr>
417
-      <tr id="censored_tr">
418
-        <td class="label tooltip" title="Whether the torrent contains raw reads or alignment data">Aligned Sequence?</td>
419
-        <td>
420
-          <input type="checkbox" name="censored" value="1" <?=(($Torrent['Censored'] ?? 0) ? 'checked ' : '')?>/>
421
-        </td>
422
-      </tr>
423
-      <tr id="anon_tr">
424
-        <td class="label tooltip" title="Hide your username from other users on the torrent details page">Upload Anonymously?</td>
425
-        <td><input type="checkbox" name="anonymous" value="1" <?=(($Torrent['Anonymous'] ?? false) ? 'checked ' : '')?>/></td>
426
-      </tr>
427
-    </table>
421
+      <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" <?=($this->DisabledFlag) ? ' disabled="disabled"' : ''?>>
422
+        <option>---</option>
423
+        <?php foreach (Misc::display_array($GenreTags) as $Genre) { ?>
424
+        <option value="<?=$Genre?>"><?=$Genre?>
425
+        </option>
426
+        <?php } ?>
427
+      </select>
428
+      <input type="text" id="tags" name="tags" size="60"
429
+        value="<?=display_str(implode(', ', explode(',', $Torrent['TagList']))) ?>"
430
+        <?php Users::has_autocomplete_enabled('other'); ?> />
431
+      <p class="min_padding notes"></p>
432
+    </td>
433
+  </tr>
434
+  <tr id="cover_tr">
435
+    <td class="label tooltip" title="A meaningful picture, e.g., of the specimen">Picture</td>
436
+    <td><input type="text" id="image" name="image" size="60"
437
+        value="<?=display_str($Torrent['Image']) ?>"
438
+        <?=$this->Disabled?> /></td>
439
+  </tr>
440
+  <?php if (!$this->DisabledFlag && $this->NewTorrent) { ?>
441
+  <tr id="screenshots_tr">
442
+    <td class="label tooltip" title="Relevant publications that use the data">Publications</td>
443
+    <td>
444
+      <textarea rows="8" cols="60" name="screenshots"
445
+        id="screenshots"><?=display_str($Torrent['Screenshots'])?></textarea>
446
+      <p>Enter up to 10 links to studies for the torrent, one per line. The system will automatically remove malformed
447
+        or invalid links, as well as any links after the 10th. Remember to consult the <a
448
+          href="/rules.php?p=upload#h1.4">rules for adding publications</a>.</p>
449
+      <p class="min_padding notes"></p>
450
+  </tr>
451
+  <?php } ?>
452
+  <tr id="group_desc_tr">
453
+    <td class="label tooltip" title="General info about the gene or protein's function or significance">Torrent Group
454
+      Description</td>
455
+    <td>
456
+      <p class="min_padding notes"></p>
457
+      <?php new TEXTAREA_PREVIEW('album_desc', 'album_desc', display_str($Torrent['GroupDescription']), 60, 8, !$this->DisabledFlag, !$this->DisabledFlag, false, array($this->Disabled)); ?>
458
+    </td>
459
+  </tr>
460
+  <?php    } ?>
461
+  <tr id="release_desc_tr">
462
+    <td class="label tooltip" title="Specific info about what protocols and equipment helped generate the data">Torrent
463
+      Description (optional)</td>
464
+    <td>
465
+      <p class="min_padding notes"></p>
466
+      <?php new TEXTAREA_PREVIEW('release_desc', 'release_desc', display_str($Torrent['TorrentDescription']??''), 60, 8); ?>
467
+    </td>
468
+  </tr>
469
+  <tr id="censored_tr">
470
+    <td class="label tooltip" title="Whether the torrent contains raw reads or alignment data">Aligned Sequence?</td>
471
+    <td>
472
+      <input type="checkbox" name="censored" value="1" <?=(($Torrent['Censored'] ?? 0) ? 'checked ' : '')?>/>
473
+    </td>
474
+  </tr>
475
+  <tr id="anon_tr">
476
+    <td class="label tooltip" title="Hide your username from other users on the torrent details page">Upload
477
+      Anonymously?</td>
478
+    <td><input type="checkbox" name="anonymous" value="1" <?=(($Torrent['Anonymous'] ?? false) ? 'checked ' : '')?>/>
479
+    </td>
480
+  </tr>
481
+</table>
428
 
482
 
429
-<?
483
+<?php
430
     $this->foot();
484
     $this->foot();
431
-    G::$DB->set_query_id($QueryID);
432
-  }
433
-
485
+        G::$DB->set_query_id($QueryID);
486
+    }
434
 }
487
 }
435
-?>

Loading…
Cancel
Save