function initializeCheckout($iPendingId, $aCartInfo, $bRecurring = false, $iRecurringDays = 0) { $this->aBpOptions['redirectURL'] .= $aCartInfo['vendor_id']; $this->aBpOptions['notificationURL'] .= $aCartInfo['vendor_id']; $this->aBpOptions['notificationURL'] = bx_append_url_params($this->aBpOptions['notificationURL'], array('bxssl' => 1)); switch ($aCartInfo['vendor_currency_code']) { case 'USD': case 'EUR': case 'CAD': case 'AUD': case 'GBP': case 'MXN': case 'NZD': case 'ZAR': case 'BTC': $this->aBpOptions['currency'] = $aCartInfo['vendor_currency_code']; } $aPosData = array('vnd' => (string) $aCartInfo['vendor_id'], 'clt' => (string) $aCartInfo['client_id'], 'pnd' => (string) $iPendingId); $aOptions = array('itemDesc' => 'Payment to ' . $aCartInfo['vendor_profile_name']); $aResponse = $this->createInvoice($iPendingId, (double) $aCartInfo['items_price'], $aPosData, $aOptions); if (!empty($aResponse['error'])) { return _t(is_array($aResponse['error']) ? $aResponse['error']['message'] : $aResponse['error']); } header('Location: ' . $aResponse['url']); exit; }
function genRowImageUploader(&$aInput) { $aTmplVarsPreview = array('bx_if:show_empty' => array('condition' => true, 'content' => array()), 'bx_if:show_image' => array('condition' => false, 'content' => array())); if (($iId = (int) $aInput['value']) != 0) { $sFileUrl = false; if (!empty($aInput['transcoder_object'])) { $oTranscoder = BxDolTranscoderImage::getObjectInstance($aInput['transcoder_object']); $sFileUrl = $oTranscoder->getFileUrlNotReady($iId); if (isset($aInput['transcoder_image_width']) && $aInput['transcoder_image_width'] > 0) { $sFileUrl = bx_append_url_params($sFileUrl, array('x' => $aInput['transcoder_image_width'])); } if (isset($aInput['transcoder_image_height']) && $aInput['transcoder_image_height'] > 0) { $sFileUrl = bx_append_url_params($sFileUrl, array('y' => $aInput['transcoder_image_height'])); } } else { $sStorage = isset($aInput['storage_object']) && $aInput['storage_object'] != '' ? $aInput['storage_object'] : BX_DOL_STORAGE_OBJ_IMAGES; $oStorage = BxDolStorage::getObjectInstance($sStorage); $sFileUrl = $oStorage->getFileUrlById($iId); } if ($sFileUrl !== false) { $aTmplVarsPreview['bx_if:show_empty']['condition'] = false; $aTmplVarsPreview['bx_if:show_image'] = array('condition' => true, 'content' => array('url' => $sFileUrl, 'bx_if:show_action_delete' => array('condition' => isset($aInput['ajax_action_delete']) && $aInput['ajax_action_delete'] != "", 'content' => array('action' => $aInput['ajax_action_delete'])))); } } $sRow = ''; $aInputPreview = array('type' => 'custom', 'name' => 'preview', 'caption' => isset($aInput['caption_preview']) ? $aInput['caption_preview'] : _t('_adm_txt_form_view_iu_preview'), 'content' => $this->oTemplate->parseHtmlByName('form_view_iu_preview.html', $aTmplVarsPreview)); $sRow .= $this->genRow($aInputPreview); $aInput['type'] = 'file'; $sRow .= $this->genRow($aInput); return $sRow; }
function getMonthUrl($isNextMoths, $isMiniMode = false) { if ($isMiniMode && $this->iBlockID && $this->sDynamicUrl) { return "javascript:loadDynamicBlock('" . $this->iBlockID . "', '" . bx_append_url_params($this->sDynamicUrl, 'date=' . ($isNextMoths ? "{$this->iNextYear}/{$this->iNextMonth}" : "{$this->iPrevYear}/{$this->iPrevMonth}")) . "');"; } else { return parent::getMonthUrl($isNextMoths, $isMiniMode); } }
/** * Get file url. * @param $iFileId file * @return file url or false if file was not found */ public function getFileUrlById($iFileId) { $aFile = $this->_oDb->getFileById($iFileId); if (!$aFile) { return false; } $sUrl = $this->getObjectBaseUrl($aFile['private']) . $aFile['remote_id'] . '.' . $aFile['ext']; if ($aFile['private']) { $sToken = $this->_oDb->genToken($iFileId); $sUrl = bx_append_url_params($sUrl, array('t' => $sToken)); } return $sUrl; }
function initializeCheckout($iPendingId, $aCartInfo) { $this->_setExpressCheckout($iPendingId, $aCartInfo); $aResponse = $this->_executeCall(); if ($aResponse === false) { return false; } $this->_logInfo(__METHOD__, $aResponse); $sToken = process_db_input($aResponse['TOKEN'], BX_TAGS_STRIP); $sRedirectUrl = $this->_oConfig->getPpEndpoint(BX_PFW_ENDPOINT_TYPE_HOSTED); $sRedirectUrl = bx_append_url_params($sRedirectUrl, array('cmd' => '_express-checkout', 'token' => $sToken)); header("Location: " . $sRedirectUrl); exit; }
/** * Redirect to remote Dolphin site login form * * @return n/a/ - redirect or HTML page in case of error */ function actionStart() { if (isLogged()) { $this->_redirect($this->_oConfig->sDefaultRedirectUrl); } if (!$this->_oConfig->sApiID || !$this->_oConfig->sApiSecret || !$this->_oConfig->sApiUrl) { $sCode = MsgBox(_t('_bx_dolphcon_profile_error_api_keys')); $this->_oTemplate->getPage(_t('_bx_dolphcon'), $sCode); } else { // define redirect URL to the remote Dolphin site $sUrl = bx_append_url_params($this->_oConfig->sApiUrl . 'auth', array('response_type' => 'code', 'client_id' => $this->_oConfig->sApiID, 'redirect_uri' => $this->_oConfig->sPageHandle, 'scope' => $this->_oConfig->sScope, 'state' => $this->_genCsrfToken())); $this->_redirect($sUrl); } }
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 getAccessToken($sToken, $mixedSecret, $sVerifier, $iUser, $oConsumer) { $oConsumer->setToken($sToken, $mixedSecret); $aAccessToken = $oConsumer->getAccessToken(bx_append_url_params(BX_DOL_OAUTH_URL_ACCESS_TOKEN, array('oauth_verifier' => $sVerifier))); if (empty($aAccessToken)) { return _t('_adm_err_oauth_cannot_get_token'); } if ($this->isServerError($aAccessToken)) { throw new OAuthException(); } $this->oSession->setValue('sys_oauth_token', $aAccessToken['oauth_token']); $this->oSession->setValue('sys_oauth_secret', $aAccessToken['oauth_token_secret']); $this->oSession->setValue('sys_oauth_authorized', 1); $this->oSession->setValue('sys_oauth_authorized_user', $iUser); return true; }
/** * Redirect to remote Trident site login form * * @return n/a/ - redirect or HTML page in case of error */ function actionStart() { if (isLogged()) { $this->_redirect($this->_oConfig->sDefaultRedirectUrl); } if (!$this->_oConfig->sApiID || !$this->_oConfig->sApiSecret || !$this->_oConfig->sApiUrl) { require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; bx_import('BxDolLanguages'); $sCode = MsgBox(_t('_bx_tricon_profile_error_api_keys')); $this->_oTemplate->getPage(_t('_bx_tricon'), $sCode); } else { // define redirect URL to the remote Trident site $sUrl = bx_append_url_params($this->_oConfig->sApiUrl . 'auth', array('response_type' => 'code', 'client_id' => $this->_oConfig->sApiID, 'redirect_uri' => $this->_oConfig->sPageHandle, 'scope' => $this->_oConfig->sScope, 'state' => $this->_genCsrfToken())); $this->_redirect($sUrl); } }
protected function authorize($sKey, $sSecret) { if ($this->isAuthorized()) { return true; } try { $oConsumer = new OAuth($sKey, $sSecret); $oConsumer->setAuthType(OAUTH_AUTH_TYPE_URI); $oConsumer->enableDebug(); $bToken = bx_get('oauth_token') !== false; $mixedSecret = $this->oSession->getValue('sys_oauth_secret'); if (!$bToken && $mixedSecret !== false) { $this->oSession->unsetValue('sys_oauth_secret'); $mixedSecret = false; } //--- Get request token and redirect to authorize. if (!$bToken && $mixedSecret === false) { $aRequestToken = $oConsumer->getRequestToken(BX_DOL_OAUTH_URL_REQUEST_TOKEN); if (empty($aRequestToken)) { return _t('_adm_err_oauth_cannot_get_token'); } if ($this->isServerError($aRequestToken)) { return $this->processServerError($aRequestToken); } $this->oSession->setValue('sys_oauth_secret', $aRequestToken['oauth_token_secret']); return _t('_adm_msg_oauth_need_authorize', bx_append_url_params(BX_DOL_OAUTH_URL_AUTHORIZE, array('oauth_token' => $aRequestToken['oauth_token'], 'sid' => bx_site_hash()))); } //--- Get access token. if ($bToken && $mixedSecret !== false) { $oConsumer->setToken(bx_get('oauth_token'), $mixedSecret); $aAccessToken = $oConsumer->getAccessToken(bx_append_url_params(BX_DOL_OAUTH_URL_ACCESS_TOKEN, array('oauth_verifier' => bx_get('oauth_verifier')))); if (empty($aAccessToken)) { return _t('_adm_err_oauth_cannot_get_token'); } if ($this->isServerError($aAccessToken)) { return $this->processServerError($aAccessToken); } $this->oSession->setValue('sys_oauth_token', $aAccessToken['oauth_token']); $this->oSession->setValue('sys_oauth_secret', $aAccessToken['oauth_token_secret']); $this->oSession->setValue('sys_oauth_authorized', 1); $this->oSession->setValue('sys_oauth_authorized_user', (int) bx_get('oauth_user')); return true; } } catch (OAuthException $e) { return _t('_adm_err_oauth_cannot_get_token'); } }
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; }
public function __construct($aObject, $oTemplate = false) { $this->MODULE = 'bx_convos'; parent::__construct($aObject, $oTemplate); $CNF =& $this->_oModule->_oConfig->CNF; $this->_oModule->_oDb->updateReadComments(bx_get_logged_profile_id(), $this->_aContentInfo[$CNF['FIELD_ID']], $this->_aContentInfo[$CNF['FIELD_COMMENTS']]); $iFolder = $this->_oModule->_oDb->getConversationFolder($this->_aContentInfo[$CNF['FIELD_ID']], bx_get_logged_profile_id()); if (BX_CNV_FOLDER_DRAFTS == $iFolder) { // if draft is opened - redirect to compose page $sUrl = BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_ADD_ENTRY']); $sUrl = bx_append_url_params($sUrl, array('draft_id' => $this->_aContentInfo[$CNF['FIELD_ID']])); header('Location: ' . BX_DOL_URL_ROOT . $sUrl); exit; } //$this->_oModule->setModuleSubmenu ($iFolder); $this->_oModule->_oTemplate->addJs('main.js'); $this->_oModule->_oTemplate->addCss(array('main-media-tablet.css', 'main-media-desktop.css')); }
protected function authorize($sKey, $sSecret) { if ($this->isAuthorized()) { return true; } try { $oService = $this->getServiceObject(); $bToken = bx_get('oauth_token') !== false; $mixedSecret = $this->oSession->getValue('sys_oauth_secret'); if (!$bToken && $mixedSecret !== false) { $this->oSession->unsetValue('sys_oauth_secret'); $mixedSecret = false; } //--- Get request token and redirect to authorize. if (!$bToken && $mixedSecret === false) { $oToken = $oService->requestRequestToken(); if (empty($oToken)) { return _t('_adm_err_oauth_cannot_get_token'); } $this->oSession->setValue('sys_oauth_secret', $oToken->getRequestTokenSecret()); $oUrl = $oService->getAuthorizationUri(array('oauth_token' => $oToken->getRequestToken())); return _t('_adm_msg_oauth_need_authorize', bx_append_url_params($oUrl, array('sid' => bx_site_hash()))); } //--- Get access token. if ($bToken && $mixedSecret !== false) { $oToken = $this->oStorage->retrieveAccessToken($this->sService); $oAccessToken = $oService->requestAccessToken(bx_get('oauth_token'), bx_get('oauth_verifier'), $oToken->getRequestTokenSecret()); if (empty($oAccessToken)) { return _t('_adm_err_oauth_cannot_get_token'); } $this->oSession->setValue('sys_oauth_token', $oAccessToken->getAccessToken()); $this->oSession->setValue('sys_oauth_secret', $oAccessToken->getAccessTokenSecret()); $this->oSession->setValue('sys_oauth_authorized', 1); $this->oSession->setValue('sys_oauth_authorized_user', (int) bx_get('oauth_user')); return true; } } catch (TokenResponseException $e) { return _t('_adm_err_oauth_cannot_get_token'); } catch (TokenNotFoundException $e) { return _t('_adm_err_oauth_cannot_get_token'); } }
/** * Display captcha. */ public function display($bDynamicMode = false) { $sCode = ''; $aApiParams = array(); if ($bDynamicMode) { $sPostfix = $this->_sObject; $sId = 'sys-captcha-' . $sPostfix; $sOnLoadFunction = 'onLoadCallback' . $sPostfix; $sOnLoadCode = "\n\t \tvar " . $sOnLoadFunction . " = function() {\n\t\t\t\t\tgrecaptcha.render('" . $sId . "', {\n\t\t\t\t\t\t'sitekey': '" . $this->_sKeyPublic . "',\n\t\t\t\t\t\t'theme': '" . $this->_sSkin . "'\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t "; $aApiParams = array('onload' => $sOnLoadFunction, 'render' => 'explicit'); $sCode .= $this->_oTemplate->_wrapInTagJsCode($sOnLoadCode); $sCode .= '<div id="' . $sId . '">'; } else { $aApiParams = array('render' => 'onload'); $sCode .= '<div class="g-recaptcha" data-sitekey="' . $this->_sKeyPublic . '" data-theme="' . $this->_sSkin . '"></div>'; } $aApiParams['hl'] = BxDolLanguages::getInstance()->getCurrentLanguage(); $sCodeJs = $this->_oTemplate->addJs(bx_append_url_params($this->sApiUrl, $aApiParams), $bDynamicMode); return ($bDynamicMode ? $sCodeJs : '') . $sCode; }
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)); }
/** * Gets file contents by URL. * * @param string $sFileUrl - file URL to be read. * @param array $aParams - an array of parameters to be pathed with URL. * @return string the file's contents. */ function bx_file_get_contents($sFileUrl, $aParams = array()) { $sFileUrl = bx_append_url_params($sFileUrl, $aParams); $sResult = ''; if (function_exists('curl_init')) { $rConnect = curl_init(); curl_setopt($rConnect, CURLOPT_TIMEOUT, 10); curl_setopt($rConnect, CURLOPT_URL, $sFileUrl); curl_setopt($rConnect, CURLOPT_HEADER, 0); curl_setopt($rConnect, CURLOPT_RETURNTRANSFER, 1); curl_setopt($rConnect, CURLOPT_CAINFO, BX_DIRECTORY_PATH_PLUGINS . 'curl/cacert.pem'); if (!ini_get('open_basedir')) { curl_setopt($rConnect, CURLOPT_FOLLOWLOCATION, 1); } $sAllCookies = ''; foreach ($_COOKIE as $sKey => $sValue) { $sAllCookies .= $sKey . "=" . $sValue . ";"; } curl_setopt($rConnect, CURLOPT_COOKIE, $sAllCookies); $sResult = curl_exec($rConnect); curl_close($rConnect); } else { $sResult = @file_get_contents($sFileUrl); } return $sResult; }
/** * Generate User`s Blog Page * * @param $iUserID - User ID * @return HTML presentation of data */ function GenMemberBlog($iUserID = 0) { $iCheckedMemberID = $this->_iVisitorID; $sRetHtml = ''; $sBlogPosts = ''; $iMemberID = $this->defineUserId(); if ($iUserID > 0) { $iMemberID = $iUserID; } $GLOBALS['oTopMenu']->setCurrentProfileID($iMemberID); $sCategoryName = $this->defineCategoryName(); $aBlogsRes = $this->_oDb->getBlogInfo($iMemberID); if (!$aBlogsRes) { if ($iMemberID == $iCheckedMemberID && $iCheckedMemberID > 0 || $this->isAdmin()) { return $this->GenCreateBlogForm(); } else { return DesignBoxContent($this->_sPageHeader, MsgBox(_t('_Empty')), 1); } } $iOwnerID = $aBlogsRes['OwnerID']; if ((!$this->_iVisitorID || $iOwnerID != $this->_iVisitorID) && !$this->isAllowedBlogView($iOwnerID, true)) { return $this->_oTemplate->displayAccessDenied(); } if ($aBlogsRes['OwnerID'] > 0) { $sUser = getNickName($aBlogsRes['OwnerID']); $aUserInfo = getProfileInfo($aBlogsRes['OwnerID']); } else { $sUser = _t('_Admin'); $aUserInfo = array('NickName' => _t('_Admin')); } $sOwnerBlogLink = $this->genBlogLink('show_member_blog_home', array('Permalink' => $aUserInfo['NickName'], 'Link' => $aBlogsRes['OwnerID'])); $sAsBlog = _t('_bx_blog_Members_blog', $sUser); $sHome = $this->genBlogFormUrl(); $sCurCategory = $sCategoryName; $sBreadCrumb = $sCurCategory != '' ? $sCurCategory : _t('_bx_blog_Latest_posts'); if (!$this->isAllowedBlogsPostsBrowse()) { $sBlogPostsHtmlVal = $this->_oTemplate->displayAccessDenied(); } else { require_once $this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php'; $oTmpBlogSearch = new BxBlogsSearchUnit($this); $oTmpBlogSearch->PerformObligatoryInit($this, 4); $oTmpBlogSearch->aCurrent['sorting'] = 'last'; $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage(); $oTmpBlogSearch->aCurrent['restriction']['owner']['value'] = $iMemberID; if ($sCategoryName != '') { $oTmpBlogSearch->aCurrent['join']['category'] = array('type' => 'left', 'table' => 'sys_categories', 'mainField' => 'PostID', 'onField' => 'ID', 'joinFields' => array('Category')); $oTmpBlogSearch->aCurrent['restriction']['category'] = array('field' => 'Category', 'operator' => '=', 'table' => 'sys_categories', 'value' => $sCategoryName); $oTmpBlogSearch->aCurrent['restriction']['category_type'] = array('field' => 'Type', 'operator' => '=', 'table' => 'sys_categories', 'value' => 'bx_blogs'); $oTmpBlogSearch->aCurrent['restriction']['category_owner'] = array('field' => 'Owner', 'operator' => '=', 'table' => 'sys_categories', 'value' => $iMemberID); } if ($this->_iVisitorID == $iMemberID && $iMemberID > 0 || $this->isAdmin() == true) { $oTmpBlogSearch->aCurrent['restriction']['activeStatus'] = ''; } $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock(); $sBlogPostsVal = $oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0 ? MsgBox(_t('_Empty')) : $sBlogPostsVal; // Prepare link to pagination if ($this->bUseFriendlyLinks == false || $this->bAdminMode == true) { //old variant $sCategUrlAdd = $sCategoryName ? "category={$sCategoryName}" : ''; $sRequest = bx_append_url_params($sOwnerBlogLink, $sCategUrlAdd . '&page={page}&per_page={per_page}'); } else { $sCategUrlAdd = $sCategoryName ? "/category/{$sCategoryName}" : ''; $sRequest = bx_append_url_params($sOwnerBlogLink . $sCategUrlAdd, 'page={page}&per_page={per_page}'); } // End of prepare link to pagination $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $sRequest; $sPagination = $oTmpBlogSearch->showPagination3(); $sBlogPostsHtmlVal = <<<EOF <div class="bx-def-bc-padding"> {$sBlogPostsVal} </div> {$sPagination} EOF; } $sPostsSect = DesignBoxContent($sBreadCrumb, $sBlogPostsHtmlVal, 1); $sRightSect = $this->GenMemberDescrAndCat($aBlogsRes, $sCategoryName); $sRetHtml = $this->Templater($sPostsSect, $sRightSect); return $sRetHtml; }
protected function addAdditionalUrlParams($sUrl, $aAdditionalParams, $bReplacePagesParams, $bAddPaginateParams = true) { if ($bAddPaginateParams) { // add pages params $sUrl = bx_append_url_params($sUrl, array('start' => $bReplacePagesParams ? (int) $this->aCurrent['paginate']['start'] : '{start}', 'per_page' => $bReplacePagesParams ? (int) $this->aCurrent['paginate']['perPage'] : '{per_page}')); } foreach ($this->aGetParams as $sGetParam) { $sValue = false; if (isset($aAdditionalParams[$sGetParam])) { $sValue = $aAdditionalParams[$sGetParam]; } elseif (false !== bx_get($sGetParam)) { $sValue = bx_get($sGetParam); } if (false !== $sValue) { $sUrl = bx_append_url_params($sUrl, $sGetParam . '=' . rawurlencode($sValue)); } } return $sUrl; }
function showPaginationAjax($sContainerId, $sBaseUrl = false) { bx_import('BxDolPaginate'); $sLink = BX_DOL_URL_ROOT . ($sBaseUrl ? $sBaseUrl : $this->aCurrent['paginate']['page_url']); $sLink = bx_append_url_params($sLink, 'ajax=1'); $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $this->aCurrent['paginate']['totalNum'], 'per_page' => $this->aCurrent['paginate']['perPage'], 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_page' => 'getHtmlData(\'' . bx_html_attribute($sContainerId) . '\', \'' . bx_html_attribute($sLink) . '&page={page}&per_page={per_page}\'); return false;', 'on_change_per_page' => 'getHtmlData(\'' . bx_html_attribute($sContainerId) . '\', \'' . bx_html_attribute($sLink) . '&page=1&per_page=\' + this.value); return false;')); $sPaginate = '<div class="clear_both"></div>' . $oPaginate->getPaginate(); return $sPaginate; }
/** * Get logo URL. * @return string */ function getMainLogoUrl() { $iFileId = (int) getParam('sys_site_logo'); if (!$iFileId) { return false; } $oStorage = BxDolTranscoder::getObjectInstance('sys_custom_images'); $sFileUrl = $oStorage->getFileUrl($iFileId); if (!$sFileUrl) { return false; } if (getParam('sys_site_logo_width') > 0) { $sFileUrl = bx_append_url_params($sFileUrl, array('x' => getParam('sys_site_logo_width'))); } if (getParam('sys_site_logo_height') > 0) { $sFileUrl = bx_append_url_params($sFileUrl, array('y' => getParam('sys_site_logo_height'))); } return $sFileUrl; }
* CC-BY License - http://creativecommons.org/licenses/by/3.0/ */ require_once './inc/header.inc.php'; require_once './inc/db.inc.php'; require_once './inc/profiles.inc.php'; $aPredefinedRssFeeds = array('boonex_news' => 'https://www.boonex.com/notes/featured_posts/?rss=1', 'boonex_version' => 'http://rss.boonex.com/', 'boonex_unity_market' => 'https://www.boonex.com/market/latest/?rss=1', 'boonex_unity_lang_files' => 'https://www.boonex.com/market/tag/translations&rss=1', 'boonex_unity_market_templates' => 'https://www.boonex.com/market/tag/templates&rss=1', 'boonex_unity_market_featured' => 'https://www.boonex.com/market/featured_posts?rss=1'); if (isset($aPredefinedRssFeeds[$_GET['ID']])) { $sCont = $aPredefinedRssFeeds[$_GET['ID']]; } elseif (0 === strncmp('forum|', $_GET['ID'], 6)) { $a = explode('|', $_GET['ID']); if (!is_array($a) || 3 != count($a)) { exit; } $sCont = BX_DOL_URL_ROOT . $a[0] . '/' . $a[1] . '/rss/forum/' . $a[2] . '.htm'; } else { $sQuery = "SELECT `Content` FROM `sys_page_compose` WHERE `ID` = " . (int) $_GET['ID']; $sCont = db_value($sQuery); if (!$sCont) { exit; } } list($sUrl) = explode('#', $sCont); $sUrl = str_replace('{SiteUrl}', $site['url'], $sUrl); $iMemID = (int) $_GET['member']; if ($iMemID) { $aMember = getProfileInfo($iMemID); $sUrl = str_replace('{NickName}', $aMember['NickName'], $sUrl); } header('Content-Type: text/xml'); echo bx_file_get_contents(defined('BX_PROFILER') && BX_PROFILER && 0 === strncmp($site['url'], $sUrl, strlen($site['url'])) ? bx_append_url_params($sUrl, 'bx_profiler_disable=1') : $sUrl);
protected function getJoinLink($sKey) { $sKeyCode = $this->_oConfig->getKeyCode(); $sJoinUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account'); return bx_append_url_params($sJoinUrl, array($sKeyCode => $sKey)); }
function _actionManageFansPopup($iEntryId, $sTitle, $sFuncGetFans = 'getFans', $sFuncIsAllowedManageFans = 'isAllowedManageFans', $sFuncIsAllowedManageAdmins = 'isAllowedManageAdmins', $iMaxFans = 1000) { header('Content-type:text/html;charset=utf-8'); $iEntryId = (int) $iEntryId; if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, 0, true))) { echo $GLOBALS['oFunctions']->transBox(MsgBox(_t('_Empty'))); exit; } if (!$this->{$sFuncIsAllowedManageFans}($aDataEntry)) { echo $GLOBALS['oFunctions']->transBox(MsgBox(_t('_Access denied'))); exit; } $aProfiles = array(); $iNum = $this->_oDb->{$sFuncGetFans}($aProfiles, $iEntryId, true, 0, $iMaxFans); if (!$iNum) { echo $GLOBALS['oFunctions']->transBox(MsgBox(_t('_Empty'))); exit; } $sActionsUrl = bx_append_url_params(BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . "view/" . $aDataEntry[$this->_oDb->_sFieldUri], 'ajax_action='); $aButtons = array(array('type' => 'submit', 'name' => 'fans_remove', 'value' => _t('_sys_btn_fans_remove'), 'onclick' => "onclick=\"getHtmlData('sys_manage_items_manage_fans_content', '{$sActionsUrl}remove&ids=' + sys_manage_items_get_manage_fans_ids(), false, 'post'); return false;\"")); if ($this->{$sFuncIsAllowedManageAdmins}($aDataEntry)) { $aButtons = array_merge($aButtons, array(array('type' => 'submit', 'name' => 'fans_add_to_admins', 'value' => _t('_sys_btn_fans_add_to_admins'), 'onclick' => "onclick=\"getHtmlData('sys_manage_items_manage_fans_content', '{$sActionsUrl}add_to_admins&ids=' + sys_manage_items_get_manage_fans_ids(), false, 'post'); return false;\""), array('type' => 'submit', 'name' => 'fans_move_admins_to_fans', 'value' => _t('_sys_btn_fans_move_admins_to_fans'), 'onclick' => "onclick=\"getHtmlData('sys_manage_items_manage_fans_content', '{$sActionsUrl}admins_to_fans&ids=' + sys_manage_items_get_manage_fans_ids(), false, 'post'); return false;\""))); } bx_import('BxTemplSearchResult'); $sControl = BxTemplSearchResult::showAdminActionsPanel('sys_manage_items_manage_fans', $aButtons, 'sys_fan_unit'); $aVarsContent = array('suffix' => 'manage_fans', 'content' => $this->_profilesEdit($aProfiles, false, $aDataEntry), 'control' => $sControl); $aVarsPopup = array('title' => $sTitle, 'content' => $this->_oTemplate->parseHtmlByName('manage_items_form', $aVarsContent)); echo $GLOBALS['oFunctions']->transBox($this->_oTemplate->parseHtmlByName('popup', $aVarsPopup), true); exit; }
public function generateJs() { $sUrlSelf = bx_js_string($_SERVER['PHP_SELF'], BX_ESCAPE_STR_APOS); ?> <script language="javascript"> function bx_sys_adm_audit_test_email() { var sEmail = prompt('<?php echo _t('_Email'); ?> ', '<?php echo class_exists('BxDolDb') && BxDolDb::getInstance() ? BxDolDb::getInstance()->getParam('site_email') : ''; ?> '); if (null == sEmail || ('string' == (typeof sEmail) && !sEmail.length)) return; $('#bx-sys-adm-audit-test-email').html('Sending...'); $.post('<?php echo bx_append_url_params($sUrlSelf, array('action' => 'audit_send_test_email')); ?> &email=' + sEmail, function(data) { $('#bx-sys-adm-audit-test-email').html(data); }); } function bx_sys_adm_audit_phpinfo() { $(window).dolPopupAjax({url: '<?php echo bx_append_url_params($sUrlSelf, array('action' => 'phpinfo_popup')); ?> '}); } </script> <?php }
public function getCode($isDisplayHeader = true) { $this->_replaceMarkers(); if ($isDisplayHeader && empty($this->_aOptions['paginate_url'])) { // reset page query params if grid is just initialized and it uses AJAX paginate $this->resetQueryParams(); } $sPaginate = ''; $aData = array(); $sIdWrapper = 'bx-grid-wrap-' . $this->_sObject; $sIdContainer = 'bx-grid-cont-' . $this->_sObject; $sIdTable = 'bx-grid-table-' . $this->_sObject; $sFilter = bx_unicode_urldecode(bx_process_input(bx_get('filter'))); $sOrderField = bx_unicode_urldecode(bx_process_input(bx_get('order_field'))); $sOrderDir = 0 == strcasecmp('desc', bx_get('order_dir')) ? 'DESC' : 'ASC'; if ($this->_aOptions['paginate_get_start']) { $iStart = (int) bx_get($this->_aOptions['paginate_get_start']); } else { $iStart = 0; } if ($this->_aOptions['paginate_get_per_page'] && (int) bx_get($this->_aOptions['paginate_get_per_page']) > 0) { $iPerPage = (int) bx_get($this->_aOptions['paginate_get_per_page']); } elseif ($this->_aOptions['paginate_per_page']) { $iPerPage = (int) $this->_aOptions['paginate_per_page']; } else { $iPerPage = 10; } if ($this->_aOptions['paginate_get_start']) { $aData = $this->_getData($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage + 1); $sPageUrl = false; if (!empty($this->_aOptions['paginate_url'])) { $sPageUrl = $this->_aOptions['paginate_url']; $aParamsAppend = array(); if ($sFilter) { $aParamsAppend['filter'] = bx_process_input(bx_get('filter')); } if ($sOrderField) { $aParamsAppend['order_field'] = bx_process_input(bx_get('order_field')); $aParamsAppend['order_dir'] = bx_process_input(bx_get('order_dir')); } if ($aParamsAppend) { $sPageUrl = bx_append_url_params($sPageUrl, $aParamsAppend); } } $aPaginateParams = array('start' => $iStart, 'per_page' => $iPerPage, 'page_url' => $sPageUrl ? $sPageUrl : "javascript:glGrids." . $this->_sObject . ".reload('{start}'); void(0);"); bx_import('BxTemplPaginate'); $oPaginate = new BxTemplPaginate($aPaginateParams, $this->_oTemplate); $oPaginate->setNumFromDataArray($aData); if (isset($this->_aOptions['paginate_simple']) && false !== $this->_aOptions['paginate_simple']) { $sPaginate = $oPaginate->getSimplePaginate($this->_aOptions['paginate_simple']); } else { $sPaginate = $oPaginate->getPaginate(); } } else { $aData = $this->_getData($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage); } $sPopupOptions = '{}'; if (!empty($this->_aPopupOptions) && is_array($this->_aPopupOptions)) { $sPopupOptions = json_encode($this->_aPopupOptions); } $aQueryAppend = array_merge(is_array($this->_aQueryAppend) ? $this->_aQueryAppend : array(), is_array($this->_aMarkers) ? $this->_aMarkers : array()); $sQueryAppend = '{}'; if (!empty($aQueryAppend) && is_array($aQueryAppend)) { $sQueryAppend = json_encode($aQueryAppend); } $sConfirmMessages = '{}'; if (!empty($this->_aConfirmMessages) && is_array($this->_aConfirmMessages)) { $sConfirmMessages = json_encode($this->_aConfirmMessages); } $aVars = array('object' => $this->_sObject, 'id_table' => $sIdTable, 'id_cont' => $sIdContainer, 'id_wrap' => $sIdWrapper, 'sortable' => empty($this->_aOptions['field_order']) ? 0 : 1, 'sorting' => empty($this->_aOptions['sorting_fields']) ? 0 : 1, 'sorting_field' => $sOrderField, 'sorting_dir' => $sOrderDir, 'bx_repeat:row_header' => $this->_getRowHeader(), 'bx_repeat:rows_data' => $this->_getRowsDataDesign($aData), 'paginate' => $sPaginate, 'paginate_get_start' => $this->_aOptions['paginate_get_start'], 'paginate_get_per_page' => $this->_aOptions['paginate_get_per_page'], 'start' => $iStart, 'per_page' => $iPerPage, 'filter' => bx_js_string($sFilter, BX_ESCAPE_STR_APOS), 'order_field' => bx_js_string($sOrderField, BX_ESCAPE_STR_APOS), 'order_dir' => bx_js_string($sOrderDir, BX_ESCAPE_STR_APOS), 'popup_options' => $sPopupOptions, 'query_append' => $sQueryAppend, 'confirm_messages' => $sConfirmMessages, 'columns' => count($this->_aOptions['fields']), 'bx_if:actions_bulk' => array('condition' => !empty($this->_aOptions['actions_bulk']), 'content' => array('actions_bulk' => $this->_getActions('bulk'))), 'bx_if:display_header' => array('condition' => $isDisplayHeader, 'content' => array('bx_if:actions_independent' => array('condition' => !empty($this->_aOptions['actions_independent']), 'content' => array('actions_independent' => $this->_getActions('independent'))), 'bx_if:filter' => array('condition' => !empty($this->_aOptions['filter_fields']) || !empty($this->_aOptions['filter_fields_translatable']), 'content' => array('controls' => $this->_getFilterControls()))))); $this->_addJsCss(); return $this->_oTemplate->parseHtmlByName('grid.html', $aVars); }
/** * * Join Methods * */ function performJoin($iPendingId, $aPayment = array()) { $oSession = BxDolSession::getInstance(); $oSession->setValue($this->_sSessionKeyPending, (int) $iPendingId); if (!empty($aPayment['payer_name']) && !empty($aPayment['payer_email'])) { bx_import('BxDolEmailTemplates'); $oEmailTemplates = new BxDolEmailTemplates(); $aTemplate = $oEmailTemplates->parseTemplate($this->_sEmailTemplatesPrefix . 'paid_need_join', array('RealName' => $aPayment['payer_name'], 'JoinLink' => bx_append_url_params($this->_oConfig->getJoinUrl(), array($this->_sRequestKeyPending => (int) $iPendingId)))); sendMail($aPayment['payer_email'], $aTemplate['Subject'], $aTemplate['Body'], 0, array(), 'html', false, true); } header('Location: ' . $this->_oConfig->getJoinUrl()); exit; }
protected function _getActionsBox(&$aCmt, $aDp = array()) { $oTemplate = BxDolTemplate::getInstance(); //--- Actions Menu bx_import('BxDolMenu'); $oMenuActions = BxDolMenu::getObjectInstance($this->_sMenuObjActions); $oMenuActions->setCmtsData($this, $aCmt['cmt_id']); $sMenuActions = $oMenuActions->getCode(); $oVote = $this->getVoteObject($aCmt['cmt_id']); if ($oVote !== false) { $sMenuActions .= $oVote->getJsScript(); } //--- Manage Menu $oMenuManage = BxDolMenu::getObjectInstance($this->_sMenuObjManage); $oMenuManage->setCmtsData($this, $aCmt['cmt_id']); $sMenuManage = $oMenuManage->getCode(); $bMenuManage = !empty($sMenuManage); if ($bMenuManage) { $sMenuManage = $oTemplate->parseHtmlByName('comment_manage.html', array('style_prefix' => $this->_sStylePrefix, 'content' => $sMenuManage)); bx_import('BxTemplFunctions'); $sMenuManage = BxTemplFunctions::getInstance()->transBox($this->_sSystem . '-manage-' . $aCmt['cmt_id'], $sMenuManage, true); } $sAgo = bx_time_js($aCmt['cmt_time']); $bObjectTitle = !empty($this->_aSystem['trigger_field_title']); return $oTemplate->parseHtmlByName('comment_actions.html', array('id' => $aCmt['cmt_id'], 'js_object' => $this->_sJsObjName, 'style_prefix' => $this->_sStylePrefix, 'bx_if:show_ago_link' => array('condition' => $bObjectTitle, 'content' => array('style_prefix' => $this->_sStylePrefix, 'view_link' => bx_append_url_params($this->_sViewUrl, array('sys' => $this->_sSystem, 'id' => $this->_iId, 'cmt_id' => $aCmt['cmt_id'])), 'ago' => $sAgo)), 'bx_if:show_ago_text' => array('condition' => !$bObjectTitle, 'content' => array('ago' => $sAgo)), 'menu_actions' => $sMenuActions, 'bx_if:show_menu_manage' => array('condition' => $bMenuManage, 'content' => array('js_object' => $this->_sJsObjName, 'style_prefix' => $this->_sStylePrefix, 'id' => $aCmt['cmt_id'], 'popup_text' => $sMenuManage)))); }
public function getViewUrl($iCmtId) { if (empty($this->_aSystem['trigger_field_title'])) { return ''; } return bx_append_url_params($this->_sViewUrl, array('sys' => $this->_sSystem, 'id' => $this->_iId, 'cmt_id' => $iCmtId)); }
function getUploadFormFile($aExtras) { $aUploaders = $this->oModule->_oConfig->getUploaders(); $aForm = array('form_attrs' => array('id' => $this->sUploadTypeLC . '_upload_form', 'name' => 'upload', 'action' => bx_append_url_params($this->sWorkingFile, array('action' => $aUploaders['regular']['action'])), 'method' => 'post', 'enctype' => 'multipart/form-data', 'target' => $this->sUploadTypeLC . '_upload_frame'), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => _t('_bx_' . $this->sUploadTypeLC . 's_upload')), 'browse' => array('type' => 'file', 'name' => 'file[]', 'caption' => _t('_bx_' . $this->sUploadTypeLC . 's_browse'), 'required' => true, 'attrs' => array('multiplyable' => $aExtras['from_wall'] ? 'false' : 'true', 'onchange' => "parent." . $this->_sJsPostObject . ".onFileChangedEvent();")), 'agreement' => array('type' => 'checkbox', 'name' => 'agree', 'label' => _t('_bx_' . $this->sUploadTypeLC . 's_i_have_the_right_to_distribute'), 'required' => true, 'attrs' => array('onchange' => "parent.{$this->_sJsPostObject}.onFileChangedEvent();")), 'submit' => array('type' => 'submit', 'name' => 'upload', 'value' => _t('_Continue'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . "._loading(true);", 'disabled' => 'disabled')))); //--- Process Extras ---// foreach ($this->_aExtras as $sKey => $mixedValue) { $aForm['inputs'][BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => $mixedValue); } $oForm = new BxTemplFormView($aForm); return $this->getLoadingCode() . $oForm->getCode(); }
/** * Gets file contents by URL. * * @param string $sFileUrl - file URL to be read. * @param array $aParams - an array of parameters to be pathed with URL. * @return string the file's contents. */ function bx_file_get_contents($sFileUrl, $aParams = array(), $bChangeTimeout = false) { if ($aParams) { $sFileUrl = bx_append_url_params($sFileUrl, $aParams); } $sResult = ''; if (function_exists('curl_init')) { $rConnect = curl_init(); curl_setopt($rConnect, CURLOPT_URL, $sFileUrl); curl_setopt($rConnect, CURLOPT_HEADER, 0); curl_setopt($rConnect, CURLOPT_RETURNTRANSFER, 1); curl_setopt($rConnect, CURLOPT_FOLLOWLOCATION, 1); if ($bChangeTimeout) { curl_setopt($rConnect, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($rConnect, CURLOPT_TIMEOUT, 3); } $sAllCookies = ''; foreach ($_COOKIE as $sKey => $sValue) { $sAllCookies .= $sKey . "=" . $sValue . ";"; } curl_setopt($rConnect, CURLOPT_COOKIE, $sAllCookies); $sResult = curl_exec($rConnect); curl_close($rConnect); } else { $iSaveTimeout = false; if ($bChangeTimeout) { $iSaveTimeout = ini_get('default_socket_timeout'); ini_set('default_socket_timeout', 3); } $sResult = @file_get_contents($sFileUrl); if ($bChangeTimeout && false !== $iSaveTimeout) { ini_set('default_socket_timeout', $iSaveTimeout); } } return $sResult; }