NewTorrent = $NewTorrent; $this->Torrent = $Torrent; $this->Error = $Error; $this->UploadForm = $UploadForm; $this->Categories = $Categories; $this->TorrentID = $TorrentID; # Platforms # See classes/config.php $this->SeqPlatforms = $SeqPlatforms; $this->GraphPlatforms = $GraphPlatforms; $this->ImgPlatforms = $ImgPlatforms; $this->DocPlatforms = $DocPlatforms; $this->RawPlatforms = $RawPlatforms; #$this->Media = $Media; #$this->MediaManga = $MediaManga; # Formats # See classes/config.php $this->SeqFormats = $SeqFormats; $this->ProtFormats = $ProtFormats; $this->GraphXmlFormats = $GraphXmlFormats; $this->GraphTxtFormats = $GraphTxtFormats; $this->ImgFormats = $ImgFormats; $this->MapVectorFormats = $MapVectorFormats; $this->MapRasterFormats = $MapRasterFormats; $this->BinDocFormats = $BinDocFormats; $this->CpuGenFormats = $CpuGenFormats; $this->PlainFormats = $PlainFormats; #$this->Containers = $Containers; #$this->ContainersGames = $ContainersGames; #$this->ContainersProt = $ContainersProt; #$this->ContainersExtra = $ContainersExtra; # Misc $this->Codecs = $Codecs; $this->Archives = $Archives; $this->Resolutions = $Resolutions; # Deprecated #$this->ArchivesManga = $ArchivesManga; #$this->Formats = $Formats; #$this->AudioFormats = $AudioFormats; #$this->Bitrates = $Bitrates; #$this->Platform = $Platform; # Quick constructor test if ($this->Torrent && $this->Torrent['GroupID']) { $this->Disabled = ' readonly="readonly"'; $this->DisabledFlag = true; } } /** * ======================== * = New functional class = * ======================== * * Contains functions that output discreet torrent form fields. * Useful for NewTorrent) { $HTML = <<

Please consult the Upload Rules and the Categories Wiki to help fill out the upload form correctly.

The site adds the Announce and Source automatically. Just download and seed the new torrent after uploading it.

HTML; } # fi NewTorrent return $HTML; } /** * Announce URLs * * Announce URLs displayed on the form. * They're added to torrents in torrentsdl.class.php. * Bio Gazelle supports tiered swarms, T1 private and T2 public. */ public function announceSource() { if ($this->NewTorrent) { $HTML = ''; } # fi NewTorrent return $HTML; } /** * Display torrent upload errors */ public function error() { if ($this->NewTorrent) { if ($this->Error) { echo <<

$this->Error

HTML; } } # fi NewTorrent } /** * head * * Everything until the catalogue number field. * Server-side torrent scrubbing admonishment. */ public function head() { $ENV = ENV::go(); G::$DB->query( " SELECT COUNT(`ID`) FROM `torrents` WHERE `UserID` = ".G::$LoggedUser['ID'] ); list($Uploads) = G::$DB->next_record(); # Torrent form hidden values $AuthKey = G::$LoggedUser['AuthKey']; $HTML = << HTML; if (!$this->NewTorrent) { # Edit form hidden fields $TorrentID = display_str($this->TorrentID); $CategoryID = display_str($this->Torrent['CategoryID'] - 1); $HTML .= << HTML; } # fi !NewTorrent else { # Torrent upload hidden fields if ($this->Torrent && $this->Torrent['GroupID']) { $GroupID = display_str($this->Torrent['GroupID']); $CategoryID = display_str($this->Torrent['CategoryID'] - 1); $HTML .= << HTML; } # Request hidden fields (new or edit?) if ($this->Torrent && ($this->Torrent['RequestID'] ?? false)) { $RequestID = display_str($this->Torrent['RequestID']); $HTML .= << HTML; } } # else /** * Start printing the torrent form */ $HTML .= ''; return $HTML; } /** * New torrent options: file */ public function basicInfo() { $ENV = ENV::go(); if ($this->NewTorrent) { $HTML = '

Basic Info

'; $HTML .= << HTML; } # fi NewTorrent /** * New torrent options: category */ if ($this->NewTorrent) { $DisabledFlag = ($this->DisabledFlag) ? ' disabled="disabled"' : ''; $HTML .= <<

Set the private flag, e.g., mktorrent -p -a <announce> <target folder>

HTML; } # fi NewTorrent # Start the dynamic form $HTML .= '
'; return $HTML; } # End head() /** * foot * * Make the endmatter. */ public function foot() { $Torrent = $this->Torrent; echo ' HTML; } } # fi !NewTorrent /** * Rules notice */ echo <<'; /** * Submit button */ $Value = ($this->NewTorrent) ? 'Upload' : 'Edit'; echo <<
HTML; /** * Freeleech reasons */ $FL = array('N/A', 'Staff Pick', 'Perma-FL', 'Freeleechizer', 'Site-Wide FL'); foreach ($FL as $Key => $Name) { $Selected = ($Key === $Torrent['FreeLeechType']) ? ' selected="selected"' : ''; echo << $Name HTML; } echo <<
HTML; } # End foot() /** * upload_form * * Finally the "real" upload form. * Contains all the field you'd expect. * * This is currently one enormous function. * It has sub-functions, variables, and everything. * It continues to the end of the class. */ public function upload_form() { $ENV = ENV::go(); $QueryID = G::$DB->get_query_id(); #$this->head(); #echo $this->basicInfo(); $Torrent = $this->Torrent; # Start printing the form echo '

Torrent Form

'; echo ''; /** * Accession Number * * The headings below refer to a new generic input schema. * The HTML labels and various user-visible text should come from $ENV. * * RecursiveArrayObject->toArray() returns arrays from, e.g., $ENV->A->B->C. * This makes it easy to get and program with any subset of config objects. */ $CatalogueNumber = display_str($Torrent['CatalogueNumber']); $Disabled = $this->Disabled; # DOI echo << HTML; # RefSeq $DisabledFlagInput = (!$this->DisabledFlag) ? '' : null; echo << HTML; # UniProt $DisabledFlagInput = (!$this->DisabledFlag) ? '' : null; echo << HTML; /** * Semantic Version */ $AudioFormat = display_str($Torrent['AudioFormat']); echo << HTML; /** * Title fields * * Gazelle has three title fields available, regrettably hardcoded. * Ideally we could rank them in importance in the site ontology, * then update one config file to apply custom metadata across the board. */ # New torrent upload if ($this->NewTorrent) { $Disabled = $this->Disabled; /** * Title 1 */ $Title1 = display_str($Torrent['Title']); echo << HTML; /** * Title 2 */ $Title2 = display_str($Torrent['Title2']); echo << HTML; /** * Title 3 */ $Title3 = display_str($Torrent['TitleJP']); echo << HTML; } # fi NewTorrent /** * Creator(s) * CURRENTLY BROKEN * * Gazelle supports multiple creators per torrent. * One day I want to integrate the creator DB to join: * - DOI publication info in `torrents_screenshots` * - Attributions listed on the creator pages * - Stats about creator vs. total DOI citations */ if ($this->NewTorrent) { # Useful variables $Disabled = $this->Disabled; $AutocompleteOption = Users::has_autocomplete_enabled('other'); $AddRemoveBrackets = <<+ HTML; echo <<'; } # fi $NewTorrent /** * Affiliation * * The company, studio, lab, etc., that did the work. * todo: Add creator affiliation and pick a predetermined one * (in our case, last author's institution). */ if ($this->NewTorrent) { $Affiliation = display_str($Torrent['Studio']); echo << HTML; } /** * Location * * The location of the studio, lab, etc. * Currently not sanitized to a standard format. */ if ($this->NewTorrent) { $TorrentLocation = display_str($Torrent['Series']); echo << HTML; } # fi NewTorrent /** * ============================ * = End if NewTorrent fields = * ============================ */ /** * Year */ $TorrentYear = display_str($Torrent['Year']); echo << HTML; /** * Misc meta * * Used in OT Gazelle as Codec. * Used in Bio Gazelle as License. * * Unsure what to call the final field. * Some essential, specific one-off info. */ echo << HTML; /** * ==================================== * = Begin if NewTorrent fields again = * ==================================== */ /** * Media * * The class of technology associated with the data. * Answers the question: "Where does the data come from?" * * This could be the data genesis platform or program, * or a genre of physical media (e.g., vinyl record). */ /** * Make select element * * Takes an ID, label, torrent, and media list. * Returns a media select option as on upload.php. */ function mediaSelect($trID = '', $Label = '', $Torrent = [], $Media = []) { echo << HTML; } # End mediaSelect() /** * Platform: Sequences */ if ($this->NewTorrent) { mediaSelect( $trID = 'media_tr', $Label = 'Platform', $Torrent = $Torrent, $Media = $this->SeqPlatforms ); /** * Platform: Graphs */ mediaSelect( $trID = 'media_graphs_tr', $Label = 'Platform', $Torrent = $Torrent, $Media = array_merge($this->GraphPlatforms, $this->SeqPlatforms) ); /** * Platform: Scalars/Vectors */ mediaSelect( $trID = 'media_scalars_vectors_tr', $Label = 'Platform', $Torrent = $Torrent, $Media = array_merge($this->GraphPlatforms, $this->ImgPlatforms) ); /** * Platform: Scalars/Vectors */ mediaSelect( $trID = 'media_images_tr', $Label = 'Platform', $Torrent = $Torrent, $Media = $this->ImgPlatforms ); /** * Platform: Documents */ mediaSelect( $trID = 'media_documents_tr', $Label = 'Platform', $Torrent = $Torrent, $Media = $this->DocPlatforms ); /** * Platform: Machine Data */ mediaSelect( $trID = 'media_machine_data_tr', $Label = 'Platform', $Torrent = $Torrent, $Media = $this->RawPlatforms ); } # fi NewTorrent else { $TorrentMedia = $Torrent['Media']; echo << HTML; } /** * Format * * Simple: the data's file format. * Called Container in OT Gazelle, same diff. * In the future, $ENV will automagically set this. */ function formatSelect($trID = '', $Label = '', $Torrent = [], $FileTypes = []) { echo << HTML; } # End formatSelect() /** * Format: Sequences */ formatSelect( $trID = 'container_tr', $Label = 'Format', $Torrent = $Torrent, $FileTypes = array_merge($this->SeqFormats, $this->ProtFormats, $this->PlainFormats) ); /** * Format: Graphs */ formatSelect( $trID = 'container_graphs_tr', $Label = 'Format', $Torrent = $Torrent, $FileTypes = array_merge($this->GraphXmlFormats, $this->GraphTxtFormats, $this->SeqFormats, $this->ProtFormats, $this->PlainFormats) ); /** * Format: Scalars/Vectors */ formatSelect( $trID = 'container_scalars_vectors_tr', $Label = 'Format', $Torrent = $Torrent, $FileTypes = array_merge($this->ImgFormats, $this->SeqFormats, $this->ProtFormats, $this->PlainFormats) ); /** * Format: Images */ formatSelect( $trID = 'container_images_tr', $Label = 'Format', $Torrent = $Torrent, $FileTypes = array_merge($this->ImgFormats, $this->PlainFormats) ); /** * Format: Spatial */ formatSelect( $trID = 'container_spatial_tr', $Label = 'Format', $Torrent = $Torrent, $FileTypes = array_merge($this->MapVectorFormats, $this->MapRasterFormats, $this->ImgFormats, $this->PlainFormats) ); /** * Format: Documents */ formatSelect( $trID = 'container_documents_tr', $Label = 'Format', $Torrent = $Torrent, $FileTypes = array_merge($this->BinDocFormats, $this->CpuGenFormats, $this->PlainFormats) ); /** * Format: Compression */ formatSelect( $trID = 'archive_tr', $Label = 'Archive', $Torrent = $Torrent, $FileTypes = $this->Archives ); /** * Scope * * How complete the data are. * Relatively, how much information does it contain? */ $TorrentResolution = ($Torrent['Resolution']) ?? ''; echo << HTML; /** * ==================================== * = Begin if NewTorrent fields again = * ==================================== */ /** * Tags * * Simple enough. * I won't rehash tag management. */ if ($this->NewTorrent) { echo << HTML; } # fi NewTorrent /** * Picture * * Another obvious field. */ if ($this->NewTorrent) { $TorrentImage = display_str($Torrent['Image']); $Disabled = $this->Disabled; echo << HTML; } /** * Mirrors * * This should be in the `torrents` table not `torrents_group`. * The intended use is for web seeds, Dat mirrors, etc. */ if (!$this->DisabledFlag && $this->NewTorrent) { $TorrentMirrors = display_str($Torrent['Mirrors']); echo << HTML; } /** * Samples * * Called Screenshots in OT Gazelle. * Called Publication in Bio Gazelle. * Eventually this will be a proper database in itself, * pulling info from DOI to populate the schema. */ if (!$this->DisabledFlag && $this->NewTorrent) { $TorrentSamples = display_str($Torrent['Screenshots']); echo << HTML; } /** * Torrent group description * * The text on the main torrent pages, * between torrent info and torrent comments, * visible even if individual torrents are collapsed. */ if ($this->NewTorrent) { echo <<'; } # fi NewTorrent /** * ============================ * = End if NewTorrent fields = * ============================ */ /** * Torrent description * * The test displayed when torrent info is expanded. * It should describe the specific torrent, not the group. */ echo <<'; /** * Boolean options * * Simple checkboxes that do stuff. * Currently checks for data annotations and anonymous uploads. * More fields could be created as the need arises. */ /** * Aligned/Annontated * * Called Censored in OT Gazelle. */ $TorrentAnnotated = ($Torrent['Censored'] ?? 0) ? ' checked' : ''; echo << HTML; /** * Upload Anonymously */ $TorrentAnonymous = ($Torrent['Anonymous'] ?? false) ? ' checked' : ''; echo << HTML; # End the giant dynamic form table echo '
$DisabledFlagInput
$DisabledFlagInput

Please see Semantic Versioning

One per field, e.g., Robert K. Mortimer [+] David Schild

HTML; # If there are already creators listed if (!empty($Torrent['Artists'])) { foreach ($Torrent['Artists'] as $Num => $Artist) { $ArtistName = display_str($Artist['name']); $AddRemoveBrackets = ($Num === 0) ?: null; echo << $AddRemoveBrackets HTML; } } else { echo << $AddRemoveBrackets HTML; } echo '

How complete the data is, specifically or conceptually

HTML; $GenreTags = G::$Cache->get_value('genre_tags'); if (!$GenreTags) { $DB->query(" SELECT `Name` FROM `tags` WHERE `TagType` = 'genre' ORDER BY `Name` "); $GenreTags = $DB->collect('Name'); G::$Cache->cache_value('genre_tags', $GenreTags, 3600*6); } # todo: Find a better place for these $Disabled = ($this->DisabledFlag) ? ' disabled="disabled"' : null; $TorrentTagList = display_str(implode(', ', explode(',', $Torrent['TagList']))); $AutocompleteOption = Users::has_autocomplete_enabled('other'); echo << HTML; foreach (Misc::display_array($GenreTags) as $Genre) { echo << $Genre HTML; } echo <<
HTML; new TEXTAREA_PREVIEW( $Name = 'album_desc', $ID = 'album_desc', $Value = display_str($Torrent['GroupDescription']) ?? '', $Placeholder = "General info about the torrent subject's function or significance", ); echo '
HTML; new TEXTAREA_PREVIEW( $Name = 'release_desc', $ID = 'release_desc', $Value = display_str($Torrent['TorrentDescription'] ?? ''), $Placeholder = 'Specific info about the protocols and equipment used to produce the data', ); echo '
  Whether the torrent contains alignments, annotations, or other structural metadata
  Hide your username from other users on the torrent details page
'; # Drink a stiff one $this->foot(); G::$DB->set_query_id($QueryID); } # End upload_form() } # End TorrentForm()