use Inflector class to hyphenize for consistency and safety

This commit is contained in:
Andy Miller
2016-07-22 09:46:52 -06:00
parent 2bb6d1d4db
commit ab17fb2fdd

View File

@@ -67,7 +67,8 @@ class Session extends BaseSession
$httponly = $config->get('system.session.httponly', true);
$unique_identifier = GRAV_ROOT;
$this->setName(str_replace(' ', '-', $config->get('system.session.name', 'grav_site')) . '-' . substr(md5($unique_identifier), 0, 7) . ($is_admin ? '-admin' : ''));
$inflector = new Inflector();
$this->setName($inflector->hyphenize($config->get('system.session.name', 'grav_site')) . '-' . substr(md5($unique_identifier), 0, 7) . ($is_admin ? '-admin' : ''));
$this->start();
setcookie(session_name(), session_id(), time() + $session_timeout, $session_path, $domain, $secure, $httponly);
}