2020-12-26 01:42:23 +08:00
< ? php
ob_start (); //Do not delete this line
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 ());
loggedinorreturn ();
2021-01-06 00:56:13 +08:00
$id = intval ( $_GET [ " id " ] ? ? 0 );
2021-03-04 20:43:55 +08:00
$customField = new \Nexus\Field\Field ();
2024-10-31 01:55:16 +08:00
int_check ( $id , true );
2020-12-26 01:42:23 +08:00
if ( ! isset ( $id ) || ! $id )
die ();
2022-10-27 20:21:54 +08:00
$taxonomyFields = " sources.name AS source_name, media.name AS medium_name, codecs.name AS codec_name, standards.name AS standard_name, processings.name AS processing_name, teams.name AS team_name, audiocodecs.name AS audiocodec_name " ;
2023-02-11 16:08:48 +08:00
$res = sql_query ( " SELECT torrents.cache_stamp, torrents.sp_state, torrents.url, torrents.small_descr, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, nfo, LENGTH(torrents.nfo) AS nfosz, torrents.last_action, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.numfiles, torrents.anonymous, torrents.pt_gen, torrents.technical_info, torrents.hr, torrents.promotion_until, torrents.promotion_time_type, torrents.approval_status, torrents.price,
2022-10-27 20:21:54 +08:00
categories . name AS cat_name , categories . mode as search_box_id , $taxonomyFields
2021-05-29 18:26:04 +08:00
FROM torrents LEFT JOIN categories ON torrents . category = categories . id
LEFT JOIN sources ON torrents . source = sources . id
LEFT JOIN media ON torrents . medium = media . id
LEFT JOIN codecs ON torrents . codec = codecs . id
LEFT JOIN standards ON torrents . standard = standards . id
LEFT JOIN processings ON torrents . processing = processings . id
LEFT JOIN teams ON torrents . team = teams . id
LEFT JOIN audiocodecs ON torrents . audiocodec = audiocodecs . id
WHERE torrents . id = $id LIMIT 1 " )
2020-12-26 01:42:23 +08:00
or sqlerr ();
$row = mysql_fetch_array ( $res );
2022-08-20 19:11:28 +08:00
if ( user_can ( 'torrentmanage' ) || $CURUSER [ " id " ] == $row [ " owner " ])
2020-12-26 01:42:23 +08:00
$owned = 1 ;
else $owned = 0 ;
2021-03-16 23:28:37 +08:00
$settingMain = get_setting ( 'main' );
2021-05-29 18:26:04 +08:00
if ( ! $row ) {
stderr ( $lang_details [ 'std_error' ], $lang_details [ 'std_no_torrent_id' ]);
} elseif (
2022-08-20 19:11:28 +08:00
( $row [ 'banned' ] == 'yes' && ! user_can ( 'seebanned' ) && $row [ 'owner' ] != $CURUSER [ 'id' ])
2023-02-08 13:33:25 +08:00
|| ( ! can_access_torrent ( $row , $CURUSER [ 'id' ]) && $row [ 'owner' ] != $CURUSER [ 'id' ])
2021-05-29 18:26:04 +08:00
) {
permissiondenied ();
} else {
2022-06-08 14:15:59 +08:00
$row = apply_filter ( 'torrent_detail' , $row );
2022-08-10 17:38:05 +08:00
$owner = \App\Models\User :: query () -> find ( $row [ 'owner' ]);
2022-03-14 12:10:54 +08:00
if ( ! $owner ) {
2022-03-14 14:51:58 +08:00
$owner = \App\Models\User :: defaultUser ();
2022-03-14 12:10:54 +08:00
}
2021-06-02 08:44:22 +08:00
$torrentRep = new \App\Repositories\TorrentRepository ();
2022-10-27 20:21:54 +08:00
$searchBoxRep = new \App\Repositories\SearchBoxRepository ();
2021-01-18 00:41:35 +08:00
$torrentUpdate = [];
2020-12-29 21:49:37 +08:00
if ( ! empty ( $_GET [ " hit " ])) {
2021-01-18 00:41:35 +08:00
$torrentUpdate [] = 'views = views + 1' ;
2020-12-26 01:42:23 +08:00
}
2021-01-18 19:45:33 +08:00
$imdb_id = parse_imdb_id ( $row [ " url " ]);
if ( $imdb_id && $showextinfo [ 'imdb' ] == 'yes' ) {
$imdb = new \Nexus\Imdb\Imdb ();
$movie = $imdb -> getMovie ( $imdb_id );
}
2020-12-26 01:42:23 +08:00
if ( ! isset ( $_GET [ " cmtpage " ])) {
stdhead ( $lang_details [ 'head_details_for_torrent' ] . " \" " . $row [ " name " ] . " \" " );
2020-12-29 21:49:37 +08:00
if ( ! empty ( $_GET [ " uploaded " ]))
2020-12-26 01:42:23 +08:00
{
print ( " <h1 align= \" center \" > " . $lang_details [ 'text_successfully_uploaded' ] . " </h1> " );
print ( " <p> " . $lang_details [ 'text_redownload_torrent_note' ] . " </p> " );
header ( " refresh: 1; url=download.php?id= $id " );
//header("refresh: 1; url=getimdb.php?id=$id&type=1");
}
2020-12-29 21:49:37 +08:00
elseif ( ! empty ( $_GET [ " edited " ])) {
2020-12-26 01:42:23 +08:00
print ( " <h1 align= \" center \" > " . $lang_details [ 'text_successfully_edited' ] . " </h1> " );
if ( isset ( $_GET [ " returnto " ]))
print ( " <p><b> " . $lang_details [ 'text_go_back' ] . " <a href= \" " . htmlspecialchars ( $_GET [ " returnto " ]) . " \" > " . $lang_details [ 'text_whence_you_came' ] . " </a></b></p> " );
2024-07-03 04:26:56 +08:00
} elseif ( ! empty ( $_GET [ 'existed' ])) {
print ( " <h1 align= \" center \" style='color: red'> " . $lang_details [ 'torrent_existed' ] . " </h1> " );
if ( isset ( $_GET [ " returnto " ]))
print ( " <p><b> " . $lang_details [ 'text_go_back' ] . " <a href= \" " . htmlspecialchars ( $_GET [ " returnto " ]) . " \" > " . $lang_details [ 'text_whence_you_came' ] . " </a></b></p> " );
}
2022-06-14 01:07:05 +08:00
$banned_torrent = ( $row [ " banned " ] == 'yes' ? " <b>(<font class= \" striking \" > " . $lang_functions [ 'text_banned' ] . " </font>)</b> " : " " );
2022-06-08 14:15:59 +08:00
$sp_torrent = get_torrent_promotion_append ( $row [ 'sp_state' ], 'word' , false , '' , 0 , '' , $row [ '__ignore_global_sp_state' ] ? ? false );
$sp_torrent_sub = get_torrent_promotion_append_sub ( $row [ 'sp_state' ], " " , true , $row [ 'added' ], $row [ 'promotion_time_type' ], $row [ 'promotion_until' ], $row [ '__ignore_global_sp_state' ] ? ? false );
2022-10-01 00:11:22 +08:00
$hrImg = get_hr_img ( $row , $row [ 'search_box_id' ]);
2022-06-24 14:55:10 +08:00
$approvalStatusIcon = $torrentRep -> renderApprovalStatus ( $row [ " approval_status " ]);
2023-02-11 16:08:48 +08:00
$paidIcon = $torrentRep -> getPaidIcon ( $row , 20 );
$s = htmlspecialchars ( $row [ " name " ]) . $banned_torrent . $paidIcon . ( $sp_torrent ? " " . $sp_torrent : " " ) . ( $sp_torrent_sub ) . $hrImg . $approvalStatusIcon ;
2020-12-26 01:42:23 +08:00
print ( " <h1 align= \" center \" id= \" top \" > " . $s . " </h1> \n " );
2022-06-15 15:43:33 +08:00
//Banned reason
if ( $row [ 'approval_status' ] == \App\Models\Torrent :: APPROVAL_STATUS_DENY ) {
$torrentOperationLog = \App\Models\TorrentOperationLog :: query ()
-> where ( 'torrent_id' , $row [ 'id' ])
-> where ( 'action_type' , \App\Models\TorrentOperationLog :: ACTION_TYPE_APPROVAL_DENY )
-> orderBy ( 'id' , 'desc' )
-> first ();
if ( $torrentOperationLog ) {
$dangerIcon = '<svg t="1655242121471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="46590" width="16" height="16"><path d="M963.555556 856.888889a55.978667 55.978667 0 0 1-55.978667 56.007111c-0.284444 0-0.540444-0.085333-0.824889-0.085333l-0.056889 0.085333H110.734222l-0.654222-1.137778A55.409778 55.409778 0 0 1 56.888889 856.462222c0-9.756444 2.730667-18.773333 7.139555-26.737778l-3.726222-6.599111L453.461333 156.302222A59.335111 59.335111 0 0 1 510.236444 113.777778c26.936889 0 49.436444 18.005333 56.803556 42.552889l389.973333 661.447111-3.669333 6.997333c6.4 9.102222 10.211556 20.138667 10.211556 32.113778z m-497.777778-541.326222l16.014222 312.888889h56.888889l16.014222-312.888889h-88.917333z m44.458666 398.222222a56.888889 56.888889 0 1 0-0.028444 113.749333 56.888889 56.888889 0 0 0 0.028444-113.749333z" p-id="46591" fill="#d81e06" data-spm-anchor-id="a313x.7781069.0.i61" class="selected"></path></svg>' ;
printf (
'<div style="display: flex; justify-content: center;margin-bottom: 10px"><div style="display: flex;background-color: black; color: white;font-weight: bold; padding: 10px 100px">%s %s</div></div>' ,
$dangerIcon , nexus_trans ( 'torrent.approval.deny_comment_show' , [ 'reason' => $torrentOperationLog -> comment ])
);
}
}
2021-05-26 21:38:39 +08:00
print ( " <table width= \" 97% \" cellspacing= \" 0 \" cellpadding= \" 5 \" > \n " );
2020-12-26 01:42:23 +08:00
$url = " edit.php?id= " . $row [ " id " ];
if ( isset ( $_GET [ " returnto " ])) {
$url .= " &returnto= " . rawurlencode ( $_GET [ " returnto " ]);
}
$editlink = " a title= \" " . $lang_details [ 'title_edit_torrent' ] . " \" href= \" $url\ " " ;
// ------------- start upped by block ------------------//
if ( $row [ 'anonymous' ] == 'yes' ) {
2022-10-12 01:42:43 +08:00
if ( ! user_can ( 'viewanonymous' ) && $row [ 'owner' ] != $CURUSER [ 'id' ])
2020-12-26 01:42:23 +08:00
$uprow = " <i> " . $lang_details [ 'text_anonymous' ] . " </i> " ;
else
2022-08-10 17:38:05 +08:00
$uprow = " <i> " . $lang_details [ 'text_anonymous' ] . " </i> ( " . get_username ( $row [ 'owner' ], false , true , true , false , false , true ) . " ) " ;
2020-12-26 01:42:23 +08:00
}
else {
2022-08-10 17:38:05 +08:00
$uprow = ( isset ( $row [ 'owner' ]) ? get_username ( $row [ 'owner' ], false , true , true , false , false , true ) : " <i> " . $lang_details [ 'text_unknown' ] . " </i> " );
2020-12-26 01:42:23 +08:00
}
if ( $CURUSER [ " id " ] == $row [ " owner " ])
$CURUSER [ " downloadpos " ] = " yes " ;
if ( $CURUSER [ " downloadpos " ] != " no " )
{
print ( " <tr><td class= \" rowhead \" width= \" 13% \" > " . $lang_details [ 'row_download' ] . " </td><td class= \" rowfollow \" width= \" 87% \" align= \" left \" > " );
if ( $CURUSER [ 'timetype' ] != 'timealive' )
$uploadtime = $lang_details [ 'text_at' ] . $row [ 'added' ];
else $uploadtime = $lang_details [ 'text_blank' ] . gettime ( $row [ 'added' ], true , false );
print ( " <a class= \" index \" href= \" download.php?id= $id\ " > " . htmlspecialchars( $torrentnameprefix . " . " . $row["save_as"] ) . " . torrent </ a >& nbsp ; & nbsp ; < a id = \ " bookmark0 \" href= \" javascript: bookmark( " . $row [ 'id' ] . " ,0); \" > " . get_torrent_bookmark_state ( $CURUSER [ 'id' ], $row [ 'id' ], false ) . " </a> " . $lang_details [ 'row_upped_by' ] . " " . $uprow . $uploadtime );
print ( " </td></tr> " );
}
else
tr ( $lang_details [ 'row_download' ], $lang_details [ 'text_downloading_not_allowed' ]);
if ( $smalldescription_main == 'yes' )
tr ( $lang_details [ 'row_small_description' ], htmlspecialchars ( trim ( $row [ " small_descr " ])), true );
2022-09-17 20:38:54 +08:00
//tag
$torrentTags = \App\Models\TorrentTag :: query () -> where ( 'torrent_id' , $row [ 'id' ]) -> get ();
if ( $torrentTags -> isNotEmpty ()) {
$tagRep = new \App\Repositories\TagRepository ();
2022-10-30 17:30:24 +08:00
tr ( $lang_details [ 'row_tags' ], $tagRep -> renderSpan ( $row [ 'search_box_id' ], $torrentTags -> pluck ( 'tag_id' ) -> toArray ()), true );
2022-09-17 20:38:54 +08:00
}
2020-12-26 01:42:23 +08:00
$size_info = " <b> " . $lang_details [ 'text_size' ] . " </b> " . mksize ( $row [ " size " ]);
$type_info = " <b> " . $lang_details [ 'row_type' ] . " :</b> " . $row [ " cat_name " ];
2022-10-27 20:21:54 +08:00
// $source_info = $medium_info = $codec_info = $audiocodec_info = $standard_info = $processing_info = $team_info = '';
// if (isset($row["source_name"]))
// $source_info = " <b>".$lang_details['text_source']." </b>".$row['source_name'];
// if (isset($row["medium_name"]))
// $medium_info = " <b>".$lang_details['text_medium']." </b>".$row['medium_name'];
// if (isset($row["codec_name"]))
// $codec_info = " <b>".$lang_details['text_codec']." </b>".$row['codec_name'];
// if (isset($row["standard_name"]))
// $standard_info = " <b>".$lang_details['text_stardard']." </b>".$row['standard_name'];
// if (isset($row["processing_name"]))
// $processing_info = " <b>".$lang_details['text_processing']." </b>".$row['processing_name'];
// if (isset($row["team_name"]))
// $team_info = " <b>".$lang_details['text_team']." </b>".$row['team_name'];
// if (isset($row["audiocodec_name"]))
// $audiocodec_info = " <b>".$lang_details['text_audio_codec']." </b>".$row['audiocodec_name'];
2020-12-26 01:42:23 +08:00
2022-10-27 20:21:54 +08:00
// tr($lang_details['row_basic_info'], $size_info.$type_info.$source_info . $medium_info. $codec_info . $audiocodec_info. $standard_info . $processing_info . $team_info, 1);
2020-12-26 01:42:23 +08:00
2022-10-27 20:21:54 +08:00
$taxonomyInfo = $searchBoxRep -> listTaxonomyInfo ( $row [ 'search_box_id' ], $row );
$taxonomyRendered = '' ;
foreach ( $taxonomyInfo as $item ) {
$taxonomyRendered .= sprintf ( ' <b>%s: </b>%s' , $item [ 'label' ], $item [ 'value' ]);
}
tr ( $lang_details [ 'row_basic_info' ], $size_info . $type_info . $taxonomyRendered , 1 );
2022-06-08 14:15:59 +08:00
$actions = [];
if ( $CURUSER [ " downloadpos " ] != " no " ) {
2023-02-11 16:08:48 +08:00
$hasBuy = \App\Models\TorrentBuyLog :: query () -> where ( 'uid' , $CURUSER [ 'id' ]) -> where ( 'torrent_id' , $id ) -> exists ();
if ( $row [ 'price' ] > 0 ) {
if ( $hasBuy ) {
$downloadBtn = $lang_details [ 'text_download_bought_torrent' ];
} else {
$downloadBtn = sprintf ( $lang_details [ 'text_download_paid_torrent' ], number_format ( $row [ 'price' ]));
}
} else {
$downloadBtn = $lang_details [ 'text_download_torrent' ];
}
$actions [] = " <a title= \" " . $lang_details [ 'title_download_torrent' ] . " \" href= \" download.php?id= " . $id . " \" ><img class= \" dt_download \" src= \" pic/trans.gif \" alt= \" download \" /> <b><font class= \" small \" > " . $downloadBtn . " </font></b></a> " ;
2022-06-08 14:15:59 +08:00
}
if ( $owned == 1 ) {
2022-08-24 14:31:34 +08:00
$actions [] = " < $editlink ><img class= \" dt_edit \" src= \" pic/trans.gif \" alt= \" edit \" /> <b><font class= \" small \" > " . ( user_can ( 'torrentmanage' ) ? $lang_details [ 'text_edit_and_delete_torrent' ] : $lang_details [ 'text_edit_torrent' ]) . " </font></b></a> " ;
2022-06-08 14:15:59 +08:00
}
2022-08-20 19:11:28 +08:00
if ( user_can ( 'askreseed' ) && $row [ 'seeders' ] == 0 ) {
2022-06-08 14:15:59 +08:00
$actions [] = " <a title= \" " . $lang_details [ 'title_ask_for_reseed' ] . " \" href= \" takereseed.php?reseedid= $id\ " >< img class = \ " dt_reseed \" src= \" pic/trans.gif \" alt= \" reseed \" > <b><font class= \" small \" > " . $lang_details [ 'text_ask_for_reseed' ] . " </font></b></a> " ;
}
2022-08-20 21:07:29 +08:00
if ( user_can ( 'torrent-approval' ) && ( get_setting ( 'torrent.approval_status_icon_enabled' ) == 'yes' || get_setting ( 'torrent.approval_status_none_visible' ) == 'no' )) {
2022-06-15 15:43:33 +08:00
$approvalIcon = '<svg t="1655224943277" class="icon" viewBox="0 0 1397 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="45530" width="16" height="16"><path d="M1396.363636 121.018182c0 0-223.418182 74.472727-484.072727 372.363636-242.036364 269.963636-297.890909 381.672727-390.981818 530.618182C512 1014.690909 372.363636 744.727273 0 549.236364l195.490909-186.181818c0 0 176.872727 121.018182 297.890909 344.436364 0 0 307.2-474.763636 902.981818-707.490909L1396.363636 121.018182 1396.363636 121.018182zM1396.363636 121.018182" p-id="45531" fill="#e78d0f"></path></svg>' ;
$actions [] = sprintf (
'<a href="javascript:;"><b><font id="approval" class="small approval" data-torrent_id="%s">%s %s</font></b></a>' ,
$row [ 'id' ], $approvalIcon , $lang_details [ 'action_approval' ]
);
2022-08-16 18:31:04 +08:00
$title = nexus_trans ( 'torrent.approval.modal_title' );
2022-06-15 15:43:33 +08:00
$js = <<< JS
jQuery ( '#approval' ) . on ( " click " , function () {
let torrentId = jQuery ( this ) . attr ( 'data-torrent_id' )
2022-08-16 18:31:04 +08:00
layer . open ({
type : 2 ,
title : '$title' ,
area : [ '60%' , '600px' ],
content : '/web/torrent-approval-page?torrent_id=' + torrentId ,
})
2022-06-15 15:43:33 +08:00
})
JS ;
\Nexus\Nexus :: js ( $js , 'footer' , false );
}
2022-06-08 14:15:59 +08:00
$actions = apply_filter ( 'torrent_detail_actions' , $actions , $row );
2022-06-15 15:43:33 +08:00
$actions [] = " <a title= \" " . $lang_details [ 'title_report_torrent' ] . " \" href= \" report.php?torrent= $id\ " >< img class = \ " dt_report \" src= \" pic/trans.gif \" alt= \" report \" /> <b><font class= \" small \" > " . $lang_details [ 'text_report_torrent' ] . " </font></b></a> " ;
2022-06-08 14:15:59 +08:00
tr ( $lang_details [ 'row_action' ], implode ( ' | ' , $actions ), 1 );
2022-05-05 22:19:48 +08:00
// ------------- start claim block ------------------//
$claimTorrentTTL = \App\Models\Claim :: getConfigTorrentTTL ();
2022-05-06 15:50:26 +08:00
if ( \App\Models\Claim :: getConfigIsEnabled () && \Carbon\Carbon :: parse ( $row [ 'added' ]) -> addDays ( $claimTorrentTTL ) -> lte ( \Carbon\Carbon :: now ())) {
2022-05-05 22:19:48 +08:00
$baseClaimQuery = \App\Models\Claim :: query () -> where ( 'torrent_id' , $id );
$claimCounts = ( clone $baseClaimQuery ) -> count ();
$isClaimed = ( clone $baseClaimQuery ) -> where ( 'uid' , $CURUSER [ 'id' ]) -> exists ();
if ( $isClaimed ) {
$inputValue = $lang_details [ 'claim_already' ];
$disabled = ' disabled' ;
} else {
$inputValue = $lang_details [ 'claim_now' ];
$disabled = '' ;
$claimJs = <<< JS
jQuery ( '#add-claim' ) . on ( 'click' , function () {
if ( ! window . confirm ( '{$lang_details[' claim_confirm ']}' )) {
return
}
let params = { action : " addClaim " , params : { " torrent_id " : jQuery ( this ) . attr ( 'data-torrent_id' )}}
jQuery . post ( " ajax.php " , params , function ( response ) {
console . log ( response )
if ( response . ret != 0 ) {
alert ( response . msg )
} else {
window . location . reload ()
}
}, 'json' )
})
JS ;
\Nexus\Nexus :: js ( $claimJs , 'footer' , false );
}
$maxUserCounts = get_setting ( 'torrent.claim_torrent_user_counts_up_limit' , \App\Models\Claim :: USER_UP_LIMIT );
$y = sprintf ( '<input type="button" value="%s" id="add-claim" data-torrent_id="%s"%s>' , $inputValue , $id , $disabled );
$y .= sprintf ( ' ' . $lang_details [ 'claim_info' ], $claimCounts , bcsub ( $maxUserCounts , $claimCounts ));
$y .= sprintf ( ' <b><a href="claim.php?torrent_id=%s">' . $lang_details [ 'claim_detail' ] . '</a></b>' , $id );
tr ( $lang_details [ 'claim_label' ], $y , 1 );
}
// ------------- end claim block ------------------//
2024-12-24 01:10:48 +08:00
tr ( $lang_details [ 'torrent_dl_url' ], sprintf ( '<a title="%s" href="%s">%s</a>' , $lang_details [ 'torrent_dl_url_notice' ], $torrentRep -> getDownloadUrl ( $id , $CURUSER ), $lang_details [ 'torrent_dl_url_text' ]), 1 );
2020-12-26 01:42:23 +08:00
// ---------------- start subtitle block -------------------//
2022-09-02 19:49:41 +08:00
$subTorrentIdArr = [ $row [ 'id' ]];
$otherCopiesIdArr = [];
if ( $imdb_id ) {
$otherCopiesIdArr = \App\Models\Torrent :: query () -> where ( 'url' , $imdb_id ) -> where ( 'id' , '!=' , $row [ 'id' ]) -> pluck ( 'id' ) -> toArray ();
2022-09-03 21:31:49 +08:00
// $subTorrentIdArr = array_merge($subTorrentIdArr, $otherCopiesIdArr);
2022-09-02 19:49:41 +08:00
}
$r = sql_query ( " SELECT subs.*, language.flagpic, language.lang_name FROM subs LEFT JOIN language ON subs.lang_id=language.id WHERE torrent_id in( " . implode ( ',' , $subTorrentIdArr ) . " ) ORDER BY subs.lang_id ASC " ) or sqlerr ( __FILE__ , __LINE__ );
2020-12-26 01:42:23 +08:00
print ( " <tr><td class= \" rowhead \" valign= \" top \" > " . $lang_details [ 'row_subtitles' ] . " </td> " );
print ( " <td class= \" rowfollow \" align= \" left \" valign= \" top \" > " );
print ( " <table border= \" 0 \" cellspacing= \" 0 \" > " );
if ( mysql_num_rows ( $r ) > 0 )
{
while ( $a = mysql_fetch_assoc ( $r ))
{
$lang = " <tr><td class= \" embedded \" ><img border= \" 0 \" src= \" pic/flag/ " . $a [ " flagpic " ] . " \" alt= \" " . $a [ " lang_name " ] . " \" title= \" " . $a [ " lang_name " ] . " \" style= \" padding-bottom: 4px \" /></td> " ;
2022-12-08 20:43:33 +08:00
$lang .= " <td class= \" embedded \" > <a href= \" downloadsubs.php?torrentid= " . $a [ 'torrent_id' ] . " &subid= " . $a [ 'id' ] . " \" ><u> " . htmlspecialchars ( $a [ " title " ]) . " </u></a> " . ( user_can ( 'submanage' ) || ( user_can ( 'delownsub' ) && $a [ " uppedby " ] == $CURUSER [ " id " ]) ? " <font class= \" small \" ><a href= \" subtitles.php?delete= " . $a [ 'id' ] . " \" >[ " . $lang_details [ 'text_delete' ] . " </a>]</font> " : " " ) . " </td><td class= \" embedded \" > " . ( $a [ " anonymous " ] == 'yes' ? $lang_details [ 'text_anonymous' ] . ( user_can ( 'viewanonymous' ) ? get_username ( $a [ 'uppedby' ], false , true , true , false , true ) : " " ) : get_username ( $a [ 'uppedby' ])) . " </td></tr> " ;
2020-12-26 01:42:23 +08:00
print ( $lang );
}
}
else
print ( " <tr><td class= \" embedded \" > " . $lang_details [ 'text_no_subtitles' ] . " </td></tr> " );
print ( " </table> " );
print ( " <table border= \" 0 \" cellspacing= \" 0 \" ><tr> " );
2022-08-25 16:02:50 +08:00
if ( $CURUSER [ 'id' ] == $row [ 'owner' ] || user_can ( 'uploadsub' ))
2020-12-26 01:42:23 +08:00
{
print ( " <td class= \" embedded \" ><form method= \" post \" action= \" subtitles.php \" ><input type= \" hidden \" name= \" torrent_name \" value= \" " . $row [ " name " ] . " \" /><input type= \" hidden \" name= \" detail_torrent_id \" value= \" " . $row [ " id " ] . " \" /><input type= \" hidden \" name= \" in_detail \" value= \" in_detail \" /><input type= \" submit \" value= \" " . $lang_details [ 'submit_upload_subtitles' ] . " \" /></form></td> " );
}
$moviename = " " ;
if ( $imdb_id && $showextinfo [ 'imdb' ] == 'yes' )
{
$thenumbers = $imdb_id ;
if ( ! $moviename = $Cache -> get_value ( 'imdb_id_' . $thenumbers . '_movie_name' )){
2021-01-19 00:55:34 +08:00
switch ( $imdb -> getCacheStatus ( $imdb_id )){
2020-12-26 01:42:23 +08:00
case " 1 " : {
$moviename = $movie -> title (); break ;
$Cache -> cache_value ( 'imdb_id_' . $thenumbers . '_movie_name' , $moviename , 1296000 );
}
default : break ;
}
}
}
2022-03-09 12:08:14 +08:00
print ( " <td class= \" embedded \" ><form method= \" get \" action= \" https://assrt.net/sub/ \" target= \" _blank \" ><input type= \" text \" name= \" searchword \" id= \" keyword \" style= \" width: 250px \" value= \" " . $moviename . " \" /><input type= \" submit \" value= \" " . $lang_details [ 'submit_search_at_shooter' ] . " \" /></form></td><td class= \" embedded \" ><form method= \" get \" action= \" https://www.opensubtitles.org/en/search2/ \" target= \" _blank \" ><input type= \" hidden \" id= \" moviename \" name= \" MovieName \" /><input type= \" hidden \" name= \" action \" value= \" search \" /><input type= \" hidden \" name= \" SubLanguageID \" value= \" all \" /><input onclick= \" document.getElementById('moviename').value=document.getElementById('keyword').value; \" type= \" submit \" value= \" " . $lang_details [ 'submit_search_at_opensubtitles' ] . " \" /></form></td> \n " );
2020-12-26 01:42:23 +08:00
print ( " </tr></table> " );
print ( " </td></tr> \n " );
// ---------------- end subtitle block -------------------//
2022-09-15 01:13:14 +08:00
//hook before desc
do_action ( 'torrent_detail_before_desc' , $row [ 'id' ], $CURUSER [ 'id' ]);
2021-03-04 20:43:55 +08:00
/**************start custom fields****************/
2022-09-19 16:27:04 +08:00
echo $customField -> renderOnTorrentDetailsPage ( $id , $row [ 'search_box_id' ]);
2021-03-04 20:43:55 +08:00
/**************end custom fields****************/
2021-03-18 20:32:35 +08:00
//technical info
if ( $settingMain [ 'enable_technical_info' ] == 'yes' ) {
$technicalInfo = new \Nexus\Torrent\TechnicalInformation ( $row [ 'technical_info' ] ? ? '' );
$technicalInfoResult = $technicalInfo -> renderOnDetailsPage ();
if ( ! empty ( $technicalInfoResult )) {
tr ( $lang_functions [ 'text_technical_info' ], $technicalInfoResult , 1 );
}
}
2020-12-26 01:42:23 +08:00
if ( $CURUSER [ 'showdescription' ] != 'no' && ! empty ( $row [ " descr " ])){
2021-03-16 23:28:37 +08:00
$torrentdetailad = $Advertisement -> get_ad ( 'torrentdetail' );
2022-06-08 14:15:59 +08:00
$desc = format_comment ( $row [ 'descr' ]);
$desc = apply_filter ( 'torrent_detail_description' , $desc , $row [ 'id' ], $CURUSER [ 'id' ]);
tr ( " <a href= \" javascript: klappe_news('descr') \" ><span class= \" nowrap \" ><img class= \" minus \" src= \" pic/trans.gif \" alt= \" Show/Hide \" id= \" picdescr \" title= \" " . ( $lang_details [ 'title_show_or_hide' ] ? ? '' ) . " \" /> " . $lang_details [ 'row_description' ] . " </span></a> " , " <div id='kdescr'> " . ( $Advertisement -> enable_ad () && $torrentdetailad ? " <div align= \" left \" style= \" margin-bottom: 10px \" id= \" \" > " . $torrentdetailad [ 0 ] . " </div> " : " " ) . $desc . " </div> " , 1 );
2020-12-26 01:42:23 +08:00
}
2022-08-20 19:11:28 +08:00
if ( user_can ( 'viewnfo' ) && $CURUSER [ 'shownfo' ] != 'no' && $row [ " nfosz " ] > 0 ){
2020-12-26 01:42:23 +08:00
if ( ! $nfo = $Cache -> get_value ( 'nfo_block_torrent_id_' . $id )){
2022-10-01 19:54:19 +08:00
$nfo = code_new ( $row [ " nfo " ], get_setting ( 'torrent.nfo_view_style_default' ));
2020-12-26 01:42:23 +08:00
$Cache -> cache_value ( 'nfo_block_torrent_id_' . $id , $nfo , 604800 );
}
2022-09-27 22:06:05 +08:00
tr ( " <a href= \" javascript: klappe_news('nfo') \" ><img class= \" plus \" src= \" pic/trans.gif \" alt= \" Show/Hide \" id= \" picnfo \" title= \" " . $lang_details [ 'title_show_or_hide' ] . " \" /> " . $lang_details [ 'text_nfo' ] . " </a><br /><a href= \" viewnfo.php?id= " . $row [ 'id' ] . " \" class= \" sublink \" > " . $lang_details [ 'text_view_nfo' ] . " </a> " , " <div id='knfo' style= \" display: none; \" ><pre style= \" font-size:10pt; font-family: 'Courier New', monospace;white-space: break-spaces \" > " . $nfo . " </pre></div> \n " , 1 );
2020-12-26 01:42:23 +08:00
}
if ( $imdb_id && $showextinfo [ 'imdb' ] == 'yes' && $CURUSER [ 'showimdb' ] != 'no' )
{
$thenumbers = $imdb_id ;
2022-04-14 00:52:28 +08:00
$Cache -> new_page ( 'imdb_id_' . $thenumbers . '_large' , 3600 * 24 , true );
2020-12-26 01:42:23 +08:00
if ( ! $Cache -> get_page ()){
2021-01-19 00:55:34 +08:00
switch ( $imdb -> getCacheStatus ( $imdb_id ))
2020-12-26 01:42:23 +08:00
{
case " 0 " : //cache is not ready, try to
{
2021-01-18 19:45:33 +08:00
if ( $row [ 'cache_stamp' ] == 0 || ( $row [ 'cache_stamp' ] != 0 && ( time () - $row [ 'cache_stamp' ]) > 120 )) //not exist or timed out
2020-12-26 01:42:23 +08:00
tr ( $lang_details [ 'text_imdb' ] . $lang_details [ 'row_info' ] , $lang_details [ 'text_imdb' ] . $lang_details [ 'text_not_ready' ] . " <a href= \" retriver.php?id= " . $id . " &type=1&siteid=1 \" > " . $lang_details [ 'text_here_to_retrieve' ] . $lang_details [ 'text_imdb' ], 1 );
else
2024-02-23 02:38:42 +08:00
tr ( $lang_details [ 'text_imdb' ] . $lang_details [ 'row_info' ] , " <img src= \" pic/progressbar.gif \" alt= \" \" /> " . $lang_details [ 'text_someone_has_requested' ] . min ( max ( time () - $row [ 'cache_stamp' ], 0 ), 120 ) . $lang_details [ 'text_please_be_patient' ], 1 );
2020-12-26 01:42:23 +08:00
break ;
}
case " 1 " :
{
reset_cachetimestamp ( $row [ 'id' ]);
2021-03-17 01:21:35 +08:00
if (( $photo_url = $movie -> photo () ) != FALSE )
2021-01-18 19:45:33 +08:00
$smallth = " <img src= \" " . $photo_url . " \" width= \" 105 \" onclick= \" Preview(this); \" alt= \" poster \" /> " ;
else
2022-04-14 00:52:28 +08:00
$smallth = " <img src= \" pic/imdb_pic/nophoto.gif \" alt= \" no poster \" /> " ;
2021-01-18 19:45:33 +08:00
$autodata = $imdb -> renderDetailsPageDescription ( $row [ 'id' ], $imdb_id );
2021-01-19 00:55:34 +08:00
$cache_time = $imdb -> getCachedAt ( $imdb_id );
2021-01-18 19:45:33 +08:00
$Cache -> add_whole_row ();
print ( " <tr> " );
print ( " <td class= \" rowhead \" ><a href= \" javascript: klappe_ext('imdb') \" ><span class= \" nowrap \" ><img class= \" minus \" src= \" pic/trans.gif \" alt= \" Show/Hide \" id= \" picimdb \" title= \" " . $lang_details [ 'title_show_or_hide' ] . " \" /> " . $lang_details [ 'text_imdb' ] . $lang_details [ 'row_info' ] . " </span></a><div id= \" posterimdb \" > " . $smallth . " </div></td> " );
$Cache -> end_whole_row ();
$Cache -> add_row ();
$Cache -> add_part ();
print ( " <td class= \" rowfollow \" align= \" left \" ><div id='kimdb'> " . $autodata );
$Cache -> end_part ();
$Cache -> add_part ();
print ( $lang_details [ 'text_information_updated_at' ] . date ( " Y-m-d H:i:s " , $cache_time ) . $lang_details [ 'text_might_be_outdated' ] . " <a href= \" " . htmlspecialchars ( " retriver.php?id= " . $id . " &type=2&siteid=1 " ) . " \" > " . $lang_details [ 'text_here_to_update' ]);
$Cache -> end_part ();
$Cache -> end_row ();
$Cache -> add_whole_row ();
print ( " </div></td></tr> " );
$Cache -> end_whole_row ();
$Cache -> cache_page ();
echo $Cache -> next_row ();
$Cache -> next_row ();
echo $Cache -> next_part ();
2022-08-20 19:11:28 +08:00
if ( user_can ( 'updateextinfo' ))
2021-01-18 19:45:33 +08:00
echo $Cache -> next_part ();
echo $Cache -> next_row ();
break ;
2020-12-26 01:42:23 +08:00
}
case " 2 " :
{
tr ( $lang_details [ 'text_imdb' ] . $lang_details [ 'row_info' ] , $lang_details [ 'text_network_error' ], 1 );
break ;
}
case " 3 " :// not a valid imdb url
{
break ;
}
}
}
else {
echo $Cache -> next_row ();
$Cache -> next_row ();
echo $Cache -> next_part ();
2022-08-20 19:11:28 +08:00
if ( user_can ( 'updateextinfo' )){
2020-12-26 01:42:23 +08:00
echo $Cache -> next_part ();
}
echo $Cache -> next_row ();
}
}
2022-02-28 23:20:42 +08:00
if ( get_setting ( 'main.enable_pt_gen_system' ) == 'yes' && ! empty ( $row [ 'pt_gen' ])) {
2021-01-15 22:13:46 +08:00
$ptGen = new \Nexus\PTGen\PTGen ();
2022-04-15 03:09:12 +08:00
$ptGen -> updateTorrentPtGen ( $row );
2021-01-15 22:13:46 +08:00
}
2022-09-02 19:49:41 +08:00
if ( ! empty ( $otherCopiesIdArr ))
2020-12-26 01:42:23 +08:00
{
2022-09-02 19:49:41 +08:00
// $where_area = " url = " . sqlesc((int)$imdb_id) ." AND torrents.id != ".sqlesc($id);
$where_area = sprintf ( 'torrents.id in (%s)' , implode ( ',' , $otherCopiesIdArr ));
2022-10-27 20:21:54 +08:00
$copies_res = sql_query ( " SELECT torrents.id, torrents.name, torrents.sp_state, torrents.size, torrents.added, torrents.seeders, torrents.leechers, torrents.hr,categories.id AS catid, categories.name AS catname, categories.image AS catimage, $taxonomyFields , categories.mode as search_box_id FROM torrents
LEFT JOIN categories ON torrents . category = categories . id
LEFT JOIN sources ON torrents . source = sources . id
LEFT JOIN media ON torrents . medium = media . id
LEFT JOIN codecs ON torrents . codec = codecs . id
LEFT JOIN standards ON torrents . standard = standards . id
LEFT JOIN teams ON torrents . team = teams . id
LEFT JOIN audiocodecs ON torrents . audiocodec = audiocodecs . id
LEFT JOIN processings ON torrents . processing = processings . id
WHERE " . $where_area . " ORDER BY torrents . id DESC " ) or sqlerr(__FILE__, __LINE__);
2020-12-26 01:42:23 +08:00
$copies_count = mysql_num_rows ( $copies_res );
if ( $copies_count > 0 )
{
$s = " <table border= \" 1 \" cellspacing= \" 0 \" cellpadding= \" 5 \" > \n " ;
$s .= " <tr><td class= \" colhead \" style= \" padding: 0px; text-align:center; \" > " . $lang_details [ 'col_type' ] . " </td><td class= \" colhead \" align= \" left \" > " . $lang_details [ 'col_name' ] . " </td><td class= \" colhead \" align= \" center \" > " . $lang_details [ 'col_quality' ] . " </td><td class= \" colhead \" align= \" center \" ><img class= \" size \" src= \" pic/trans.gif \" alt= \" size \" title= \" " . $lang_details [ 'title_size' ] . " \" /></td><td class= \" colhead \" align= \" center \" ><img class= \" time \" src= \" pic/trans.gif \" alt= \" time added \" title= \" " . $lang_details [ 'title_time_added' ] . " \" /></td><td class= \" colhead \" align= \" center \" ><img class= \" seeders \" src= \" pic/trans.gif \" alt= \" seeders \" title= \" " . $lang_details [ 'title_seeders' ] . " \" /></td><td class= \" colhead \" align= \" center \" ><img class= \" leechers \" src= \" pic/trans.gif \" alt= \" leechers \" title= \" " . $lang_details [ 'title_leechers' ] . " \" /></td></tr> \n " ;
while ( $copy_row = mysql_fetch_assoc ( $copies_res ))
{
$dispname = htmlspecialchars ( trim ( $copy_row [ " name " ]));
$count_dispname = strlen ( $dispname );
$max_lenght_of_torrent_name = " 80 " ; // maximum lenght
if ( $count_dispname > $max_lenght_of_torrent_name )
{
$dispname = substr ( $dispname , 0 , $max_lenght_of_torrent_name ) . " .. " ;
}
2022-10-27 20:21:54 +08:00
// $other_source_info = $other_medium_info = $other_codec_info = $other_standard_info = $other_processing_info = '';
// if (isset($copy_row["source_name"]))
// $other_source_info = $copy_row['source_name'].", ";
// if (isset($copy_row["medium_name"]))
// $other_medium_info = $copy_row['medium_name'].", ";
// if (isset($copy_row["codec_name"]))
// $other_codec_info = $copy_row['codec_name'].", ";
// if (isset($copy_row["standard_name"]))
// $other_standard_info = $copy_row['standard_name'].", ";
// if (isset($copy_row["processing_name"]))
// $other_processing_info = $copy_row['processing_name'].", ";
2020-12-26 01:42:23 +08:00
2022-10-27 20:21:54 +08:00
$taxonomyInfo = $searchBoxRep -> listTaxonomyInfo ( $copy_row [ 'search_box_id' ], $copy_row );
$taxonomyValues = array_column ( $taxonomyInfo , 'value' );
2020-12-26 01:42:23 +08:00
$sphighlight = get_torrent_bg_color ( $copy_row [ 'sp_state' ]);
2022-06-08 14:15:59 +08:00
$sp_info = get_torrent_promotion_append ( $copy_row [ 'sp_state' ], '' , false , '' , 0 , '' , $copy_row [ '__ignore_global_sp_state' ] ? ? false );
2022-10-01 18:26:18 +08:00
$hrImg = get_hr_img ( $copy_row , $copy_row [ 'search_box_id' ]);
2020-12-26 01:42:23 +08:00
2021-06-21 02:01:26 +08:00
$s .= " <tr " . $sphighlight . " ><td class= \" rowfollow nowrap \" valign= \" middle \" style='padding: 0px'> " . return_category_image ( $copy_row [ " catid " ], " torrents.php?allsec=1& " ) . " </td><td class= \" rowfollow \" align= \" left \" ><a href= \" " . htmlspecialchars ( get_protocol_prefix () . $BASEURL . " /details.php?id= " . $copy_row [ " id " ] . " &hit=1 " ) . " \" > " . $dispname . " </a> " . $sp_info . $hrImg . " </td> " .
2022-10-27 20:21:54 +08:00
" <td class= \" rowfollow \" align= \" left \" > " . implode ( ', ' , $taxonomyValues ) . " </td> " .
2020-12-26 01:42:23 +08:00
" <td class= \" rowfollow \" align= \" center \" > " . mksize ( $copy_row [ " size " ]) . " </td> " .
" <td class= \" rowfollow nowrap \" align= \" center \" > " . str_replace ( " " , " <br /> " , gettime ( $copy_row [ " added " ], false )) . " </td> " .
" <td class= \" rowfollow \" align= \" center \" > " . $copy_row [ " seeders " ] . " </td> " .
" <td class= \" rowfollow \" align= \" center \" > " . $copy_row [ " leechers " ] . " </td> " .
" </tr> \n " ;
}
$s .= " </table> \n " ;
2020-12-29 21:49:37 +08:00
tr ( " <a href= \" javascript: klappe_news('othercopy') \" ><span class= \" nowrap \" ><img class= \" " . ( $copies_count > 5 ? " plus " : " minus " ) . " \" src= \" pic/trans.gif \" alt= \" Show/Hide \" id= \" picothercopy \" title= \" " . $lang_details [ 'title_show_or_hide' ] . " \" /> " . $lang_details [ 'row_other_copies' ] . " </span></a> " , " <b> " . $copies_count . $lang_details [ 'text_other_copies' ] . " </b><br /><div id='kothercopy' style= \" " . ( $copies_count > 5 ? " display: none; " : " display: block; " ) . " \" > " . $s . " </div> " , 1 );
2020-12-26 01:42:23 +08:00
}
}
if ( $row [ " type " ] == " multi " )
{
$files_info = " <b> " . $lang_details [ 'text_num_files' ] . " </b> " . $row [ " numfiles " ] . $lang_details [ 'text_files' ] . " <br /> " ;
$files_info .= " <span id= \" showfl \" ><a href= \" javascript: viewfilelist( " . $id . " ) \" > " . $lang_details [ 'text_see_full_list' ] . " </a></span><span id= \" hidefl \" style= \" display: none; \" ><a href= \" javascript: hidefilelist() \" > " . $lang_details [ 'text_hide_list' ] . " </a></span> " ;
}
function hex_esc ( $matches ) {
return sprintf ( " %02x " , ord ( $matches [ 0 ]));
}
2022-09-11 01:15:31 +08:00
$infoTds = [];
if ( ! empty ( $files_info )) {
$infoTds [] = " <td class= \" no_border_wide \" > " . $files_info . " </td> " ;
}
$infoTds [] = " <td class= \" no_border_wide \" ><b> " . $lang_details [ 'row_info_hash' ] . " :</b> " . preg_replace_callback ( '/./s' , " hex_esc " , hash_pad ( $row [ " info_hash " ])) . " </td> " ;
if ( user_can ( 'torrentstructure' )) {
$infoTds [] = " <td class= \" no_border_wide \" ><b> " . $lang_details [ 'text_torrent_structure' ] . " </b><a href= \" torrent_info.php?id= " . $id . " \" > " . $lang_details [ 'text_torrent_info_note' ] . " </a></td> " ;
}
tr ( $lang_details [ 'row_torrent_info' ], " <table><tr> " . implode ( " " , $infoTds ) . " </tr></table><span id='filelist'></span> " , 1 );
2020-12-26 01:42:23 +08:00
tr ( $lang_details [ 'row_hot_meter' ], " <table><tr><td class= \" no_border_wide \" ><b> " . $lang_details [ 'text_views' ] . " </b> " . $row [ " views " ] . " </td><td class= \" no_border_wide \" ><b> " . $lang_details [ 'text_hits' ] . " </b> " . $row [ " hits " ] . " </td><td class= \" no_border_wide \" ><b> " . $lang_details [ 'text_snatched' ] . " </b><a href= \" viewsnatches.php?id= " . $id . " \" ><b> " . $row [ " times_completed " ] . $lang_details [ 'text_view_snatches' ] . " </td><td class= \" no_border_wide \" ><b> " . $lang_details [ 'row_last_seeder' ] . " </b> " . gettime ( $row [ " last_action " ]) . " </td></tr></table> " , 1 );
$bwres = sql_query ( " SELECT uploadspeed.name AS upname, downloadspeed.name AS downname, isp.name AS ispname FROM users LEFT JOIN uploadspeed ON users.upload = uploadspeed.id LEFT JOIN downloadspeed ON users.download = downloadspeed.id LEFT JOIN isp ON users.isp = isp.id WHERE users.id= " . $row [ 'owner' ]);
$bwrow = mysql_fetch_array ( $bwres );
2024-09-26 23:35:14 +08:00
if ( isset ( $bwrow [ 'upname' ]) && isset ( $bwrow [ 'downname' ]) && $bwrow [ 'upname' ] && $bwrow [ 'downname' ])
2020-12-26 01:42:23 +08:00
tr ( $lang_details [ 'row_uploader_bandwidth' ], " <img class= \" speed_down \" src= \" pic/trans.gif \" alt= \" Downstream Rate \" /> " . $bwrow [ 'downname' ] . " <img class= \" speed_up \" src= \" pic/trans.gif \" alt= \" Upstream Rate \" /> " . $bwrow [ 'upname' ] . " " . $bwrow [ 'ispname' ], 1 );
/*
// Health
$seedersTmp = $row [ 'seeders' ];
$leechersTmp = $row [ 'leechers' ];
if ( $leechersTmp >= 1 ) // it is possible that there's traffic while have no seeders
{
$progressPerTorrent = 0 ;
$i = 0 ;
$subres = sql_query ( " SELECT seeder, finishedat, downloadoffset, uploadoffset, ip, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, peer_id, UNIX_TIMESTAMP(last_action) AS la, userid FROM peers WHERE torrent = $row[id] " ) or sqlerr ();
while ( $subrow = mysql_fetch_array ( $subres )) {
$progressPerTorrent += sprintf ( " %.2f " , 100 * ( 1 - ( $subrow [ " to_go " ] / $row [ " size " ])));
$i ++ ;
if ( $subrow [ " seeder " ] == " yes " )
$seeders [] = $subrow ;
else
$downloaders [] = $subrow ;
}
if ( $i == 0 )
$i = 1 ;
$progressTotal = sprintf ( " %.2f " , $progressPerTorrent / $i );
$totalspeed = 0 ;
if ( $seedersTmp >= 1 )
{
if ( $seeders ) {
foreach ( $seeders as $e ) {
$totalspeed = $totalspeed + ( $e [ " uploaded " ] - $e [ " uploadoffset " ]) / max ( 1 , ( $e [ " la " ] - $e [ " st " ]));
$totalspeed = $totalspeed + ( $e [ " downloaded " ] - $e [ " downloadoffset " ]) / max ( 1 , $e [ " finishedat " ] - $e [ st ]);
}
}
}
if ( $downloaders ) {
foreach ( $downloaders as $e ) {
$totalspeed = $totalspeed + ( $e [ " uploaded " ] - $e [ " uploadoffset " ]) / max ( 1 , ( $e [ " la " ] - $e [ " st " ]));
$totalspeed = $totalspeed + ( $e [ " downloaded " ] - $e [ " downloadoffset " ]) / max ( 1 , ( $e [ " la " ] - $e [ " st " ]));
}
}
$avgspeed = $lang_details [ 'text_average_speed' ] . " <b> " . mksize ( $totalspeed / ( $seedersTmp + $leechersTmp )) . " /s</b> " ;
$totalspeed = $lang_details [ 'text_total_speed' ] . " <b> " . mksize ( $totalspeed ) . " /s</b> " . $lang_details [ 'text_health_note' ];
$health = $lang_details [ 'text_avprogress' ] . get_percent_completed_image ( floor ( $progressTotal )) . " ( " . round ( $progressTotal ) . " %) <b> " . $lang_details [ 'text_traffic' ] . " </b> " . $avgspeed . " " . $totalspeed ;
}
else
$health = " <b> " . $lang_details [ 'text_traffic' ] . " </b> " . $lang_details [ 'text_no_traffic' ];
if ( $row [ " visible " ] == " no " )
$health = " <b> " . $lang_details [ 'text_status' ] . " </b> " . $lang_details [ 'text_dead' ] . " " . $health ;
tr ( $lang_details [ 'row_health' ], $health , 1 ); */
tr ( " <span id= \" seeders \" ></span><span id= \" leechers \" ></span> " . $lang_details [ 'row_peers' ] . " <br /><span id= \" showpeer \" ><a href= \" javascript: viewpeerlist( " . $row [ 'id' ] . " ); \" class= \" sublink \" > " . $lang_details [ 'text_see_full_list' ] . " </a></span><span id= \" hidepeer \" style= \" display: none; \" ><a href= \" javascript: hidepeerlist(); \" class= \" sublink \" > " . $lang_details [ 'text_hide_list' ] . " </a></span> " , " <div id= \" peercount \" ><b> " . $row [ 'seeders' ] . $lang_details [ 'text_seeders' ] . add_s ( $row [ 'seeders' ]) . " </b> | <b> " . $row [ 'leechers' ] . $lang_details [ 'text_leechers' ] . add_s ( $row [ 'leechers' ]) . " </b></div><div id= \" peerlist \" ></div> " , 1 );
2020-12-29 21:49:37 +08:00
if ( isset ( $_GET [ 'dllist' ]) && $_GET [ 'dllist' ] == 1 )
2020-12-26 01:42:23 +08:00
{
$scronload = " viewpeerlist( " . $row [ 'id' ] . " ) " ;
echo " <script type= \" text/javascript \" > \n " ;
echo $scronload ;
echo " </script> " ;
}
2021-06-08 02:01:35 +08:00
//Add 魔力值奖励功能
if ( isset ( $magic_value_bonus )){
$bonus_array = $magic_value_bonus ;
} else {
2022-03-30 15:37:11 +08:00
$bonus_array = implode ( ',' , \App\Models\Torrent :: BONUS_REWARD_VALUES );
2021-06-08 02:01:35 +08:00
}
echo ' < style type = " text/css " >
ul . magic
{
cursor : pointer ;
list - style - type : none ;
padding - left : 0 px ;
}
ul . magic li
{
margin : 0 px ; text - align : center ; float : left ; width : 40 px ; margin - right : 15 px ; height : 21 px ; background : url ( " styles/huise.png " ) no - repeat ;
padding - left : 5 px ; padding - right : 5 px ;
line - height : 20 px ;
}
ul . magic li : hover
{
background : url ( " styles/boli.png " ) no - repeat
}
</ style >
' ;
$magic_value_button = '' ;
if ( $CURUSER [ 'id' ] <> $row [ 'owner' ]) {
$arr_temp = explode ( ',' , $bonus_array );
$bonus_has = $CURUSER [ 'seedbonus' ];
if ( intval ( $bonus_has ) < intval ( $arr_temp [ 0 ])){
$error_bonus_message = $lang_details [ 'magic_have_no_enough_bonus_value' ];
$button_name = " <input class= \" btn \" type= \" button \" value= \" " . $error_bonus_message . " \" disabled= \" disabled \" /> " ;
$magic_value_button .= $button_name ;
} else {
foreach ( $arr_temp as $key => $each_temp ){
$each_temp = intval ( $each_temp );
if ( $each_temp > 0 && $each_temp <= $bonus_has ) {
$button_name = $magic_value_button . $key ;
$magic_button_id = 'magic_value_' . $key ;
$each_temp_font = '<font style="font-size:8pt;padding-right:5px;">' . ( '+' . $each_temp ) . '</font>' ;
$error_bonus_message = $lang_details [ 'magic_have_no_enough_bonus_value' ];
$button_name = " <li onclick= \" saveMagicValue( " . $id . " , $each_temp ); \" > " . $each_temp_font . " </li> " ;
$magic_value_button .= $button_name ;
}
}
}
}
$span_description = $lang_details [ 'span_description_have_given' ];
$span = '<input class="btn" type="button" id="magic_add" style="display:none" value="' . $span_description . '" disabled="disabled" /> ' ;
$whether_have_give_value = 0 ;
$give_value = array ();
$no_give = " " ;
$add_value = " " ;
$tempresult = sql_query ( " SELECT count( DISTINCT `userid` ) as count FROM magic WHERE torrentid= " . sqlesc ( $id ));
$count_user = mysql_fetch_array ( $tempresult );
$count_user_number = $count_user [ 'count' ];
$give_value_sql = sql_query ( " SELECT userid,value FROM magic WHERE torrentid= " . sqlesc ( $id ) . " ORDER BY id DESC " );
$give_value_count = get_row_count ( " magic " , " WHERE torrentid= " . sqlesc ( $id ));
$give_value_all = mysql_num_rows ( $give_value_sql );
$sum_value = 0 ;
if ( $give_value_all ) {
while ( $rows_t = mysql_fetch_array ( $give_value_sql )) {
$give_value_userid = $rows_t [ " userid " ];
$sum_value += $rows_t [ " value " ] * 1 ;
if ( $give_value_userid == $CURUSER [ 'id' ]) {
$whether_have_give_value = 1 ;
$add_value = $rows_t [ " value " ];
}
$give_value [] = get_username ( $give_value_userid ) . " " ;
}
} else $no_give = $lang_details [ 'text_no_magic_added' ];
2021-06-14 13:16:21 +08:00
if ( isset ( $bonus_has ) && isset ( $arr_temp ) && intval ( $bonus_has ) < intval ( $arr_temp [ 0 ])){
2021-06-08 02:01:35 +08:00
} else if ( $whether_have_give_value == 0 ) {
$magic_value_button = '<ul id="listNumber" class="magic">' . $magic_value_button . '</ul>' ;
} else {
$add_value = str_replace ( " Number " , $add_value , $lang_details [ 'magic_value_number' ]);
$magic_value_button = " <input class= \" btn \" type= \" button \" value= \" " . $add_value . " \" disabled= \" disabled \" /> " ;
//$give_value = get_username($CURUSER['id'])." ".$give_value;
}
$show_list = null ;
$show_all = null ;
$show_list_new_number = 6 ;
$other_user_str = null ;
$other_user_span = null ;
if ( count ( $give_value ) > 0 ){
$count_user_span = '<span id="count_user_spa">' . $count_user_number . '</span>' ;
$magic_newest_record = '<span id="magic_newest_record">' . $lang_details [ 'magic_newest_record' ] . '</span>' ;
$show_list_description = '(' . $magic_newest_record . $lang_details [ 'magic_sum_user_give_number' ] . ')' ;
$show_list_description = str_replace ( 'Number' , $count_user_span , $show_list_description );
$output = array_slice ( $give_value , 0 , $show_list_new_number );
foreach ( $output as $eachOutput ){
$show_list .= $eachOutput . ' ' ;
}
//other user list
if ( count ( $give_value ) > $show_list_new_number ){
$show_list .= '<span id="ellipsis"> ...... </span>' ;
$show_all_description = '[' . $lang_details [ 'magic_show_all_description' ] . ']' ;
$show_all = '<a herf="#" style="cursor:pointer" onclick="displayOtherUserList()">' . $show_all_description . '</a>' . '<br/>' ;
$other_user_list = array_slice ( $give_value , $show_list_new_number , count ( $give_value ));
foreach ( $other_user_list as $each ){
$other_user_str .= $each . ' ' ;
}
$other_user_span = '<span id="other_user_list" style="display:none">' . $other_user_str . '</span>' ;
}
} else {
$show_list_description = null ;
$haveGotBonus = $no_give ;
}
$current_user_magic = " <span id='current_user_magic' style='display:none'> " . get_username ( $CURUSER [ 'id' ]) . " </span> " ;
$haveGotBonus = $lang_details [ 'magic_haveGotBonus' ] . ' ' ;
$spanSumAll = '<span id="spanSumAll">' . $sum_value . '</span>' ;
$haveGotBonus = str_replace ( 'Number' , $spanSumAll , $haveGotBonus );
$firstLine = '<div style="height:25px">' . $magic_value_button . $span . $haveGotBonus . $show_all . '</div>' ;
$otherLine = '<div>' . $current_user_magic . $show_list . $other_user_span . $show_list_description . '</div>' ;
tr ( $lang_details [ 'magic_value_award' ], $firstLine . $otherLine , 1 );
//End 魔力值奖励功能
2020-12-26 01:42:23 +08:00
// ------------- start thanked-by block--------------//
$torrentid = $id ;
$thanksby = " " ;
$nothanks = " " ;
$thanks_said = 0 ;
$thanks_sql = sql_query ( " SELECT userid FROM thanks WHERE torrentid= " . sqlesc ( $torrentid ) . " ORDER BY id DESC LIMIT 20 " );
$thanksCount = get_row_count ( " thanks " , " WHERE torrentid= " . sqlesc ( $torrentid ));
$thanks_all = mysql_num_rows ( $thanks_sql );
if ( $thanks_all ) {
while ( $rows_t = mysql_fetch_array ( $thanks_sql )) {
$thanks_userid = $rows_t [ " userid " ];
if ( $rows_t [ " userid " ] == $CURUSER [ 'id' ]) {
$thanks_said = 1 ;
} else {
$thanksby .= get_username ( $thanks_userid ) . " " ;
}
}
}
else $nothanks = $lang_details [ 'text_no_thanks_added' ];
if ( ! $thanks_said ) {
$thanks_said = get_row_count ( " thanks " , " WHERE torrentid= $torrentid AND userid= " . sqlesc ( $CURUSER [ 'id' ]));
}
if ( $thanks_said == 0 ) {
$buttonvalue = " value= \" " . $lang_details [ 'submit_say_thanks' ] . " \" " ;
} else {
$buttonvalue = " value= \" " . $lang_details [ 'submit_you_said_thanks' ] . " \" disabled= \" disabled \" " ;
$thanksby = get_username ( $CURUSER [ 'id' ]) . " " . $thanksby ;
}
$thanksbutton = " <input class= \" btn \" type= \" button \" id= \" saythanks \" onclick= \" saythanks( " . $torrentid . " ); \" " . $buttonvalue . " /> " ;
tr ( $lang_details [ 'row_thanks_by' ], " <span id= \" thanksadded \" style= \" display: none; \" ><input class= \" btn \" type= \" button \" value= \" " . $lang_details [ 'text_thanks_added' ] . " \" disabled= \" disabled \" /></span><span id= \" curuser \" style= \" display: none; \" > " . get_username ( $CURUSER [ 'id' ]) . " </span><span id= \" thanksbutton \" > " . $thanksbutton . " </span> <span id= \" nothanks \" > " . $nothanks . " </span><span id= \" addcuruser \" ></span> " . $thanksby . ( $thanks_all < $thanksCount ? $lang_details [ 'text_and_more' ] . $thanksCount . $lang_details [ 'text_users_in_total' ] : " " ), 1 );
// ------------- end thanked-by block--------------//
print ( " </table> \n " );
}
else {
stdhead ( $lang_details [ 'head_comments_for_torrent' ] . " \" " . $row [ " name " ] . " \" " );
print ( " <h1 id= \" top \" > " . $lang_details [ 'text_comments_for' ] . " <a href= \" details.php?id= " . $id . " \" > " . htmlspecialchars ( $row [ " name " ]) . " </a></h1> \n " );
}
2021-01-18 00:41:35 +08:00
if ( ! empty ( $torrentUpdate )) {
sql_query ( " UPDATE torrents SET " . join ( " , " , $torrentUpdate ) . " WHERE id = $id " ) or sqlerr ( __FILE__ , __LINE__ );
}
2020-12-26 01:42:23 +08:00
// -----------------COMMENT SECTION ---------------------//
if ( $CURUSER [ 'showcomment' ] != 'no' ){
$count = get_row_count ( " comments " , " WHERE torrent= " . sqlesc ( $id ));
if ( $count )
{
print ( " <br /><br /> " );
print ( " <h1 align= \" center \" id= \" startcomments \" > " . $lang_details [ 'h1_user_comments' ] . " </h1> \n " );
2020-12-29 21:49:37 +08:00
list ( $pagertop , $pagerbottom , $limit ) = pager ( 10 , $count , " details.php?id= $id &cmtpage=1& " , array ( 'lastpagedefault' => 1 ), " page " );
2020-12-26 01:42:23 +08:00
$subres = sql_query ( " SELECT id, text, user, added, editedby, editdate FROM comments WHERE torrent = $id ORDER BY id $limit " ) or sqlerr ( __FILE__ , __LINE__ );
$allrows = array ();
while ( $subrow = mysql_fetch_array ( $subres )) {
$allrows [] = $subrow ;
}
print ( $pagertop );
commenttable ( $allrows , " torrent " , $id );
print ( $pagerbottom );
}
}
print ( " <br /><br /> " );
print ( " <table style='border:1px solid #000000;'><tr><td class= \" text \" align= \" center \" ><b> " . $lang_details [ 'text_quick_comment' ] . " </b><br /><br /><form id= \" compose \" name= \" comment \" method= \" post \" action= \" " . htmlspecialchars ( " comment.php?action=add&type=torrent " ) . " \" onsubmit= \" return postvalid(this); \" ><input type= \" hidden \" name= \" pid \" value= \" " . $id . " \" /><br /> " );
quickreply ( 'comment' , 'body' , $lang_details [ 'submit_add_comment' ]);
print ( " </form></td></tr></table> " );
print ( " <p align= \" center \" ><a class= \" index \" href= \" " . htmlspecialchars ( " comment.php?action=add&pid= " . $id . " &type=torrent " ) . " \" > " . $lang_details [ 'text_add_a_comment' ] . " </a></p> \n " );
}
stdfoot ();