public function performActionEdit() { $sAction = 'edit'; $aIds = bx_get('ids'); if (!$aIds || !is_array($aIds)) { $sId = bx_get('set_name'); if (!$sId) { $this->_echoResultJson(array()); exit; } $aIds = array($sId); } $sId = bx_process_input($aIds[0]); $aSet = array(); $iSet = $this->oDb->getSets(array('type' => 'by_name', 'value' => $sId), $aSet); if ($iSet != 1 || empty($aSet)) { $this->_echoResultJson(array()); exit; } bx_import('BxTemplStudioFormView'); $aForm = array('form_attrs' => array('id' => 'adm-nav-set-edit', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT), 'params' => array('db' => array('table' => 'sys_menu_sets', 'key' => 'set_name', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('set_name' => array('type' => 'hidden', 'name' => 'set_name', 'value' => $sId, 'db' => array('pass' => 'Xss')), 'title' => array('type' => 'text_translatable', 'name' => 'title', 'caption' => _t('_adm_nav_txt_sets_title'), 'info' => _t('_adm_nav_dsc_sets_title'), 'value' => $aSet['title'], 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'LengthTranslatable', 'params' => array(3, 100, 'title'), 'error' => _t('_adm_nav_err_sets_title'))), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_nav_btn_menus_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_nav_btn_menus_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left'))))); $oForm = new BxTemplStudioFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { if ($oForm->update($sId) !== false) { $aRes = array('grid' => $this->getCode(false), 'blink' => $sId); } else { $aRes = array('msg' => _t('_adm_nav_err_sets_edit')); } $this->_echoResultJson($aRes, true); } else { $sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-nav-set-edit-popup', _t('_adm_nav_txt_sets_edit_popup', _t($aSet['title'])), $this->_oTemplate->parseHtmlByName('nav_add_set.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction))); $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true); } }
function response(&$o) { if ($o->sUnit == 'system') { switch ($o->sAction) { case 'join_after_payment': $this->oModule->processJoinAfterPayment($o); break; } } if ($o->sUnit == 'profile') { switch ($o->sAction) { case 'logout': //delete facebook's session cookie $this->oModule->oFacebook->destroySession(); break; case 'join': bx_import('BxDolSession'); $oSession = BxDolSession::getInstance(); $iFacebookProfileUid = $oSession->getValue($this->oModule->_oConfig->sFacebookSessionUid); if ($iFacebookProfileUid) { $oSession->unsetValue($this->oModule->_oConfig->sFacebookSessionUid); //save Fb's uid $this->oModule->_oDb->saveFbUid($o->iObject, $iFacebookProfileUid); //Auto-friend members if they are already friends on Facebook $this->oModule->_makeFriends($o->iObject); } break; case 'delete': //remove Fb account $this->oModule->_oDb->deleteFbUid($o->iObject); break; default: } } }
function __construct($sModule = "", $sPage = "") { parent::__construct($sModule, $sPage); bx_import('BxDolModule'); $this->oModule = BxDolModule::getInstance('bx_smtp'); $this->aMenuItems = array(array('name' => 'general', 'icon' => 'cogs', 'title' => '_adm_lmi_cpt_settings'), array('name' => 'tester', 'icon' => 'envelope', 'title' => '_bx_smtp_tester')); }
function post($sSystem, $iId, $iCmtAuthorId, $iCmtParentId, $iMood, $sFileId) { global $sIncPath; global $sModule; global $sHomeUrl; $iId = (int) $iId; $iCmtParentId = (int) $iCmtParentId; $iMood = (int) $iMood; bx_import('BxDolCmts'); $oCmts = BxDolCmts::getObjectInstance($sSystem, $iId); if (!$oCmts) { return 0; } $sText = '<iframe width="100%" height="240" src="[ray_url]modules/video_comments/embed.php?id=' . $sFileId . '" frameborder="0" allowfullscreen></iframe>'; $mixedOverrideResult = null; $oAlert = new BxDolAlerts('bx_video_comments', 'post', $sFileId, getLoggedId(), array('override' => &$mixedOverrideResult, 'text' => &$sText, 'file_id' => &$sFileId, 'object_id' => &$iId, 'author' => &$iCmtAuthorId, 'parent_id' => &$iCmtParentId, 'mood' => &$iMood)); $oAlert->alert(); if (null !== $mixedOverrideResult) { return $mixedOverrideResult; } $iCmtNewId = $oCmts->_oQuery->addComment($iId, $iCmtParentId, $iCmtAuthorId, $sText, $iMood); if (false === $iCmtNewId) { return 0; } bx_import('BxDolAlerts'); $oZ = new BxDolAlerts($sSystem, 'commentPost', $oCmts->getId(), $oCmts->_getAuthorId(), array('comment_id' => $iCmtNewId, 'comment_author_id' => $iCmtAuthorId)); $oZ->alert(); $oCmts->_triggerComment(); return $iCmtNewId; }
function activate($sTemplate) { $aTemplate = BxDolModuleQuery::getInstance()->getModuleByName($sTemplate); if (empty($aTemplate) || !is_array($aTemplate)) { return array('code' => 1, 'message' => _t('_adm_err_operation_failed')); } $aTemplates = array(); $iTemplates = $this->oDb->getTemplatesBy(array('type' => 'active'), $aTemplates); if ($iTemplates == 1 && $aTemplates[0]['name'] == $sTemplate) { return array('code' => 1, 'message' => _t('_adm_dsg_err_last_active')); } $sTemplateDefault = getParam('template'); if ($aTemplate['uri'] == $sTemplateDefault) { return array('code' => 2, 'message' => _t('_adm_dsg_err_deactivate_default')); } bx_import('BxDolStudioInstallerUtils'); $oInstallerUtils = BxDolStudioInstallerUtils::getInstance(); $aResult = (int) $aTemplate['enabled'] == 0 ? $oInstallerUtils->perform($aTemplate['path'], 'enable') : $oInstallerUtils->perform($aTemplate['path'], 'disable'); if ($aResult['code'] != 0) { return $aResult; } bx_import('BxDolStudioTemplate'); $oTemplate = BxDolStudioTemplate::getInstance(); $aResult = array('code' => 0, 'message' => _t('_adm_scs_operation_done')); if ((int) $aTemplate['enabled'] == 0) { $aResult['content'] = $oTemplate->parseHtmlByName('page_content_2_col.html', array('page_menu_code' => $this->getPageMenu(), 'page_main_code' => $this->getPageCode())); } else { $aResult['content'] = ""; } return $aResult; }
function getCode() { bx_import('BxTemplStudioMenu'); $aTmplVars = array(); foreach ($this->aItems as $sPosition => $mixedItems) { if (!$this->aVisible[$sPosition]) { continue; } $sContent = ""; if (is_array($mixedItems)) { $oMenu = new BxTemplStudioMenu(array('template' => 'menu_top_toolbar.html', 'menu_items' => $mixedItems)); $sContent = $oMenu->getCode(); } else { if (is_string($mixedItems) && !empty($mixedItems)) { $sContent = $mixedItems; } } $aTmplVars[] = array('name' => $sPosition, 'content' => $sContent); } if (empty($aTmplVars)) { return ''; } $oTemplate = BxDolStudioTemplate::getInstance(); $oTemplate->addJs($this->getJs()); $oTemplate->addCss($this->getCss()); return $oTemplate->parseHtmlByName('menu_top.html', array('bx_repeat:menus' => $aTmplVars)); }
function processActions() { if (($sAction = bx_get($this->sParamPrefix . '_action')) !== false) { $sAction = bx_process_input($sAction); $aResult = array('code' => 1, 'message' => _t('_adm_' . $this->sLangPrefix . '_err_cannot_process_action')); switch ($sAction) { case 'uninstall': $sPageName = bx_process_input(bx_get($this->sParamPrefix . '_page_name')); if (empty($sPageName)) { break; } bx_import('BxDolModuleQuery'); $aModule = BxDolModuleQuery::getInstance()->getModuleByName($sPageName); if (empty($aModule) || !is_array($aModule)) { break; } if (($iWidgetId = (int) bx_get($this->sParamPrefix . '_widget_id')) != 0 && (int) bx_get($this->sParamPrefix . '_confirmed') != 1) { $aResult['message'] = $this->getPopupConfirm($iWidgetId, $aModule); break; } bx_import('BxDolStudioInstallerUtils'); $aResult = BxDolStudioInstallerUtils::getInstance()->perform($aModule['path'], 'uninstall'); if (!empty($aResult['message'])) { $aResult['message'] = $this->getPopupResult($aResult['message']); } break; } if (!empty($aResult['message'])) { bx_import('BxTemplStudioFunctions'); $aResult['message'] = BxTemplStudioFunctions::getInstance()->transBox('', $aResult['message']); } echo json_encode($aResult); exit; } }
function actionAdministration() { if (!$this->isAdmin()) { $this->_oTemplate->displayAccessDenied(); return; } $iId = $this->_oDb->getSettingsCategory('Google Search'); if (empty($iId)) { $this->_oTemplate->displayPageNotFound(); return; } $this->_oTemplate->pageStart(); bx_import('BxDolAdminSettings'); $mixedResult = ''; if (isset($_POST['save']) && isset($_POST['cat'])) { $oSettings = new BxDolAdminSettings($iId); $mixedResult = $oSettings->saveChanges($_POST); } $oSettings = new BxDolAdminSettings($iId); $sResult = $oSettings->getForm(); if ($mixedResult !== true && !empty($mixedResult)) { $sResult = $mixedResult . $sResult; } echo $this->_oTemplate->adminBlock($sResult, _t('_bx_gsearch_administration'), false, false, 11); $this->_oTemplate->addCssAdmin('main.css'); $this->_oTemplate->addCssAdmin('forms_adv.css'); $this->_oTemplate->pageCodeAdmin(_t('_bx_gsearch_administration')); }
public function performActionEdit() { $sAction = 'edit'; $sFormObject = $this->oModule->_oConfig->getObject('form_forms_prevalue'); $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_prevalue_edit'); $aValue = $this->_getItem('getValues'); if ($aValue === false) { $this->_echoResultJson(array()); exit; } bx_import('BxDolForm'); $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate); $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction . '&list=' . $this->sList; $this->onLoad($oForm->aInputs); $oForm->initChecker($aValue); if ($oForm->isSubmittedAndValid()) { if ($oForm->update($aValue['id']) !== false) { $this->onSave($oForm); $aRes = array('grid' => $this->getCode(false), 'blink' => $aValue['id']); } else { $aRes = array('msg' => _t('_bx_dev_frm_err_prevalues_edit')); } $this->_echoResultJson($aRes, true); } else { bx_import('BxTemplStudioFunctions'); $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-prevalue-edit-popup', _t('_bx_dev_frm_txt_prevalues_edit_popup', _t($aValue['lkey'])), $this->oModule->_oTemplate->parseHtmlByName('form_add_value.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction))); $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true); } }
public function __construct($aObject, $oTemplate = false) { parent::__construct($aObject, $oTemplate); $CNF = $this->_oModule->_oConfig->CNF; $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT); $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT); if ($iProfileId) { $this->_oProfile = BxDolProfile::getInstance($iProfileId); } if (!$this->_oProfile && $iContentId) { $this->_oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->MODULE); } if ($this->_oProfile) { $this->_aProfileInfo = $this->_oProfile->getInfo(); $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_aProfileInfo['content_id']); $this->addMarkers($this->_aProfileInfo); $this->addMarkers(array('profile_id' => $this->_oProfile->id())); if (isLogged()) { bx_import('BxDolConnection'); $oConn = BxDolConnection::getObjectInstance('sys_profiles_friends'); if ($oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $this->_oProfile->id())) { $this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend_sent']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend_cancel_request']))); } elseif ($oConn->isConnectedNotMutual($this->_oProfile->id(), bx_get_logged_profile_id())) { $this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend_confirm']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend_reject_request']))); } else { $this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend']))); } } } }
function displaySelectLevelBlock($aLevels) { $iModuleId = $this->_oConfig->getId(); $iLevelsHalf = (int) ceil(count($aLevels) / 2); $sCurrencyCode = strtoupper($this->_oConfig->getCurrencyCode()); $sCurrencySign = $this->_oConfig->getCurrencySign(); bx_import('BxDolPayments'); $oPayment = BxDolPayments::getInstance(); $aProviders = $oPayment->getProviders(0); if (empty($aProviders)) { return MsgBox(_t('_membership_err_no_payment_options')); } $aTmplVarsLevels = array(); foreach ($aLevels as $aLevel) { $aTmplVarsLevels[] = array('id' => $aLevel['mem_id'], 'descriptor' => $oPayment->getCartItemDescriptor(0, $iModuleId, $aLevel['price_id'], 1), 'checked' => empty($aTmplVarsLevels) ? 'checked="checked"' : '', 'title' => $aLevel['mem_name'], 'icon' => $this->_oConfig->getIconsUrl() . $aLevel['mem_icon'], 'bx_if:show_description' => array('condition' => strlen($aLevel['mem_description']) > 0, 'content' => array('description' => str_replace("\$", "$", $aLevel['mem_description']))), 'days' => $aLevel['price_days'] > 0 ? $aLevel['price_days'] . ' ' . _t('_membership_txt_days') : _t('_membership_txt_expires_never'), 'price' => $aLevel['price_amount'], 'currency_code' => $sCurrencyCode); } $aTmplVarsProviders = array(); if (!empty($aProviders)) { foreach ($aProviders as $aProvider) { if ((int) $aProvider['for_visitor'] != 1) { continue; } $aTmplVarsProviders[] = array('name' => $aProvider['name'], 'caption' => $aProvider['caption_cart'], 'checked' => empty($aTmplVarsProviders) ? 'checked="checked"' : ''); } } $bSelectedProvider = count($aTmplVarsProviders) == 1; $sSelectedProvider = $bSelectedProvider ? $aTmplVarsProviders[0]['name'] : ''; $aTmplParams = array('js_object' => $this->_oConfig->getJsObject('join'), 'js_code' => $this->getJsCode('join', true), 'submit_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'join_submit', 'bx_repeat:levels_left' => array_slice($aTmplVarsLevels, 0, $iLevelsHalf), 'bx_repeat:levels_right' => array_slice($aTmplVarsLevels, $iLevelsHalf), 'bx_if:show_providers_selector' => array('condition' => !$bSelectedProvider, 'content' => array('bx_repeat:providers' => $aTmplVarsProviders)), 'bx_if:show_selected_provider' => array('condition' => $bSelectedProvider, 'content' => array('name' => $sSelectedProvider))); $this->addCss('levels.css'); $this->addJs('join.js'); $this->addJsTranslation(array('_membership_err_need_select_level', '_membership_err_need_select_provider')); return array($this->parseHtmlByName('select_level_block.html', $aTmplParams), array(), array(), false); }
function genSiteServiceMenu() { $bLogged = isLogged(); $aMenuItem = array(); $sMenuPopupId = ''; $sMenuPopupContent = ''; if ($bLogged) { bx_import('BxTemplMenuService'); $oMenu = new BxTemplMenuService(); if ($oMenu->aMenuInfo['memberID'] != 0) { $aProfile = getProfileInfo($oMenu->aMenuInfo['memberID']); } $sThumbSetting = getParam('sys_member_info_thumb_icon'); bx_import('BxDolMemberInfo'); $o = BxDolMemberInfo::getObjectInstance($sThumbSetting); $sThumbUrl = $o ? $o->get($aProfile) : ''; $o = BxDolMemberInfo::getObjectInstance($sThumbSetting . '_2x'); $sThumbTwiceUrl = $o ? $o->get($aProfile) : ''; if (!$sThumbTwiceUrl) { $sThumbTwiceUrl = $sThumbUrl; } $bThumb = !empty($sThumbUrl); $aMenuItem = array('bx_if:show_fu_thumb_image' => array('condition' => $bThumb, 'content' => array('image' => $sThumbUrl, 'image_2x' => $sThumbTwiceUrl)), 'bx_if:show_fu_thumb_icon' => array('condition' => !$bThumb, 'content' => array()), 'thumbnail' => get_member_icon($oMenu->aMenuInfo['memberID']), 'title' => getNickName($oMenu->aMenuInfo['memberID'])); $sMenuPopupId = 'sys-service-menu-' . time(); $sMenuPopupContent = $this->transBox($oMenu->getCode()); } return $GLOBALS['oSysTemplate']->parseHtmlByName('extra_service_menu_wrapper.html', array('bx_if:show_for_visitor' => array('condition' => !$bLogged, 'content' => array()), 'bx_if:show_for_user' => array('condition' => $bLogged, 'content' => $aMenuItem), 'menu_popup_id' => $sMenuPopupId, 'menu_popup_content' => $sMenuPopupContent)); }
public function getCode($sUrl, $sTitle, $aCustomVars = false) { // define markers for replacments $aMarkers = array('url' => $sUrl, 'url_encoded' => rawurlencode($sUrl), 'lang' => $GLOBALS['sCurrentLanguage'], 'locale' => $this->_getLocaleFacebook($GLOBALS['sCurrentLanguage']), 'twit' => _t('_sys_social_sharing_twit'), 'title' => $sTitle, 'title_encoded' => rawurlencode($sTitle)); if (!empty($aCustomVars) && is_array($aCustomVars)) { $aMarkers = array_merge($aMarkers, $aCustomVars); } // alert $sOverrideOutput = null; bx_import('BxDolAlerts'); $oAlert = new BxDolAlerts('system', 'social_sharing_display', '', '', array('buttons' => &$this->_aSocialButtons, 'markers' => &$aMarkers, 'override_output' => &$sOverrideOutput)); $oAlert->alert(); // return custom code if there is one if ($sOverrideOutput) { return $sOverrideOutput; } // return empty string of there is no buttons if (empty($this->_aSocialButtons)) { return ''; } // prepare buttons $aButtons = array(); foreach ($this->_aSocialButtons as $aButton) { $sButton = $this->_replaceMarkers($aButton['content'], $aMarkers); if (preg_match('/{[A-Za-z0-9_]+}/', $sButton)) { // if not all markers are replaced skip it continue; } $aButtons[] = array('button' => $sButton); } // output $aTemplateVars = array('bx_repeat:buttons' => $aButtons); return $GLOBALS['oSysTemplate']->parseHtmlByName('social_sharing.html', $aTemplateVars); }
/** * page code function */ function PageCompMainCode() { ob_start(); bx_import('BxDolAccount'); $oAccount = BxDolAccount::getInstance(); $aAccountInfo = $oAccount ? $oAccount->getInfo() : false; if (!$aAccountInfo) { return DesignBoxContent("Send Email example", 'Please login first', BX_DB_PADDING_DEF); } echo "<h2>Account info</h2>"; echo "Email: " . $aAccountInfo['email'] . '<br />'; echo "Email Confirmed: " . ($aAccountInfo['email_confirmed'] ? 'yes' : 'no') . '<br />'; echo "Receive site updates: " . ($aAccountInfo['receive_updates'] ? 'yes' : 'no') . '<br />'; echo "Receive site newsletters: " . ($aAccountInfo['receive_news'] ? 'yes' : 'no') . '<br />'; echo "Site emails are sent from: " . getParam('site_email_notify') . '<br />'; $a = array('sys' => array('title' => "Send me system email", 'type' => BX_EMAIL_SYSTEM, 'subj' => 'System Email', 'body' => 'This is system email <br /> {unsubscribe}'), 'notif' => array('title' => "Send me notification", 'type' => BX_EMAIL_NOTIFY, 'subj' => 'Notification Email', 'body' => 'This is notification email<br /> {unsubscribe}'), 'mass' => array('title' => "Send me bulk email", 'type' => BX_EMAIL_MASS, 'subj' => 'Bulk Email', 'body' => 'This is bulk email<br /> {unsubscribe}')); $sSendMail = bx_get('send'); if ($sSendMail && isset($a[$sSendMail])) { echo "<h2>Send Email Result</h2>"; $r = $a[$sSendMail]; if (sendMail($aAccountInfo['email'], $r['subj'], $r['body'], 0, array(), $r['type'])) { echo MsgBox($r['subj'] . ' - successfully sent'); } else { echo MsgBox($r['subj'] . ' - sent failed'); } } echo "<h2>Send email</h2>"; foreach ($a as $k => $r) { echo '<a href="samples/email.php?send=' . $k . '">' . $r['title'] . '</a><br />'; } return DesignBoxContent("Send Email Example", ob_get_clean(), BX_DB_PADDING_DEF); }
function __construct() { $this->aPseud = $this->_getPseud(); parent::__construct(); bx_import('BxTemplVotingView'); $this->aConstants['linksTempl'] = $this->isPermalinkEnabled() ? $this->aPermalinks['enabled'] : $this->aPermalinks['disabled']; }
function actionAdministration() { if (!$this->isAdmin()) { $this->_oTemplate->displayAccessDenied(); return; } $this->_oTemplate->pageStart(); $iId = $this->_oDb->getSettingsCategory(); if (empty($iId)) { echo MsgBox(_t('_sys_request_page_not_found_cpt')); $this->_oTemplate->pageCodeAdmin(_t('_bx_profiler_administration')); return; } bx_import('BxDolAdminSettings'); $mixedResult = ''; if (isset($_POST['save']) && isset($_POST['cat'])) { $oSettings = new BxDolAdminSettings($iId); $mixedResult = $oSettings->saveChanges($_POST); } $oSettings = new BxDolAdminSettings($iId); $sResult = $oSettings->getForm(); if ($mixedResult !== true && !empty($mixedResult)) { $sResult = $mixedResult . $sResult; } $aVars = array('content' => $sResult); echo $this->_oTemplate->adminBlock($this->_oTemplate->parseHtmlByName('default_padding', $aVars), _t('_bx_profiler_administration')); $this->_oTemplate->addCssAdmin('main.css'); $this->_oTemplate->addCssAdmin('forms_adv.css'); $this->_oTemplate->pageCodeAdmin(_t('_bx_profiler_administration')); }
function response(&$o) { if ($o->sUnit == 'system') { switch ($o->sAction) { case 'join_after_payment': $this->oModule->processJoinAfterPayment($o); break; } } if ($o->sUnit == 'profile') { switch ($o->sAction) { case 'join': bx_import('BxDolSession'); $oSession = BxDolSession::getInstance(); $iRemoteProfileId = $oSession->getValue($this->oModule->_oConfig->sSessionUid); if ($iRemoteProfileId) { $oSession->unsetValue($this->oModule->_oConfig->sSessionUid); // save remote profile id $this->oModule->_oDb->saveRemoteId($o->iObject, $iRemoteProfileId); } break; case 'delete': // remove remote account $this->oModule->_oDb->deleteRemoteAccount($o->iObject); break; } } }
public function performActionDelete($aParams = array()) { $iProfileId = $this->_oModule->getProfileId(); $mixedAllowed = $this->_oModule->isAllowedDeleteRequest($iProfileId); if ($mixedAllowed !== true) { $this->_echoResultJson(array('msg' => $mixedAllowed)); exit; } $iAffected = 0; $aIds = bx_get('ids'); if (!$aIds || !is_array($aIds)) { $this->_echoResultJson(array()); exit; } bx_import('BxDolForm'); $oForm = BxDolForm::getObjectInstance($this->_oModule->_oConfig->getObject('form_request'), $this->_oModule->_oConfig->getObject('form_display_request_send')); $aIdsAffected = array(); foreach ($aIds as $iId) { if (!$oForm->delete($iId)) { continue; } $this->_oModule->isAllowedDeleteRequest($iProfileId, true); $aIdsAffected[] = $iId; $iAffected++; } $this->_echoResultJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected) : array('msg' => _t('_bx_invites_err_delete_request'))); }
public function getBlockRequest() { bx_import('BxDolPermalinks'); $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->_oConfig->CNF['URL_REQUEST']); $this->addCss(array('main.css')); return $this->parseHtmlByName('block_request.html', array('style_prefix' => $this->_oConfig->getPrefix('style'), 'text' => _t('_bx_invites_txt_request_block_text'), 'bx_if:show_button_request' => array('condition' => $this->_oConfig->isRequestInvite(), 'content' => array('url' => $sUrl)))); }
public function getCode() { // check if content exists if (!$this->_aContentInfo) { // if entry is not found - display standard "404 page not found" page $this->_oTemplate->displayPageNotFound(); exit; } // permissions check if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aContentInfo))) { $this->_oTemplate->displayAccessDenied($sMsg); exit; } $this->_oModule->checkAllowedView($this->_aContentInfo, true); // count views $CNF =& $this->_oModule->_oConfig->CNF; if (!empty($CNF['OBJECT_VIEWS'])) { bx_import('BxDolView'); BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $this->_aContentInfo[$CNF['FIELD_ID']])->doView(); } // add content metatags if (!empty($CNF['OBJECT_METATAGS'])) { bx_import('BxDolMetatags'); $o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); if ($o) { $aThumb = false; if (!empty($CNF['FIELD_THUMB']) && !empty($this->_aContentInfo[$CNF['FIELD_THUMB']]) && !empty($CNF['OBJECT_STORAGE'])) { $aThumb = array('id' => $this->_aContentInfo[$CNF['FIELD_THUMB']], 'object' => $CNF['OBJECT_STORAGE']); } $o->metaAdd($this->_aContentInfo[$CNF['FIELD_ID']], $aThumb); } } return parent::getCode(); }
public function performActionEdit($bUpdateGrid = false) { $sAction = 'edit'; $sFormObject = $this->oModule->_oConfig->getObject('form_nav_item'); $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_nav_item_edit'); $aItem = $this->_getItem('getItems'); if ($aItem === false) { $this->_echoResultJson(array()); exit; } bx_import('BxDolForm'); $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate); $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction . '&set=' . $this->sSet; $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_nav_btn_items_save'); $this->fillInSelects($oForm->aInputs); $oForm->initChecker($aItem); if ($oForm->isSubmittedAndValid()) { if ($oForm->update($aItem['id']) !== false) { $aRes = array('grid' => $this->getCode(false), 'blink' => $aItem['id']); } else { $aRes = array('msg' => _t('_bx_dev_nav_err_items_edit')); } $this->_echoResultJson($aRes, true); } else { bx_import('BxTemplStudioFunctions'); $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-nav-item-edit-popup', _t('_bx_dev_nav_txt_items_edit_popup', _t($aItem['title_system'])), $this->oModule->_oTemplate->parseHtmlByName('nav_add_item.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction))); $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true); } }
/** * Attach editor to HTML element, in most cases - textarea. * @param $sSelector - jQuery selector to attach editor to. * @param $iViewMode - editor view mode: BX_EDITOR_STANDARD, BX_EDITOR_MINI, BX_EDITOR_FULL * @param $bDynamicMode - is AJAX mode or not, the HTML with editor area is loaded dynamically. */ public function attachEditor($sSelector, $iViewMode = BX_EDITOR_STANDARD, $bDynamicMode = false) { // set visual mode switch ($iViewMode) { case BX_EDITOR_MINI: $sToolsItems = self::$CONF_MINI; break; case BX_EDITOR_FULL: $sToolsItems = self::$CONF_FULL; break; case BX_EDITOR_STANDARD: default: $sToolsItems = self::$CONF_STANDARD; } // detect language bx_import('BxDolLanguages'); $sLang = BxDolLanguages::getInstance()->detectLanguageFromArray(self::$CONF_LANGS); // initialize editor $sInitEditor = $this->_replaceMarkers(self::$CONF_COMMON, array('bx_var_custom_init' => $sToolsItems, 'bx_var_plugins_path' => bx_js_string(BX_DOL_URL_PLUGINS, BX_ESCAPE_STR_APOS), 'bx_var_css_path' => bx_js_string($this->_oTemplate->getCssUrl('editor.css'), BX_ESCAPE_STR_APOS), 'bx_var_skin' => bx_js_string($this->_aObject['skin'], BX_ESCAPE_STR_APOS), 'bx_var_lang' => bx_js_string($sLang, BX_ESCAPE_STR_APOS), 'bx_var_selector' => bx_js_string($sSelector, BX_ESCAPE_STR_APOS), 'bx_url_root' => bx_js_string(BX_DOL_URL_ROOT, BX_ESCAPE_STR_APOS), 'bx_url_tinymce' => bx_js_string(BX_DOL_URL_PLUGINS_PUBLIC . 'tinymce/', BX_ESCAPE_STR_APOS))); if ($bDynamicMode) { $sScript = "<script>\n if ('undefined' == typeof(jQuery(document).tinymce)) {\n window.tinyMCEPreInit = {base : '" . bx_js_string(BX_DOL_URL_PLUGINS_PUBLIC . 'tinymce', BX_ESCAPE_STR_APOS) . "', suffix : '.min', query : ''};\n \$.getScript('" . bx_js_string(BX_DOL_URL_ROOT . 'inc/js/editor.tinymce.js', BX_ESCAPE_STR_APOS) . "');\n \$.getScript('" . bx_js_string(BX_DOL_URL_PLUGINS_PUBLIC . 'tinymce/tinymce.min.js', BX_ESCAPE_STR_APOS) . "', function(data, textStatus, jqxhr) {\n \$.getScript('" . bx_js_string(BX_DOL_URL_PLUGINS_PUBLIC . 'tinymce/jquery.tinymce.min.js', BX_ESCAPE_STR_APOS) . "', function(data, textStatus, jqxhr) {\n {$sInitEditor}\n });\n });\n } else {\n {$sInitEditor}\n }\n </script>"; } else { $sScript = "\n <script>\n \$(document).ready(function () {\n {$sInitEditor}\n });\n </script>"; } return $this->_addJsCss($bDynamicMode) . $sScript; }
/** * Clean database by deleting some expired data */ protected function cleanDatabase() { // clean expired membership levels bx_import('BxDolAcl'); $oAcl = BxDolAcl::getInstance(); $iDeleteMemLevels = $oAcl ? $oAcl->maintenance() : 0; //--- Clean sessions ---// bx_import('BxDolSession'); $oSession = BxDolSession::getInstance(); $iSessions = $oSession ? $oSession->maintenance() : 0; // clean old views bx_import('BxDolView'); $iDeletedViews = BxDolView::maintenance(); // clean storage engine expired private file tokens bx_import('BxDolStorage'); $iDeletedExpiredTokens = BxDolStorage::pruning(); // clean outdated transcoded images bx_import('BxDolImageTranscoder'); $iDeletedTranscodedImages = BxDolImageTranscoder::pruning(); // clean expired keys bx_import('BxDolKey'); $oKey = BxDolKey::getInstance(); $iDeletedKeys = $oKey ? $oKey->prune() : 0; // clean old votes bx_import('BxDolVote'); $iDeletedVotes = BxDolVote::maintenance(); echo _t('_sys_pruning_db', $iDeleteMemLevels, $iSessions, $iDeletedViews, $iDeletedVotes, $iDeletedKeys, $iDeletedExpiredTokens, $iDeletedTranscodedImages); }
function BxBaseSearchResultText() { $this->aPseud = $this->_getPseud(); parent::BxBaseSearchResult(); bx_import('BxTemplVotingView'); $this->aConstants['linksTempl'] = $this->isPermalinkEnabled() ? $this->aPermalinks['enabled'] : $this->aPermalinks['disabled']; }
function blockFiles(&$aData) { $iEntryId = $aData['id']; $aReadyMedia = array(); if ($iEntryId) { $aReadyMedia = $GLOBALS['oBxStoreModule']->_oDb->getFiles($iEntryId, true); } if (!$aReadyMedia) { return ''; } $aVars = array('bx_repeat:files' => array()); $sCurrencySign = getParam('pmt_default_currency_sign'); foreach ($aReadyMedia as $r) { $iMediaId = $r['media_id']; $a = BxDolService::call('files', 'get_file_array', array($iMediaId), 'Search'); if (!$a['date']) { continue; } bx_import('BxTemplFormView'); $oForm = new BxTemplFormView(array()); $aInputBtnDownload = array('type' => 'submit', 'name' => 'bx_store_download', 'value' => _t('_bx_store_download'), 'attrs' => array('onclick' => "window.open ('" . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . "download/{$r['id']}','_self');")); $aVars['bx_repeat:files'][] = array('id' => $iMediaId, 'title' => $a['title'], 'icon' => $a['file'], 'price' => $sCurrencySign . ' ' . $r['price'], 'for_group' => sprintf(_t('_bx_store_for_group'), $GLOBALS['oBxStoreModule']->getGroupName($r['allow_purchase_to'])), 'date' => defineTimeInterval($a['date']), 'bx_if:purchase' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedPurchase($r), 'content' => array('btn_purchase' => BxDolService::call('payment', 'get_add_to_cart_link', array($r['author_id'], $this->_oConfig->getId(), $r['id'], 1)))), 'bx_if:download' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedDownload($r), 'content' => array('btn_download' => $oForm->genInputButton($aInputBtnDownload)))); } if (!$aVars['bx_repeat:files']) { return ''; } return $this->parseHtmlByName('block_files', $aVars); }
function getComments($iId, $iCmtVParentId = 0, $iAuthorId = 0, $sFilter = '', $aOrder = array(), $iStart = 0, $iCount = -1) { $sFields = $sJoin = ""; $oVote = $this->_oMain->getVoteObject(0); if ($oVote !== false) { $aSql = $oVote->getSqlParts($this->_sTable, 'cmt_id'); $sFields .= $aSql['fields']; $sJoin .= $aSql['join']; } $sWhereParent = ''; if ((int) $iCmtVParentId >= 0) { $sWhereParent = $this->prepare(" AND `{$this->_sTable}`.`cmt_vparent_id` = ?", $iCmtVParentId); } if (in_array($sFilter, array(BX_CMT_FILTER_FRIENDS, BX_CMT_FILTER_SUBSCRIPTIONS))) { bx_import('BxDolConnection'); $oConnection = BxDolConnection::getObjectInstance($this->_oMain->getConnectionObject($sFilter)); $aQueryParts = $oConnection->getConnectedContentAsSQLParts($this->_sTable, 'cmt_author_id', $iAuthorId); $sJoin .= ' ' . $aQueryParts['join']; } $sOder = " ORDER BY `{$this->_sTable}`.`cmt_time` ASC"; if (isset($aOrder['by']) && isset($aOrder['way'])) { $aOrder['way'] = strtoupper(in_array($aOrder['way'], array(BX_CMT_ORDER_WAY_ASC, BX_CMT_ORDER_WAY_DESC)) ? $aOrder['way'] : BX_CMT_ORDER_WAY_ASC); switch ($aOrder['by']) { case BX_CMT_ORDER_BY_DATE: $sOder = " ORDER BY `{$this->_sTable}`.`cmt_time` " . $aOrder['way']; break; case BX_CMT_ORDER_BY_POPULAR: $sOder = " ORDER BY `{$this->_sTable}`.`cmt_rate` " . $aOrder['way']; break; } } $sLimit = $iCount != -1 ? $this->prepare(" LIMIT ?, ?", (int) $iStart, (int) $iCount) : ''; $sQuery = $this->prepare("SELECT\n `{$this->_sTable}`.`cmt_id`,\n `{$this->_sTable}`.`cmt_parent_id`,\n `{$this->_sTable}`.`cmt_vparent_id`,\n `{$this->_sTable}`.`cmt_object_id`,\n `{$this->_sTable}`.`cmt_author_id`,\n `{$this->_sTable}`.`cmt_level`,\n `{$this->_sTable}`.`cmt_text`,\n `{$this->_sTable}`.`cmt_replies`,\n `{$this->_sTable}`.`cmt_time`\n {$sFields}\n FROM `{$this->_sTable}`\n {$sJoin}\n WHERE `{$this->_sTable}`.`cmt_object_id` = ?" . $sWhereParent . $sOder . $sLimit, $iId); return $this->getAll($sQuery); }
function actionDetails() { bx_import('PageDetails', $this->_aModule); $oPage = new BxPfwPageDetails($this); $aParams = array('index' => 4, 'title' => array('page' => _t($this->_sLangsPrefix . 'pcpt_details')), 'content' => array('page_main_code' => $oPage->getCode())); $this->_oTemplate->getPageCode($aParams); }
/** * Constructor * @param string $sType - system type * @param string $sAction - system action * @param int $iObjectId - object id * @param int $iSenderId - sender (action's author) profile id, if it is false - then currectly logged in profile id is used */ public function __construct($sUnit, $sAction, $iObjectId, $iSender = false, $aExtras = array()) { parent::__construct(); if (getParam('sys_db_cache_enable')) { $oDb = BxDolDb::getInstance(); $oCache = $oDb->getDbCacheObject(); $sCacheKey = $oDb->genDbCacheKey('sys_alerts'); $aData = $oCache->getData($sCacheKey); if (null === $aData) { $aData = $this->getAlertsData(); $oCache->setData($sCacheKey, $aData); } } else { $aData = $this->getAlertsData(); } $this->_aAlerts = $aData['alerts']; $this->_aHandlers = $aData['handlers']; $this->sUnit = $sUnit; $this->sAction = $sAction; $this->iObject = (int) $iObjectId; $this->aExtras = $aExtras; if (false === $iSender) { bx_import('BxDolProfile'); $oProfile = BxDolProfile::getInstance(); $this->iSender = $oProfile ? $oProfile->id() : 0; } else { $this->iSender = (int) $iSender; } }
/** * Show uploader form. * @return HTML string */ public function getUploaderForm($isMultiple = true, $iContentId = false) { parent::getUploaderForm($isMultiple, $iContentId); $sForm = $this->_oTemplate->parseHtmlByName('uploader_form_simple.html', array('form_container_id' => $this->_sFormContainerId, 'errors_container_id' => $this->_sErrorsContainerId, 'uploader_instance_name' => $this->getNameJsInstanceUploader(), 'restrictions_text' => $this->getRestrictionsText(), 'iframe_id' => $this->_sIframeId, 'engine' => $this->_aObject['object'], 'storage_object' => $this->_sStorageObject, 'uniq_id' => $this->_sUniqId, 'multiple' => $isMultiple, 'content_id' => $iContentId)); bx_import('BxTemplFunctions'); return BxTemplFunctions::getInstance()->transBox('', $sForm); }
protected function getCodeAdd($sAction, $sObject) { $aForm = $this->getFormAdd($sAction, $sObject); $oForm = new BxTemplStudioFormView($aForm); if ($oForm->isSubmitted() && isset($oForm->aInputs['required'])) { $this->updateCheckerFields($oForm); } $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $sInputObject = $oForm->getCleanValue('object'); //--- Process field name. bx_import('BxDolStudioLanguagesUtils'); $sLanguage = BxDolStudioLanguagesUtils::getInstance()->getCurrentLangName(false); $sCaption = BxDolForm::getSubmittedValue('caption-' . $sLanguage, $aForm['form_attrs']['method']); $sName = $this->getFieldName($sInputObject, $sCaption); BxDolForm::setSubmittedValue('name', $sName, $oForm->aFormAttrs['method']); $this->onSubmitField($oForm); if (($iId = $oForm->insert()) === false) { return false; } $this->alterAdd($sName); return true; } else { return BxTemplStudioFunctions::getInstance()->popupBox('adm-form-field-add-' . $this->aParams['display'] . '-popup', _t('_adm_form_txt_field_add_popup'), BxDolStudioTemplate::getInstance()->parseHtmlByName('form_add_field.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $sObject, 'action' => $sAction))); } }