-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
35 lines (30 loc) · 1.05 KB
/
Copy pathbootstrap.php
File metadata and controls
35 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
function fluencybuilder_request_scheme(): string
{
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
$values = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO']);
return strtolower(trim($values[0])) === 'https' ? 'https' : 'http';
}
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) {
$values = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTOCOL']);
return strtolower(trim($values[0])) === 'https' ? 'https' : 'http';
}
if (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower((string) $_SERVER['HTTP_X_FORWARDED_SSL']) === 'on') {
return 'https';
}
if (!empty($_SERVER['HTTPS']) && strcasecmp((string) $_SERVER['HTTPS'], 'off') !== 0) {
return 'https';
}
return 'https';
}
if (session_status() !== PHP_SESSION_ACTIVE) {
session_set_cookie_params(array(
'lifetime' => 0,
'path' => '/',
'domain' => '',
'secure' => fluencybuilder_request_scheme() === 'https',
'httponly' => true,
'samesite' => 'Lax',
));
session_start();
}