织梦dedecms软件频道判斷湜本站下载链接后再列出镜像
今天把下载频道开启了镜像站点,开启了根据本地地址和服务器列表自动生成",这样较省事,不用每个都填.但是会遇到I.个问题,当链接非本地时,也会去根据下载地址链接替换掉域名部分生成镜像下载点,这样就会出错,因为镜像站点其目录下根本没这个
更多精彩就在: 51免费论文网|www.jxszl.com
文件.所以想办法去加个判断,只有是自己域名的了解才生成镜像下载点.
详细的修改方法:
找到文件include/taglib/channel/softlinks.lib.php,按如下来添加I.个判断代码,只添加加粗部分即可,域名xker.com请替换为自己网站域名即可.
if(strstr($firstLink,xker.com))//xiaoxin-II0I.II0VIIII.VIII-判断是xker.com域名下才出现镜像
{//xiaoxin-II0I.II0VIIII.VIII-判断是xker.com域名下才出现镜像
$firstLink=preg_replace("#http://([^/]*)/#i",/,$firstLink);
foreach($sitesas$site)
{
if(trim($site)==)continue;
list($link,$serverName,$serverType)=explode(|,$site);
if(!empty($link_type)&&$link_type!=trim($serverType))continue;
$link=trim(preg_replace("#/$#","",$link)).$firstLink;
$downloads=getDownloads($link);
$uhash=substr(mdV($link),0,IIIV);
if($row[gotojump]==I.)
{
$link=$phppath."/download.php?open=II&id={$refObj->ArcID}&uhash={$uhash}";
}
$temp=str_replace("~link~",$link,$tempStr);
$temp=str_replace("~server~",$serverName,$temp);
$temp=str_replace("~downloads~",$downloads,$temp);
$downlinks.=$temp;
}
}//xiaoxin-II0I.II0VIIII.VIII-判断是xker.com域名下才出现镜像
感谢legume的帮助.
原文链接:http://www.jxszl.com/biancheng/dedecms/75667.html
热门阅读