public function installstep2Action() { if (setupUtility::checkInstall() == false) { return $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); } if (!setupUtility::checkConfigFile()) { return $this->redirect()->toRoute('install'); } $installForm2 = new InstallForm2(); $installForm2->get('adminName')->setValue('admin'); $installForm2->get('adminPassword1')->setValue('admin'); $installForm2->get('adminPassword2')->setValue('admin'); $request = $this->getRequest(); if ($request->isPost()) { $data = $this->params()->fromPost(); if ($data['adminName'] == '' || $data['adminPassword1'] == '' || $data['adminPassword2'] == '') { $this->flashMessenger()->addErrorMessage("Please fill out all info"); } else { if ($data['adminPassword1'] != $data['adminPassword2']) { $this->flashMessenger()->addErrorMessage("These passwords don't match. Try again?"); return $this->redirect()->toRoute('install', array('controller' => 'install', 'action' => 'installstep2')); } else { $resault = setupUtility::createDatabase($data); if ($resault == null) { $this->redirect()->toRoute('install'); } $this->flashMessenger()->addSuccessMessage("Data inserted"); return $this->redirect()->toRoute('install', array('controller' => 'install', 'action' => 'installstep3')); } } } return new ViewModel(array('title' => $this->translator->translate('Install Step 2'), 'form' => $installForm2)); }
public function onDispatch(\Zend\Mvc\MvcEvent $e) { $install = setupUtility::checkInstall(); if ($install == true) { return $this->redirect()->toRoute('install'); } //get doctrine service $this->serviceLocatorStr = 'doctrine'; $this->sm = $this->getServiceLocator(); $this->doctrineService = $this->sm->get($this->serviceLocatorStr); //get translate service $this->translator = Utility::translate(); //check login $user = Utility::checkLogin(); if (!is_object($user) && $user == 0) { $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); } //start acl // $acl = new myAcl(); // $currentRoute = $this->getModuleCurrentRoute($e); // $isOk = $acl->checkRole(UtilityRoleLevel::convertUserTypeToRole($user->userType)['role'],$currentRoute); // if(!$isOk || $isOk == '' || $isOk == null){ // return $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); // } //end check login //end acl $this->init(); return parent::onDispatch($e); }
public function onDispatch(\Zend\Mvc\MvcEvent $e) { //check install $install = setupUtility::checkInstall(); if ($install == true) { return $this->redirect()->toRoute('install'); } //end check install $service_locator_str = 'doctrine'; $this->sm = $this->getServiceLocator(); $CategoriesTable = $this->sm->get($service_locator_str); $this->modelUsers = new userModel($CategoriesTable); $this->translator = Utility::translate(); $this->layout('layout/login'); //$this->layout('layout/login'); return parent::onDispatch($e); }
public function onDispatch(\Zend\Mvc\MvcEvent $e) { $install = setupUtility::checkInstall(); if ($install == true) { return $this->redirect()->toRoute('install'); } //get doctrine service $this->serviceLocatorStr = 'doctrine'; $this->sm = $this->getServiceLocator(); $this->doctrineService = $this->sm->get($this->serviceLocatorStr); //get translate service $this->translator = Utility::translate(); //check login $user = Utility::checkLogin(); if (!is_object($user) && $user == 0) { $this->redirect()->toRoute('admin/child', array('controller' => 'login')); } if (!Utility::checkRole($user->userType, ROLE_ADMIN)) { $this->redirect()->toRoute('frontend/child', array('controller' => 'login')); } $this->init(); return parent::onDispatch($e); }