織夢軟件頻道如何判斷是本站下載鏈接后再列出鏡像

織夢軟件頻道如何判斷是本站下載鏈接后再列出鏡像

織夢軟件頻道如何判斷是本站下載鏈接后再列出鏡像?

今天把下載頻道開啟了鏡像站點,開啟了根據本地地址和服務器列表自動生成,這樣較省事,不用每個都填。但是會遇到一個問題,當鏈接非本地時,也會去根據下載地址鏈接替換掉域名部分生成鏡像下載點,這樣就會出錯,因為鏡像站點其目錄下根本沒這個文件

??推薦學習:織夢cms

所以想辦法去加個判斷,只有是自己域名的了解才生成鏡像下載點。?

詳細的修改方法:?

找到文件include/taglib/channel/softlinks.lib.php,按如下來添加一個判斷代碼,只添加加粗部分即可,域名xxx.net請替換為自己網站域名即可。?

代碼如下:

if?(strstr($firstLink,?'xxx.net'))?//xiaoxin-20120818-判斷是xxx.net域名下才出現鏡像? {?//xiaoxin-20120818-判斷是xxx.net域名下才出現鏡像? $firstLink?=?preg_replace("#http://([^/]*)/#i",?'/',?$firstLink);? foreach($sites?as?$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(md5($link),?0,?24);? if($row['gotojump']==1)? {? $link?=?$phppath."/download.php?open=2&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-20120818-判斷是xxx.net域名下才出現鏡像

? 版權聲明
THE END
喜歡就支持一下吧
點贊9 分享