/** * Default action */ public function index() { $lang = OW::getLanguage(); OW::getDocument()->setHeading($lang->text('ocssitestats', 'admin_page_heading')); OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel'); $pluginManager = OW::getPluginManager(); $pluginsActivated = array('total_users' => true, 'online_users' => true, 'new_users_today' => true, 'new_users_this_month' => true, 'photos' => $pluginManager->isPluginActive('photo'), 'videos' => $pluginManager->isPluginActive('video'), 'blogs' => $pluginManager->isPluginActive('blogs'), 'groups' => $pluginManager->isPluginActive('groups'), 'events' => $pluginManager->isPluginActive('event'), 'discussions' => $pluginManager->isPluginActive('forum'), 'links' => $pluginManager->isPluginActive('links')); $config = OW::getConfig(); if (OW::getRequest()->isPost() && !empty($_POST['action'])) { switch ($_POST['action']) { case 'update_metrics': $conf = array(); foreach ($pluginsActivated as $key => $m) { $conf[$key] = $pluginsActivated[$key] && !empty($_POST['metrics'][$key]) && $_POST['metrics'][$key]; } $config->saveConfig('ocssitestats', 'metrics', json_encode($conf)); OW::getFeedback()->info($lang->text('ocssitestats', 'settings_updated')); $this->redirect(); break; case 'update_settings': $config->saveConfig('ocssitestats', 'zero_values', !empty($_POST['zero_values'])); OW::getFeedback()->info($lang->text('ocssitestats', 'settings_updated')); $this->redirect(); break; } } $metricsConf = json_decode($config->getValue('ocssitestats', 'metrics'), true); $this->assign('metrics', $metricsConf); $zeroValues = $config->getValue('ocssitestats', 'zero_values'); $this->assign('zeroValues', $zeroValues); $this->assign('pluginsActivated', $pluginsActivated); $logo = OW::getPluginManager()->getPlugin('ocssitestats')->getStaticUrl() . 'img/oxwallcandystore-logo.jpg'; $this->assign('logo', $logo); }
public function editSlide() { if (!OW::getRequest()->isAjax()) { exit(json_encode(array('result' => false))); } if (!OW::getUser()->isAdmin()) { throw new AuthenticationException(); exit; } if (!empty($_POST['slideId'])) { $title = !empty($_POST['title']) ? htmlspecialchars($_POST['title']) : null; $url = !empty($_POST['url']) ? htmlspecialchars($_POST['url']) : null; $service = SLIDESHOW_BOL_Service::getInstance(); $slideId = (int) $_POST['slideId']; $slide = $service->findSlideById($slideId); if (!$slide) { exit(json_encode(array('result' => false))); } $slide->label = $title; $slide->url = $url; $service->updateSlide($slide); exit(json_encode(array('result' => true, 'slideId' => $slideId))); } exit; }
public function grantCredits() { if (!OW::getRequest()->isAjax()) { throw new Redirect404Exception(); } if (!OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } $form = new USERCREDITS_CLASS_GrantCreditsForm(); if ($form->isValid($_POST)) { $lang = OW::getLanguage(); $creditService = USERCREDITS_BOL_CreditsService::getInstance(); $grantorId = OW::getUser()->getId(); $values = $form->getValues(); $userId = (int) $values['userId']; $amount = abs((int) $values['amount']); $granted = $creditService->grantCredits($grantorId, $userId, $amount); $credits = $creditService->getCreditsBalance($grantorId); if ($granted) { $data = array('amount' => $amount, 'grantorId' => $grantorId, 'userId' => $userId); $event = new OW_Event('usercredits.grant', $data); OW::getEventManager()->trigger($event); $data = array('message' => $lang->text('usercredits', 'credits_granted', array('amount' => $amount)), 'credits' => $credits); } else { $data = array('error' => $lang->text('usercredits', 'credits_grant_error')); } exit(json_encode($data)); } }
public function index($params) { $id = (int) $params['id']; $menu = BOL_NavigationService::getInstance()->findMenuItemById($id); $form = new EditPluginPageForm('edit-form', $menu); $service = BOL_NavigationService::getInstance(); if (OW::getRequest()->isPost() && $form->isValid($_POST)) { $data = $form->getValues(); $visibleFor = 0; $arr = !empty($data['visible-for']) ? $data['visible-for'] : array(); foreach ($arr as $val) { $visibleFor += $val; } $service->saveMenuItem($menu->setVisibleFor($visibleFor)); $languageService = BOL_LanguageService::getInstance(); $langKey = $languageService->findKey($menu->getPrefix(), $menu->getKey()); $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId()); $languageService->saveValue($langValue->setValue($data['name'])); $adminPlugin = OW::getPluginManager()->getPlugin('admin'); OW::getFeedback()->info(OW::getLanguage()->text($adminPlugin->getKey(), 'updated_msg')); $this->redirect(); } //-- $this->addForm($form); }
public function index() { $language = OW::getLanguage(); OW::getDocument()->setHeading($language->text('mcompose', 'heading_configuration')); OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel'); $this->assign('pluginUrl', 'http://www.oxwall.org/store/item/10'); if (!$this->plugin->isAvaliable()) { $this->assign('avaliable', false); return; } $this->assign('avaliable', true); $settingUrl = OW::getRouter()->urlForRoute('mailbox_admin_config'); $this->assign('settingsUrl', $settingUrl); $configs = OW::getConfig()->getValues('mcompose'); $features = array(); $features["friends"] = MCOMPOSE_CLASS_FriendsBridge::getInstance()->isActive(); $features["groups"] = MCOMPOSE_CLASS_GroupsBridge::getInstance()->isActive(); $features["events"] = MCOMPOSE_CLASS_EventsBridge::getInstance()->isActive(); $form = new MCOMPOSE_ConfigForm($configs, $features); $this->addForm($form); $this->assign("configs", $configs); $this->assign("features", $features); $this->assign("activeFeatures", array_filter($features)); if (OW::getRequest()->isPost() && $form->isValid($_POST)) { if ($form->process($_POST)) { OW::getFeedback()->info($language->text('mcompose', 'admin_settings_updated')); $this->redirect(OW::getRouter()->urlForRoute('mcompose-admin')); } } }
public function __construct($conversationId, $opponentId) { parent::__construct('newMailMessageForm'); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $field = new TextField('newMessageText'); $field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation')); $field->setId('newMessageText'); $this->addElement($field); $field = new HiddenField('attachment'); $this->addElement($field); $field = new HiddenField('conversationId'); $field->setValue($conversationId); $this->addElement($field); $field = new HiddenField('opponentId'); $field->setValue($opponentId); $this->addElement($field); $field = new HiddenField('uid'); $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId)); $this->addElement($field); $submit = new Submit('newMessageSendBtn'); $submit->setId('newMessageSendBtn'); $submit->setName('newMessageSendBtn'); $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button')); $this->addElement($submit); if (!OW::getRequest()->isAjax()) { $js = UTIL_JsGenerator::composeJsString(' owForms["newMailMessageForm"].bind( "submit", function( r ) { $("#newmessage-mail-send-btn").addClass("owm_preloader_circle"); });'); OW::getDocument()->addOnloadScript($js); } $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage')); }
/** * Default action */ public function index() { $language = OW::getLanguage(); $clipService = VIDEO_BOL_ClipService::getInstance(); $userId = OW::getUser()->getId(); if (!OW::getUser()->isAuthorized('video', 'add')) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('video', 'add'); throw new AuthorizationException($status['msg']); } if (!($clipService->findUserClipsCount($userId) <= $clipService->getUserQuotaConfig())) { $this->assign('auth_msg', $language->text('video', 'quota_exceeded', array('limit' => $clipService->getUserQuotaConfig()))); } else { $this->assign('auth_msg', null); $videoAddForm = new videoAddForm(); $this->addForm($videoAddForm); if (OW::getRequest()->isPost() && $videoAddForm->isValid($_POST)) { $values = $videoAddForm->getValues(); $code = $clipService->validateClipCode($values['code']); if (!mb_strlen($code)) { OW::getFeedback()->warning($language->text('video', 'resource_not_allowed')); $this->redirect(); } $res = $videoAddForm->process(); OW::getFeedback()->info($language->text('video', 'clip_added')); $this->redirect(OW::getRouter()->urlForRoute('view_clip', array('id' => $res['id']))); } } if (!OW::getRequest()->isAjax()) { OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'video', 'video'); } OW::getDocument()->setHeading($language->text('video', 'page_title_add_video')); OW::getDocument()->setHeadingIconClass('ow_ic_video'); OW::getDocument()->setTitle($language->text('video', 'meta_title_video_add')); OW::getDocument()->setDescription($language->text('video', 'meta_description_video_add')); }
public function index() { $groups = MODERATION_BOL_Service::getInstance()->getContentGroups(); if (OW::getRequest()->isPost()) { $selectedGroups = empty($_POST["groups"]) ? array() : $_POST["groups"]; $types = array(); foreach ($groups as $group) { $selected = in_array($group["name"], $selectedGroups); foreach ($group["entityTypes"] as $type) { $types[$type] = $selected; } } OW::getConfig()->saveConfig("moderation", "content_types", json_encode($types)); OW::getFeedback()->info(OW::getLanguage()->text("moderation", "content_types_saved_message")); $this->redirect(OW::getRouter()->urlForRoute("moderation.admin")); } $this->setPageHeading(OW::getLanguage()->text("moderation", "admin_heading")); $this->setPageTitle(OW::getLanguage()->text("moderation", "admin_title")); $form = new Form("contentTypes"); $submit = new Submit("save"); $submit->setLabel(OW::getLanguage()->text("admin", "save_btn_label")); $form->addElement($submit); $this->addForm($form); $this->assign("groups", $groups); }
/** * Default action */ public function index() { $language = OW::getLanguage(); $item = new BASE_MenuItem(); $item->setLabel($language->text('gphotoviewer', 'admin_menu_general')); $item->setUrl(OW::getRouter()->urlForRoute('gphotoviewer.admin_config')); $item->setKey('general'); $item->setIconClass('ow_ic_gear_wheel'); $item->setOrder(0); $menu = new BASE_CMP_ContentMenu(array($item)); $this->addComponent('menu', $menu); $configs = OW::getConfig()->getValues('gphotoviewer'); $configSaveForm = new ConfigSaveForm(); $this->addForm($configSaveForm); if (OW::getRequest()->isPost() && $configSaveForm->isValid($_POST)) { $res = $configSaveForm->process(); OW::getFeedback()->info($language->text('gphotoviewer', 'settings_updated')); $this->redirect(OW::getRouter()->urlForRoute('gphotoviewer.admin_config')); } if (!OW::getRequest()->isAjax()) { $this->setPageHeading(OW::getLanguage()->text('gphotoviewer', 'admin_config')); $this->setPageHeadingIconClass('ow_ic_picture'); $elem = $menu->getElement('general'); if ($elem) { $elem->setActive(true); } } $configSaveForm->getElement('enablePhotoviewer')->setValue($configs['enable_photo_viewer']); $configSaveForm->getElement('downloadable')->setValue($configs['can_users_to_download_photos']); $configSaveForm->getElement('slideshowTime')->setValue($configs['slideshow_time_per_a_photo']); }
public function settings() { $adminForm = new Form('adminForm'); $language = OW::getLanguage(); $config = OW::getConfig(); $element = new TextField('autoclick'); $element->setRequired(true); $validator = new IntValidator(1); $validator->setErrorMessage($language->text('autoviewmore', 'admin_invalid_number_error')); $element->addValidator($validator); $element->setLabel($language->text('autoviewmore', 'admin_auto_click')); $element->setValue($config->getValue('autoviewmore', 'autoclick')); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue($language->text('autoviewmore', 'admin_save_settings')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { if ($adminForm->isValid($_POST)) { $values = $adminForm->getValues(); $config = OW::getConfig(); $config->saveConfig('autoviewmore', 'autoclick', $values['autoclick']); OW::getFeedback()->info($language->text('autoviewmore', 'user_save_success')); } } $this->addForm($adminForm); }
public function index() { $language = OW::getLanguage(); $billingService = BOL_BillingService::getInstance(); $adminForm = new Form('adminForm'); $element = new TextField('creditValue'); $element->setRequired(true); $element->setLabel($language->text('billingcredits', 'admin_usd_credit_value')); $element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc')); $element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue')); $validator = new FloatValidator(0.1); $validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format')); $element->addValidator($validator); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue($language->text('billingcredits', 'admin_save_settings')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { if ($adminForm->isValid($_POST)) { $values = $adminForm->getValues(); $billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']); OW::getFeedback()->info($language->text('billingcredits', 'user_save_success')); } } $this->addForm($adminForm); $this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading')); $this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading')); $this->setPageHeadingIconClass('ow_ic_app'); }
public function gallery($params) { if (OW::getRequest()->isPost()) { $userId = OW::getUser()->getId(); if (empty($userId)) { throw new Exception('Guests can\'t view this page'); } $imgId = intval($_POST['img-id']); if ($imgId <= 0) { throw new Redirect404Exception(); } BOL_MediaPanelService::getInstance()->deleteById($imgId); OW::getFeedback()->info(OW::getLanguage()->text('base', 'media_panel_file_deleted')); $this->redirect(); } $pluginKey = $params['pluginKey']; $this->initMenu($params); $this->addComponent('menu', $this->menu); $this->menu->getElement('gallery'); $service = BOL_MediaPanelService::getInstance(); $list = $service->findGalleryImages($pluginKey, OW::getUser()->getId(), 0, 500); $list = array_reverse($list); $images = array(); foreach ($list as $img) { $images[] = array('dto' => $img, 'data' => $img->getData(), 'url' => OW::getStorage()->getFileUrl(OW::getPluginManager()->getPlugin('base')->getUserFilesDir() . $img->id . '-' . $img->getData()->name), 'sel' => !empty($params['pid']) && $img->getId() == $params['pid']); } $this->assign('images', $images); $this->assign('id', $params['id']); }
/** * Default action */ public function index() { $language = OW::getLanguage(); $configSaveForm = new ConfigSaveForm(); $this->addForm($configSaveForm); $activeModes = MAILBOX_BOL_ConversationService::getInstance()->getActiveModeList(); if (count($activeModes) > 1) { $selectedMode = 'mailchat'; } else { $selectedMode = $activeModes[0]; } $this->assign('selectedMode', $selectedMode); $mailModeEnabled = in_array('mail', $activeModes); $this->assign('mailModeEnabled', $mailModeEnabled); if (OW::getRequest()->isPost() && $configSaveForm->isValid($_POST)) { $configSaveForm->process(); // clear cache MAILBOX_BOL_ConversationService::getInstance()->resetAllUsersLastData(); OW::getFeedback()->info($language->text('mailbox', 'settings_updated')); $this->redirect(); } if (!OW::getRequest()->isAjax()) { $this->setPageHeading(OW::getLanguage()->text('mailbox', 'admin_config')); $this->setPageHeadingIconClass('ow_ic_mail'); } }
public function customization() { $language = OW::getLanguage(); $this->setPageHeading($language->text('newsfeed', 'admin_page_heading')); $this->setPageTitle($language->text('newsfeed', 'admin_page_title')); $this->setPageHeadingIconClass('ow_ic_comment'); $types = NEWSFEED_BOL_CustomizationService::getInstance()->getActionTypes(); $form = new NEWSFEED_CustomizationForm(); $this->addForm($form); $processTypes = array(); foreach ($types as $type) { $field = new CheckboxField($type['activity']); $field->setValue($type['active']); $form->addElement($field); $processTypes[] = $type['activity']; } if (OW::getRequest()->isPost()) { $result = $form->process($_POST, $processTypes); if ($result) { OW::getFeedback()->info($language->text('newsfeed', 'customization_changed')); } else { OW::getFeedback()->warning($language->text('newsfeed', 'customization_not_changed')); } $this->redirect(); } $this->assign('types', $types); $this->addComponent('menu', $this->getMenu()); }
public function index() { $language = OW::getLanguage(); $this->setPageHeading($language->text('ynsocialpublisher', 'admin_config')); $this->setPageHeadingIconClass('ow_ic_picture'); $item = new BASE_MenuItem(); $item->setLabel($language->text('ynsocialpublisher', 'admin_menu_general')); $item->setUrl(OW::getRouter()->urlForRoute('ynsocialpublisher.admin')); $item->setKey('general'); $item->setIconClass('ow_ic_gear_wheel'); $item->setOrder(0); $item->setActive(true); $menu = new BASE_CMP_ContentMenu(array($item)); $this->addComponent('menu', $menu); $service = YNSOCIALPUBLISHER_BOL_Service::getInstance(); $plugins = $service->getEnabledPlugins(); $this->assign('plugins', $plugins); $form_url = OW::getRouter()->urlForRoute('ynsocialpublisher.admin'); $this->assign('form_url', $form_url); if (OW::getRequest()->isPost()) { // get plugins data from post $params = $_POST['params']; foreach ($params as $key => $settings) { if (!isset($settings['providers'])) { $settings['providers'] = array(); } OW::getConfig()->saveConfig('ynsocialpublisher', $key, json_encode($settings)); } OW::getFeedback()->info($language->text('ynsocialpublisher', 'settings_updated')); $this->redirect($form_url); } }
public function index() { $billingService = BOL_BillingService::getInstance(); $gwKey = OCSBILLINGMONEYBOOKERS_CLASS_MoneybookersAdapter::GATEWAY_KEY; $language = OW::getLanguage(); $form = new MoneybookersConfigForm(); $this->addForm($form); if (OW::getRequest()->isPost() && $form->isValid($_POST)) { $values = $form->getValues(); $billingService->setGatewayConfigValue($gwKey, 'merchantId', $values['merchantId']); $billingService->setGatewayConfigValue($gwKey, 'merchantEmail', $values['merchantEmail']); $billingService->setGatewayConfigValue($gwKey, 'secret', $values['secret']); $billingService->setGatewayConfigValue($gwKey, 'sandboxMode', $values['sandboxMode']); $billingService->setGatewayConfigValue($gwKey, 'recipientDescription', $values['recipientDescription']); $billingService->setGatewayConfigValue($gwKey, 'language', $values['language']); OW::getFeedback()->info($language->text('ocsbillingmoneybookers', 'settings_updated')); $this->redirect(); } $adapter = new OCSBILLINGMONEYBOOKERS_CLASS_MoneybookersAdapter(); $this->assign('logoUrl', $adapter->getLogoUrl()); $gateway = $billingService->findGatewayByKey($gwKey); $this->assign('gateway', $gateway); $this->assign('activeCurrency', $billingService->getActiveCurrency()); $supported = $billingService->currencyIsSupported($gateway->currencies); $this->assign('currSupported', $supported); $logo = OW::getPluginManager()->getPlugin('ocsbillingmoneybookers')->getStaticUrl() . 'img/oxwallcandystore-logo.jpg'; $this->assign('logo', $logo); $this->setPageHeading(OW::getLanguage()->text('ocsbillingmoneybookers', 'config_page_heading')); $this->setPageHeadingIconClass('ow_ic_app'); }
public function addStatic($onloadJs = '') { static $fistCall = true; $staticUrl = OW::getPluginManager()->getPlugin('attachments')->getStaticUrl(); OW::getDocument()->addStyleSheet($staticUrl . 'styles.css' . '?' . self::PLUGIN_VERSION); if ($fistCall) { if (OW::getRequest()->isAjax()) { OW::getDocument()->addOnloadScript('window.ATTPAjaxLoadCallbackQueue = [];'); OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(' if ( !window.ATTP ) OW.addScriptFiles([{$url}]); ', array('url' => $staticUrl . 'scripts.js' . '?' . self::PLUGIN_VERSION))); } else { OW::getDocument()->addScript($staticUrl . 'scripts.js' . '?' . self::PLUGIN_VERSION); if (!empty($onloadJs)) { OW::getDocument()->addOnloadScript($onloadJs); } return; } } $fistCall = false; OW::getDocument()->addOnloadScript('(function() { var loaded = function() { ' . $onloadJs . ' }; if ( window.ATTP ) loaded.call(); else window.ATTPAjaxLoadCallbackQueue.push(loaded); })();'); }
public function index($params) { $id = (int) $params['id']; $this->assign('id', $id); $menu = BOL_NavigationService::getInstance()->findMenuItemById($id); $service = BOL_NavigationService::getInstance(); $form = new EditExternalPageForm('edit-form', $menu); if (OW::getRequest()->isPost() && $form->isValid($_POST)) { $data = $form->getValues(); $visibleFor = 0; $arr = !empty($data['visible-for']) ? $data['visible-for'] : array(); foreach ($arr as $val) { $visibleFor += $val; } $service->saveMenuItem($menu->setExternalUrl($data['url'])->setVisibleFor($visibleFor)->setNewWindow(!empty($_POST['ext-open-in-new-window']) && $_POST['ext-open-in-new-window'] == 'on')); $languageService = BOL_LanguageService::getInstance(); $plugin = OW::getPluginManager()->getPlugin('base'); $langKey = $languageService->findKey($plugin->getKey(), $menu->getKey()); if (empty($langKey)) { $langPrefixDto = $languageService->findPrefix($menu->getPrefix()); $langKey = $languageService->addKey($langPrefixDto->getId(), $menu->getKey()); } $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId()); if (empty($langValue)) { $languageService->addValue($languageService->getCurrent()->getId(), $menu->getPrefix(), $langKey->getKey(), $data['name']); } else { $languageService->saveValue($langValue->setValue($data['name'])); } $adminPlugin = OW::getPluginManager()->getPlugin('admin'); OW::getFeedback()->info(OW::getLanguage()->text($adminPlugin->getKey(), 'updated_msg')); $this->redirect(); } $this->addForm($form); }
public function index() { $language = OW::getLanguage(); $config = OW::getConfig(); OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_mobile_settings')); OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel'); $settingsForm = new Form('mobile_settings'); $disableMobile = new CheckboxField('disable_mobile'); $disableMobile->setLabel($language->text('admin', 'mobile_settings_mobile_context_disable_label')); $disableMobile->setDescription($language->text('admin', 'mobile_settings_mobile_context_disable_desc')); $settingsForm->addElement($disableMobile); $submit = new Submit('save'); $submit->setValue($language->text('admin', 'save_btn_label')); $settingsForm->addElement($submit); $this->addForm($settingsForm); if (OW::getRequest()->isPost()) { if ($settingsForm->isValid($_POST)) { $data = $settingsForm->getValues(); $config->saveConfig('base', 'disable_mobile_context', (bool) $data['disable_mobile']); OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message')); } else { OW::getFeedback()->error('Error'); } $this->redirect(); } $disableMobile->setValue($config->getValue('base', 'disable_mobile_context')); }
public function ajaxGetClip() { if (!OW::getRequest()->isAjax()) { throw new Redirect404Exception(); } $importService = SPVIDEOLITE_CLASS_ImportService::getInstance(); try { $video = $importService->checkClip($_REQUEST['clipUrl']); $this->setTemplate(OW::getPluginManager()->getPlugin('spvideolite')->getCmpViewDir() . 'add_form.html'); $this->assign('auth_msg', null); $spVideoAddForm = new spVideoAddForm(); $spVideoAddForm->setAction(OW::getRouter()->urlForRoute('spvideolite.import')); $thumbnail = ''; foreach ($video->thumbnails as $thumb) { if (!empty($thumb->url)) { $thumbnail = $thumb->url; break; } } $spVideoAddForm->setValues(array('title' => $video->title, 'description' => $video->description, 'code' => $video->embedCode, 'tags' => implode(',', (array) $video->tags), 'thumbnail' => $thumbnail)); $this->addForm($spVideoAddForm); $this->assign('thumbUrl', $thumbnail); $formHtml = base64_encode($this->render()); $result = array('error' => false, 'formHtml' => $formHtml, 'script' => base64_encode($spVideoAddForm->getFormJs())); if (isset($_REQUEST['external'])) { die(json_encode(array('title' => $video->title, 'description' => $video->description, 'code' => $video->embedCode, 'tags' => implode(',', (array) $video->tags), 'thumbnail' => $thumbnail, 'error' => false), true)); } exit(json_encode($result)); } catch (Exception $e) { $msg = $e->getMessage(); $result = array('error' => true, 'errMsg' => $msg); exit(json_encode($result)); } }
/** * Constructor. */ public function __construct() { parent::__construct(); if (!OW::getUser()->isAdmin()) { throw new AuthenticateException(); } if (!OW::getRequest()->isAjax()) { $document = OW::getDocument(); $document->setMasterPage(new ADMIN_CLASS_MasterPage()); $this->setPageTitle(OW::getLanguage()->text('admin', 'page_default_title')); } BOL_PluginService::getInstance()->checkManualUpdates(); $plugin = BOL_PluginService::getInstance()->findNextManualUpdatePlugin(); $handlerParams = OW::getRequestHandler()->getHandlerAttributes(); // TODO refactor shortcut below if (!defined('OW_PLUGIN_XP') && $plugin !== null) { if ($handlerParams['controller'] === 'ADMIN_CTRL_Plugins' && $handlerParams['action'] === 'manualUpdateRequest') { //action } else { throw new RedirectException(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'manualUpdateRequest', array('key' => $plugin->getKey()))); } } // TODO temp admin pge inform event function admin_check_if_admin_page() { return true; } OW::getEventManager()->bind('admin.check_if_admin_page', 'admin_check_if_admin_page'); }
public function index($params = array()) { $userService = BOL_UserService::getInstance(); $language = OW::getLanguage(); $this->setPageHeading($language->text('hotlist', 'admin_heading_settings')); $this->setPageHeadingIconClass('ow_ic_gear_wheel'); $settingsForm = new Form('settingsForm'); $settingsForm->setId('settingsForm'); $expiration_time = new TextField('expiration_time'); $expiration_time->setRequired(); $expiration_time->setLabel($language->text('hotlist', 'label_expiration_time')); $expiration_time_value = (int) OW::getConfig()->getValue('hotlist', 'expiration_time') / 86400; $expiration_time->setValue($expiration_time_value); $settingsForm->addElement($expiration_time); $submit = new Submit('save'); $submit->addAttribute('class', 'ow_ic_save'); $submit->setValue($language->text('hotlist', 'label_save_btn_label')); $settingsForm->addElement($submit); $this->addForm($settingsForm); if (OW::getRequest()->isPost()) { if ($settingsForm->isValid($_POST)) { $data = $settingsForm->getValues(); OW::getConfig()->saveConfig('hotlist', 'expiration_time', $data['expiration_time'] * 86400); OW::getFeedback()->info($language->text('hotlist', 'settings_saved')); $this->redirect(); } } }
/** * Application init actions. */ public function init() { // $this->urlHostRedirect(); // //printVar(10);exit; $this->userAutoLogin(); // setting default time zone date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone')); // OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel'); // OW::getRequestHandler()->setStaticPageAttributes('BASE_CTRL_StaticDocument'); // // // router init - need to set current page uri and base url $router = OW::getRouter(); $router->setBaseUrl(OW_URL_HOME . 'api/'); $uri = OW::getRequest()->getRequestUri(); // before setting in router need to remove get params if (strstr($uri, '?')) { $uri = substr($uri, 0, strpos($uri, '?')); } $router->setUri($uri); $router->setDefaultRoute(new OW_ApiDefaultRoute()); $beckend = OW::getEventManager()->call('base.cache_backend_init'); if ($beckend !== null) { OW::getCacheManager()->setCacheBackend($beckend); OW::getCacheManager()->setLifetime(3600); OW::getDbo()->setUseCashe(true); } OW::getResponse()->setDocument($this->newDocument()); }
/** * Constructor. * */ public function __construct() { parent::__construct(''); $template = OW::getPluginManager()->getPlugin('BASE')->getCmpViewDir() . 'console_switch_language.html'; $this->setTemplate($template); $languages = BOL_LanguageService::getInstance()->getLanguages(); $session_language_id = BOL_LanguageService::getInstance()->getCurrent()->getId(); $active_languages = array(); foreach ($languages as $id => $language) { if ($language->status == 'active') { $tag = $this->parseCountryFromTag($language->tag); $active_lang = array('id' => $language->id, 'label' => $tag['label'], 'order' => $language->order, 'tag' => $language->tag, 'class' => "ow_console_lang{$tag['country']}", 'url' => OW::getRequest()->buildUrlQueryString(null, array("language_id" => $language->id)), 'is_current' => false); if ($session_language_id == $language->id) { $active_lang['is_current'] = true; $this->assign('label', $tag['label']); $this->assign('class', "ow_console_lang{$tag['country']}"); } $active_languages[] = $active_lang; } } if (count($active_languages) <= 1) { $this->setVisible(false); return; } function sortActiveLanguages($lang1, $lang2) { return $lang1['order'] < $lang2['order'] ? -1 : 1; } usort($active_languages, 'sortActiveLanguages'); $switchLanguage = new BASE_CMP_SwitchLanguage($active_languages); $this->setContent($switchLanguage->render()); }
public function index($params) { if (OW::getRequest()->isAjax()) { exit; } $language = OW::getLanguage(); $this->setPageHeading($language->text('base', 'massmailing_unsubscribe')); $code = null; $userId = null; $result = false; if (isset($params['code']) && isset($params['id'])) { $result = 'confirm'; if (!empty($_POST['cancel'])) { $this->redirect(OW_URL_HOME); } $code = trim($params['code']); $userId = $params['id']; $user = $this->userServise->findUserById($userId); if ($user !== null) { if (md5($user->username . $user->password) === $code) { $result = 'confirm'; if (!empty($_POST['confirm'])) { BOL_PreferenceService::getInstance()->savePreferenceValue('mass_mailing_subscribe', false, $user->id); $result = true; OW::getFeedback()->info($language->text('base', 'massmailing_unsubscribe_successful')); $this->redirect(OW_URL_HOME); } } } } $this->assign('result', $result); }
/** * Default action */ public function index() { $language = OW::getLanguage(); $uploadMaxFilesize = (double) ini_get("upload_max_filesize"); $postMaxSize = (double) ini_get("post_max_size"); $maxUploadMaxFilesize = $uploadMaxFilesize >= $postMaxSize ? $postMaxSize : $uploadMaxFilesize; $this->assign('maxUploadMaxFilesize', $maxUploadMaxFilesize); $configSaveForm = new ConfigSaveForm($maxUploadMaxFilesize); $this->addForm($configSaveForm); if (OW::getRequest()->isPost() && $configSaveForm->isValid($_POST)) { $configSaveForm->process(); OW::getFeedback()->info($language->text('mailbox', 'settings_updated')); $this->redirect(); } if (!OW::getRequest()->isAjax()) { $this->setPageHeading(OW::getLanguage()->text('mailbox', 'admin_config')); $this->setPageHeadingIconClass('ow_ic_mail'); } /* OW::getDocument()->addOnloadScript(" $(\"form[name='configSaveForm'] input[name='enableAttachments']\").change( function() { if( $(this).attr('checked') ) { $(\"form[name='configSaveForm'] input[name='uploadMaxFileSize']\").removeAttr('disabled'); } else { $(\"form[name='configSaveForm'] input[name='uploadMaxFileSize']\").attr('disabled','disabled'); } }); "); */ }
private function init_icon($providers, $user_id) { //$callback = OW_Router::getInstance()->getBaseUrl().OW_Router::getInstance()->getUri(); $callback = OW::getRequest()->getRequestUri(); $config = OW::getConfig(); foreach ($providers as $key => $provider) { $core = new YNSOCIALSTREAM_CLASS_Core(); if (!OW::getConfig()->configExists('ynsocialstream', 'enable_facebook_' . $user_id)) { OW::getConfig()->addConfig('ynsocialstream', 'enable_facebook_' . $user_id, 1); OW::getConfig()->addConfig('ynsocialstream', 'enable_twitter_' . $user_id, 1); OW::getConfig()->addConfig('ynsocialstream', 'enable_linkedin_' . $user_id, 1); OW::getConfig()->addConfig('ynsocialstream', 'cron_job_user_' . $user_id, 1); OW::getConfig()->addConfig('ynsocialstream', 'auth_fb_' . $user_id, 'only_for_me'); OW::getConfig()->addConfig('ynsocialstream', 'auth_tw_' . $user_id, 'only_for_me'); OW::getConfig()->addConfig('ynsocialstream', 'auth_li_' . $user_id, 'only_for_me'); } $configs = OW::getConfig()->getValues('ynsocialstream'); if ($core->checkSocialBridgePlugin($provider) && $configs['enable_' . $provider . '_' . $user_id]) { $src = OW::getPluginManager()->getPlugin('ynsocialstream')->getStaticUrl() . 'img/' . 'socialStream_icon.png'; //echo $src;die; $html = "<a class=\"ynsocialstream_get_feed_" . $provider . "\" title=" . $key . " id=\"get_feed_" . $provider . "\" rel=\"{$provider}\" href=\"javascript://\" style=\"margin:0 0 0 -1px;\"></a>"; $url = OW::getRouter()->urlFor('YNSOCIALSTREAM_CTRL_Socialstream', 'connect'); $sript = "\$(document).ready(function() {if(\$('.ow_attachment_icons #nfa-feed1 span.buttons').length){\n\t\t\t\t\t\$('.ow_attachment_icons #nfa-feed1 span.buttons').append('" . $html . "');\n\t\t\t\t\t\$('#get_feed_" . $provider . "').click(function(){\t\t\t\n\t\t\t\t\t\t\$('.ow_submit_auto_click').hide();\n\t\t\t \t\t\$('#attachment_preview_nfa-feed1').show();\n\t\t\t \t\t\$('#attachment_preview_nfa-feed1').empty().addClass('attachment_preloader').animate({height:45});\n\t\t\t \t\n\t\t\t \t\$.ajax({\n\t\t\t\t\t\t type: 'POST',\n\t\t\t\t\t\t url: '{$url}',\n\t\t\t\t\t\t data: 'service={$provider}&url={$callback}',\n\t\t\t\t\t\t dataType: 'json',\n\t\t\t\t\t\t success : function(data){\n\t\t\t\t\t\t\tdocument.location.href=data;\n\t\t },\n\t\t error : function( XMLHttpRequest, textStatus, errorThrown ){\n\t\t \tOW.error(textStatus);\n\t\t\t\t\t }\n\t\t\t\t\t});\n\t\t\t \t\n\t\t\t\t\t});\n\t\t\t\t}});"; OW::getDocument()->addScriptDeclaration($sript); } } }
/** * Constructor. */ public function __construct($params = array()) { parent::__construct(); $userId = (int) $params['userId']; $showMessage = (bool) $params['showMessage']; $rspUrl = OW::getRouter()->urlFor('BASE_CTRL_User', 'deleteUser', array('user-id' => $userId)); $rspUrl = OW::getRequest()->buildUrlQueryString($rspUrl, array('showMessage' => (int) $showMessage)); $js = UTIL_JsGenerator::composeJsString('$("#baseDCButton").click(function() { var button = this; OW.inProgressNode(button); $.getJSON({$rsp}, function(r) { OW.activateNode(button); if ( _scope.floatBox ) { _scope.floatBox.close(); } if ( _scope.deleteCallback ) { _scope.deleteCallback(r); } }); });', array('rsp' => $rspUrl)); OW::getDocument()->addOnloadScript($js); }
/** * Constructor. */ public function __construct() { if (!OW::getRequest()->isAjax()) { throw new Redirect404Exception(); } $this->commentService = BOL_CommentService::getInstance(); }
public function __construct(BASE_CLASS_WidgetParameter $paramsObj) { parent::__construct(); $params = $paramsObj->customParamList; $addParams = $paramsObj->additionalParamList; if (empty($addParams['entityId']) || !OW::getUser()->isAuthenticated() || !OW::getUser()->isAuthorized('eventx', 'view_event')) { $this->setVisible(false); return; } else { $userId = $addParams['entityId']; } $eventParams = array('action' => 'event_view_attend_events', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId()); try { OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams); } catch (RedirectException $e) { $this->setVisible(false); return; } $language = OW::getLanguage(); $eventService = EVENTX_BOL_EventService::getInstance(); $userEvents = $eventService->findUserParticipatedPublicEvents($userId, null, $params['events_count']); if (empty($userEvents)) { $this->setVisible(false); return; } $this->assign('my_events', $eventService->getListingDataWithToolbar($userEvents)); $toolbarArray = array(); if ($eventService->findUserParticipatedPublicEventsCount($userId) > $params['events_count']) { $url = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('eventx.view_event_list', array('list' => 'user-participated-events')), array('userId' => $userId)); $toolbarArray = array(array('href' => $url, 'label' => $language->text('eventx', 'view_all_label'))); } $this->assign('toolbars', $toolbarArray); }