/** * admin_add * * @return void */ public function admin_add() { $this->set('title_for_layout', __('Upload a new theme')); if (!empty($this->request->data)) { $file = $this->request->data['Theme']['file']; unset($this->request->data['Theme']['file']); $Installer = new ExtensionsInstaller(); try { $Installer->extractTheme($file['tmp_name']); $this->Session->setFlash(__('Theme uploaded successfully.'), 'default', array('class' => 'success')); } catch (CakeException $e) { $this->Session->setFlash($e->getMessage(), 'default', array('class' => 'error')); } $this->redirect(array('action' => 'index')); } }