$_SERVER['HTTPS'] is not always available

$_SERVER['HTTPS'] is not always available, so add a isset().