/**
* Index method
*
* @return void
*/
public function index()
{
if (DB_INTERFACE != '' && DB_NAME != '') {
Response::redirect(BASE_PATH . APP_URI);
} else {
$install = new Model\Install(array('title' => $this->i18n->__('Installation')));
$form = new Form\Install($this->request->getBasePath() . $this->request->getRequestUri() . '?lang=' . $this->i18n->getLanguage() . '_' . $this->i18n->getLocale(), 'post');
if (!\Pop\Image\Gd::isInstalled() && !\Pop\Image\Imagick::isInstalled()) {
$install->set('error', 'Neither the GD or Imagick extensions are installed. Phire CMS 2.0 requires one of them to be installed for graphic manipulation to fully function properly. You can continue with the install, but you will not be able to upload or manipulate image graphics until one of the image extensions is installed.');
}
if ($this->request->isPost()) {
$form->setFieldValues($this->request->getPost(), array('strip_tags' => null, 'htmlentities' => array(ENT_QUOTES, 'UTF-8')));
if ($form->isValid()) {
$install->config($form);
$url = isset($install->configWritable) && $install->configWritable ? BASE_PATH . $form->app_uri . '/install/user' : BASE_PATH . APP_URI . '/install/config';
Response::redirect($url . '?lang=' . POP_LANG);
} else {
$install->set('form', $form);
$this->view = View::factory($this->viewPath . '/index.phtml', $install->getData());
$this->view->set('i18n', $this->i18n);
$this->send();
}
} else {
$install->set('form', $form);
$this->view = View::factory($this->viewPath . '/index.phtml', $install->getData());
$this->view->set('i18n', $this->i18n);
$this->send();
}
}
}