优化 HTTPS 细节完善

This commit is contained in:
康盛Discuz! 2017-01-17 15:39:44 +08:00
parent d011f52840
commit 6fba8df400
4 changed files with 15 additions and 15 deletions

View File

@ -4,7 +4,7 @@
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: admincp_styles.php 34498 2014-05-12 02:51:02Z nemohou $
* $Id: admincp_styles.php 36353 2017-01-17 07:19:28Z nemohou $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
@ -483,7 +483,7 @@ function imgpre_resize(obj) {
function imgpre_update(id, obj) {
url = obj.value;
if(url) {
re = /^http:\/\//i;
re = /^(https?:)?\/\//i;
var matches = re.exec(url);
if(matches == null) {
url = ($('styleimgdir').value ? $('styleimgdir').value : ($('imgdir').value ? $('imgdir').value : 'static/image/common')) + '/' + url;
@ -537,7 +537,7 @@ function imgpre_switch(id) {
$bgimg = $stylestuff[$predefinedvar]['subst'][1];
$bgextra = implode(' ', array_slice($stylestuff[$predefinedvar]['subst'], 2));
$stylestuff[$predefinedvar]['subst'] = $stylestuff[$predefinedvar]['subst'][0];
$bgimgpre = $bgimg ? (preg_match('/^http:\/\//i', $bgimg) ? $bgimg : ($stylestuff['styleimgdir']['subst'] ? $stylestuff['styleimgdir']['subst'] : ($stylestuff['imgdir']['subst'] ? $stylestuff['imgdir']['subst'] : 'static/image/common')).'/'.$bgimg) : 'static/image/common/none.gif';
$bgimgpre = $bgimg ? (preg_match('/^(https?:)?\/\//i', $bgimg) ? $bgimg : ($stylestuff['styleimgdir']['subst'] ? $stylestuff['styleimgdir']['subst'] : ($stylestuff['imgdir']['subst'] ? $stylestuff['imgdir']['subst'] : 'static/image/common')).'/'.$bgimg) : 'static/image/common/none.gif';
$comment .= '<div id="bgpre_'.$stylestuff[$predefinedvar]['id'].'" onclick="imgpre_switch('.$stylestuff[$predefinedvar]['id'].')" style="background-image:url('.$bgimgpre.');cursor:pointer;float:right;width:350px;height:40px;overflow:hidden;border: 1px solid #ccc"></div>'.$lang['styles_edit_'.$predefinedvar.'_comment'].$lang['styles_edit_bg'];
$extra = '<br /><input name="stylevarbgimg['.$stylestuff[$predefinedvar]['id'].']" value="'.$bgimg.'" onchange="imgpre_update('.$stylestuff[$predefinedvar]['id'].', this)" type="text" class="txt" style="margin:5px 0;" />'.
'<br /><input name="stylevarbgextra['.$stylestuff[$predefinedvar]['id'].']" value="'.$bgextra.'" type="text" class="txt" />';

View File

@ -4,7 +4,7 @@
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cache_setting.php 36293 2016-12-14 02:50:56Z nemohou $
* $Id: cache_setting.php 36353 2017-01-17 07:19:28Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
@ -949,7 +949,7 @@ function get_cachedata_mynavs() {
if(!preg_match("/^".preg_quote(STATICURL, '/')."/i", $navicon) && !(($valueparse = parse_url($navicon)) && isset($valueparse['host']))) {
$navicon = $_G['setting']['attachurl'].'common/'.$nav['icon'].'?'.random(6);
}
$navicon = preg_match('/^http:\/\//i', $navicon) ? $navicon : $_G['siteurl'].$navicon;
$navicon = preg_match('/^(https?:)?\/\//i', $navicon) ? $navicon : $_G['siteurl'].$navicon;
$nav['icon'] = ' style="background-image:url('.$navicon.') !important"';
}
$nav['code'] = '<a href="'.$nav['url'].'"'.($nav['title'] ? ' title="'.$nav['title'].'"' : '').($nav['target'] == 1 ? ' target="_blank"' : '').$nav['icon'].'>'.$nav['name'].'</a>';
@ -1082,4 +1082,4 @@ function parsehighlight($highlight) {
return $style;
}
?>
?>

View File

@ -4,7 +4,7 @@
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cache_styles.php 36278 2016-12-09 07:52:35Z nemohou $
* $Id: cache_styles.php 36353 2017-01-17 07:19:28Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
@ -35,10 +35,10 @@ function build_cache_styles() {
if(strstr($data['boardimg'], ',')) {
$flash = explode(",", $data['boardimg']);
$flash[0] = trim($flash[0]);
$flash[0] = preg_match('/^http:\/\//i', $flash[0]) ? $flash[0] : $data['styleimgdir'].'/'.$flash[0];
$flash[0] = preg_match('/^(https?:)?\/\//i', $flash[0]) ? $flash[0] : $data['styleimgdir'].'/'.$flash[0];
$data['boardlogo'] = "<embed src=\"".$flash[0]."\" width=\"".trim($flash[1])."\" height=\"".trim($flash[2])."\" type=\"application/x-shockwave-flash\" wmode=\"transparent\"></embed>";
} else {
$data['boardimg'] = preg_match('/^http:\/\//i', $data['boardimg']) ? $data['boardimg'] : $data['styleimgdir'].'/'.$data['boardimg'];
$data['boardimg'] = preg_match('/^(https?:)?\/\//i', $data['boardimg']) ? $data['boardimg'] : $data['styleimgdir'].'/'.$data['boardimg'];
$data['boardlogo'] = "<img src=\"$data[boardimg]\" alt=\"".$_G['setting']['bbname']."\" border=\"0\" />";
}
$data['bold'] = $data['nobold'] ? 'normal' : 'bold';
@ -82,7 +82,7 @@ function setcssbackground(&$data, $code) {
if($codes[$i]{0} == '#') {
$css .= strtoupper($codes[$i]).' ';
$codevalue = strtoupper($codes[$i]);
} elseif(preg_match('/^http:\/\//i', $codes[$i])) {
} elseif(preg_match('/^(https?:)?\/\//i', $codes[$i])) {
$css .= 'url("'.$codes[$i].'") ';
} else {
$css .= 'url("'.$data['styleimgdir'].'/'.$codes[$i].'") ';
@ -122,9 +122,9 @@ function writetocsscache($data) {
$cssdata = preg_replace_callback("/\{([A-Z0-9]+)\}/", 'writetocsscache_callback_1', $cssdata);
$cssdata = preg_replace("/<\?.+?\?>\s*/", '', $cssdata);
$cssdata = !preg_match('/^http:\/\//i', $data['styleimgdir']) ? preg_replace("/url\(([\"'])?".preg_quote($data['styleimgdir'], '/')."/i", "url(\\1$_G[siteurl]$data[styleimgdir]", $cssdata) : $cssdata;
$cssdata = !preg_match('/^http:\/\//i', $data['imgdir']) ? preg_replace("/url\(([\"'])?".preg_quote($data['imgdir'], '/')."/i", "url(\\1$_G[siteurl]$data[imgdir]", $cssdata) : $cssdata;
$cssdata = !preg_match('/^http:\/\//i', $data['staticurl']) ? preg_replace("/url\(([\"'])?".preg_quote($data['staticurl'], '/')."/i", "url(\\1$_G[siteurl]$data[staticurl]", $cssdata) : $cssdata;
$cssdata = !preg_match('/^(https?:)?\/\//i', $data['styleimgdir']) ? preg_replace("/url\(([\"'])?".preg_quote($data['styleimgdir'], '/')."/i", "url(\\1$_G[siteurl]$data[styleimgdir]", $cssdata) : $cssdata;
$cssdata = !preg_match('/^(https?:)?\/\//i', $data['imgdir']) ? preg_replace("/url\(([\"'])?".preg_quote($data['imgdir'], '/')."/i", "url(\\1$_G[siteurl]$data[imgdir]", $cssdata) : $cssdata;
$cssdata = !preg_match('/^(https?:)?\/\//i', $data['staticurl']) ? preg_replace("/url\(([\"'])?".preg_quote($data['staticurl'], '/')."/i", "url(\\1$_G[siteurl]$data[staticurl]", $cssdata) : $cssdata;
if($entry == 'module.css') {
$cssdata = preg_replace('/\/\*\*\s*(.+?)\s*\*\*\//', '[\\1]', $cssdata);
}

View File

@ -4,7 +4,7 @@
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: function_admincp.php 36299 2016-12-15 06:35:18Z nemohou $
* $Id: function_admincp.php 36353 2017-01-17 07:19:28Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
@ -705,7 +705,7 @@ function showsetting($setname, $varname, $value, $type = 'radio', $disabled = ''
if($code[$i] != '') {
if($code[$i]{0} == '#') {
$css .= strtoupper($code[$i]).' ';
} elseif(preg_match('/^http:\/\//i', $code[$i])) {
} elseif(preg_match('/^(https?:)?\/\//i', $code[$i])) {
$css .= 'url(\''.$code[$i].'\') ';
} else {
$css .= 'url(\''.$stylestuff['imgdir']['subst'].'/'.$code[$i].'\') ';