public function update() { $posts = array('action' => 'update'); $response = N2SS3::api($posts); if (is_string($response)) { if (N2Platform::updateFromZip($response, N2SS3::getUpdateInfo())) { return 'OK'; } return 'UPDATE_ERROR'; } return $response['status']; }
public function actionImportDemo() { $this->validateToken(); $this->validatePermission('smartslider_edit'); $key = 'http:' . base64_decode(N2Request::getVar('key')); if (strpos($key, 'http://smartslider3.com/') !== 0) { N2Message::error(sprintf(n2_('Import url is not valid: %s'), $key)); $this->response->error(); } $posts = array('action' => 'asset', 'asset' => $key); $result = N2SS3::api($posts); if (!is_string($result)) { $hasError = N2SS3::hasApiError($result['status'], array('key' => $key)); if (is_array($hasError)) { $this->redirect($hasError); } else { if ($hasError !== false) { $this->response->error(); } } } else { N2Loader::import(array('models.Sliders', 'models.Slides'), 'smartslider'); N2Loader::import('libraries.import', 'smartslider'); $import = new N2SmartSliderImport(); $sliderId = $import->import($result, 'clone', 1, false); if ($sliderId !== false) { N2Message::success(n2_('Slider imported.')); $this->response->redirect(array("slider/edit", array("sliderid" => $sliderId))); } else { N2Message::error(n2_('Import error!')); $this->response->error(); } } $this->response->respond(); }