Skip to content

Commit

Permalink
🔧Fix: 非HTTPS无法加载番剧图片
Browse files Browse the repository at this point in the history
Fixed Issue #33
  • Loading branch information
kengwang committed Mar 20, 2020
1 parent c94e5a2 commit 7021c6b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bangumi.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
*
* @package custom
*/
//判断是否为HTPS
function is_https() {
if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
return true;
} elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
return true;
} elseif ( !empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
return true;
}
return false;
}
define('IS_HTTPS',is_https());
$this->need('includes/head.php');
$this->need('includes/header.php');
$this->need('libs/Bangumi.php');
Expand Down Expand Up @@ -69,7 +81,7 @@
<?php $db=Typecho_Db::get();
$load_image = $db->fetchAll($db->select('value')->from('table.options')->where('name = %s', "theme:Miracles")->limit(1));
$load_image = explode("\";",explode("\"",explode("\"loading_image\";",$load_image[0]["value"],2)[1],2)[1],2)[0]; ?>
<img src="/usr/themes/Miracles/images/loading/<?php echo $load_image;?>.gif" data-original="<?php echo $bgm['img'];?>">
<img src="<?php if(IS_HTTPS):?>/usr/themes/Miracles/images/loading/<?php echo $load_image;?>.gif" data-original="<?php echo $bgm['img']; else: echo $bgm['img']; endif;?>" referrerpolicy="no-referrer">
<div class="bangumi-des">
<p><?php echo $bgm['des']; ?></p>
</div>
Expand Down

0 comments on commit 7021c6b

Please sign in to comment.