예제 #1
0
 /**
  * Install action method
  *
  * @return void
  */
 public function install()
 {
     $module = new Model\Module();
     $module->install($this->services);
     $this->sess->setRequestValue('saved', true);
     $this->redirect(BASE_PATH . APP_URI . '/modules');
 }
예제 #2
0
 /**
  * Install action method
  *
  * @return void
  */
 public function install()
 {
     $module = new Model\Module();
     $new = $module->detectNew();
     if ($new > 0) {
         $module = new Model\Module();
         $module->install($this->services);
         $this->console->append($this->console->colorize($new . ' Module' . ($new > 1 ? 's' : '') . ' Installed!', Console::BOLD_GREEN));
     } else {
         $this->console->append($this->console->colorize('No new modules detected.', Console::BOLD_YELLOW));
     }
     $this->console->send();
 }
예제 #3
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();
 }