27
2018
09

PHPCMS V9怎么添加https开头的友情链接方法

现在不少网站都开始流行使用了https开头的,在换友情链接的时候要填写https开头的网址,可是phpcms v9却只能填写以http开头的网站,该如何修改呢?

其实一段代码就可以搞定了:

1、打开 \phpcms\modules\link\index.php 文件

找到

if($_POST['url']=="" || !preg_match('/^http:\/\/(.*)/i', $_POST['url'])){

showmessage(L('siteurl_not_empty'),"?m=link&c=index&a=register&siteid=$siteid");

 }

修改为:

if($_POST['url']=="" || !preg_match('/^(http:\/\/|https:\/\/)(.*)/i', $_POST['url'])){

showmessage(L('siteurl_not_empty'),"?m=link&c=index&a=register&siteid=$siteid");

 }

找到

$logo = safe_replace(strip_tags($_POST['logo']));

if(!preg_match('/^http:\/\/(.*)/i', $logo)){

$logo = '';

}

修改为:

 $logo = safe_replace(strip_tags($_POST['logo']));

if(!preg_match('/^(http:\/\/|https:\/\/)(.*)/i', $logo)){

$logo = '';

}

2、打开 \phpcms\modules\link\templates\link_add.tpl.php 文件

找到

$("#link_url").formValidator({onshow:"<?php echo L("input").L('url')?>",onfocus:"<?php echo L("input").L('url')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('url')?>"}).regexValidator({regexp:"^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$",onerror:"<?php echo L('link_onerror')?>"})

修改为:

$("#link_url").formValidator({onshow:"<?php echo L("input").L('url')?>",onfocus:"<?php echo L("input").L('url')?>"}).inputValidator({min:1,onerror:"<?php echo L("input").L('url')?>"}).regexValidator({regexp:"^(http:\/\/|https:\/\/)[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$",onerror:"<?php echo L('link_onerror')?>"})

原文链接:https://www.qiquanji.com/post/7315.html

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注

更新实时通知

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。