因历史原因PHPCMCSV9并不支持https,而且网上的修改教程都不是太完整,所以我发出我整理出来的修改教程供大家参考
https修改教程
/phpcms/modules/admin/site.php
45行,128行
/phpcms/modules/admin/templates/category_add.tpl.php
/phpcms/modules/admin/templates/category_edit.tpl.php
11行
/phpcms/modules/admin/templates/site_add.tpl.php
13行
/phpcms/modules/admin/templates/site_edit.tpl.php
11行
/phpsso_server/phpcms/modules/admin/templates/applications_add.tpl.php
/phpsso_server/phpcms/modules/admin/templates/applications_edit.tpl.php
14行
找到下面代码:
PHP
http:\/\/(.+)\/$
1
http:\/\/(.+)\/$
改成
PHP
^(http(s)?:)?\/\/(.+)\/$
1
^(http(s)?:)?\/\/(.+)\/$
基本配置的phpcms/modules/admin/templates/setting.tpl.php
PHP
http:\/\/(.+)[^/]$
1
http:\/\/(.+)[^/]$
改成
PHP
^(http(s)?:)?\/\/(.+)[^/]$
1
^(http(s)?:)?\/\/(.+)[^/]$
友链模块的
phpcms/modules/link/templates/link_add.tpl.php和link_edit.tpl.php找到
PHP
^http:\/\/[A-Za-z0-9]&#43;\.[A-Za-z0-9]&#43;[\/&#61;\?%\-&]*([^<>])*$
1
^http:\/\/[A-Za-z0-9]&#43;\.[A-Za-z0-9]&#43;[\/&#61;\?%\-&]*([^<>])*$
改成
PHP
^(http(s)?:)?\/\/[A-Za-z0-9]&#43;\.[A-Za-z0-9]&#43;[\/&#61;\?%\-&]*([^<>])*$
1
^(http(s)?:)?\/\/[A-Za-z0-9]&#43;\.[A-Za-z0-9]&#43;[\/&#61;\?%\-&]*([^<>])*$
扩展-来源的phpcms/modules/admin/templates/copyfrom_add.tpl.php和copyfrom_edit.tpl.php找到
PHP
^http://
1
^http://
改成
PHP
^(http(s)?:)?\/\/(.&#43;)\/$
1
^(http(s)?:)?\/\/(.&#43;)\/$
扩展-关联链接的phpcms/modules/admin/templates/keylink_add.tpl.php和keylink_edit.tpl.php找到
PHP
^http:
1
^http:
改成
PHP
^http(s)?:\/\/
1
^http(s)?:\/\/
以上为前端修改
通信及后台部分修改
后台内容列表&#xff0c;这部分很重要&#xff0c;牵扯到整个后台的分页&#xff0c;不仅限于内容分页
phpcms/modules/content/templates/content_list.tpl.php
97行找到
PHP
} elseif(strpos($r[&#39;url&#39;],&#39;http://&#39;)!&#61;&#61;false) {
1
}elseif(strpos($r[&#39;url&#39;],&#39;http://&#39;)!&#61;&#61;false){
改成
PHP
} elseif(preg_match(&#39;/^(http(s)?:)?\/\//&#39;, $r[&#39;url&#39;])) {
1
}elseif(preg_match(&#39;/^(http(s)?:)?\/\//&#39;,$r[&#39;url&#39;])){
后台分页&#xff0c;这部分很重要&#xff0c;牵扯到内容管理里的标题超链打开地址
phpcms/libs/functions/global.func.php
找到pageurl函数&#xff0c;没修改过的在784行&#xff0c;里面找到
PHP
$url &#61; str_replace(array(&#39;http://&#39;,&#39;//&#39;,&#39;~&#39;), array(&#39;~&#39;,&#39;/&#39;,&#39;http://&#39;), $url);
1
$url&#61;str_replace(array(&#39;http://&#39;,&#39;//&#39;,&#39;~&#39;),array(&#39;~&#39;,&#39;/&#39;,&#39;http://&#39;),$url);
改成
PHP
$url &#61; preg_replace(array(&#39;/^((\w&#43;):)?\/\//&#39;, &#39;/\/{2,}/&#39;, &#39;/~/&#39;), array(&#39;$1~&#39;, &#39;/&#39;, &#39;//&#39;), $url);
1
$url&#61;preg_replace(array(&#39;/^((\w&#43;):)?\/\//&#39;,&#39;/\/{2,}/&#39;,&#39;/~/&#39;),array(&#39;$1~&#39;,&#39;/&#39;,&#39;//&#39;),$url);
/phpsso_server/api/uc_client/client.php找到
PHP
$port &#61; !empty($matches[&#39;port&#39;]) ? $matches[&#39;port&#39;] : 80;
1
$port&#61;!empty($matches[&#39;port&#39;])?$matches[&#39;port&#39;]:80;
改成
PHP
$port &#61; !empty($matches[&#39;port&#39;]) ? $matches[&#39;port&#39;] : ($matches[&#39;scheme&#39;] &#61;&#61; &#39;https&#39; ? 443 : 80);
1
$port&#61;!empty($matches[&#39;port&#39;])?$matches[&#39;port&#39;]:($matches[&#39;scheme&#39;]&#61;&#61;&#39;https&#39;?443:80);
/phpsso_server/api/uc_client/model/misc.php找到
PHP
$port &#61; !empty($matches[&#39;port&#39;]) ? $matches[&#39;port&#39;] : 80;
1
$port&#61;!empty($matches[&#39;port&#39;])?$matches[&#39;port&#39;]:80;
改成
PHP
$port &#61; !empty($matches[&#39;port&#39;]) ? $matches[&#39;port&#39;] : ($matches[&#39;scheme&#39;] &#61;&#61; &#39;https&#39; ? 443 : 80);
1
$port&#61;!empty($matches[&#39;port&#39;])?$matches[&#39;port&#39;]:($matches[&#39;scheme&#39;]&#61;&#61;&#39;https&#39;?443:80);
/phpcms/libs/classes/http.class.php找到
PHP
$port &#61; $matches[&#39;port&#39;] ? $matches[&#39;port&#39;] : 80;
1
$port&#61;$matches[&#39;port&#39;]?$matches[&#39;port&#39;]:80;
改成
PHP
$port &#61; !empty($matches[&#39;port&#39;]) ? $matches[&#39;port&#39;] : ($matches[&#39;scheme&#39;]&#61;&#61;&#39;https&#39; ? 443 : 80);
$protocol &#61; (&#39;https&#39; &#61;&#61; $matches[&#39;scheme&#39;]) ? &#39;ssl://&#39; : &#39;&#39;;
1
2
$port&#61;!empty($matches[&#39;port&#39;])?$matches[&#39;port&#39;]:($matches[&#39;scheme&#39;]&#61;&#61;&#39;https&#39;?443:80);
$protocol&#61;(&#39;https&#39;&#61;&#61;$matches[&#39;scheme&#39;])?&#39;ssl://&#39;:&#39;&#39;;
找到
PHP
$fp &#61; &#64;fsockopen($host, $port, $errno, $errstr, $timeout);
1
$fp&#61;&#64;fsockopen($host,$port,$errno,$errstr,$timeout);
改成
PHP
$fp &#61; &#64;fsockopen($protocol.$host, $port, $errno, $errstr, $timeout);
1
$fp&#61;&#64;fsockopen($protocol.$host,$port,$errno,$errstr,$timeout);
phpsso_server/phpcms/libs/classes/http.class.php找到
PHP
$port &#61; $matches[&#39;port&#39;] ? $matches[&#39;port&#39;] : 80;
1
$port&#61;$matches[&#39;port&#39;]?$matches[&#39;port&#39;]:80;
改成
PHP
$port &#61; !empty($matches[&#39;port&#39;]) ? $matches[&#39;port&#39;] : ($matches[&#39;scheme&#39;]&#61;&#61;&#39;https&#39; ? 443 : 80);
$protocol &#61; (&#39;https&#39; &#61;&#61; $matches[&#39;scheme&#39;]) ? &#39;ssl://&#39; : &#39;&#39;;
1
2
$port&#61;!empty($matches[&#39;port&#39;])?$matches[&#39;port&#39;]:($matches[&#39;scheme&#39;]&#61;&#61;&#39;https&#39;?443:80);
$protocol&#61;(&#39;https&#39;&#61;&#61;$matches[&#39;scheme&#39;])?&#39;ssl://&#39;:&#39;&#39;;
phpcms/modules/member/classes/client.class.php里找到_ps_post函数&#xff0c;里面的
PHP
$port &#61; !empty($matches[&#39;port&#39;]) ? $matches[&#39;port&#39;] : 80;
1
$port&#61;!empty($matches[&#39;port&#39;])?$matches[&#39;port&#39;]:80;
改成
PHP
$port &#61; !empty($matches[&#39;port&#39;]) ? $matches[&#39;port&#39;] : ($matches[&#39;scheme&#39;]&#61;&#61;&#39;https&#39; ? 443 : 80);
1
$port&#61;!empty($matches[&#39;port&#39;])?$matches[&#39;port&#39;]:($matches[&#39;scheme&#39;]&#61;&#61;&#39;https&#39;?443:80);
通过以上修改&#xff0c;基本解决了PHPCMCSV9兼容https的问题&#xff0c;至于为什么说基本&#xff0c;因为这里也有可能我尚未发现的地方&#xff0c;如果有可以在评论区告知一下&#xff0c;我更新上来