/** * Index action method * * @return void */ public function index() { $module = new Model\Module(); if ($module->hasPages($this->config->pagination)) { $limit = $this->config->pagination; $pages = new Paginator($module->getCount(), $limit); $pages->useInput(true); } else { $limit = null; $pages = null; } $this->prepareView('phire/modules/index.phtml'); $this->view->title = 'Modules'; $this->view->pages = $pages; $this->view->newModules = $module->detectNew(); $this->view->modules = $module->getAll($this->application->modules(), $this->services['acl'], $limit, $this->request->getQuery('page'), $this->request->getQuery('sort')); $this->view->moduleUpdates = $this->sess->updates->modules; $this->send(); }
/** * 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; }
/** * 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(); }