fixed SSL checks
This commit is contained in:
parent
3422d6b46c
commit
7cb8bff32c
@ -348,12 +348,30 @@ function fancytokens_civicrm_tokens( &$tokens ){
|
|||||||
$civi_url = CRM_Utils_System::url('civicrm/example', NULL, TRUE, NULL, FALSE);
|
$civi_url = CRM_Utils_System::url('civicrm/example', NULL, TRUE, NULL, FALSE);
|
||||||
$website_host_name = parse_url( $civi_url, PHP_URL_HOST );
|
$website_host_name = parse_url( $civi_url, PHP_URL_HOST );
|
||||||
|
|
||||||
|
$isSecure = false;
|
||||||
|
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
|
||||||
|
$isSecure = true;
|
||||||
|
}elseif ( ( !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') ||
|
||||||
|
(!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower( $_SERVER['HTTP_X_FORWARDED_SSL']) == 'on') ) {
|
||||||
|
$isSecure = true;
|
||||||
|
}
|
||||||
|
$protocol = $isSecure ? 'https://' : 'http://';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ( array_key_exists( 'HTTPS', $_SERVER )){
|
||||||
$ssl_in_use = $_SERVER['HTTPS'];
|
$ssl_in_use = $_SERVER['HTTPS'];
|
||||||
if( strlen($ssl_in_use) > 0){
|
if( strlen($ssl_in_use) > 0){
|
||||||
$protocol = "https://";
|
$protocol = "https://";
|
||||||
}else{
|
}else{
|
||||||
$protocol = "http://";
|
$protocol = "http://";
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$protocol = "http://";
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
while( $cur_token_raw = current( $tokens['communitynews'] )){
|
while( $cur_token_raw = current( $tokens['communitynews'] )){
|
||||||
$tmp_key = key($tokens['communitynews']);
|
$tmp_key = key($tokens['communitynews']);
|
||||||
|
Loading…
Reference in New Issue
Block a user