Skip to content

Commit

Permalink
完善回复邮件通知
Browse files Browse the repository at this point in the history
  • Loading branch information
fooleap committed Feb 22, 2018
1 parent b5f2ac2 commit 8fbb132
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions api/postcomment.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @param url 访客网址,可为空
*
* @author fooleap <fooleap@gmail.com>
* @version 2017-09-16 23:26:32
* @version 2018-02-22 13:55:01
* @link https://github.com/fooleap/disqus-php-api
*
*/
Expand Down Expand Up @@ -77,7 +77,15 @@
'session'=> $session
);
$mail = curl_init();
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
$isSecure = false;
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$isSecure = true;
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {
$isSecure = true;
}
$protocol = $isSecure ? 'https://' : 'http://';
//$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
$curl_opt = array(
CURLOPT_URL => $protocol.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/sendemail.php',
CURLOPT_RETURNTRANSFER => true,
Expand Down

0 comments on commit 8fbb132

Please sign in to comment.