csrfProtection(); $router = $this->container->router; $returnUrl = $router->route('index.php?view=discover'); $directory = $this->input->get('directory', '', 'string'); if (empty($directory)) { $msg = Text::_('DISCOVER_ERROR_NODIRECTORY'); $this->setRedirect($returnUrl, $msg, 'error'); return; } $model = $this->getModel(); $model->setState('directory', $directory); $this->display(); } /** * Performs the actual import * * @return void */ public function import() { $this->csrfProtection(); $router = $this->container->router; $returnUrl = $router->route('index.php?view=discover'); $directory = $this->input->get('directory', '', 'string'); $files = $this->input->get('files', array(), 'array'); if (empty($files)) { $msg = Text::_('DISCOVER_ERROR_NOFILESSELECTED'); $this->setRedirect($returnUrl, $msg, 'error'); return; } /** @var \Solo\Model\Discover $model */ $model = $this->getModel(); $model->setState('directory', $directory); foreach ($files as $file) { $model->import($file); } $msg = Text::_('DISCOVER_LABEL_IMPORTDONE'); $this->setRedirect($returnUrl, $msg); } }