Example #1
0
 public function chooseTheme()
 {
     $this->themeService->updateThemeList();
     $this->themeService->updateThemesInfo();
     $themes = $this->themeService->findAllThemes();
     $themesInfo = array();
     $activeTheme = OW::getThemeManager()->getSelectedTheme()->getDto()->getName();
     /* @var $theme BOL_Theme */
     foreach ($themes as $theme) {
         $themesInfo[$theme->getName()] = (array) json_decode($theme->getDescription());
         $themesInfo[$theme->getName()]['key'] = $theme->getName();
         $themesInfo[$theme->getName()]['title'] = $theme->getTitle();
         $themesInfo[$theme->getName()]['iconUrl'] = $this->themeService->getStaticUrl($theme->getName()) . BOL_ThemeService::ICON_FILE;
         $themesInfo[$theme->getName()]['previewUrl'] = $this->themeService->getStaticUrl($theme->getName()) . BOL_ThemeService::PREVIEW_FILE;
         $themesInfo[$theme->getName()]['active'] = $theme->getName() === $activeTheme;
         $themesInfo[$theme->getName()]['changeUrl'] = OW::getRouter()->urlFor(__CLASS__, 'changeTheme', array('theme' => $theme->getName()));
         $themesInfo[$theme->getName()]['update_url'] = (int) $theme->getUpdate() === 1 && !defined('OW_PLUGIN_XP') ? OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'updateRequest', array('name' => $theme->getName())) : false;
     }
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('admin')->getStaticJsUrl() . 'theme_select.js');
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.sticky.js');
     OW::getDocument()->addOnloadScript("window.owThemes = new ThemesSelect(" . json_encode($themesInfo) . ");\n        \t\$('.selected_theme_info input.theme_select_submit').click(function(){\n    \t\t\twindow.location.href = '" . $themesInfo[$activeTheme]['changeUrl'] . "';\n    \t\t});\n            \$('.selected_theme_info_stick').sticky({topSpacing:60});\n            ");
     $adminTheme = OW::getThemeManager()->getThemeService()->getThemeObjectByName('origin');
     $defaultThemeImgUrl = $adminTheme === null ? '' : $adminTheme->getStaticImagesUrl();
     $this->assign('themeInfo', $themesInfo[$activeTheme]);
     $this->assign('themes', $themesInfo);
     $this->assign('defaultThemeImgDir', $defaultThemeImgUrl);
 }
Example #2
0
 public function processCleanUp()
 {
     $configs = OW::getConfig()->getValues('cacheextreme');
     //clean template cache
     if ($configs['template_cache']) {
         OW_ViewRenderer::getInstance()->clearCompiledTpl();
     }
     //clean db backend cache
     if ($configs['backend_cache']) {
         OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL);
     }
     //clean themes static contents cache
     if ($configs['theme_static']) {
         OW::getThemeManager()->getThemeService()->processAllThemes();
     }
     //clean plugins static contents cache
     if ($configs['plugin_static']) {
         $pluginService = BOL_PluginService::getInstance();
         $activePlugins = $pluginService->findActivePlugins();
         /* @var $pluginDto BOL_Plugin */
         foreach ($activePlugins as $pluginDto) {
             $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS;
             if (file_exists($pluginStaticDir)) {
                 $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS;
                 if (file_exists($staticDir)) {
                     UTIL_File::removeDir($staticDir);
                 }
                 mkdir($staticDir);
                 chmod($staticDir, 0777);
                 UTIL_File::copyDir($pluginStaticDir, $staticDir);
             }
         }
     }
 }
Example #3
0
/**
 * Smarty form block function.
 *
 * @author Sardar Madumarov <*****@*****.**>
 * @package ow.ow_smarty.plugin
 * @since 1.0
 */
function smarty_block_form($params, $content)
{
    if (!isset($params['name'])) {
        throw new InvalidArgumentException('Empty form name!');
    }
    $vr = OW_ViewRenderer::getInstance();
    $assignedForms = $vr->getAssignedVar('_owForms_');
    if (!isset($assignedForms[$params['name']])) {
        throw new InvalidArgumentException('There is no form with name `' . $params['name'] . '` !');
    }
    // mark active form
    if ($content === null) {
        $vr->assignVar('_owActiveForm_', $assignedForms[$params['name']]);
        return;
    }
    /* @var $form OW_Form */
    $form = $vr->getAssignedVar('_owActiveForm_');
    if (isset($params['decorator'])) {
        $viewRenderer = OW_ViewRenderer::getInstance();
        $viewRenderer->assignVar('formInfo', $form->getElementsInfo());
        $content = $viewRenderer->renderTemplate(OW::getThemeManager()->getDecorator($params['decorator']));
    }
    unset($params['decorator']);
    unset($params['name']);
    return $form->render($content, $params);
}
Example #4
0
 public function __construct(array $arrParams)
 {
     parent::__construct();
     $format = isset($arrParams['format']) ? $arrParams['format'] : null;
     $serviceName = isset($arrParams['service']) ? $arrParams['service'] : null;
     if (null != $serviceName) {
         $params = array();
         $params['limit'] = intval(isset($arrParams['limit']) ? $arrParams['limit'] : YNMEDIAIMPORTER_PER_PAGE);
         $params['offset'] = intval(isset($arrParams['offset']) ? $arrParams['offset'] : 0);
         $params['service'] = $serviceName;
         $params['extra'] = isset($arrParams['extra']) ? $arrParams['extra'] : 'my';
         //Load my photos first with Flickr provider.
         if ($serviceName == 'flickr') {
             $params['media'] = $media = isset($arrParams['media']) ? $arrParams['media'] : 'photo';
         } else {
             $params['media'] = $media = isset($arrParams['media']) ? $arrParams['media'] : 'album';
         }
         $params['aid'] = isset($arrParams['aid']) ? $arrParams['aid'] : 0;
         $params['cache'] = isset($arrParams['cache']) ? $arrParams['cache'] : 1;
         $cache = isset($arrParams['cache']) ? $arrParams['cache'] : 1;
         $jsonParams = json_encode($params);
         $getDataUrl = OW::getRouter()->urlForRoute('ynmediaimporter.getdata');
         $moduleUrl = OW::getRouter()->urlForRoute('ynmediaimporter.index');
         OW::getLanguage()->addKeyForJs('ynmediaimporter', 'message_text_loading');
         $ajaxImageUrl = OW::getThemeManager()->getThemeImagesUrl() . '/ajax_preloader_content.gif';
         $this->assign('ajaxImageUrl', $ajaxImageUrl);
         $this->assign('getDataUrl', $getDataUrl);
         $this->assign('moduleUrl', $moduleUrl);
         $this->assign('jsonParams', $jsonParams);
     } else {
         $this->assign('content', "errors");
     }
 }
Example #5
0
/**
 * Decorator block function for smarty templates. 
 *
 * @author Sardar Madumarov <*****@*****.**>
 * @package ow.ow_smarty.plugin
 * @since 1.0
 */
function smarty_function_decorator($params)
{
    if (!isset($params['name'])) {
        throw new InvalidArgumentException('Empty decorator name!');
    }
    return OW::getThemeManager()->processDecorator($params['name'], $params);
}
Example #6
0
    public function __construct(BASE_CLASS_WidgetParameter $objParams)
    {
        parent::__construct();
        $uniqName = $objParams->widgetDetails->uniqName;
        $this->assign('uniqName', $uniqName);
        $service = SLIDESHOW_BOL_Service::getInstance();
        $slides = $service->getSlideList($uniqName);
        $this->assign('slides', $slides);
        if ($slides) {
            $url = OW::getPluginManager()->getPlugin('slideshow')->getStaticJsUrl() . 'slides.min.jquery.js';
            OW::getDocument()->addScript($url);
            $settings = $objParams->customParamList;
            $params = array('sizes' => $service->getSizes($slides), 'pagination' => $settings['navigation'] ? "true" : "false", 'interval' => $settings['interval'], 'uniqname' => $uniqName, 'effect' => $settings['effect'], 'preloadImage' => OW::getThemeManager()->getThemeImagesUrl() . '/ajax_preloader_content.gif');
            $url = OW::getPluginManager()->getPlugin('slideshow')->getStaticJsUrl() . 'slideshow.js';
            OW::getDocument()->addScript($url);
            $id = uniqid();
            $script = 'var slideshow' . $id . ' = new slideshow(' . json_encode($params) . '); slideshow' . $id . '.init();';
            if ($objParams->customizeMode) {
                $script .= 'OW.WidgetPanel.bind("move", function(e) {
		            if ( e.widgetName == "' . $uniqName . '" ) {
		               OW.WidgetPanel.reloadWidget("' . $uniqName . '", function(markup, data){});
		            }
		        });';
            }
            OW::getDocument()->addOnloadScript($script);
        }
    }
Example #7
0
 public function __construct()
 {
     if (!OW::getUser()->isAuthenticated()) {
         $this->setVisible(false);
         return;
     }
     OW::getDocument()->getMasterPage()->setTemplate(OW::getThemeManager()->getMasterPageTemplate(OW_MasterPage::TEMPLATE_BLANK));
 }
Example #8
0
    public function addStatic($ajax = false)
    {
        if ($this->staticAdded) {
            return;
        }
        $staticUrl = OW::getPluginManager()->getPlugin(self::PLUGIN_KEY)->getStaticUrl();
        $scriptUrl = $staticUrl . 'equestions.js' . '?' . self::PLUGIN_VERSION;
        $styleUrl = $staticUrl . 'equestions.css' . '?' . self::PLUGIN_VERSION;
        $imagesUrl = OW::getThemeManager()->getThemeImagesUrl();
        $css = 'html body div .q_ic_preloader { background-image: url(' . $imagesUrl . 'ajax_preloader_button.gif) };';
        OW::getDocument()->addStyleDeclaration($css);
        if (!$ajax) {
            OW::getDocument()->addScript($scriptUrl);
            OW::getDocument()->addStyleSheet($styleUrl);
        } else {
            OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('
                if ( !window.QUESTIONS_Loaded )
                {

                    OW.addScriptFiles([{$scriptUrl}], function(){
                        if ( window.EQAjaxLoadCallbacksRun )
                        {
                            window.EQAjaxLoadCallbacksRun();
                        }
                    });
                    OW.addCssFile({$styleUrl});

                 }
            ', array('styleUrl' => $styleUrl, 'scriptUrl' => $scriptUrl)));
        }
        $messages = EQUESTIONS_CLASS_CreditsBridge::getInstance()->getAllPermissionMessages();
        $actions = EQUESTIONS_CLASS_CreditsBridge::getInstance()->getAllPermissions();
        $js = UTIL_JsGenerator::newInstance();
        $js->addScript(UTIL_JsGenerator::composeJsString('UTILS.Credits = new UTILS.CreditsConstructor({$actions}, {$messages}); ', array('messages' => $messages, 'actions' => $actions)));
        $friendMode = (bool) OW::getEventManager()->call('plugin.friends');
        $js->setVariable(array('QUESTIONS', 'friendMode'), $friendMode);
        if (!$ajax) {
            OW::getDocument()->addOnloadScript($js);
        } else {
            OW::getDocument()->addOnloadScript('window.EQAjaxLoadCallbackQueue = [];');
            OW::getDocument()->addOnloadScript('(function() {
                var loaded = function() {
                    ' . $js->generateJs() . '
                };

                if ( window.QUESTIONS_Loaded )
                    loaded.call();
                else
                    window.EQAjaxLoadCallbackQueue.push(loaded);
            })();');
        }
        OW::getLanguage()->addKeyForJs('equestions', 'selector_title_friends');
        OW::getLanguage()->addKeyForJs('equestions', 'selector_title_users');
        OW::getLanguage()->addKeyForJs('equestions', 'followers_fb_title');
        OW::getLanguage()->addKeyForJs('equestions', 'toolbar_unfollow_btn');
        OW::getLanguage()->addKeyForJs('equestions', 'toolbar_follow_btn');
        $this->staticAdded = true;
    }
Example #9
0
 public function __construct()
 {
     if (!OW::getUser()->isAuthenticated()) {
         $this->setVisible(false);
         return;
     }
     OW::getDocument()->getMasterPage()->setTemplate(OW::getThemeManager()->getMasterPageTemplate(OW_MasterPage::TEMPLATE_BLANK));
     OW::getDocument()->addStyleDeclaration(".ow_footer{display:none;}");
 }
Example #10
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     if (!empty($this->vars['info']['route'])) {
         $this->vars['info']['url'] = $this->getUrl($this->vars['info']['route']);
     }
     $this->vars['blankImg'] = OW::getThemeManager()->getCurrentTheme()->getStaticUrl() . 'mobile/images/1px.png';
     $this->assign('vars', $this->vars);
 }
Example #11
0
/**
 * Decorator block function for smarty templates. 
 *
 * @author Sardar Madumarov <*****@*****.**>
 * @package ow.ow_smarty.plugin
 * @since 1.0
 */
function smarty_block_block_decorator($params, $content)
{
    if (!isset($params['name'])) {
        throw new InvalidArgumentException('Empty decorator name!');
    }
    if ($content === null) {
        return;
    }
    return OW::getThemeManager()->processBlockDecorator($params['name'], $params, $content);
}
Example #12
0
 private function __construct()
 {
     $this->service = UHEADER_BOL_Service::getInstance();
     $this->plugin = OW::getPluginManager()->getPlugin('uheader');
     //66 - for 1000px themes
     //84 - for 780px themes
     $scale = (OW::getThemeManager()->getSelectedTheme()->getDto()->sidebarPosition == "none" ? 69 : 88) / 100;
     $this->config = OW::getConfig()->getValues("uheader");
     $this->config["cover_height"] *= $scale;
 }
Example #13
0
/**
 * Smarty user avatar function.
 *
 * @author Sardar Madumarov <*****@*****.**>
 * @package ow.ow_smarty.plugin
 * @since 1.0
 */
function smarty_function_user_avatar($params, $smarty)
{
    if (empty($params['userId'])) {
        return '_EMPTY_USER_ID_';
    }
    $decoratorParams = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($params['userId']));
    if (empty($decoratorParams)) {
        return '_USER_NOT_FOUND_';
    }
    return OW::getThemeManager()->processDecorator('avatar_item', $decoratorParams[$params['userId']]);
}
Example #14
0
 public function onBeforeRender()
 {
     if ($this->getTemplate() === null) {
         $this->setTemplate(OW::getThemeManager()->getMasterPageTemplate(self::TEMPLATE_GENERAL));
     }
     $this->addComponent("signIn", new BASE_MCMP_SignIn());
     $this->addComponent("topMenu", new BASE_MCMP_TopMenu());
     $this->addComponent("bottomMenu", new BASE_MCMP_BottomMenu());
     $this->assign("buttonData", $this->buttonData);
     parent::onBeforeRender();
 }
Example #15
0
 public function index($params = NULL)
 {
     if (!$this->service->isLocked()) {
         $this->redirect(OW_URL_HOME);
     }
     OW::getDocument()->setJavaScripts(array('added' => array()));
     $configs = OW::getConfig()->getValues('antibruteforce');
     $this->setPageTitle($configs['lock_title']);
     $this->assign('configs', $configs);
     $masterPageFileDir = OW::getThemeManager()->getMasterPageTemplate('blank');
     OW::getDocument()->getMasterPage()->setTemplate($masterPageFileDir);
 }
Example #16
0
 public function __construct()
 {
     parent::__construct();
     $this->service = UHEADER_BOL_Service::getInstance();
     $this->plugin = OW::getPluginManager()->getPlugin("uheader");
     //66 - for 1000px themes
     //84 - for 780px themes
     $scale = (OW::getThemeManager()->getSelectedTheme()->getDto()->sidebarPosition == "none" ? 69 : 88) / 100;
     $this->config = OW::getConfig()->getValues("uheader");
     $this->config["avatar_big_size"] = OW::getConfig()->getValue("base", "avatar_big_size") * $scale;
     $this->config["cover_height"] *= $scale;
 }
Example #17
0
 public function __construct($userList, $fieldList, $usersCount)
 {
     parent::__construct();
     $this->userList = $userList;
     $this->fieldList = array_unique($fieldList);
     try {
         OW::getThemeManager()->addDecorator('user_big_list_item', 'base');
     } catch (LogicException $e) {
     }
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $usersOnPage = OW::getConfig()->getValue('base', 'users_on_page');
     $this->addComponent('paging', new BASE_CMP_Paging($page, ceil($usersCount / $usersOnPage), 5));
 }
Example #18
0
    public function onBeforeRender()
    {
        parent::onBeforeRender();
        $hasSideBar = OW::getThemeManager()->getCurrentTheme()->getDto()->getSidebarPosition() != 'none';
        $photoParams = array('classicMode' => false);
        $photoParams[] = $photoParams['classicMode'] ? $hasSideBar ? 4 : 5 : 4;
        $photoDefault = array('getPhotoURL' => OW::getRouter()->urlFor('ADMIN_CTRL_Theme', 'ajaxResponder'), 'listType' => null, 'rateUserId' => OW::getUser()->getId(), 'urlHome' => OW_URL_HOME, 'level' => 4);
        $document = OW::getDocument();
        $plugin = OW::getPluginManager()->getPlugin('base');
        $document->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'clipboard.js');
        OW::getDocument()->addOnloadScript("\n        ;var floatboxClipboard = new Clipboard('.ow_photoview_url a');\n\n        floatboxClipboard.on('success', function(e) {\n            OW.info(OW.getLanguageText('admin', 'url_copied'));\n            e.clearSelection();\n        });\n\n        floatboxClipboard.on('error', function(e) {\n            OW.warning(OW.getLanguageText('admin', 'press_ctrl_c'));\n        });\n\n        OW.bind('photo.photoItemRendered', function(item){\n            var clipboard = new Clipboard(\$(item).find('.clipboard-button')[0]);\n\n            clipboard.on('success', function(e) {\n                OW.info(OW.getLanguageText('admin', 'url_copied'));\n                e.clearSelection();\n            });\n\n            clipboard.on('error', function(e) {\n                OW.warning(OW.getLanguageText('admin', 'press_ctrl_c'));\n                var parent = \$(e.trigger).parent();\n                var input = parent.find('input')\n                parent.addClass('ow_url_input_visible');\n                input.val(\$(e.trigger).attr('data-clipboard-text'));\n                input.get(0).setSelectionRange(0, input.get(0).value.length);\n            });\n        });\n        ");
        $document->addScriptDeclarationBeforeIncludes(';window.browsePhotoParams = ' . json_encode(array_merge($photoDefault, $photoParams)) . ';');
        $document->addOnloadScript(';window.browsePhoto.init();');
        $contDefault = array('downloadAccept' => (bool) OW::getConfig()->getValue('photo', 'download_accept'), 'downloadUrl' => OW_URL_HOME . 'photo/download-photo/:id', 'actionUrl' => $photoDefault['getPhotoURL'], 'contextOptions' => array(array('action' => 'deleteImage', 'name' => OW::getLanguage()->text('admin', 'delete_image'))));
        $document->addScriptDeclarationBeforeIncludes(';window.photoContextActionParams = ' . json_encode($contDefault));
        $document->addOnloadScript(';window.photoContextAction.init();');
        $document->addOnloadScript('$(document.getElementById("browse-photo")).on("click", ".ow_photo_item_wrap img", function( event )
            {
                var data = $(this).closest(".ow_photo_item_wrap").data(), _data = {};

                if ( data.dimension && data.dimension.length )
                {
                    try
                    {
                        var dimension = JSON.parse(data.dimension);

                        _data.main = dimension.main;
                    }
                    catch( e )
                    {
                        _data.main = [this.naturalWidth, this.naturalHeight];
                    }
                }
                else
                {
                    _data.main = [this.naturalWidth, this.naturalHeight];
                }

                _data.mainUrl = data.photoUrl;
                photoView.setId(data.photoId, data.listType, browsePhoto.getMoreData(), _data);
            });');
        $document->addStyleSheet($plugin->getStaticCssUrl() . 'browse_files.css');
        $document->addScript($plugin->getStaticJsUrl() . 'browse_file.js');
        OW::getLanguage()->addKeyForJs("admin", "copy_url");
        OW::getLanguage()->addKeyForJs("admin", "confirm_delete_images");
        OW::getLanguage()->addKeyForJs("admin", "no_photo_selected");
        OW::getLanguage()->addKeyForJs("admin", "no_items");
        OW::getLanguage()->addKeyForJs("admin", "dnd_support");
        OW::getLanguage()->addKeyForJs("admin", "url_copied");
        OW::getLanguage()->addKeyForJs("admin", "press_ctrl_c");
    }
Example #19
0
    public function onBeforeRender()
    {
        parent::onBeforeRender();
        $hasSideBar = OW::getThemeManager()->getCurrentTheme()->getDto()->getSidebarPosition() != 'none';
        $photoParams = array('classicMode' => false);
        $photoParams[] = $photoParams['classicMode'] ? $hasSideBar ? 4 : 5 : 4;
        $photoDefault = array('getPhotoURL' => OW::getRouter()->urlFor('ADMIN_CTRL_Theme', 'ajaxResponder'), 'listType' => null, 'rateUserId' => OW::getUser()->getId(), 'urlHome' => OW_URL_HOME, 'level' => 4);
        $document = OW::getDocument();
        $plugin = OW::getPluginManager()->getPlugin('base');
        $document->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'ZeroClipboard.js');
        $swfPath = OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'ZeroClipboard.swf';
        OW::getDocument()->addOnloadScript("\n        ;ZeroClipboard.config( { swfPath: '{$swfPath}' } );\n        OW.bind('photo.photoItemRendered', function(item){\n            var elementId = 'zero_' + \$(item).attr('id');\n            \$(item).find('.zero-clipboard-button').attr('id', elementId);\n            var client = new ZeroClipboard(document.getElementById(elementId));\n            client.on('copy', function(){\n                OW.info('Url copied to clipboard');\n            });\n        });\n        ");
        $document->addScriptDeclarationBeforeIncludes(';window.browsePhotoParams = ' . json_encode(array_merge($photoDefault, $photoParams)) . ';');
        $document->addOnloadScript(';window.browsePhoto.init();');
        $contDefault = array('downloadAccept' => (bool) OW::getConfig()->getValue('photo', 'download_accept'), 'downloadUrl' => OW_URL_HOME . 'photo/download-photo/:id', 'actionUrl' => $photoDefault['getPhotoURL'], 'contextOptions' => array(array('action' => 'deleteImage', 'name' => OW::getLanguage()->text('admin', 'delete_image'))));
        $document->addScriptDeclarationBeforeIncludes(';window.photoContextActionParams = ' . json_encode($contDefault));
        $document->addOnloadScript(';window.photoContextAction.init();');
        $document->addOnloadScript('$(document.getElementById("browse-photo")).on("click", ".ow_photo_item_wrap img", function( event )
            {
                var data = $(this).closest(".ow_photo_item_wrap").data(), _data = {};

                if ( data.dimension && data.dimension.length )
                {
                    try
                    {
                        var dimension = JSON.parse(data.dimension);

                        _data.main = dimension.main;
                    }
                    catch( e )
                    {
                        _data.main = [this.naturalWidth, this.naturalHeight];
                    }
                }
                else
                {
                    _data.main = [this.naturalWidth, this.naturalHeight];
                }

                _data.mainUrl = data.photoUrl;
                photoView.setId(data.photoId, data.listType, browsePhoto.getMoreData(), _data);
            });');
        $document->addStyleSheet($plugin->getStaticCssUrl() . 'browse_files.css');
        $document->addScript($plugin->getStaticJsUrl() . 'browse_file.js');
        OW::getLanguage()->addKeyForJs("admin", "copy_url");
        OW::getLanguage()->addKeyForJs("admin", "confirm_delete_images");
        OW::getLanguage()->addKeyForJs("admin", "no_photo_selected");
        OW::getLanguage()->addKeyForJs("admin", "no_items");
        OW::getLanguage()->addKeyForJs("admin", "dnd_support");
    }
Example #20
0
 public function form(array $params)
 {
     $billingService = BOL_BillingService::getInstance();
     $adapter = new BILLINGCCBILL_CLASS_CcbillAdapter();
     $lang = OW::getLanguage();
     $sale = $billingService->getSessionSale();
     if (!$sale) {
         $url = $billingService->getSessionBackUrl();
         if ($url != null) {
             OW::getFeedback()->warning($lang->text('base', 'billing_order_canceled'));
             $billingService->unsetSessionBackUrl();
             $this->redirect($url);
         } else {
             $this->redirectToAction('select');
         }
     }
     $formId = uniqid('order_form-');
     $this->assign('formId', $formId);
     $js = '$("#' . $formId . '").submit()';
     OW::getDocument()->addOnloadScript($js);
     $fieldsParams = array('formType' => isset($params['type']) ? $params['type'] : 'cc', 'pluginKey' => $sale->pluginKey, 'entityKey' => $sale->entityKey);
     $fields = $adapter->getFields($fieldsParams);
     $this->assign('fields', $fields);
     if ($billingService->prepareSale($adapter, $sale)) {
         $sale->totalAmount = sprintf("%01.2f", $sale->totalAmount);
         $sale->price = sprintf("%01.2f", $sale->price);
         if ($sale->recurring) {
             $rebills = 99;
             $digest = $adapter->generateRecurringTransactionDigest($sale->totalAmount, $sale->period, $sale->totalAmount, $sale->period, $rebills, $adapter->getActiveCurrencyCode());
             $this->assign('rebills', $rebills);
         } else {
             $digest = $adapter->generateSingleTransactionDigest($sale->totalAmount, $sale->period, $adapter->getActiveCurrencyCode());
         }
         $this->assign('formDigest', $digest);
         $this->assign('currencyCode', $adapter->getActiveCurrencyCode());
         $this->assign('sale', $sale);
         $masterPageFileDir = OW::getThemeManager()->getMasterPageTemplate('blank');
         OW::getDocument()->getMasterPage()->setTemplate($masterPageFileDir);
         $billingService->unsetSessionSale();
     } else {
         $productAdapter = $billingService->getProductAdapter($sale->entityKey);
         if ($productAdapter) {
             $productUrl = $productAdapter->getProductOrderUrl();
         }
         OW::getFeedback()->warning($lang->text('base', 'billing_order_init_failed'));
         $url = isset($productUrl) ? $productUrl : $billingService->getOrderFailedPageUrl();
         $this->redirect($url);
     }
 }
Example #21
0
 public function index()
 {
     HINT_BOL_Service::getInstance()->saveConfig("admin_notified", 1);
     $this->setPageHeading(OW::getLanguage()->text('hint', 'admin_heading'));
     $this->setPageHeadingIconClass('ow_ic_user');
     $sortableStatic = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl() . "jquery-ui-1.8.9.custom.min.js";
     OW::getDocument()->addScript($sortableStatic);
     $buttonConfig = $this->getActionConfigs(HINT_BOL_Service::ENTITY_TYPE_USER);
     $this->assign("buttonConfigs", $buttonConfig);
     $features = array();
     $features["cover"] = HINT_CLASS_UheaderBridge::getInstance()->isEnabled();
     $info = array();
     $info[HINT_BOL_Service::INFO_LINE0] = HINT_BOL_Service::getInstance()->getInfoConfig(HINT_BOL_Service::ENTITY_TYPE_USER, HINT_BOL_Service::INFO_LINE0);
     $info[HINT_BOL_Service::INFO_LINE1] = HINT_BOL_Service::getInstance()->getInfoConfig(HINT_BOL_Service::ENTITY_TYPE_USER, HINT_BOL_Service::INFO_LINE1);
     $info[HINT_BOL_Service::INFO_LINE2] = HINT_BOL_Service::getInstance()->getInfoConfig(HINT_BOL_Service::ENTITY_TYPE_USER, HINT_BOL_Service::INFO_LINE2);
     $form = new HINT_ConfigurationForm(HINT_BOL_Service::ENTITY_TYPE_USER, $buttonConfig, $features, $info);
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         $form->process();
         OW::getFeedback()->info(OW::getLanguage()->text("hint", "admin_configs_saved"));
         $this->redirect();
     }
     $this->addForm($form);
     $requirements = array();
     $params = array();
     $params["actions"] = array();
     foreach ($buttonConfig as $action) {
         if ($action["active"]) {
             $params["actions"][] = $action["key"];
         }
         if (!empty($action["requirements"]["long"])) {
             $requirements[] = array("text" => $action["requirements"]["long"], "hidden" => !$action["active"], "key" => $action["key"]);
         }
     }
     if (!HINT_CLASS_UheaderBridge::getInstance()->isActive()) {
         $pluginEmbed = '<a href="' . HINT_CLASS_UheaderBridge::PLUGIN_URL . '" target="_blank">' . HINT_CLASS_UheaderBridge::PLUGIN_TITLE . '</a>';
         $requirements[] = array("text" => OW::getLanguage()->text("hint", "uheader_required_long", array("plugin" => $pluginEmbed, "feature" => OW::getLanguage()->text("hint", "admin_profile_cover_option"))), "hidden" => !$features["cover"], "key" => "cover");
         $this->assign("coverRequired", OW::getLanguage()->text("hint", "uheader_required_short", array("plugin" => $pluginEmbed)));
     }
     $this->assign("requirements", $requirements);
     $params["features"] = $features;
     $params["info"] = $info;
     $cmp = new HINT_CMP_UserHintPreview(HINT_BOL_Service::ENTITY_TYPE_USER, $params);
     $this->addComponent("preview", $cmp);
     $this->assign("entityType", HINT_BOL_Service::ENTITY_TYPE_USER);
     $this->assign("info", $info);
     $preloaderUrl = OW::getThemeManager()->getCurrentTheme()->getStaticUrl() . 'images/ajax_preloader_button.gif';
     $this->assign("preloaderUrl", $preloaderUrl);
     $this->assign("pluginUrl", self::PLUGIN_URL);
 }
Example #22
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $defaults = array("image" => null, "iconClass" => null, "title" => '', "description" => '', "status" => null, "url" => null, "embed" => '');
     $tplVars = array_merge($defaults, $this->vars);
     $tplVars["url"] = $this->getUrl($tplVars["url"]);
     $tplVars['blankImg'] = OW::getThemeManager()->getCurrentTheme()->getStaticUrl() . 'mobile/images/1px.png';
     $this->assign('vars', $tplVars);
     if ($tplVars['embed']) {
         $script = '$("a.ow_format_video_play").click(function(){
             var $embed = $($(this).parent().find(".ow_format_video_embed").val());
             $(this).replaceWith($embed);
         });';
         OW::getDocument()->addOnloadScript($script);
     }
 }
Example #23
0
 public function onTodayBirthday(OW_Event $e)
 {
     $params = $e->getParams();
     $userIds = $params['userIdList'];
     $usersData = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIds);
     $actionParams = array('entityType' => 'birthday', 'pluginKey' => 'birthdays', 'replace' => true);
     $actionData = array('time' => time());
     foreach ($userIds as $userId) {
         $userEmbed = '<a href="' . $usersData[$userId]['url'] . '">' . $usersData[$userId]['title'] . '</a>';
         $actionParams['userId'] = $userId;
         $actionParams['entityId'] = $userId;
         $actionData['line'] = OW::getLanguage()->text('birthdays', 'feed_item_line', array('user' => $userEmbed));
         $actionData['content'] = OW::getThemeManager()->processDecorator('avatar_item', $usersData[$userId]);
         $event = new OW_Event('feed.action', $actionParams, $actionData);
         OW::getEventManager()->trigger($event);
     }
 }
Example #24
0
 public function canvas()
 {
     OW::getDocument()->getMasterPage()->setTemplate(OW::getThemeManager()->getMasterPageTemplate('blank'));
     $requestIds = empty($_GET['request_ids']) ? array() : explode(',', $_GET['request_ids']);
     $appId = OW::getConfig()->getValue('contactimporter', 'facebook_app_id');
     $appSecret = OW::getConfig()->getValue('contactimporter', 'facebook_app_secret');
     if (empty($appId) || empty($appSecret)) {
         $this->assign('content', 'App Secret and App Id are required');
         return;
     }
     $facebook = new Facebook(array('appId' => $appId, 'secret' => $appSecret));
     $from = array();
     $inviters = array();
     foreach ($requestIds as $rid) {
         $request = $facebook->api('/' . $rid);
         if ($request) {
             $from[$request['from']['id']] = $request['from'];
         }
         $data = empty($request['data']) ? array() : json_decode($request['data'], true);
         if (!empty($data['userId'])) {
             $inviters[] = $data['userId'];
         }
     }
     $from = array_reverse($from);
     $inviters = array_unique($inviters);
     $joinData = json_encode(array('inviters' => $inviters, 'requestIds' => $requestIds));
     $code = base64_encode($joinData);
     $url = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('base_join'), array('code' => $code));
     $buttonEmbed = OW::getThemeManager()->processDecorator('button', array('langLabel' => 'contactimporter+facebook_canvas_page_visit_btn', 'onclick' => "window.open('" . $url . "'); return false;"));
     switch (count($from)) {
         case 1:
             $user = reset($from);
             $content = OW::getLanguage()->text('contactimporter', 'facebook_canvas_page_1', array('user' => $user['name'], 'siteUrl' => $url, 'button' => $buttonEmbed));
             break;
         case 2:
             $user1 = reset($from);
             $user2 = next($from);
             $content = OW::getLanguage()->text('contactimporter', 'facebook_canvas_page_2', array('user1' => $user1['name'], 'user2' => $user2['name'], 'siteUrl' => $url, 'button' => $buttonEmbed));
             break;
         default:
             $user = reset($from);
             $content = OW::getLanguage()->text('contactimporter', 'facebook_canvas_page_x', array('user' => $user['name'], 'count' => count($from) - 1, 'siteUrl' => $url, 'button' => $buttonEmbed));
     }
     $this->assign('content', $content);
 }
Example #25
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $language = OW::getLanguage();
     OW::getDocument()->setBodyClass('ow_admin_area');
     $this->setTemplate(OW::getThemeManager()->getMasterPageTemplate(OW_MasterPage::TEMPLATE_ADMIN));
     $arrayToAssign = array();
     srand(time());
     /* @var $value ADMIN_CMP_AdminMenu */
     foreach ($this->menuCmps as $key => $value) {
         $id = 'mi' . rand(1, 10000);
         $value->setCategory($key);
         $value->onBeforeRender();
         $menuItem = $value->getFirstElement();
         $arrayToAssign[$key] = array('id' => $id, 'firstLink' => $menuItem->getUrl(), 'key' => $key, 'isActive' => $value->isActive(), 'label' => $language->text('admin', 'sidebar_' . $key), 'sub_menu' => $value->getElementsCount() < 2 ? '' : $value->render(), 'active_sub_menu' => $value->getElementsCount() < 2 ? '' : $value->render('ow_admin_submenu'));
     }
     $this->assign('menuArr', $arrayToAssign);
 }
Example #26
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $uniqId = uniqid("vf-");
     $this->assign("uniqId", $uniqId);
     $defaults = array("image" => null, "iconClass" => null, "title" => '', "description" => '', "status" => null, "url" => null, "embed" => '');
     $tplVars = array_merge($defaults, $this->vars);
     $tplVars["url"] = $this->getUrl($tplVars["url"]);
     $tplVars['blankImg'] = OW::getThemeManager()->getCurrentTheme()->getStaticUrl() . 'mobile/images/1px.png';
     $this->assign('vars', $tplVars);
     if ($tplVars['embed']) {
         $js = UTIL_JsGenerator::newInstance();
         $code = BOL_TextFormatService::getInstance()->addVideoCodeParam($tplVars['embed'], "autoplay", 1);
         $code = BOL_TextFormatService::getInstance()->addVideoCodeParam($code, "play", 1);
         $js->addScript('$(".ow_oembed_video_cover", "#" + {$uniqId}).click(function() { ' . '$("#" + {$uniqId}).addClass("ow_video_playing"); ' . '$(".ow_newsfeed_item_picture", "#" + {$uniqId}).html({$embed});' . 'return false; });', array("uniqId" => $uniqId, "embed" => $code));
         OW::getDocument()->addOnloadScript($js);
     }
 }
Example #27
0
 public function form()
 {
     $billingService = BOL_BillingService::getInstance();
     $adapter = new BILLINGPAYEER_CLASS_PayeerAdapter();
     $lang = OW::getLanguage();
     $sale = $billingService->getSessionSale();
     if (!$sale) {
         $url = $billingService->getSessionBackUrl();
         if ($url != null) {
             OW::getFeedback()->warning($lang->text('base', 'billing_order_canceled'));
             $billingService->unsetSessionBackUrl();
             $this->redirect($url);
         } else {
             $this->redirect($billingService->getOrderFailedPageUrl());
         }
     }
     $formId = uniqid('order_form-');
     $this->assign('formId', $formId);
     $js = '$("#' . $formId . '").submit()';
     OW::getDocument()->addOnloadScript($js);
     if ($billingService->prepareSale($adapter, $sale)) {
         $sale->totalAmount = floatval($sale->totalAmount);
         $this->assign('sale', $sale);
         $fields = $adapter->getFields(array("sale" => $sale));
         $this->assign("formaction", $fields["formActionUrl"]);
         unset($fields["formActionUrl"]);
         $this->assign('fields', $fields);
         $this->assign('email', OW::getUser()->getEmail());
         $masterPageFileDir = OW::getThemeManager()->getMasterPageTemplate('blank');
         OW::getDocument()->getMasterPage()->setTemplate($masterPageFileDir);
         $billingService->unsetSessionSale();
     } else {
         $productAdapter = $billingService->getProductAdapter($sale->entityKey);
         if ($productAdapter) {
             $productUrl = $productAdapter->getProductOrderUrl();
         }
         OW::getFeedback()->warning($lang->text('base', 'billing_order_init_failed'));
         $url = isset($productUrl) ? $productUrl : $billingService->getOrderFailedPageUrl();
         $this->redirect($url);
     }
 }
Example #28
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $this->vars['blankImg'] = OW::getThemeManager()->getCurrentTheme()->getStaticUrl() . 'mobile/images/1px.png';
     if (!empty($this->vars['info']['route'])) {
         $this->vars['info']['url'] = $this->getUrl($this->vars['info']['route']);
     }
     $limit = self::LIST_LIMIT;
     // prepare view more url
     if (!empty($this->vars['more'])) {
         $this->vars['more']['url'] = $this->getUrl($this->vars['more']);
         if (!empty($this->vars['more']['limit'])) {
             $limit = $this->vars['more']['limit'];
         }
     }
     $this->list = array_slice($this->list, 0, $limit);
     $this->assign('list', $this->list);
     $this->assign('vars', $this->vars);
     $count = count($this->list);
     $this->assign('totalCount', $count);
     $count = $count > 4 ? 4 : $count;
     $this->assign('count', $count);
 }
 public function onTodayBirthday(OW_Event $e)
 {
     $params = $e->getParams();
     $userIds = $params['userIdList'];
     $usersData = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIds);
     $actionParams = array('entityType' => 'birthday', 'pluginKey' => 'birthdays', 'replace' => true);
     $actionData = array('time' => time());
     $birthdays = BOL_QuestionService::getInstance()->getQuestionData($userIds, array('birthdate'));
     foreach ($userIds as $userId) {
         $userEmbed = '<a href="' . $usersData[$userId]['url'] . '">' . $usersData[$userId]['title'] . '</a>';
         $actionParams['userId'] = $userId;
         $actionParams['entityId'] = $userId;
         $actionData['line'] = OW::getLanguage()->text('birthdays', 'feed_item_line', array('user' => $userEmbed));
         $actionData['content'] = '<div class="ow_user_list_picture">' . OW::getThemeManager()->processDecorator('avatar_item', $usersData[$userId]) . '</div>';
         if (!empty($birthdays[$userId]['birthdate'])) {
             $actionData['birthdate'] = $birthdays[$userId]['birthdate'];
             $actionData['userData'] = $usersData[$userId];
         }
         $event = new OW_Event('feed.action', $actionParams, $actionData);
         OW::getEventManager()->trigger($event);
         BOL_AuthorizationService::getInstance()->trackActionForUser($userId, 'birthdays', 'birthday');
     }
 }
Example #30
0
 private function exportThemes(ZipArchive $za, $archiveDir)
 {
     $currentTheme = OW::getThemeManager()->getSelectedTheme()->getDto();
     $currentThemeDir = OW::getThemeManager()->getSelectedTheme()->getRootDir();
     $currentThemeUserfilesDir = OW_DIR_THEME_USERFILES;
     $this->configs['currentTheme'] = array('name' => $currentTheme->name, 'customCss' => $currentTheme->customCss, 'customCssFileName' => $currentTheme->customCssFileName, 'description' => $currentTheme->description, 'isActive' => $currentTheme->isActive, 'sidebarPosition' => $currentTheme->sidebarPosition, 'title' => $currentTheme->title);
     $controlValueList = OW::getDbo()->queryForList(" SELECT * FROM " . BOL_ThemeControlValueDao::getInstance()->getTableName() . " WHERE themeId = :themeId ", array('themeId' => $currentTheme->id));
     foreach ($controlValueList as $controlValue) {
         $this->configs['controlValue'][$controlValue['themeControlKey']] = $controlValue['value'];
     }
     $za->addEmptyDir($archiveDir . '/' . $currentTheme->getName());
     $this->zipFolder($za, $currentThemeDir, $archiveDir . '/' . $currentTheme->getName() . '/');
     $themesDir = Ow::getPluginManager()->getPlugin('dataexporter')->getPluginFilesDir() . 'themes' . DS;
     UTIL_File::copyDir(OW_DIR_THEME_USERFILES, $themesDir);
     $fileList = Ow::getStorage()->getFileNameList(OW_DIR_THEME_USERFILES);
     mkdir($themesDir, 0777);
     foreach ($fileList as $file) {
         if (Ow::getStorage()->isFile($file)) {
             Ow::getStorage()->copyFileToLocalFS($file, $themesDir . mb_substr($file, mb_strlen(OW_DIR_THEME_USERFILES)));
         }
     }
     $za->addEmptyDir($archiveDir . '/themes');
     $this->zipFolder($za, $themesDir, $archiveDir . '/themes/');
 }