10月 032011
 

2.2 初步修改

2.2.1 修改超全局变量:$_G

文件位置./source/class/class_core.php (112行开始)

在$_G声明的下一行添加:

$swHttp = empty($_SERVER[‘HTTPS’]) || $_SERVER[‘HTTPS’] == ‘off’ ? ‘http’ :’https’;

添加和修改键值:

$_G[‘http’] => $swHttp; //这是添加

$_G[‘siteurl’] =$swHttp . ”; //这是修改(165行左右, 把 ‘http: 换成 $swHttp . ‘:)
2.2.2 解决请求端口自动转成443的Bug:

文件位置:source/function/function_core.php (L1038,X1.5才有,X2.0的目前没有找到)

修改为:$port=”

2.4 在模板和PHP文件中改http为https
2.4.1 替换所有的htm模板中的http: https:

(假设当前目录为论坛的根目录,这时使用sed来批量替换,后面的第一个grep是查找文件)

sed -ir “s/http:/https:/g” `grep -rl “http:” ./ | grep \.htm$`

sed -ir “s/http:/https:/g” `grep -rl “http:” ./ | grep \.php$`

sed -ir “s/http:/https:/g” `grep -rl “http:” ./ | grep \.css$`

sed -ir “s/http:/https:/g” `grep -rl “http:” ./ | grep \.xml$`

sed -ir “s/http:/https:/g” `grep -rl “http:” ./ | grep \.js$`

sed -ir “s/http:/https:/g” `grep -rl “http:” ./ | grep \.sql$`

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lanshunfang/archive/2011/04/22/6342630.aspx

 回复

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>