/**
  * Get module id
  *
  * @return int
  */
 protected function getModuleId()
 {
     $modules = Table\Modules::findAll()->rows();
     $module = new Model\Module();
     $new = $module->detectNew();
     $moduleIds = [];
     if ($new > 0) {
         $this->console->append('[' . $new . ' New Module' . ($new > 1 ? 's' : '') . ' Detected]' . PHP_EOL);
     }
     $this->console->append("ID  \tActive\t\tModule");
     $this->console->append("----\t------\t\t------");
     foreach ($modules as $module) {
         $moduleIds[] = $module->id;
         $this->console->append($module->id . "\t" . ($module->active ? 'Yes' : 'No') . "\t\t" . $module->folder);
     }
     $this->console->append();
     $this->console->send();
     $moduleId = null;
     while (!is_numeric($moduleId) || !in_array($moduleId, $moduleIds)) {
         $moduleId = $this->console->prompt($this->console->getIndent() . 'Select Module ID: ');
     }
     return $moduleId;
 }
示例#2
0
 /**
  * Process action method
  *
  * @return void
  */
 public function process()
 {
     $module = new Model\Module();
     $module->process($this->request->getPost(), $this->services);
     if (null !== $this->request->getPost('rm_modules')) {
         $this->sess->setRequestValue('removed', true);
     } else {
         $this->sess->setRequestValue('saved', true);
     }
     \Pop\Http\Response::redirect(BASE_PATH . APP_URI . '/modules');
     exit;
 }
示例#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();
 }