Ejemplo n.º 1
0
 public function actionSearch()
 {
     $this->validateToken();
     N2Loader::import('libraries.models.content', 'platform');
     $keyword = N2Request::getVar('keyword', '');
     $this->response->respond(N2ModelsContent::search($keyword));
 }
Ejemplo n.º 2
0
 public function save()
 {
     $namespace = N2Request::getCmd('namespace', 'default');
     $settings = N2Request::getVar('settings');
     if ($namespace && $settings) {
         if ($namespace == 'default') {
             $namespace = 'settings';
         }
         if ($namespace == 'font' && N2Request::getInt('sliderid')) {
             $namespace .= N2Request::getInt('sliderid');
             self::markChanged(N2Request::getInt('sliderid'));
         }
         if ($namespace == 'joomla') {
             $license = empty($settings['license']) ? '' : $settings['license'];
             $updates = $this->db->queryAll("SELECT b.update_site_id FROM " . $this->db->tableAlias("extensions") . " AS a LEFT JOIN " . $this->db->tableAlias("update_sites_extensions") . " AS b ON a.extension_id = b.extension_id WHERE a.element = 'com_smartslider3'");
             if (count($updates)) {
                 $id = $updates[0]['update_site_id'];
                 unset($updates[0]);
                 if (count($updates)) {
                     foreach ($updates as $u) {
                         $this->db->setTableName("update_sites");
                         $this->db->deleteByAttributes(array("update_site_id" => $u['update_site_id']));
                         $this->db->setTableName("update_sites_extensions");
                         $this->db->deleteByAttributes(array("update_site_id" => $u['update_site_id']));
                     }
                 }
                 $this->db->setTableName("update_sites");
                 $this->db->update(array("location" => 'http://www.nextendweb.com/update2/joomla/update.php?license=' . urlencode($license) . '&fake=extension.xml'), array("update_site_id" => $id));
             }
         }
         N2SmartSliderSettings::store($namespace, json_encode($settings));
     }
 }
Ejemplo n.º 3
0
 public function actionEnd()
 {
     $this->validateToken();
     $this->validatePermission('smartslider_edit');
     $key = N2Request::getCmd('key');
     N2SmartSliderSettings::set('guide-' . $key, 0);
     N2Message::notice('The ' . $key . ' guide completed. If you need it again, you can turn it on in the "Settings"!');
     $this->response->respond();
 }
Ejemplo n.º 4
0
 public function sliderWidget($appType, $name)
 {
     $configurationXmlFile = $this->getWidgetPath($name) . 'config.xml';
     $values = (array) N2Request::getVar('values', array());
     $values['widget' . $name] = N2Post::getVar('value');
     $class = 'N2SSPluginWidget' . $name . N2Post::getVar('value');
     if (class_exists($class, false)) {
         $values = array_merge(call_user_func(array($class, 'getDefaults')), $values);
     }
     return $this->subform($appType, $configurationXmlFile, $values, 'slider', 'widget' . $name);
 }
Ejemplo n.º 5
0
 public function renderFontsConfigurationForm()
 {
     $values = N2Fonts::loadSettings();
     $form = new N2Form($this->appType);
     $form->loadArray($values);
     $form->loadArray($values['plugins']->toArray());
     $form->loadXMLFile(N2Loader::getPath('models', 'system') . '/forms/fonts.xml');
     echo N2Html::openTag("form", array("id" => "nextend-config", "method" => "post", "action" => N2Request::getRequestUri()));
     $form->render('fonts');
     echo N2Html::closeTag("form");
 }
Ejemplo n.º 6
0
 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();
     }
 }
Ejemplo n.º 7
0
 public function actionChangeVisual()
 {
     $this->validateToken();
     $visualId = N2Request::getInt('visualId');
     $this->validateVariable($visualId > 0, 'image');
     $model = $this->getModel();
     if ($visual = $model->changeVisual($visualId, N2Request::getVar('value'))) {
         $this->response->respond(array('visual' => $visual));
     }
     N2Message::error(n2_('Unexpected error'));
     $this->response->error();
 }
Ejemplo n.º 8
0
 public function parseRequest()
 {
     $mode = N2Request::getVar('mode');
     switch ($mode) {
         case 'pluginmethod':
             $this->pluginmethod();
             break;
         default:
             return;
             break;
     }
 }
Ejemplo n.º 9
0
 public function actionGenerator()
 {
     if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
         $generator_id = N2Request::getInt('generator_id');
         $generatorModel = new N2SmartsliderGeneratorModel();
         $sliderId = $generatorModel->getSliderId($generator_id);
         if ($sliderId) {
             $generatorData = array();
             $generatorData[$generator_id] = N2Request::getVar('generator');
             $this->addView("generator", array('generatorData' => $generatorData, 'sliderId' => $sliderId));
             $this->render();
         }
     }
 }
Ejemplo n.º 10
0
 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();
     }
 }
Ejemplo n.º 11
0
 public function actionItemDefaults()
 {
     if ($this->validatePermission('smartslider_config')) {
         if (N2Request::getInt('save')) {
             if ($this->validateToken()) {
                 $settingsModel = new N2SmartsliderSettingsModel();
                 if ($settingsModel->saveDefaults(N2Request::getVar('defaults', array()))) {
                     $this->refresh();
                 }
             } else {
                 $this->refresh();
             }
         }
         $this->addView("../../inline/_sidebar_settings", array(), "sidebar");
         $this->addView("defaults");
         $this->render();
     }
 }
Ejemplo n.º 12
0
 public function actionUpload()
 {
     if (defined('N2_IMAGE_UPLOAD_DISABLE')) {
         N2Message::error(n2_('You are not allowed to upload!'));
         $this->response->error();
     }
     $this->validateToken();
     $root = N2Filesystem::getImagesFolder();
     $folder = ltrim(rtrim(N2Request::getVar('path', ''), '/'), '/');
     $path = N2Filesystem::realpath($root . '/' . $folder);
     if ($path === false || $path == '') {
         $folder = preg_replace("/[^A-Za-z0-9]/", '', $folder);
         if (empty($folder)) {
             N2Message::error(n2_('Folder is missing!'));
             $this->response->error();
         } else {
             N2Filesystem::createFolder($root . '/' . $folder);
             $path = N2Filesystem::realpath($root . '/' . $folder);
         }
     }
     $relativePath = $this->relative($path, $root);
     if (!$relativePath) {
         $relativePath = '';
     }
     $response = array('path' => $relativePath);
     try {
         if (isset($_FILES) && isset($_FILES['image']) && isset($_FILES['image']['name'])) {
             $info = pathinfo($_FILES['image']['name']);
             $fileName = preg_replace('/[^a-zA-Z0-9_-]/', '', $info['filename']);
             if (strlen($fileName) == 0) {
                 $fileName = '';
             }
             $upload = new N2BulletProof();
             $file = $upload->uploadDir($path)->upload($_FILES['image'], $fileName);
             $response['name'] = basename($file);
             $response['url'] = N2ImageHelper::dynamic(N2Filesystem::pathToAbsoluteURL($file));
         }
     } catch (Exception $e) {
         N2Message::error($e->getMessage());
         $this->response->error();
     }
     $this->response->respond($response);
 }
Ejemplo n.º 13
0
 public function actionSaveImage()
 {
     $this->validateToken();
     N2Loader::import('libraries.image.aviary');
     $image = N2Request::getVar('aviaryUrl');
     $this->validateVariable(!empty($image), 'image');
     require_once dirname(__FILE__) . '/Browse.php';
     $root = N2Filesystem::getImagesFolder();
     $folder = 'aviary';
     $path = N2Filesystem::realpath($root . '/' . $folder);
     if ($path === false || $path == '') {
         N2Filesystem::createFolder($root . '/' . $folder);
         $path = N2Filesystem::realpath($root . '/' . $folder);
     }
     $tmp = tempnam(sys_get_temp_dir(), 'image-');
     file_put_contents($tmp, file_get_contents($image));
     $src = null;
     // Set variables for storage
     // fix file filename for query strings
     preg_match('/([^\\?]+)\\.(jpe?g|gif|png)\\b/i', $image, $matches);
     $file_array['name'] = basename($matches[1]);
     $file_array['tmp_name'] = $tmp;
     $file_array['size'] = filesize($tmp);
     $file_array['error'] = 0;
     try {
         $fileName = preg_replace('/[^a-zA-Z0-9_-]/', '', $file_array['name']);
         $upload = new N2BulletProof();
         $file = $upload->uploadDir($path)->upload($file_array, $fileName);
         $src = N2ImageHelper::dynamic(N2Filesystem::pathToAbsoluteURL($file));
     } catch (Exception $e) {
         N2Message::error($e->getMessage());
         $this->response->error();
     }
     if ($src) {
         $this->response->respond(array('image' => $src));
     } else {
         N2Message::error(sprintf(n2_('Unexpected error: %s'), $image));
         $this->response->error();
     }
 }
Ejemplo n.º 14
0
 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);
     }
 }
Ejemplo n.º 15
0
 public function actionUnPublish()
 {
     if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
         if ($slideId = N2Request::getInt('slideid')) {
             $slidesModel = new N2SmartsliderSlidesModel();
             $slidesModel->unpublish($slideId);
             $this->redirect(N2Request::getUrlReferrer());
         }
         $this->redirect(array("sliders/index"));
     }
 }
Ejemplo n.º 16
0
<?php

/**
 * @var $slidesModel N2SmartsliderSlidesModel
 */
$slide = $slidesModel->get(N2Request::getInt('slideid', 0));
$actions = array(N2Html::tag('a', array('href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => $sliderId))), 'class' => 'n2-button n2-button-red n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return nextend.cancel(this.href);'), n2_('Cancel')));
if ($slide && $slide['generator_id'] > 0) {
    $actions[] = N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-blue n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'nextend.askToSave = false;setTimeout(function() {var static = n2("<input name=\'static\' value=\'1\' />"); n2(\'#smartslider-form\').append(static).submit(); static.remove();}, 300); return false;'), n2_('Static save'));
}
$actions[] = N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-green n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return NextendForm.submit("#smartslider-form");'), n2_('Save'));
$this->widget->init('topbar', array('back' => N2Html::tag('a', array('class' => 'n2-h4 n2-uc', 'href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => $sliderId)))), n2_('Slider settings')), "actions" => $actions, 'menu' => array(N2Html::tag('a', array('id' => 'n2-ss-preview', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-blue n2-button-big', 'style' => 'font-size: 12px;'), n2_('Preview')), N2Html::tag('a', array('id' => 'n2-ss-undo', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-grey n2-button-big n2-icon-button', 'style' => 'font-size: 12px;'), '<i class="n2-i n2-it n2-i-16 n2-i-undo"></i>'), N2Html::tag('a', array('id' => 'n2-ss-redo', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-grey n2-button-big n2-icon-button', 'style' => 'font-size: 12px;'), '<i class="n2-i n2-it n2-i-16 n2-i-redo"></i>')), "hideSidebar" => true));
?>

    <script type="text/javascript">
    nextend.isPreview = false;
    nextend.ready(
        function ($) {

            var form = $('#smartslider-form'),
                formAction = form.attr('action');

            var modal = new NextendSimpleModal('<iframe name="n2-tab-preview" src="" style="width: 100%;height:100%;"></iframe>');
            modal.modal.on('ModalHide', function () {
                modal.modal.find('iframe').attr('src', 'about:blank');
                $(window).trigger('SSPreviewHide');
            });

            $('#n2-ss-preview').on('click', function (e) {
                nextend.isPreview = true;
                e.preventDefault();
Ejemplo n.º 17
0
<?php

/**
* @author    Roland Soos
* @copyright (C) 2015 Nextendweb.com
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die('Restricted access');
$action = N2Request::getCmd('nextendaction', 'default');
$settings = array(array('id' => 'index', 'title' => n2_('General settings')));
$settings[] = array('id' => 'fonts', 'title' => n2_('Fonts'));
$dl = array();
foreach ($settings as $setting) {
    $dl[] = array('title' => $setting['title'], 'link' => $this->appType->router->createUrl("settings/{$setting['id']}"), 'class' => $setting['id'] == $action ? 'active ' : '');
}
echo $this->widget->init("definitionlist", array("dl" => $dl));
Ejemplo n.º 18
0
<?php

/**
* @author    Roland Soos
* @copyright (C) 2015 Nextendweb.com
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die('Restricted access');
/* @var $this N2Layout */
?>

    <div id="n2-admin" class="n2 n2-border-radius">

        <?php 
$cmd = N2Request::getVar("nextendcontroller", "sliders");
/**
 * @see Nav
 */
$views = array(N2Html::tag('a', array('href' => $this->appType->router->createUrl("sliders/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "sliders" ? "n2-active" : "")), n2_('Sliders')), N2Html::tag('a', array('href' => $this->appType->router->createUrl("settings/default"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "settings" ? "n2-active" : "")), n2_('Settings')), N2Html::tag('a', array('href' => N2Base::getApplication('system')->router->createUrl("dashboard/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "settings" ? "n2-active" : "")), n2_('Nextend')));
$views[] = N2Html::tag('a', array('href' => N2SS3::getProUrlPricing(), 'target' => '_blank', 'class' => 'n2-h4 n2-uc '), n2_('Go Pro!'));
$this->widget->init('nav', array('logoUrl' => $this->appType->router->createUrl("sliders/index"), 'logoImageUrl' => $this->appType->app->getLogo(), 'views' => $views, 'actions' => $this->getFragmentValue('actions')));
?>

        <div class="n2-table n2-table-fixed n2-content">
            <div class="n2-tr">
                <div class="n2-td n2-sidebar n2-sidebar-base-bg n2-border-radius-bl">
                    <?php 
$this->renderFragmentBlock('nextend_sidebar', '_sliders');
?>
                </div>
Ejemplo n.º 19
0
<?php

$this->widget->init('topbar', array("menu" => array(N2Html::tag('a', array('id' => 'n2-ss-preview', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-blue n2-button-big', 'style' => 'font-size: 12px;'), n2_('Preview'))), "actions" => array(N2Html::tag('a', array('href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => N2Request::getInt('sliderid')))), 'class' => 'n2-button n2-button-red n2-button-big n2-h4 n2-b n2-uc'), n2_('Cancel')), N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-green n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return NextendForm.submit("#smartslider-form");'), n2_('Save')))));
?>

<form id="smartslider-form" action="" method="post">
    <?php 
$params = new N2Data($generator['params'], true);
$group = $generator['group'];
$type = $generator['type'];
$generatorModel = new N2SmartsliderGeneratorModel();
$info = $generatorModel->getGeneratorInfo($group, $type);
$this->widget->init('heading', array('title' => $info->group . ' - ' . $info->title));
$xml = $generatorModel->generatorSpecificForm($group, $type, $params->toArray());
$slideParams = new N2Data($slide['params'], true);
$params->set('record-slides', $slideParams->get('record-slides', 1));
$generatorModel->generatorEditForm($params->toArray());
?>
    <input name="save" value="1" type="hidden"/>
</form>
<style>
    #generatorrecords {
        overflow: auto;
        width: 100%;
    }

    #generatorrecords table div {
        max-width: 200px;
        max-height: 200px;
        overflow: auto;
    }
Ejemplo n.º 20
0
 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();
 }
Ejemplo n.º 21
0
 /**
  * @return bool
  */
 public function isAjaxCall()
 {
     return N2Request::getInt('nextendajax');
 }
Ejemplo n.º 22
0
 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);
 }
Ejemplo n.º 23
0
 public function _renderGroupOption($group, $sources)
 {
     $options = array();
     foreach ($sources as $type => $info) {
         /**
          * @var $info N2GeneratorInfo
          */
         $options[$type] = $info->title;
         if ($info->hasConfiguration) {
             $button = N2Html::link("Next", $this->appType->router->createUrl(array("generator/checkConfiguration", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group))), array("onclick" => "var el = n2(this); el.attr('href', el.attr('href') + '&type='+el.parents('.n2-box-placeholder').find('select').val());", "class" => "n2-button n2-button-small n2-button-blue"));
         } elseif (!$info->installed) {
             $button = N2Html::link("Check extension", $info->readMore, array("target" => "_blank", "class" => "n2-button n2-button-small n2-button-grey"));
         } else {
             $button = N2Html::link("Next", $this->appType->router->createUrl(array("generator/createSettings", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group))), array("onclick" => "var el = n2(this); el.attr('href', el.attr('href') + '&type='+el.parents('.n2-box-placeholder').find('select').val());", "class" => "n2-button n2-button-small n2-button-blue"));
         }
     }
     $optionsHTML = '';
     foreach ($options as $k => $v) {
         $optionsHTML .= N2Html::tag('option', array('value' => $k), $v);
     }
     echo N2Html::tag('div', array('class' => 'n2-box'), N2Html::image(N2Uri::pathToUri(N2Filesystem::translate($info->path . '/../dynamic.png'))) . N2Html::tag("div", array('class' => 'n2-box-placeholder'), N2Html::tag("table", array(), N2Html::tag("tr", array(), N2Html::tag("td", array('class' => 'n2-box-label'), N2Html::tag('select', array('name' => 'generator-type'), $optionsHTML)) . N2Html::tag("td", array('class' => 'n2-box-button'), $button)))));
 }
Ejemplo n.º 24
0
$generatorModel = new N2SmartsliderGeneratorModel();
$info = $generatorModel->getGeneratorInfo($group, $type);
$this->widget->init('heading', array('title' => $info->group . ' - ' . $info->title));
$xml = $generatorModel->generatorSpecificForm($group, $type);
$generatorModel->generatorCommonForm();
?>
        <input name="generator[group]" value="<?php 
echo $group;
?>
" type="hidden"/>
        <input name="generator[type]" value="<?php 
echo $type;
?>
" type="hidden"/>
        <input name="slider-id" value="<?php 
echo N2Request::getInt('sliderid');
?>
" type="hidden"/>
        <input name="save" value="1" type="hidden"/>
    </form>
    <style>
        #generatorrecords {
            overflow: auto;
            width: 100%;
        }

        #generatorrecords table div {
            max-width: 200px;
            max-height: 200px;
            overflow: auto;
        }
Ejemplo n.º 25
0
<?php

/* @var $this N2Layout */
?>

    <div id="n2-admin" class="n2 n2-border-radius">

        <?php 
/**
 * @var $widget Nav
 */
$logoUrl = N2Base::getApplication('system')->getLogo();
$cmd = N2Request::getVar("nextendcontroller", "dashboard");
echo $this->widget->init('nav', array('logoUrl' => $this->appType->router->createUrl("dashboard/index"), 'logoImageUrl' => $logoUrl, 'views' => array(N2Html::tag('a', array('href' => $this->appType->router->createUrl("dashboard/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "dashboard" ? "n2-active" : "")), n2_('Dashboard')), N2Html::tag('a', array('href' => $this->appType->router->createUrl("settings/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "settings" ? "n2-active" : "")), n2_('Settings')), N2Html::tag('a', array('href' => $this->appType->router->createUrl("help/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "help" ? "n2-active" : "")), n2_('Help'))), 'actions' => $this->getFragmentValue('actions')));
?>

        <div class="n2-table n2-table-fixed n2-content">
            <div class="n2-tr">
                <div class="n2-td n2-sidebar n2-sidebar-base-bg">
                    <?php 
$this->renderFragmentBlock('nextend_sidebar');
?>
                </div>

                <div class="n2-td n2-content-base-bg">
                    <!-- Begin Content -->
                    <div class="n2-content-area n2-border-radius-br">
                        <?php 
$this->renderFragmentBlock('nextend_content');
?>
                    </div>
 public function makeSlides($extend = array())
 {
     if (N2Request::getCmd('nextendcontroller') == 'slides') {
         $slides =& $this->slides;
         if (N2Request::getCmd('nextendaction') == 'create') {
             if ($this->maximumSlideCount > 0) {
                 array_splice($slides, $this->maximumSlideCount - 1);
             }
             $staticSlide = N2Request::getInt('static', 0);
             $slide = $this->createSlide(array('id' => 0, 'title' => 'Title', 'slider' => N2Request::getInt('sliderid'), 'publish_up' => '0000-00-00 00:00:00', 'publish_down' => '0000-00-00 00:00:00', 'published' => 1, 'first' => 0, 'slide' => '', 'description' => '', 'thumbnail' => '', 'background' => 'ffffff00|*|', 'params' => json_encode(array('static-slide' => $staticSlide)), 'ordering' => count($slides), 'generator_id' => 0));
             if ($slide->isStatic()) {
                 $this->slider->addStaticSlide($slide);
                 if (count($slides) == 0) {
                     $slide2 = $this->createSlide(array('id' => 0, 'title' => 'Title', 'slider' => N2Request::getInt('sliderid'), 'publish_up' => '0000-00-00 00:00:00', 'publish_down' => '0000-00-00 00:00:00', 'published' => 1, 'first' => 0, 'slide' => '', 'description' => '', 'thumbnail' => '', 'background' => 'ffffff00|*|', 'params' => '', 'ordering' => count($slides), 'generator_id' => 0));
                     array_push($slides, $slide2);
                 }
             } else {
                 for ($i = 0; $i < count($slides); $i++) {
                     if ($slides[$i]->isStatic()) {
                         $this->slider->addStaticSlide($slides[$i]);
                         array_splice($slides, $i, 1);
                         $i--;
                     }
                 }
                 array_push($slides, $slide);
                 $this->slider->_activeSlide = count($slides) - 1;
             }
         } else {
             $currentlyEdited = N2Request::getInt('slideid');
             $currentlyEditedSlide = null;
             $isStatic = false;
             for ($i = 0; $i < count($slides); $i++) {
                 if ($slides[$i]->isStatic()) {
                     if ($slides[$i]->id == $currentlyEdited) {
                         $isStatic = true;
                     }
                     $this->slider->addStaticSlide($slides[$i]);
                     array_splice($slides, $i, 1);
                     $i--;
                 }
             }
             if ($isStatic) {
                 for ($i = 0; $i < count($this->slider->staticSlides); $i++) {
                     if ($this->slider->staticSlides[$i]->id != $currentlyEdited) {
                         array_splice($this->slider->staticSlides, $i, 1);
                         $i--;
                     }
                 }
             }
             for ($i = 0; $i < count($slides); $i++) {
                 $slides[$i]->initGenerator($extend);
             }
             for ($i = count($slides) - 1; $i >= 0; $i--) {
                 if ($slides[$i]->hasGenerator()) {
                     array_splice($slides, $i, 1, $slides[$i]->expandSlide());
                 }
             }
             if (!$isStatic) {
                 for ($i = 0; $i < count($slides); $i++) {
                     if ($slides[$i]->id == $currentlyEdited) {
                         $this->slider->_activeSlide = $i;
                         $currentlyEditedSlide = $slides[$i];
                         break;
                     }
                 }
             } else {
                 if (count($slides) == 0) {
                     if (count($slides) == 0) {
                         $slide2 = $this->createSlide(array('id' => 0, 'title' => 'Title', 'slider' => N2Request::getInt('sliderid'), 'publish_up' => '0000-00-00 00:00:00', 'publish_down' => '0000-00-00 00:00:00', 'published' => 1, 'first' => 0, 'slide' => '', 'description' => '', 'thumbnail' => '', 'background' => 'ffffff00|*|', 'params' => '', 'ordering' => count($slides), 'generator_id' => 0));
                         array_push($slides, $slide2);
                     }
                 }
                 $this->slider->_activeSlide = 0;
                 $currentlyEditedSlide = $slides[0];
             }
             if ($this->maximumSlideCount > 0) {
                 array_splice($slides, $this->maximumSlideCount);
                 $found = false;
                 for ($i = 0; $i < count($slides); $i++) {
                     if ($slides[$i] == $currentlyEditedSlide) {
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     $this->slider->_activeSlide = count($slides) - 1;
                     $slides[$this->slider->_activeSlide] = $currentlyEditedSlide;
                 }
             }
             if ($currentlyEditedSlide) {
                 $currentlyEditedSlide->setCurrentlyEdited();
             }
         }
     }
 }
Ejemplo n.º 27
0
 public function isCurrentlyEdited()
 {
     return N2Request::getInt('slideid') == $this->id;
 }
Ejemplo n.º 28
0
 /**
  * @param $slide  N2SmartSliderSlide
  * @param $slider N2SmartSliderAbstract
  * @param $widget
  * @param $appType
  *
  * @throws Exception
  */
 public static function box($slide, $slider, $widget, $appType)
 {
     $lt = array();
     if ($slide->isStatic()) {
         $lt[] = N2Html::tag('div', array('class' => 'n2-button-tag n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5'), n2_('Static slide'));
     } else {
         $lt[] = N2Html::tag('div', array('class' => 'n2-button-tag n2-button n2-button-x-small n2-button-green n2-uc n2-h5 n2-slide-is-first'), n2_('First'));
         $lt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5 n2-slide-first', 'href' => $appType->router->createUrl(array('slides/first', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), n2_('Set First'));
     }
     $rt = array();
     $rt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-small n2-sidebar-list-bg n2-sidebar-list-bg n2-slide-duplicate', 'href' => $appType->router->createUrl(array('slides/duplicate', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-duplicate'), ''));
     $rt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-small n2-sidebar-list-bg n2-slide-delete', 'href' => $appType->router->createUrl(array('slides/delete', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-delete'), ''));
     $rt[] = N2Html::tag('div', array('class' => 'n2-button n2-button-small n2-button-blue n2-slide-selected'), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-tick'), ''));
     $rb = array();
     if ($slide->hasGenerator()) {
         $rb[] = N2Html::tag('a', array('class' => 'n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5 n2-slide-generator' . (N2Request::getVar('generator_id') == $slide->generator_id ? ' n2-button-blue' : ''), 'href' => $appType->router->createUrl(array('generator/edit', array('generator_id' => $slide->generator_id)))), 'Edit generator');
     }
     $image = $slide->getThumbnail();
     if (empty($image)) {
         $image = '$system$/images/placeholder/image.png';
     }
     $editUrl = $appType->router->createUrl(array('slides/edit', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id)));
     $widget->init("box", array('attributes' => array('class' => 'n2-box-slide n2-box-overflow' . ($slide->isFirst() ? ' n2-first-slide' : '') . ($slide->isCurrentlyEdited() ? ' n2-ss-slide-active' : ''), 'data-slideid' => $slide->id, 'data-title' => $slide->getRawTitle(), 'data-description' => $slide->getRawDescription(), 'data-link' => $slide->getRawLink(), 'data-image' => N2ImageHelper::fixed($image), 'data-editUrl' => $editUrl), 'image' => N2ImageHelper::fixed($image), 'firstCol' => N2Html::link($slide->getTitle() . ($slide->hasGenerator() ? ' [' . $slide->getSlideStat() . ']' : ''), $editUrl, array('class' => 'n2-h4')), 'lt' => implode('', $lt), 'rt' => implode('', $rt), 'rtAttributes' => array('class' => 'n2-on-hover'), 'rb' => implode('', $rb), 'placeholderContent' => N2Html::tag('a', array('class' => 'n2-slide-published' . ($slide->published ? ' n2-active' : ''), 'href' => $appType->router->createUrl(array('slides/publish', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-unpublished'), ''))));
 }
Ejemplo n.º 29
0
<?php

$actions = array();
if (isset($slider)) {
    $actions[] = N2Html::tag('a', array('href' => $this->appType->router->createUrl(array("generator/create", array("sliderid" => $slider['id']))), 'class' => 'n2-button n2-button-red n2-button-big n2-h4 n2-b n2-uc'), n2_('Cancel'));
}
$actions[] = N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-green n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return NextendForm.submit("#smartslider-form");'), n2_('Save'));
$this->widget->init('topbar', array("actions" => $actions));
?>

<form id="smartslider-form" action="" method="post">
    <?php 
echo $configuration->render();
?>
    <input name="save" value="1" type="hidden"/>
</form>
<?php 
N2SS3::showBeacon(ucfirst(N2Request::getCmd('group')) . ' generator');
Ejemplo n.º 30
0
 public static function checkToken()
 {
     return wp_verify_nonce(N2Request::getVar('nextend_nonce'), 'nextend_security');
 }