protected function construct()
{
$routeName = $this->getRouteMatch()->getMatchedRouteName();
/**
* Installation check, and check on removal of the install directory.
*/
$config = $this->getServiceLocator()->get('Config');
if (!isset($config['db']) and !in_array($routeName, $this->installerRoutes)) {
return $this->redirect()->toRoute('install');
} elseif (!in_array($routeName, $this->installerRoutes)) {
$auth = $this->getServiceLocator()->get('Auth');
if (!$auth->hasIdentity()) {
if (!in_array($routeName, array('config/user/login', 'config/user/forgot-password', 'config/user/forgot-password-key', 'cms'))) {
return $this->redirect()->toRoute('config/user/login', array('redirect' => base64_encode($this->getRequest()->getRequestUri())));
}
} else {
if (!in_array($routeName, array('config/user/forbidden', 'config/user/logout'))) {
$resultResponse = $this->checkAcl($auth->getIdentity());
if (!empty($resultResponse)) {
return $resultResponse;
}
}
}
}
$this->layout()->setVariable('routeParams', $this->getRouteMatch()->getParams());
$this->layout()->setVariable('version', \Gc\Version::VERSION);
$this->useFlashMessenger(false);
}