/** * Modules method * * @return void */ public function modules() { $this->prepareView('modules.phtml', array('assets' => $this->project->getAssets(), 'acl' => $this->project->getService('acl'), 'phireNav' => $this->project->getService('phireNav'))); $ext = new Model\Extension(array('acl' => $this->project->getService('acl'))); $ext->getModules($this->project); if (null === $this->request->getPath(1)) { $this->view->set('title', $this->view->i18n->__('Extensions') . ' ' . $this->view->separator . ' ' . $this->view->i18n->__('Modules')); $this->view->merge($ext->getData()); $this->send(); } else { if (null !== $this->request->getPath(1) && $this->request->getPath(1) == 'install' && count($ext->new) > 0) { $ext->installModules(); if (null !== $ext->error) { $this->view->set('title', $this->view->i18n->__('Extensions') . ' ' . $this->view->separator . ' ' . $this->view->i18n->__('Modules') . ' ' . $this->view->separator . ' ' . $this->view->i18n->__('Installation Error')); $this->view->merge($ext->getData()); $this->send(); } else { Response::redirect($this->request->getBasePath() . '/modules?saved=' . time()); } } else { if ($this->request->isPost() && null !== $this->request->getPath(1) && $this->request->getPath(1) == 'process') { $ext->processModules($this->request->getPost()); Response::redirect($this->request->getBasePath() . '/modules?saved=' . time()); } else { Response::redirect($this->request->getBasePath() . '/modules'); } } } }
/** * Install initial user method * * @return void */ public function user() { // If the system is installed if (DB_INTERFACE != '' && DB_NAME != '' && !isset($this->sess->config)) { Response::redirect(BASE_PATH . APP_URI); // Else, if the initial install screen or config isn't complete } else { if (DB_INTERFACE == '' && DB_NAME == '') { if (isset($this->sess->config)) { Response::redirect(BASE_PATH . (isset($this->sess->app_uri) ? $this->sess->app_uri : APP_URI) . '/install/config?lang=' . $_GET['lang']); } else { Response::redirect(BASE_PATH . (isset($this->sess->app_uri) ? $this->sess->app_uri : APP_URI) . '/install?lang=' . $_GET['lang']); } // Else, install the first system user } else { $user = new Model\User(array('title' => $this->i18n->__('User Setup'))); $form = new Form\User($this->request->getBasePath() . $this->request->getRequestUri() . '?lang=' . $this->i18n->getLanguage() . '_' . $this->i18n->getLocale(), 'post', 2001, true); if ($this->request->isPost()) { $form->setFieldValues($this->request->getPost(), array('strip_tags' => null, 'htmlentities' => array(ENT_QUOTES, 'UTF-8'))); if ($form->isValid()) { $user->save($form, $this->project->module('Phire')); $newUser = Table\Users::findById($user->id); if (isset($newUser->id)) { $newUser->site_ids = serialize(array(0)); $newUser->created = date('Y-m-d H:i:s'); $newUser->update(); } $ext = new Model\Extension(array('acl' => $this->project->getService('acl'))); $ext->getModules($this->project); if (count($ext->new) > 0) { $ext->installModules(); } $user->set('form', ' <p style="text-align: center; margin: 50px 0 0 0; line-height: 1.8em; font-size: 1.2em;">' . $this->i18n->__('Thank you. The system has been successfully installed.') . '<br />' . $this->i18n->__('You can now log in %1here%2 or view the home page %3here%4.', array('<a href="' . BASE_PATH . APP_URI . '/login">', '</a>', '<a href="' . BASE_PATH . '/" target="_blank">', '</a>')) . '</p>' . PHP_EOL); Model\Install::send($form); unset($this->sess->config); unset($this->sess->app_uri); $this->view = View::factory($this->viewPath . '/user.phtml', $user->getData()); $this->view->set('i18n', $this->i18n); $this->send(); } else { $user->set('form', $form); $this->view = View::factory($this->viewPath . '/user.phtml', $user->getData()); $this->view->set('i18n', $this->i18n); $this->send(); } } else { $user->set('form', $form); $this->view = View::factory($this->viewPath . '/user.phtml', $user->getData()); $this->view->set('i18n', $this->i18n); $this->send(); } } } }
/** * Index method * * @return void */ public function index() { $config = new Model\Config(array('acl' => $this->project->getService('acl'))); $extensions = new Model\Extension(); $this->prepareView('index.phtml', array('assets' => $this->project->getAssets(), 'acl' => $this->project->getService('acl'), 'phireNav' => $this->project->getService('phireNav'))); $this->view->set('title', $this->view->i18n->__('Dashboard')); if (isset($this->sess->sessionError)) { $this->view->set('sessionError', $this->sess->sessionError); unset($this->sess->sessionError); } $overview = $config->getOverview(); $this->view->set('modules', $extensions->getAllModules())->set('overview', $overview['system'])->set('sites', $overview['sites']); $this->send(); }