find($row['owner']); if (!$owner) { $owner = \App\Models\User::defaultUser(); } $torrentRep = new \App\Repositories\TorrentRepository(); $searchBoxRep = new \App\Repositories\SearchBoxRepository(); $torrentUpdate = []; if (!empty($_GET["hit"])) { $torrentUpdate[] = 'views = views + 1'; } $imdb_id = parse_imdb_id($row["url"]); if ($imdb_id && $showextinfo['imdb'] == 'yes') { $imdb = new \Nexus\Imdb\Imdb(); $movie = $imdb->getMovie($imdb_id); } if (!isset($_GET["cmtpage"])) { stdhead($lang_details['head_details_for_torrent']. "\"" . $row["name"] . "\""); if (!empty($_GET["uploaded"])) { print("

".$lang_details['text_successfully_uploaded']."

"); print("

".$lang_details['text_redownload_torrent_note']."

"); header("refresh: 1; url=download.php?id=$id"); //header("refresh: 1; url=getimdb.php?id=$id&type=1"); } elseif (!empty($_GET["edited"])) { print("

".$lang_details['text_successfully_edited']."

"); if (isset($_GET["returnto"])) print("

".$lang_details['text_go_back'] . "" . $lang_details['text_whence_you_came']."

"); } elseif (!empty($_GET['existed'])) { print("

".$lang_details['torrent_existed']."

"); if (isset($_GET["returnto"])) print("

".$lang_details['text_go_back'] . "" . $lang_details['text_whence_you_came']."

"); } $banned_torrent = ($row["banned"] == 'yes' ? " (".$lang_functions['text_banned'].")" : ""); $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); $hrImg = get_hr_img($row, $row['search_box_id']); $approvalStatusIcon = $torrentRep->renderApprovalStatus($row["approval_status"]); $paidIcon = $torrentRep->getPaidIcon($row, 20); $s=htmlspecialchars($row["name"]).$banned_torrent.$paidIcon.($sp_torrent ? "   ".$sp_torrent : "").($sp_torrent_sub) . $hrImg . $approvalStatusIcon; print("

".$s."

\n"); //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 = ''; printf( '
%s %s
', $dangerIcon, nexus_trans('torrent.approval.deny_comment_show', ['reason' => $torrentOperationLog->comment]) ); } } print("\n"); $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') { if (!user_can('viewanonymous') && $row['owner'] != $CURUSER['id']) $uprow = "".$lang_details['text_anonymous'].""; else $uprow = "".$lang_details['text_anonymous']." (" . get_username($row['owner'], false, true, true, false, false, true) . ")"; } else { $uprow = (isset($row['owner']) ? get_username($row['owner'], false, true, true, false, false, true) : "".$lang_details['text_unknown'].""); } if ($CURUSER["id"] == $row["owner"]) $CURUSER["downloadpos"] = "yes"; if ($CURUSER["downloadpos"] != "no") { print(""); } 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); //tag $torrentTags = \App\Models\TorrentTag::query()->where('torrent_id', $row['id'])->get(); if ($torrentTags->isNotEmpty()) { $tagRep = new \App\Repositories\TagRepository(); tr($lang_details['row_tags'], $tagRep->renderSpan($row['search_box_id'], $torrentTags->pluck('tag_id')->toArray()),true); } $size_info = "".$lang_details['text_size']."" . mksize($row["size"]); $type_info = "   ".$lang_details['row_type'].": ".$row["cat_name"]; // $source_info = $medium_info = $codec_info = $audiocodec_info = $standard_info = $processing_info = $team_info = ''; // if (isset($row["source_name"])) // $source_info = "   ".$lang_details['text_source']." ".$row['source_name']; // if (isset($row["medium_name"])) // $medium_info = "   ".$lang_details['text_medium']." ".$row['medium_name']; // if (isset($row["codec_name"])) // $codec_info = "   ".$lang_details['text_codec']." ".$row['codec_name']; // if (isset($row["standard_name"])) // $standard_info = "   ".$lang_details['text_stardard']." ".$row['standard_name']; // if (isset($row["processing_name"])) // $processing_info = "   ".$lang_details['text_processing']." ".$row['processing_name']; // if (isset($row["team_name"])) // $team_info = "   ".$lang_details['text_team']." ".$row['team_name']; // if (isset($row["audiocodec_name"])) // $audiocodec_info = "   ".$lang_details['text_audio_codec']." ".$row['audiocodec_name']; // 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); $taxonomyInfo = $searchBoxRep->listTaxonomyInfo($row['search_box_id'], $row); $taxonomyRendered = ''; foreach ($taxonomyInfo as $item) { $taxonomyRendered .= sprintf('   %s: %s', $item['label'], $item['value']); } tr($lang_details['row_basic_info'], $size_info.$type_info.$taxonomyRendered, 1); $actions = []; if ($CURUSER["downloadpos"] != "no") { $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[] = "\"download\" ".$downloadBtn.""; } if ($owned == 1) { $actions[] = "<$editlink>\"edit\" ".(user_can('torrentmanage') ? $lang_details['text_edit_and_delete_torrent'] : $lang_details['text_edit_torrent']). ""; } if (user_can('askreseed') && $row['seeders'] == 0) { $actions[] = "\"reseed\" ".$lang_details['text_ask_for_reseed'] .""; } if (user_can('torrent-approval') && (get_setting('torrent.approval_status_icon_enabled') == 'yes' || get_setting('torrent.approval_status_none_visible') == 'no')) { $approvalIcon = ''; $actions[] = sprintf( '%s %s', $row['id'], $approvalIcon, $lang_details['action_approval'] ); $title = nexus_trans('torrent.approval.modal_title'); $js = <<\"report\" ".$lang_details['text_report_torrent'].""; tr($lang_details['row_action'], implode(' | ', $actions), 1); // ------------- start claim block ------------------// $claimTorrentTTL = \App\Models\Claim::getConfigTorrentTTL(); if (\App\Models\Claim::getConfigIsEnabled() && \Carbon\Carbon::parse($row['added'])->addDays($claimTorrentTTL)->lte(\Carbon\Carbon::now())) { $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 = <<', $inputValue, $id, $disabled); $y .= sprintf(' ' . $lang_details['claim_info'], $claimCounts, bcsub($maxUserCounts, $claimCounts)); $y .= sprintf(' '.$lang_details['claim_detail'].'', $id); tr($lang_details['claim_label'], $y, 1); } // ------------- end claim block ------------------// tr($lang_details['torrent_dl_url'],sprintf('%s',$lang_details['torrent_dl_url_notice'], $torrentRep->getDownloadUrl($id, $CURUSER), $lang_details['torrent_dl_url_text']),1); // ---------------- start subtitle block -------------------// $subTorrentIdArr = [$row['id']]; $otherCopiesIdArr = []; if ($imdb_id) { $otherCopiesIdArr = \App\Models\Torrent::query()->where('url', $imdb_id)->where('id', '!=', $row['id'])->pluck('id')->toArray(); // $subTorrentIdArr = array_merge($subTorrentIdArr, $otherCopiesIdArr); } $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__); print(""); print("\n"); // ---------------- end subtitle block -------------------// //hook before desc do_action('torrent_detail_before_desc', $row['id'], $CURUSER['id']); /**************start custom fields****************/ echo $customField->renderOnTorrentDetailsPage($id, $row['search_box_id']); /**************end custom fields****************/ //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); } } if ($CURUSER['showdescription'] != 'no' && !empty($row["descr"])){ $torrentdetailad=$Advertisement->get_ad('torrentdetail'); $desc = format_comment($row['descr']); $desc = apply_filter('torrent_detail_description', $desc, $row['id'], $CURUSER['id']); tr("\"Show/Hide\" ".$lang_details['row_description']."", "
".($Advertisement->enable_ad() && $torrentdetailad ? "
".$torrentdetailad[0]."
" : "").$desc."
", 1); } if (user_can('viewnfo') && $CURUSER['shownfo'] != 'no' && $row["nfosz"] > 0){ if (!$nfo = $Cache->get_value('nfo_block_torrent_id_'.$id)){ $nfo = code_new($row["nfo"], get_setting('torrent.nfo_view_style_default')); $Cache->cache_value('nfo_block_torrent_id_'.$id, $nfo, 604800); } tr("\"Show/Hide\" ".$lang_details['text_nfo']."
". $lang_details['text_view_nfo']. "", "
".$nfo."
\n", 1); } if ($imdb_id && $showextinfo['imdb'] == 'yes' && $CURUSER['showimdb'] != 'no') { $thenumbers = $imdb_id; $Cache->new_page('imdb_id_'.$thenumbers.'_large', 3600*24, true); if (!$Cache->get_page()){ switch ($imdb->getCacheStatus($imdb_id)) { case "0" : //cache is not ready, try to { if($row['cache_stamp']==0 || ($row['cache_stamp'] != 0 && (time()-$row['cache_stamp']) > 120)) //not exist or timed out tr($lang_details['text_imdb'] . $lang_details['row_info'] , $lang_details['text_imdb'] . $lang_details['text_not_ready']."".$lang_details['text_here_to_retrieve'] . $lang_details['text_imdb'],1); else tr($lang_details['text_imdb'] . $lang_details['row_info'] , "\"\"       " . $lang_details['text_someone_has_requested'].min(max(time()-$row['cache_stamp'],0),120) . $lang_details['text_please_be_patient'],1); break; } case "1" : { reset_cachetimestamp($row['id']); if (($photo_url = $movie->photo() ) != FALSE) $smallth = "\"poster\""; else $smallth = "\"no"; $autodata = $imdb->renderDetailsPageDescription($row['id'], $imdb_id); $cache_time = $imdb->getCachedAt($imdb_id); $Cache->add_whole_row(); print(""); print(""); $Cache->end_whole_row(); $Cache->add_row(); $Cache->add_part(); print(""); $Cache->end_whole_row(); $Cache->cache_page(); echo $Cache->next_row(); $Cache->next_row(); echo $Cache->next_part(); if (user_can('updateextinfo')) echo $Cache->next_part(); echo $Cache->next_row(); break; } 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(); if (user_can('updateextinfo')){ echo $Cache->next_part(); } echo $Cache->next_row(); } } if (get_setting('main.enable_pt_gen_system') == 'yes' && !empty($row['pt_gen'])) { $ptGen = new \Nexus\PTGen\PTGen(); $ptGen->updateTorrentPtGen($row); } if (!empty($otherCopiesIdArr)) { // $where_area = " url = " . sqlesc((int)$imdb_id) ." AND torrents.id != ".sqlesc($id); $where_area = sprintf('torrents.id in (%s)', implode(',', $otherCopiesIdArr)); $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__); $copies_count = mysql_num_rows($copies_res); if($copies_count > 0) { $s = "
".$lang_details['row_download'].""); if ($CURUSER['timetype'] != 'timealive') $uploadtime = $lang_details['text_at'].$row['added']; else $uploadtime = $lang_details['text_blank'].gettime($row['added'],true,false); print("" . htmlspecialchars($torrentnameprefix ."." .$row["save_as"]) . ".torrent  ".get_torrent_bookmark_state($CURUSER['id'], $row['id'], false)."   ".$lang_details['row_upped_by']." ".$uprow.$uploadtime); print("
".$lang_details['row_subtitles'].""); print(""); if (mysql_num_rows($r) > 0) { while($a = mysql_fetch_assoc($r)) { $lang = ""; $lang .= ""; print($lang); } } else print(""); print("
\""  ". htmlspecialchars($a["title"]) . "".(user_can('submanage') || (user_can('delownsub') && $a["uppedby"] == $CURUSER["id"]) ? " [".$lang_details['text_delete']."]" : "")."  ".($a["anonymous"] == 'yes' ? $lang_details['text_anonymous'] . (user_can('viewanonymous') ? get_username($a['uppedby'],false,true,true,false,true) : "") : get_username($a['uppedby']))."
".$lang_details['text_no_subtitles']."
"); print(""); if($CURUSER['id']==$row['owner'] || user_can('uploadsub')) { print(""); } $moviename = ""; if ($imdb_id && $showextinfo['imdb'] == 'yes') { $thenumbers = $imdb_id; if (!$moviename = $Cache->get_value('imdb_id_'.$thenumbers.'_movie_name')){ switch ($imdb->getCacheStatus($imdb_id)){ case "1":{ $moviename = $movie->title (); break; $Cache->cache_value('imdb_id_'.$thenumbers.'_movie_name', $moviename, 1296000); } default: break; } } } print("\n"); print("
"); print("
\"Show/Hide\" ".$lang_details['text_imdb'] . $lang_details['row_info'] ."
". $smallth."
".$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']."".$lang_details['text_here_to_update']); $Cache->end_part(); $Cache->end_row(); $Cache->add_whole_row(); print("
\n"; $s.="\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) . ".."; } // $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'].", "; $taxonomyInfo = $searchBoxRep->listTaxonomyInfo($copy_row['search_box_id'], $copy_row); $taxonomyValues = array_column($taxonomyInfo, 'value'); $sphighlight = get_torrent_bg_color($copy_row['sp_state']); $sp_info = get_torrent_promotion_append($copy_row['sp_state'], '', false, '', 0, '', $copy_row['__ignore_global_sp_state'] ?? false); $hrImg = get_hr_img($copy_row, $copy_row['search_box_id']); $s .= "" . "" . "" . "" . "" . "" . "\n"; } $s .= "
".$lang_details['col_type']."".$lang_details['col_name']."".$lang_details['col_quality']."\"size\"\"time\"seeders\"\"leechers\"
".return_category_image($copy_row["catid"], "torrents.php?allsec=1&")."" . $dispname ."". $sp_info. $hrImg ."" .implode(', ', $taxonomyValues). "" . mksize($copy_row["size"]) . "" . str_replace(" ", "
", gettime($copy_row["added"],false)). "
" . $copy_row["seeders"] . "" . $copy_row["leechers"] . "
\n"; tr(" 5 ? "plus" : "minus")."\" src=\"pic/trans.gif\" alt=\"Show/Hide\" id=\"picothercopy\" title=\"".$lang_details['title_show_or_hide']."\" /> ".$lang_details['row_other_copies']."", "".$copies_count.$lang_details['text_other_copies']."
5 ? "display: none;" : "display: block;")."\">".$s."
",1); } } if ($row["type"] == "multi") { $files_info = "".$lang_details['text_num_files']."". $row["numfiles"] . $lang_details['text_files'] . "
"; $files_info .= "".$lang_details['text_see_full_list']."".$lang_details['text_hide_list'].""; } function hex_esc($matches) { return sprintf("%02x", ord($matches[0])); } $infoTds = []; if (!empty($files_info)) { $infoTds[] = "" . $files_info . ""; } $infoTds[] = "".$lang_details['row_info_hash'].": ".preg_replace_callback('/./s', "hex_esc", hash_pad($row["info_hash"])).""; if (user_can('torrentstructure')) { $infoTds[] = "" . $lang_details['text_torrent_structure'] . "".$lang_details['text_torrent_info_note'].""; } tr($lang_details['row_torrent_info'], "" . implode("", $infoTds) . "
",1); tr($lang_details['row_hot_meter'], "
" . $lang_details['text_views']."". $row["views"] . "" . $lang_details['text_hits']. "" . $row["hits"] . "" .$lang_details['text_snatched'] . "" . $row["times_completed"]. $lang_details['text_view_snatches'] . "" . $lang_details['row_last_seeder']. "" . gettime($row["last_action"]) . "
",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); if (isset($bwrow['upname']) && isset($bwrow['downname']) && $bwrow['upname'] && $bwrow['downname']) tr($lang_details['row_uploader_bandwidth'], "\"Downstream ".$bwrow['downname']."    \"Upstream ".$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']."" . mksize($totalspeed/($seedersTmp+$leechersTmp)) . "/s"; $totalspeed = $lang_details['text_total_speed']."" . mksize($totalspeed) . "/s ".$lang_details['text_health_note']; $health = $lang_details['text_avprogress'] . get_percent_completed_image(floor($progressTotal))." (".round($progressTotal)."%)        ".$lang_details['text_traffic']."" . $avgspeed ."        ". $totalspeed; } else $health = "".$lang_details['text_traffic']. "" . $lang_details['text_no_traffic']; if ($row["visible"] == "no") $health = "".$lang_details['text_status']."" . $lang_details['text_dead'] ."        ". $health; tr($lang_details['row_health'], $health, 1);*/ tr("".$lang_details['row_peers']."
".$lang_details['text_see_full_list']."".$lang_details['text_hide_list']."", "
".$row['seeders'].$lang_details['text_seeders'].add_s($row['seeders'])." | ".$row['leechers'].$lang_details['text_leechers'].add_s($row['leechers'])."
" , 1); if (isset($_GET['dllist']) && $_GET['dllist'] == 1) { $scronload = "viewpeerlist(".$row['id'].")"; echo ""; } //Add 魔力值奖励功能 if(isset($magic_value_bonus)){ $bonus_array = $magic_value_bonus; }else{ $bonus_array = implode(',', \App\Models\Torrent::BONUS_REWARD_VALUES); } echo ' '; $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 = ""; $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 = ''.('+'.$each_temp).''; $error_bonus_message = $lang_details['magic_have_no_enough_bonus_value']; $button_name = "
  • ".$each_temp_font."
  • "; $magic_value_button .= $button_name; } } } } $span_description = $lang_details['span_description_have_given']; $span = ' '; $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']; if(isset($bonus_has) && isset($arr_temp) && intval($bonus_has) < intval($arr_temp[0])){ }else if ($whether_have_give_value == 0 ) { $magic_value_button = ''; } else { $add_value = str_replace("Number",$add_value,$lang_details['magic_value_number']); $magic_value_button =""; //$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 = ''.$count_user_number.''; $magic_newest_record = ''. $lang_details['magic_newest_record'].''; $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 .= ' ...... '; $show_all_description = '['.$lang_details['magic_show_all_description'].']'; $show_all = ''.$show_all_description.''.'
    '; $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 = ''; } }else{ $show_list_description = null; $haveGotBonus = $no_give; } $current_user_magic = " "; $haveGotBonus = $lang_details['magic_haveGotBonus'].' '; $spanSumAll = ''.$sum_value.''; $haveGotBonus = str_replace('Number',$spanSumAll,$haveGotBonus); $firstLine = '
    '.$magic_value_button.$span.$haveGotBonus.$show_all.'
    '; $otherLine = '
    '.$current_user_magic.$show_list.$other_user_span.$show_list_description.'
    '; tr($lang_details['magic_value_award'],$firstLine.$otherLine,1); //End 魔力值奖励功能 // ------------- 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 = ""; tr($lang_details['row_thanks_by'],"".get_username($CURUSER['id'])." ".$thanksbutton."  ".$nothanks."".$thanksby.($thanks_all < $thanksCount ? $lang_details['text_and_more'].$thanksCount.$lang_details['text_users_in_total'] : ""),1); // ------------- end thanked-by block--------------// print("\n"); } else { stdhead($lang_details['head_comments_for_torrent']."\"" . $row["name"] . "\""); print("

    ".$lang_details['text_comments_for']."" . htmlspecialchars($row["name"]) . "

    \n"); } if (!empty($torrentUpdate)) { sql_query("UPDATE torrents SET " . join(",", $torrentUpdate) . " WHERE id = $id") or sqlerr(__FILE__, __LINE__); } // -----------------COMMENT SECTION ---------------------// if ($CURUSER['showcomment'] != 'no'){ $count = get_row_count("comments","WHERE torrent=".sqlesc($id)); if ($count) { print("

    "); print("

    " .$lang_details['h1_user_comments'] . "

    \n"); list($pagertop, $pagerbottom, $limit) = pager(10, $count, "details.php?id=$id&cmtpage=1&", array('lastpagedefault' => 1), "page"); $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("

    "); print ("
    ".$lang_details['text_quick_comment']."


    "); quickreply('comment', 'body', $lang_details['submit_add_comment']); print("
    "); print("

    ".$lang_details['text_add_a_comment']."

    \n"); } stdfoot();