コード例 #1
0
ファイル: Slides.php プロジェクト: RenatoToasa/Pagina-Web
 public function actionDuplicate()
 {
     if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
         if ($slideId = N2Request::getInt('slideid')) {
             $slidesModel = new N2SmartsliderSlidesModel();
             $newSlideId = $slidesModel->duplicate($slideId);
             N2Message::success(n2_('Slide duplicated.'));
             $this->redirect(array("slides/edit", array("sliderid" => N2Request::getInt("sliderid"), "slideid" => $newSlideId)));
         }
         $this->redirect(array("sliders/index"));
     }
 }
コード例 #2
0
ファイル: Slider.php プロジェクト: vicpril/rep_bidqa
 public function actionDuplicate()
 {
     if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
         $slidersModel = new N2SmartsliderSlidersModel();
         if (($sliderid = N2Request::getInt('sliderid')) && $slidersModel->get($sliderid)) {
             $newSliderId = $slidersModel->duplicate($sliderid);
             N2Message::success(n2_('Slider duplicated.'));
             $this->redirect(array("slider/edit", array("sliderid" => $newSliderId)));
         }
         $this->redirectToSliders();
     }
 }
コード例 #3
0
ファイル: Settings.php プロジェクト: MBerguer/wp-demo
 public function actionClearCache()
 {
     if ($this->validatePermission('smartslider_config')) {
         if ($this->validateToken()) {
             $slidersModel = new N2SmartsliderSlidersModel();
             foreach ($slidersModel->getAll() as $slider) {
                 $slidersModel->refreshCache($slider['id']);
             }
             N2Cache::clearGroup('n2-ss-0');
             N2Cache::clearGroup('combined');
             N2Message::success(n2_('Cache cleared.'));
         }
         $this->redirect(array("settings/default"));
     }
 }
コード例 #4
0
ファイル: Update.php プロジェクト: RenatoToasa/Pagina-Web
 public function actionUpdate()
 {
     if ($this->validateToken()) {
         $status = N2SmartsliderUpdateModel::getInstance()->update();
         $hasError = N2SS3::hasApiError($status);
         if (is_array($hasError)) {
             $this->redirect($hasError);
         } else {
             if ($hasError === false) {
                 N2Message::success(n2_('Smart Slider 3 updated to the latest version!'));
             }
         }
         $this->redirectToSliders();
     } else {
         $this->refresh();
     }
 }
コード例 #5
0
ファイル: Settings.php プロジェクト: RenatoToasa/Pagina-Web
 public function actionFonts()
 {
     if ($this->canDo('nextend_config')) {
         $fonts = N2Request::getVar('fonts', false);
         if ($fonts) {
             if ($this->validateToken()) {
                 N2Fonts::storeSettings($fonts);
                 N2Message::success(n2_('Saved.'));
                 N2Request::redirect($this->appType->router->createUrl(array("settings/fonts")));
             } else {
                 $this->refresh();
             }
         }
         $this->addView("../../inline/sidebar/settings", array("appObj" => $this), "sidebar");
         $this->addView("fonts");
         $this->render();
     }
 }
コード例 #6
0
ファイル: Slider.php プロジェクト: RenatoToasa/Pagina-Web
 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();
 }
コード例 #7
0
ファイル: Slides.php プロジェクト: RenatoToasa/Pagina-Web
 public function actionQuickEdit()
 {
     $this->validateToken();
     $this->validatePermission('smartslider_edit');
     $sliderId = N2Request::getInt('sliderid');
     $this->validateVariable($sliderId > 0, 'Slider');
     $slidesModel = new N2SmartsliderSlidesModel();
     $slides = $slidesModel->getAll($sliderId);
     $changed = json_decode(base64_decode(N2Request::getVar('changed')), true);
     if (!$changed || !is_array($changed)) {
         $changed = array();
     }
     foreach ($slides as $slide) {
         if (!empty($changed[$slide['id']])) {
             $slidesModel->quickSlideUpdate($slide, $changed[$slide['id']]['name'], $changed[$slide['id']]['description'], $changed[$slide['id']]['link']);
         }
     }
     $sliderObj = new N2SmartSlider($sliderId, array());
     $slides = $slidesModel->getAll($sliderId);
     $slidesObj = array();
     foreach ($slides as $i => $slide) {
         if (!empty($changed[$slide['id']])) {
             $slidesObj[$i] = new N2SmartSliderSlide($sliderObj, $slide);
             $slidesObj[$i]->initGenerator();
         }
     }
     $updateSlideBox = array();
     /** @var N2SmartSliderSlide $slideObj */
     foreach ($slidesObj as $slideObj) {
         $slideObj->fillSample();
         $updateSlideBox[$slideObj->id] = array('title' => $slideObj->getTitle() . ($slideObj->hasGenerator() ? ' [' . $slideObj->getSlideStat() . ']' : ''), 'rawTitle' => $slideObj->getRawTitle(), 'rawDescription' => $slideObj->getRawDescription(), 'rawLink' => $slideObj->getRawLink());
     }
     N2Message::success(sprintf(n2_('%d slide(s) modified!'), count($slidesObj)));
     $this->response->respond($updateSlideBox);
 }
コード例 #8
0
ファイル: message.php プロジェクト: vicpril/rep_bidqa
 public static function showAjax()
 {
     self::loadSessionError();
     $messages = array();
     if (is_array(self::$error) && count(self::$error)) {
         $messages['error'] = array();
         foreach (self::$error as $error) {
             $messages['error'][] = $error;
         }
         self::$error = array();
     }
     self::loadSessionSuccess();
     if (is_array(self::$success) && count(self::$success)) {
         $messages['success'] = array();
         foreach (self::$success as $success) {
             $messages['success'][] = $success;
         }
         self::$success = array();
     }
     self::loadSessionNotice();
     if (is_array(self::$notice) && count(self::$notice)) {
         $messages['notice'] = array();
         foreach (self::$notice as $notice) {
             $messages['notice'][] = $notice;
         }
         self::$notice = array();
     }
     self::$flushed = true;
     if (count($messages)) {
         return $messages;
     }
     return false;
 }
コード例 #9
0
ファイル: Generator.php プロジェクト: RenatoToasa/Pagina-Web
 public function actionFinishAuth()
 {
     if ($this->validatePermission('smartslider_config')) {
         $generatorModel = new N2SmartsliderGeneratorModel();
         $group = N2Request::getVar('group');
         $type = N2Request::getVar('type');
         $info = $generatorModel->getGeneratorInfo($group, $type);
         $configuration = $info->getConfiguration();
         $result = $configuration->finishAuth();
         if ($result === true) {
             N2Message::success(n2_('Authentication successful.'));
             echo '<script>window.opener.location.reload();self.close();</script>';
         } else {
             if ($result instanceof Exception) {
                 $message = $result->getMessage();
             } else {
                 $message = 'Something wrong with the credentials';
             }
             echo '<script>window.opener.nextend.notificationCenter.error("' . htmlspecialchars($message) . '");self.close();</script>';
         }
         n2_exit(true);
     }
 }
コード例 #10
0
ファイル: Sliders.php プロジェクト: RenatoToasa/Pagina-Web
 public function actionImportFromServer()
 {
     if ($this->validatePermission('smartslider_edit')) {
         if (N2Request::getInt('save')) {
             if ($this->validateToken()) {
                 $data = new N2Data(N2Request::getVar('slider'));
                 $file = $data->get('import-file');
                 if (empty($file)) {
                     N2Message::error(n2_('Please select a file!'));
                     $this->refresh();
                 } else {
                     $dir = N2Platform::getPublicDir();
                     if (N2Filesystem::fileexists($dir . '/' . $file)) {
                         N2Loader::import('libraries.import', 'smartslider');
                         $import = new N2SmartSliderImport();
                         $sliderId = $import->import($dir . '/' . $file, $data->get('image-mode', 'clone'), $data->get('linked-visuals', 0));
                         if ($sliderId !== false) {
                             if ($data->get('delete')) {
                                 @unlink($dir . '/' . $file);
                             }
                             N2Message::success(n2_('Slider imported.'));
                             $this->redirect(array("slider/edit", array("sliderid" => $sliderId)));
                         } else {
                             N2Message::error(n2_('Import error!'));
                             $this->refresh();
                         }
                     } else {
                         N2Message::error(n2_('The chosen file is missing!'));
                         $this->refresh();
                     }
                 }
             } else {
                 $this->refresh();
             }
         }
         $this->addView('importFromServer');
         $this->render();
     }
 }