原来占楼无用(180分钟后无法再编辑),继续五楼...
第五步:在种子主题上附加促销种子过期时间提示
应用此风格的有CHDbits、HDcity、皇后等
Nexusphp本来就有促销种子的过期提示(字符及图标显示模式下),只需要用鼠标放在促销类别字符或图标上就可以进行淡入淡出提示,不过用户要想了解每一个种子过期时间,都需要用鼠标进行查看,不太方便,对此可以对代码进行适当修改,使其附加到种子主/副标题上进行显示,这样看起来就直观得多了:
打开include/functions.php文件,查找3093-3095行(不同源码版本可能行号略有差异),来到这里:
print("<td class=\"rowfollow\" width=\"100%\" align=\"left\"><table class=\"torrentname\" width=\"100%\"><tr" . $sphighlight . "><td class=\"embedded\">".$stickyicon."<a $short_torrent_name_alt $mouseovertorrent href=\"details.php?id=".$id."&hit=1\"><b>".htmlspecialchars($dispname)."</b></a>");
$sp_torrent = get_torrent_promotion_append($row['sp_state'],"",true,$row["added"], $row['promotion_time_type'], $row['promotion_until']);
$picked_torrent = "";
注意,上面红色字体用到的函数get_torrent_promotion_append()即是种子附加促销提示的显示模块。
Step1:添加一个功能函数:
为了不改变原来的功能,我们需要在后面copy一下该函数并进行修改(函数命名为get_torrent_promotion_append_sub(),并插入到原函数附近),修改后的代码如下:
---------------------
function get_torrent_promotion_append_sub($promotion = 1,$forcemode = "",$showtimeleft = false, $added = "", $promotionTimeType = 0, $promotionUntil = ''){
global $CURUSER,$lang_functions;
global $expirehalfleech_torrent, $expirefree_torrent, $expiretwoup_torrent, $expiretwoupfree_torrent, $expiretwouphalfleech_torrent, $expirethirtypercentleech_torrent;
$sp_torrent_sub = "";
$onmouseover_sub = "";
if (get_global_sp_state() == 1) {
switch ($promotion){
case 2:
{
if ($showtimeleft && (($expirefree_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
{
if ($promotionTimeType == 2) {
$futuretime = strtotime($promotionUntil);
} else {
$futuretime = strtotime($added) + $expirefree_torrent * 86400;
}
$timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
if ($timeout)
$onmouseover_sub = " (<font color='#0000FF'>".$lang_functions['text_will_end_in'].$timeout."</font>".")"; //free类型字符显示为蓝色,可以更改它
else $promotion = 1;
}
break;
}
case 3:
{
if ($showtimeleft && (($expiretwoup_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
{
if ($promotionTimeType == 2) {
$futuretime = strtotime($promotionUntil);
} else {
$futuretime = strtotime($added) + $expiretwoup_torrent * 86400;
}
$timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
if ($timeout)
$onmouseover_sub = " (".$lang_functions['text_will_end_in'].$timeout.")";
else $promotion = 1;
}
break;
}
case 4:
{
if ($showtimeleft && (($expiretwoupfree_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
{
if ($promotionTimeType == 2) {
$futuretime = strtotime($promotionUntil);
} else {
$futuretime = strtotime($added) + $expiretwoupfree_torrent * 86400;
}
$timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
if ($timeout)
$onmouseover_sub = " (<font color='#00CC66'>".$lang_functions['text_will_end_in'].$timeout."</font>".")"; //2XFree 显示为青色,可以更改它
else $promotion = 1;
}
break;
}
case 5:
{
if ($showtimeleft && (($expirehalfleech_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
{
if ($promotionTimeType == 2) {
$futuretime = strtotime($promotionUntil);
} else {
$futuretime = strtotime($added) + $expirehalfleech_torrent * 86400;
}
$timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
if ($timeout)
$onmouseover_sub = " (".$lang_functions['text_will_end_in'].$timeout.")";
else $promotion = 1;
}
break;
}
case 6:
{
if ($showtimeleft && (($expiretwouphalfleech_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
{
if ($promotionTimeType == 2) {
$futuretime = strtotime($promotionUntil);
} else {
$futuretime = strtotime($added) + $expiretwouphalfleech_torrent * 86400;
}
$timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
if ($timeout)
$onmouseover_sub = " (".$lang_functions['text_will_end_in'].$timeout.")";
else $promotion = 1;
}
break;
}
case 7:
{
if ($showtimeleft && (($expirethirtypercentleech_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
{
if ($promotionTimeType == 2) {
$futuretime = strtotime($promotionUntil);
} else {
$futuretime = strtotime($added) + $expirethirtypercentleech_torrent * 86400;
}
$timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
if ($timeout)
$onmouseover_sub = " (".$lang_functions['text_will_end_in'].$timeout.")";
else $promotion = 1;
}
break;
}
}
}
if (($CURUSER['appendpromotion'] == 'word' && $forcemode == "" ) || $forcemode == 'word'){
if(($promotion==2 && get_global_sp_state() == 1) || get_global_sp_state() == 2){
$sp_torrent_sub = $onmouseover_sub;
}
elseif(($promotion==3 && get_global_sp_state() == 1) || get_global_sp_state() == 3){
$sp_torrent_sub = $onmouseover_sub;
}
elseif(($promotion==4 && get_global_sp_state() == 1) || get_global_sp_state() == 4){
$sp_torrent_sub = $onmouseover_sub;
}
elseif(($promotion==5 && get_global_sp_state() == 1) || get_global_sp_state() == 5){
$sp_torrent_sub = $onmouseover_sub;
}
elseif(($promotion==6 && get_global_sp_state() == 1) || get_global_sp_state() == 6){
$sp_torrent_sub = $onmouseover_sub;
}
elseif(($promotion==7 && get_global_sp_state() == 1) || get_global_sp_state() == 7){
$sp_torrent_sub = $onmouseover_sub;
}
}
elseif (($CURUSER['appendpromotion'] == 'icon' && $forcemode == "") || $forcemode == 'icon'){
if(($promotion==2 && get_global_sp_state() == 1) || get_global_sp_state() == 2)
$sp_torrent_sub = $onmouseover_sub;
elseif(($promotion==3 && get_global_sp_state() == 1) || get_global_sp_state() == 3)
$sp_torrent_sub = $onmouseover_sub;
elseif(($promotion==4 && get_global_sp_state() == 1) || get_global_sp_state() == 4)
$sp_torrent_sub = $onmouseover_sub;
elseif(($promotion==5 && get_global_sp_state() == 1) || get_global_sp_state() == 5)
$sp_torrent_sub = $onmouseover_sub;
elseif(($promotion==6 && get_global_sp_state() == 1) || get_global_sp_state() == 6)
$sp_torrent_sub = $onmouseover_sub;
elseif(($promotion==7 && get_global_sp_state() == 1) || get_global_sp_state() == 7)
$sp_torrent_sub = $onmouseover_sub;
}
return $sp_torrent_sub;
}
---------------------
Step2:功能调用
到此完工,查看效果:
|