Skip to content

Commit

Permalink
Correctly handle language strings to termine if it's admin or not Fix g…
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviocopes committed May 30, 2016
1 parent a381e5b commit 43c0ac2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion system/src/Grav/Common/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public function init()
// Uri::route() is not processed yet, let's quickly get what we need
$current_route = str_replace($base_url, '', parse_url($uri->url(true), PHP_URL_PATH));
$base = '/' . trim($route, '/');
if (substr($current_route, 0, strlen($base)) == $base) {

if (substr($current_route, 0, strlen($base)) == $base || //handle no language specified
substr($current_route, 3, strlen($base)) == $base || //handle language (en)
substr($current_route, 6, strlen($base)) == $base) { //handle region specific language prefix (en-US)
$session_timeout = $config->get('plugins.admin.session.timeout', 1800);
$is_admin = true;
}
Expand Down

0 comments on commit 43c0ac2

Please sign in to comment.