Remove "is_secure_request" function

This commit is contained in:
Dmitriy Simushev 2014-11-07 12:39:19 +00:00
parent fe0d2f2760
commit 6066b9312e
2 changed files with 9 additions and 12 deletions

View File

@ -29,10 +29,3 @@ function get_get_param($name, $default = '')
return $value;
}
function is_secure_request()
{
return (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443')
|| (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on")
|| (isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on");
}

View File

@ -44,17 +44,21 @@ require_once(MIBEW_FS_ROOT . '/libs/common/request.php');
require_once(MIBEW_FS_ROOT . '/libs/common/response.php');
require_once(MIBEW_FS_ROOT . '/libs/common/string.php');
// We need to get some info from the request. Use symfony wrapper because it's
// the simplest way.
$tmp_request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
// Make session cookie more secure
@ini_set('session.cookie_httponly', true);
if (is_secure_request()) {
if ($tmp_request->isSecure()) {
@ini_set('session.cookie_secure', true);
}
@ini_set(
'session.cookie_path',
\Symfony\Component\HttpFoundation\Request::createFromGlobals()->getBasePath() . "/"
);
@ini_set('session.cookie_path', $tmp_request->getBasePath() . "/");
@ini_set('session.name', 'MibewSessionID');
// Remove temporary request to keep global scope clean.
unset($tmp_request);
// Initialize user session
session_start();