/**
  * Error method
  *
  * @return void
  */
 public function error()
 {
     $install = new Model\Install(array('title' => $this->i18n->__('404 Error') . ' > ' . $this->i18n->__('Page Not Found')));
     $this->view = View::factory($this->viewPath . '/error.phtml', $install->getData());
     $this->view->set('i18n', $this->i18n);
     $this->send(404);
 }
示例#2
0
 /**
  * User action method
  *
  * @return void
  */
 public function user()
 {
     $this->prepareView('phire/install.phtml');
     $this->view->title = 'Install User';
     $fields = $this->application->config()['forms']['Phire\\Form\\Register'];
     $fields[1]['email']['required'] = true;
     $fields[2]['role_id']['value'] = 2001;
     unset($fields[1]['first_name']);
     unset($fields[1]['last_name']);
     unset($fields[1]['company']);
     unset($fields[1]['title']);
     unset($fields[1]['phone']);
     $this->view->form = new Form\Register(false, false, $fields);
     if ($this->request->isPost()) {
         $this->view->form->addFilter('strip_tags')->addFilter('htmlentities', [ENT_QUOTES, 'UTF-8'])->setFieldValues($this->request->getPost());
         if ($this->view->form->isValid()) {
             $this->view->form->clearFilters()->addFilter('html_entity_decode', [ENT_QUOTES, 'UTF-8'])->filter();
             $fields = $this->view->form->getFields();
             $fields['active'] = 1;
             $fields['verified'] = 1;
             $user = new Model\User();
             $user->save($fields);
             $install = new Model\Install();
             $install->sendConfirmation($user);
             $module = new Model\Module();
             if ($module->detectNew()) {
                 $module->install($this->services);
             }
             $dbType = DB_INTERFACE == 'pdo' ? DB_TYPE : DB_INTERFACE;
             if (file_exists(__DIR__ . '/../../../data/install.' . strtolower($dbType) . '.sql')) {
                 $install->installProfile(__DIR__ . '/../../../data/install.' . strtolower($dbType) . '.sql');
             }
             unset($this->sess->config);
             unset($this->sess->app_uri);
             $this->sess->setRequestValue('installed', true);
             $this->redirect(BASE_PATH . APP_URI . '/login');
         }
     }
     $this->send();
 }