修改前:
-------------------------------------------
'text_peasant' => "Peasant",
'text_user' => "User",
'text_power_user' => "Power User",
'text_elite_user' => "Elite User",
'text_crazy_user' => "Crazy User",
'text_insane_user' => "Insane User",
'text_veteran_user' => "Veteran User",
'text_extreme_user' => "Extreme User",
'text_ultimate_user' => "Ultimate User",
'text_nexus_master' => "Nexus Master",
============================
'text_peasant' => "(堕落者)Peasant",
'text_user' => "(穷人)User",
'text_power_user' => "(百姓)Power User",
'text_elite_user' => "(小康)Elite User",
'text_crazy_user' => "(大康)Crazy User",
'text_insane_user' => "(中产)Insane User",
'text_veteran_user' => "(富商)Veteran User",
'text_extreme_user' => "(银行家)Extreme User",
'text_ultimate_user' => "(豪门)Ultimate User",
'text_nexus_master' => "(贵族)Nexus Master",
--------------------------------------------
注意:Web服务器需要重启http生效!
第二步:关闭搜索箱
应用此风格的有CHDbits、TCCF、Pig2Pig等
为什么要关闭?Nexusphp的搜索箱功能十分强大,不过对用户来说并不是每次都要使用的,且所占版面较大(个人觉得也是版面看起来雷同的一大因素),由于在后台和数据库中无相关配置项,故需要对程序进行修改:
打开主目录下的torrents.php文件,查找874-876行,来到这里:
<td class="colhead" align="center" colspan="2"><a href="javascript: klappe_news('searchboxmain')"><img class="minus" src="pic/trans.gif" id="picsearchboxmain" alt="Show/Hide" /><?php echo $lang_torrents['text_search_box'] ?></a></td> </tr></tbody> <tbody id="ksearchboxmain">
完成后,代码变为:
<td class="colhead" align="center" colspan="2"><a href="javascript: klappe_news('searchboxmain')"><img class="plus" src="pic/trans.gif" id="picsearchboxmain" alt="Show/Hide" /><?php echo $lang_torrents['text_search_box'] ?></a></td> </tr></tbody> <tbody id="ksearchboxmain" style="display:none">
if ($count) {
print($pagertop);
print("<p align=\"center\"> ".$lang_functions['text_promoted_torrents_note']."</p>\n"); //此处是在搜索箱下部位置插入,你也可以选择在其他位置插入!
if ($sectiontype == $browsecatmode)
torrenttable($res, "torrents");
第四步:改变置顶种子格子颜色
应用此风格的有CHDbits、皇后等
改变颜色有助于用户更醒目、更直观的区分置顶帖(当然方法有很多,看个人喜好,部分PT站使用“置顶”字符,CHDbits还更换了置顶标识),前些时间看到有人评价皇后的置顶种子颜色很“媚”,决定自己也改一改:
打开主目录/include/functions.php,查找3021-3023行,来到这里:
$id = $row["id"];
$sphighlight = get_torrent_bg_color($row['sp_state']);
print("<tr" . $sphighlight . ">\n");
修改程序为(用下面五行替换上面3行):
$id = $row["id"];
if ($row['pos_state'] == 'sticky' && $CURUSER['appendsticky'] == 'yes') {
$sphighlight = " class='twoupfree_bg'";
}
else $sphighlight = get_torrent_bg_color($row['sp_state']);
print("<tr" . $sphighlight . ">\n");
注意:上面$sphighlight = " class='twoupfree_bg'"; 中的class='twoupfree_bg'是赋予置顶种子格子的显示颜色,属性在风格目录下的theme.css文件中定义,可以根据下面sample自行添加,然后替换上面代码中的“'twoupfree_bg'”(注意每种风格都要添加),如果嫌麻烦就直接借用种子类型的一种,本例选择了twoupfree_bg,即与2X上传颜色相同。
.free{color:#f0cc00}
.twoup{color:#aaaaaa}
.twoupfree{color:#99cc66}
.halfdown{color:#7c7ff6}
.twouphalfdown{color:#7ad6ea}
.thirtypercent{color:#70328d}
.free_bg{background-color:#ffff99}
.twoup_bg{background-color:#dddddd}
.twoupfree_bg{background-color:#ccff99}
.halfdown_bg{background-color:#cccdf8}
.twouphalfdown_bg{background-color: #96dbea}
.thirtypercentdown_bg{background-color:#ddc3ea}
注:在黑色风格下无效。
第五步:在种子主题上附加促销种子过期时间提示
应用此风格的有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;
}
---------------------