2020-12-26 01:42:23 +08:00
< ? php
2021-01-13 19:32:26 +08:00
require_once ( " ../include/bittorrent.php " );
2020-12-26 01:42:23 +08:00
dbconn ();
require_once ( get_langfile_path ());
2022-09-17 18:55:26 +08:00
require_once ( get_langfile_path ( 'edit.php' ));
2020-12-26 01:42:23 +08:00
loggedinorreturn ();
parked ();
if ( $CURUSER [ " uploadpos " ] == 'no' )
stderr ( $lang_upload [ 'std_sorry' ], $lang_upload [ 'std_unauthorized_to_upload' ], false );
2022-09-13 21:11:49 +08:00
if ( $enableoffer == 'yes' )
$has_allowed_offer = get_row_count ( " offers " , " WHERE allowed='allowed' AND userid = " . sqlesc ( $CURUSER [ " id " ]));
else $has_allowed_offer = 0 ;
2020-12-26 01:42:23 +08:00
$uploadfreely = user_can_upload ( " torrents " );
2022-12-04 00:22:43 +08:00
$allowtorrents = ( $has_allowed_offer || $uploadfreely );
2020-12-26 01:42:23 +08:00
$allowspecial = user_can_upload ( " music " );
if ( ! $allowtorrents && ! $allowspecial )
stderr ( $lang_upload [ 'std_sorry' ], $lang_upload [ 'std_please_offer' ], false );
$allowtwosec = ( $allowtorrents && $allowspecial );
$brsectiontype = $browsecatmode ;
$spsectiontype = $specialcatmode ;
2022-09-14 19:05:29 +08:00
/*
2020-12-26 01:42:23 +08:00
$showsource = (( $allowtorrents && get_searchbox_value ( $brsectiontype , 'showsource' )) || ( $allowspecial && get_searchbox_value ( $spsectiontype , 'showsource' ))); //whether show sources or not
$showmedium = (( $allowtorrents && get_searchbox_value ( $brsectiontype , 'showmedium' )) || ( $allowspecial && get_searchbox_value ( $spsectiontype , 'showmedium' ))); //whether show media or not
$showcodec = (( $allowtorrents && get_searchbox_value ( $brsectiontype , 'showcodec' )) || ( $allowspecial && get_searchbox_value ( $spsectiontype , 'showcodec' ))); //whether show codecs or not
$showstandard = (( $allowtorrents && get_searchbox_value ( $brsectiontype , 'showstandard' )) || ( $allowspecial && get_searchbox_value ( $spsectiontype , 'showstandard' ))); //whether show standards or not
$showprocessing = (( $allowtorrents && get_searchbox_value ( $brsectiontype , 'showprocessing' )) || ( $allowspecial && get_searchbox_value ( $spsectiontype , 'showprocessing' ))); //whether show processings or not
$showteam = (( $allowtorrents && get_searchbox_value ( $brsectiontype , 'showteam' )) || ( $allowspecial && get_searchbox_value ( $spsectiontype , 'showteam' ))); //whether show teams or not
$showaudiocodec = (( $allowtorrents && get_searchbox_value ( $brsectiontype , 'showaudiocodec' )) || ( $allowspecial && get_searchbox_value ( $spsectiontype , 'showaudiocodec' ))); //whether show languages or not
2022-09-14 19:05:29 +08:00
*/
2021-01-15 22:13:46 +08:00
$settingMain = get_setting ( 'main' );
2022-09-05 01:46:38 +08:00
$torrentRep = new \App\Repositories\TorrentRepository ();
2022-09-14 19:05:29 +08:00
$searchBoxRep = new \App\Repositories\SearchBoxRepository ();
2022-10-30 17:30:24 +08:00
$tagRep = new \App\Repositories\TagRepository ();
2020-12-26 01:42:23 +08:00
stdhead ( $lang_upload [ 'head_upload' ]);
?>
< form id = " compose " enctype = " multipart/form-data " action = " takeupload.php " method = " post " name = " upload " >
< ? php
print ( " <p align= \" center \" > " . $lang_upload [ 'text_red_star_required' ] . " </p> " );
?>
2021-05-26 21:38:39 +08:00
< table border = " 1 " cellspacing = " 0 " cellpadding = " 5 " width = " 97% " >
2020-12-26 01:42:23 +08:00
< tr >
< td class = 'colhead' colspan = '2' align = 'center' >
2022-04-01 23:13:42 +08:00
< ? php echo $lang_upload [ 'text_tracker_url' ] ?> : <b><?php echo get_tracker_schema_and_host(true)?></b>
2020-12-26 01:42:23 +08:00
< ? php
2022-03-14 15:43:10 +08:00
if ( ! is_writable ( getFullDirectory ( $torrent_dir )))
2020-12-26 01:42:23 +08:00
print ( " <br /><br /><b>ATTENTION</b>: Torrent directory isn't writable. Please contact the administrator about this problem! " );
if ( ! $max_torrent_size )
print ( " <br /><br /><b>ATTENTION</b>: Max. Torrent Size not set. Please contact the administrator about this problem! " );
?>
</ td >
</ tr >
< ? php
tr ( $lang_upload [ 'row_torrent_file' ] . " <font color= \" red \" >*</font> " , " <input type= \" file \" class= \" file \" id= \" torrent \" name= \" file \" onchange= \" getname() \" /> \n " , 1 );
if ( $altname_main == 'yes' ){
tr ( $lang_upload [ 'row_torrent_name' ], " <b> " . $lang_upload [ 'text_english_title' ] . " </b> <input type= \" text \" style= \" width: 250px; \" name= \" name \" />
< b > " . $lang_upload['text_chinese_title'] . " </ b >& nbsp ; < input type = \ " text \" style= \" width: 250px \" name= \" cnname \" ><br /><font class= \" medium \" > " . $lang_upload [ 'text_titles_note' ] . " </font> " , 1 );
2022-09-05 01:46:38 +08:00
} else {
$autoFillText = $lang_upload [ 'fill_quality' ];
2022-09-05 02:16:06 +08:00
$nameInput = $torrentRep -> buildUploadFieldInput ( " name " , " " , $lang_upload [ 'text_torrent_name_note' ], $autoFillText );
2022-09-05 01:46:38 +08:00
tr ( $lang_upload [ 'row_torrent_name' ], $nameInput , 1 );
}
2020-12-26 01:42:23 +08:00
if ( $smalldescription_main == 'yes' )
2022-04-01 23:13:42 +08:00
tr ( $lang_upload [ 'row_small_description' ], " <input type= \" text \" style= \" width: 99%; \" name= \" small_descr \" /><br /><font class= \" medium \" > " . $lang_upload [ 'text_small_description_note' ] . " </font> " , 1 );
2020-12-26 01:42:23 +08:00
get_external_tr ();
2021-01-15 22:13:46 +08:00
if ( $settingMain [ 'enable_pt_gen_system' ] == 'yes' ) {
$ptGen = new \Nexus\PTGen\PTGen ();
echo $ptGen -> renderUploadPageFormInput ( " " );
}
2021-03-03 19:29:29 +08:00
if ( $enablenfo_main == 'yes' ) {
tr ( $lang_upload [ 'row_nfo_file' ], " <input type= \" file \" class= \" file \" name= \" nfo \" /><br /><font class= \" medium \" > " . $lang_upload [ 'text_only_viewed_by' ] . get_user_class_name ( $viewnfo_class , false , true , true ) . $lang_upload [ 'text_or_above' ] . " </font> " , 1 );
}
2023-02-11 16:08:48 +08:00
//price
2023-04-29 12:57:46 +08:00
if ( user_can ( 'torrent-set-price' ) && get_setting ( " torrent.paid_torrent_enabled " ) == " yes " ) {
$maxPrice = get_setting ( " torrent.max_price " );
$pricePlaceholder = " " ;
if ( $maxPrice > 0 ) {
$pricePlaceholder = nexus_trans ( " label.torrent.max_price_help " , [ " max_price " => $maxPrice ]);
}
tr ( nexus_trans ( 'label.torrent.price' ), '<input type="number" min="0" name="price" placeholder="' . $pricePlaceholder . '" /> ' . nexus_trans ( 'label.torrent.price_help' , [ 'tax_factor' => ( floatval ( get_setting ( 'torrent.tax_factor' , 0 )) * 100 ) . '%' ]), 1 );
2023-02-11 16:08:48 +08:00
}
2020-12-26 01:42:23 +08:00
print ( " <tr><td class= \" rowhead \" style='padding: 3px' valign= \" top \" > " . $lang_upload [ 'row_description' ] . " <font color= \" red \" >*</font></td><td class= \" rowfollow \" > " );
2022-04-01 23:13:42 +08:00
textbbcode ( " upload " , " descr " , " " , false , 130 , true );
2020-12-26 01:42:23 +08:00
print ( " </td></tr> \n " );
2021-03-16 23:28:37 +08:00
if ( $settingMain [ 'enable_technical_info' ] == 'yes' ) {
2022-04-01 23:13:42 +08:00
tr ( $lang_functions [ 'text_technical_info' ], '<textarea name="technical_info" rows="8" style="width: 99%;"></textarea><br/>' . $lang_functions [ 'text_technical_info_help_text' ], 1 );
2021-03-16 23:28:37 +08:00
}
2020-12-26 01:42:23 +08:00
if ( $allowtorrents ){
$disablespecial = " onchange= \" disableother('browsecat','specialcat') \" " ;
2022-09-19 16:27:04 +08:00
$s = " <select name= \" type \" id= \" browsecat \" data-mode=' $browsecatmode ' " . ( $allowtwosec ? $disablespecial : " " ) . " > \n <option value= \" 0 \" > " . $lang_upload [ 'select_choose_one' ] . " </option> \n " ;
2020-12-26 01:42:23 +08:00
$cats = genrelist ( $browsecatmode );
foreach ( $cats as $row )
$s .= " <option value= \" " . $row [ " id " ] . " \" > " . htmlspecialchars ( $row [ " name " ]) . " </option> \n " ;
$s .= " </select> \n " ;
}
else $s = " " ;
if ( $allowspecial ){
$disablebrowse = " onchange= \" disableother('specialcat','browsecat') \" " ;
2022-09-19 16:27:04 +08:00
$s2 = " <select name= \" type \" id= \" specialcat \" data-mode=' $specialcatmode ' " . $disablebrowse . " > \n <option value= \" 0 \" > " . $lang_upload [ 'select_choose_one' ] . " </option> \n " ;
2020-12-26 01:42:23 +08:00
$cats2 = genrelist ( $specialcatmode );
foreach ( $cats2 as $row )
$s2 .= " <option value= \" " . $row [ " id " ] . " \" > " . htmlspecialchars ( $row [ " name " ]) . " </option> \n " ;
$s2 .= " </select> \n " ;
}
else $s2 = " " ;
tr ( $lang_upload [ 'row_type' ] . " <font color= \" red \" >*</font> " , ( $allowtwosec ? $lang_upload [ 'text_to_browse_section' ] : " " ) . $s . ( $allowtwosec ? $lang_upload [ 'text_to_special_section' ] : " " ) . $s2 . ( $allowtwosec ? $lang_upload [ 'text_type_note' ] : " " ), 1 );
2022-09-14 19:05:29 +08:00
/*
2020-12-26 01:42:23 +08:00
if ( $showsource || $showmedium || $showcodec || $showaudiocodec || $showstandard || $showprocessing ){
if ( $showsource ){
$source_select = torrent_selection ( $lang_upload [ 'text_source' ], " source_sel " , " sources " );
}
else $source_select = " " ;
if ( $showmedium ){
$medium_select = torrent_selection ( $lang_upload [ 'text_medium' ], " medium_sel " , " media " );
}
else $medium_select = " " ;
if ( $showcodec ){
$codec_select = torrent_selection ( $lang_upload [ 'text_codec' ], " codec_sel " , " codecs " );
}
else $codec_select = " " ;
if ( $showaudiocodec ){
$audiocodec_select = torrent_selection ( $lang_upload [ 'text_audio_codec' ], " audiocodec_sel " , " audiocodecs " );
}
else $audiocodec_select = " " ;
if ( $showstandard ){
$standard_select = torrent_selection ( $lang_upload [ 'text_standard' ], " standard_sel " , " standards " );
}
else $standard_select = " " ;
if ( $showprocessing ){
$processing_select = torrent_selection ( $lang_upload [ 'text_processing' ], " processing_sel " , " processings " );
}
else $processing_select = " " ;
2021-05-26 21:38:39 +08:00
2020-12-26 01:42:23 +08:00
tr ( $lang_upload [ 'row_quality' ], $source_select . $medium_select . $codec_select . $audiocodec_select . $standard_select . $processing_select , 1 );
}
if ( $showteam ){
if ( $showteam ){
$team_select = torrent_selection ( $lang_upload [ 'text_team' ], " team_sel " , " teams " );
}
else $showteam = " " ;
tr ( $lang_upload [ 'row_content' ], $team_select , 1 );
}
2022-09-14 19:05:29 +08:00
*/
2022-09-19 16:27:04 +08:00
$customField = new \Nexus\Field\Field ();
2022-10-25 19:16:56 +08:00
$hitAndRunRep = new \App\Repositories\HitAndRunRepository ();
2022-09-14 19:05:29 +08:00
if ( $allowtorrents ) {
2022-10-27 20:21:54 +08:00
$selectNormal = $searchBoxRep -> renderTaxonomySelect ( $browsecatmode );
tr ( $lang_upload [ 'row_quality' ], $selectNormal , 1 , " mode_ $browsecatmode " );
2022-10-25 19:16:56 +08:00
echo $customField -> renderOnUploadPage ( 0 , $browsecatmode );
echo $hitAndRunRep -> renderOnUploadPage ( '' , $browsecatmode );
2022-10-30 17:30:24 +08:00
tr ( $lang_functions [ 'text_tags' ], $tagRep -> renderCheckbox ( $browsecatmode ), 1 , " mode_ $browsecatmode " );
2022-09-14 19:05:29 +08:00
}
if ( $allowspecial ) {
2022-10-27 20:21:54 +08:00
$selectNormal = $searchBoxRep -> renderTaxonomySelect ( $specialcatmode );
tr ( $lang_upload [ 'row_quality' ], $selectNormal , 1 , " mode_ $specialcatmode " );
2022-09-19 16:27:04 +08:00
echo $customField -> renderOnUploadPage ( 0 , $specialcatmode );
2022-10-01 00:11:22 +08:00
echo $hitAndRunRep -> renderOnUploadPage ( '' , $specialcatmode );
2022-10-30 17:30:24 +08:00
tr ( $lang_functions [ 'text_tags' ], $tagRep -> renderCheckbox ( $specialcatmode ), 1 , " mode_ $specialcatmode " );
2022-09-14 19:05:29 +08:00
}
2020-12-26 01:42:23 +08:00
//==== offer dropdown for offer mod from code by S4NE
2020-12-28 20:52:54 +08:00
$offerres = sql_query ( " SELECT id, name FROM offers WHERE userid = " . sqlesc ( $CURUSER [ 'id' ]) . " AND allowed = 'allowed' ORDER BY name ASC " ) or sqlerr ( __FILE__ , __LINE__ );
2020-12-26 01:42:23 +08:00
if ( mysql_num_rows ( $offerres ) > 0 )
{
$offer = " <select name= \" offer \" ><option value= \" 0 \" > " . $lang_upload [ 'select_choose_one' ] . " </option> " ;
while ( $offerrow = mysql_fetch_array ( $offerres ))
$offer .= " <option value= \" " . $offerrow [ " id " ] . " \" > " . htmlspecialchars ( $offerrow [ " name " ]) . " </option> " ;
$offer .= " </select> " ;
tr ( $lang_upload [ 'row_your_offer' ] . ( ! $uploadfreely && ! $allowspecial ? " <font color=red>*</font> " : " " ), $offer . $lang_upload [ 'text_please_select_offer' ] , 1 );
2022-05-25 02:15:41 +08:00
$getOfferJs = <<< JS
jQuery ( 'select[name="offer"]' ) . on ( " change " , function () {
let id = this . value
if ( id == 0 ) {
return
}
let params = { action : " getOffer " , params : { id : id }}
jQuery . post ( " ajax.php " , params , function ( response ) {
console . log ( response )
if ( response . ret != 0 ) {
alert ( response . msg )
return
}
jQuery ( " #name " ) . val ( response . data . name )
clearContent ()
doInsert ( response . data . descr , '' , false )
2022-05-29 15:19:16 +08:00
jQuery ( " #specialcat " ) . prop ( 'disabled' , false ) . val ( 0 )
jQuery ( " #browsecat " ) . prop ( 'disabled' , false ) . val ( response . data . category )
2022-05-25 02:15:41 +08:00
}, 'json' )
})
JS ;
\Nexus\Nexus :: js ( $getOfferJs , 'footer' , false );
2020-12-26 01:42:23 +08:00
}
//===end
2022-09-17 18:55:26 +08:00
//pick
$pickcontent = '' ;
if ( user_can ( 'torrentsticky' ))
{
$options = [];
foreach ( \App\Models\Torrent :: listPosStates () as $key => $value ) {
$options [] = " <option " . (( $row [ " pos_state " ] == $key ) ? " selected= \" selected \" " : " " ) . " value= \" " . $key . " \" > " . $value [ 'text' ] . " </option> " ;
}
$pickcontent .= " <b> " . $lang_edit [ 'row_torrent_position' ] . " : </b> " . " <select name= \" pos_state \" style= \" width: 100px; \" > " . implode ( '' , $options ) . " </select> " ;
2022-12-20 22:24:31 +08:00
$pickcontent .= datetimepicker_input ( 'pos_state_until' , '' , nexus_trans ( 'label.deadline' ) . " : " , [ 'require_files' => true ]);
2022-09-17 18:55:26 +08:00
}
if ( user_can ( 'torrentmanage' ) && ( $CURUSER [ " picker " ] == 'yes' || get_user_class () >= \App\Models\User :: CLASS_SYSOP ))
{
if ( $pickcontent ) $pickcontent .= '<br />' ;
$pickcontent .= " <b> " . $lang_edit [ 'row_recommended_movie' ] . " : </b> " . " <select name= \" picktype \" style= \" width: 100px; \" > " ;
foreach ( \App\Models\Torrent :: listPickInfo ( true ) as $_pick_type => $_pick_type_text ) {
$pickcontent .= sprintf ( '<option value="%s">%s</option>' , $_pick_type , $_pick_type_text );
}
$pickcontent .= '</select>' ;
}
if ( $pickcontent ) {
tr ( $lang_edit [ 'row_pick' ], $pickcontent , 1 );
}
2022-08-20 19:11:28 +08:00
if ( user_can ( 'beanonymous' ))
2020-12-26 01:42:23 +08:00
{
tr ( $lang_upload [ 'row_show_uploader' ], " <input type= \" checkbox \" name= \" uplver \" value= \" yes \" /> " . $lang_upload [ 'checkbox_hide_uploader_note' ], 1 );
}
?>
< tr >< td class = " toolbox " align = " center " colspan = " 2 " >< b >< ? php echo $lang_upload [ 'text_read_rules' ] ?> </b> <input id="qr" type="submit" class="btn" value="<?php echo $lang_upload['submit_upload']?>" /></td></tr>
</ table >
</ form >
< ? php
2022-04-14 00:52:28 +08:00
\Nexus\Nexus :: js ( 'vendor/jquery-loading/jquery.loading.min.js' , 'footer' , true );
\Nexus\Nexus :: js ( 'js/ptgen.js' , 'footer' , true );
2022-09-19 16:27:04 +08:00
$customFieldJs = <<< JS
jQuery ( " #compose " ) . on ( " change " , " select[name=type] " , function () {
let _this = jQuery ( this );
let mode = _this . attr ( " data-mode " );
let value = _this . val ();
console . log ( mode )
jQuery ( " tr[relation] " ) . hide ();
if ( value > 0 ) {
jQuery ( " tr[relation=mode_ " + mode + " ] " ) . show ();
}
})
jQuery ( " tr[relation] " ) . hide ();
JS ;
\Nexus\Nexus :: js ( $customFieldJs , 'footer' , false );
2020-12-26 01:42:23 +08:00
stdfoot ();