本文整理汇总了PHP中bx_get函数的典型用法代码示例。如果您正苦于以下问题:PHP bx_get函数的具体用法?PHP bx_get怎么用?PHP bx_get使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bx_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performActionDelete
public function performActionDelete($aParams = array())
{
$CNF =& $this->_oModule->_oConfig->CNF;
//TODO: remove this check when 'delete with content' feature will be realized in onDelete method.
if (isset($aParams['with_content']) && $aParams['with_content'] === true) {
$this->_echoResultJson(array('msg' => 'TODO: delete with content'));
return;
}
$iAffected = 0;
$aIds = bx_get('ids');
if (!$aIds || !is_array($aIds)) {
$this->_echoResultJson(array());
exit;
}
bx_import('FormsEntryHelper', $this->_oModule->_aModule);
$sClass = $this->_oModule->_oConfig->getClassPrefix() . 'FormsEntryHelper';
$oFormsHelper = new $sClass($this->_oModule);
$aIdsAffected = array();
foreach ($aIds as $iId) {
$aContentInfo = $this->_oModule->_oDb->getContentInfoById($iId);
if ($this->_oModule->checkAllowedDelete($aContentInfo) !== CHECK_ACTION_RESULT_ALLOWED) {
continue;
}
if ($oFormsHelper->deleteData($iId) != '') {
continue;
}
if (!$this->_onDelete($iId, $aParams)) {
continue;
}
$this->_oModule->checkAllowedDelete($aContentInfo, true);
$aIdsAffected[] = $iId;
$iAffected++;
}
$this->_echoResultJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected) : array('msg' => _t($CNF['T']['grid_action_err_delete'])));
}
示例2: init
function init()
{
if (($sAction = bx_get('bp_action')) === false) {
return;
}
$sAction = bx_process_input($sAction);
$aResult = array('code' => 1, 'message' => _t('_adm_bp_err_cannot_process_action'));
switch ($sAction) {
case 'reorder':
if (empty($this->aPageRebuild) || !is_array($this->aPageRebuild)) {
break;
}
$bResult = false;
for ($i = 1; $i <= $this->aPageRebuild['layout_cells_number']; $i++) {
$aItems = bx_get('bp_items_' . $i);
$iItems = count($aItems);
for ($j = 0; $j < $iItems; $j++) {
$bResult |= $this->oDb->updateBlock((int) $aItems[$j], array('cell_id' => $i, 'order' => $j));
}
}
$aResult = $bResult ? array('code' => 0, 'message' => _t('_adm_bp_scs_save')) : array('code' => 1, 'message' => _t('_adm_bp_err_nothing_changed'));
break;
default:
$sMethod = 'action' . $this->getClassName($sAction);
if (method_exists($this, $sMethod)) {
$aResult = $this->{$sMethod}();
}
}
echo json_encode($aResult);
exit;
}
示例3: init
public function init()
{
//--- Check Actions ---//
if (($sAction = bx_get('mod_action')) !== false) {
$sAction = bx_process_input($sAction);
$aResult = array('code' => 1, 'message' => _t('_adm_mod_err_cannot_process_action'));
switch ($sAction) {
case 'activate':
$sValue = bx_process_input(bx_get('mod_value'));
if (empty($sValue)) {
break;
}
$aResult = $this->activate($sValue);
break;
}
echo json_encode($aResult);
exit;
}
$this->aModule = $this->oDb->getModuleByName($this->sModule);
if (empty($this->aModule) || !is_array($this->aModule)) {
BxDolStudioTemplate::getInstance()->displayPageNotFound();
}
$this->sPageRssHelpUrl = $this->aModule['help_url'];
$this->sPageRssHelpId = $this->aModule['name'];
$this->addMarkers(array('module_name' => $this->aModule['name'], 'module_uri' => $this->aModule['uri'], 'module_title' => $this->aModule['title']));
$this->addAction(array('type' => 'switcher', 'name' => 'activate', 'caption' => '_adm_txt_pca_active', 'checked' => (int) $this->aModule['enabled'] == 1, 'onchange' => "javascript:" . $this->getPageJsObject() . ".activate('" . $this->sModule . "', this)"), false);
}
示例4: PageCompMainCode
/**
* page code function
*/
function PageCompMainCode()
{
ob_start();
$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);
}
示例5: service
function service($aToken)
{
if (!isAdmin($aToken['user_id'])) {
$this->errorOutput(403, 'access_denied', 'Only admin can access service endpoint');
return false;
}
bx_login($aToken['user_id'], false, false);
$sUri = bx_get('uri');
$sMethod = bx_get('method');
if (!($aParams = bx_get('params'))) {
$aParams = array();
} elseif (is_string($aParams) && preg_match('/^a:[\\d+]:\\{/', $aParams)) {
$aParams = @unserialize($aParams);
}
if (!is_array($aParams)) {
$aParams = array($aParams);
}
if (!($sClass = bx_get('class'))) {
$sClass = 'Module';
}
if (!BxDolRequest::serviceExists($sUri, $sMethod, $sClass)) {
$this->errorOutput(404, 'not_found', 'Service was not found');
return false;
}
$mixedRet = BxDolService::call($sUri, $sMethod, $aParams, $sClass);
$this->output(array('uri' => $sUri, 'method' => $sMethod, 'data' => $mixedRet));
}
示例6: init
public function init()
{
if (($sAction = bx_get('nav_action')) === false) {
return;
}
$sAction = bx_process_input($sAction);
$aResult = array('code' => 1, 'message' => _t('_adm_nav_err_cannot_process_action'));
switch ($sAction) {
case 'get-page-by-type':
$sValue = bx_process_input(bx_get('nav_value'));
if (empty($sValue)) {
break;
}
$this->sPage = $sValue;
$aResult = array('code' => 0, 'content' => $this->getPageCode());
break;
default:
$sMethod = 'action' . $this->getClassName($sAction);
if (method_exists($this, $sMethod)) {
$aResult = $this->{$sMethod}();
}
}
echo json_encode($aResult);
exit;
}
示例7: performActionDelete
public function performActionDelete()
{
$sAction = 'delete';
$iAffected = 0;
$aIds = bx_get('ids');
if (!$aIds || !is_array($aIds)) {
$this->_echoResultJson(array());
exit;
}
$aIdsAffected = array();
foreach ($aIds as $iId) {
$aList = array();
$this->oDb->getLists(array('type' => 'by_id', 'value' => (int) $iId), $aList, false);
if (!is_array($aList) || empty($aList)) {
continue;
}
if (!$this->_canDelete($aList)) {
continue;
}
if (!$this->oDb->deleteValues(array('type' => 'by_key', 'value' => $aList['key'])) || (int) $this->_delete($iId) <= 0) {
continue;
}
bx_import('BxDolStudioLanguagesUtils');
BxDolStudioLanguagesUtils::getInstance()->deleteLanguageString($aList['title']);
$aIdsAffected[] = $iId;
$iAffected++;
}
$this->_echoResultJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected) : array('msg' => _t('_adm_from_err_pre_lists_delete')));
}
示例8: __construct
function __construct()
{
parent::__construct(BX_DOL_STUDIO_PAGE_HOME);
$aClasses = array('BxTemplStudioModules', 'BxTemplStudioDesigns', 'BxTemplStudioLanguages');
//--- Check actions ---//
if (($sAction = bx_get('action')) !== false) {
$sAction = bx_process_input($sAction);
$aResult = array('code' => 1, 'message' => _t('_adm_err_operation_failed'));
switch ($sAction) {
case 'launcher-update-cache':
$aResult = $this->updateCache();
break;
case 'launcher-reorder':
$sPage = bx_process_input(bx_get('page'));
$aItems = bx_process_input(bx_get('items'));
BxDolStudioWidgetsQuery::getInstance()->reorder($sPage, $aItems);
$aResult = array('code' => 0, 'message' => _t('_adm_scs_operation_done'));
break;
}
echo json_encode($aResult);
exit;
}
$this->aIncludes = array();
foreach ($aClasses as $sClass) {
$this->aIncludes[] = new $sClass();
}
}
示例9: __construct
function __construct()
{
global $logged;
$this->aProfiles = array(0 => array(), 1 => array());
// double arrays (for couples)
$this->aValues = array(0 => array(), 1 => array());
$this->aErrors = array(0 => array(), 1 => array());
$iId = bx_get('ID');
$this->iProfileID = (int) $iId;
// basic checks
if ($logged['member']) {
$iMemberID = getLoggedId();
if (!$this->iProfileID) {
//if profile id is not set by request, edit own profile
$this->iProfileID = $iMemberID;
$this->iArea = 2;
} else {
// check if this member is owner
if ($this->iProfileID == $iMemberID) {
$this->iArea = 2;
}
}
} elseif ($logged['admin']) {
$this->iArea = 3;
} elseif ($logged['moderator']) {
$this->iArea = 4;
}
$this->bAjaxMode = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
$this->bForceAjaxSave = bx_get('force_ajax_save');
parent::__construct('pedit');
}
示例10: getCode
/**
* Get page code with automatic caching, adding necessary css/js files and system template vars.
* @return string.
*/
public function getCode()
{
if (bx_get('dynamic') && ($iBlockId = (int) bx_get('pageBlock'))) {
if (!$this->_isVisiblePage($this->_aObject)) {
header('HTTP/1.0 403 Forbidden');
exit;
}
bx_alert('system', 'page_output_block', 0, false, array('page_name' => $this->_sObject, 'page_object' => $this, 'page_query' => $this->_oQuery, 'block_id' => (int) $iBlockId));
header('Content-type:text/html;charset=utf-8');
echo $this->_getBlockOnlyCode($iBlockId);
exit;
}
if (!$this->_isVisiblePage($this->_aObject)) {
return $this->_getPageAccessDeniedMsg();
}
$this->_addJsCss();
$this->_addSysTemplateVars();
$this->_selectMenu();
if (!getParam('sys_page_cache_enable') || !$this->_aObject['cache_lifetime']) {
return $this->_getPageCode();
}
$oCache = $this->_getPageCacheObject();
$sKey = $this->_getPageCacheKey();
$mixedRet = $oCache->getData($sKey, $this->_aObject['cache_lifetime']);
if ($mixedRet !== null) {
return $mixedRet;
} else {
$sPageCode = $this->_getPageCode();
$oCache->setData($sKey, $sPageCode, $this->_aObject['cache_lifetime']);
}
bx_alert('system', 'page_output', 0, false, array('page_name' => $this->_sObject, 'page_object' => $this, 'page_query' => $this->_oQuery, 'page_code' => &$sPageCode));
return $sPageCode;
}
示例11: performActionSetAclLevel
public function performActionSetAclLevel()
{
$oMenu = BxDolMenu::getObjectInstance('sys_set_acl_level');
$aIds = bx_get('ids');
if (!$aIds || !is_array($aIds) || !$oMenu) {
$this->_echoResultJson(array());
return;
}
$aIdsResult = array();
foreach ($aIds as $iId) {
$aContentInfo = $this->_oModule->_oDb->getContentInfoById($iId);
if ($this->_oModule->checkAllowedSetMembership($aContentInfo) !== CHECK_ACTION_RESULT_ALLOWED) {
continue;
}
$aIdsResult[] = $this->_getProfileId($iId);
}
if (empty($aIdsResult)) {
$this->_echoResultJson(array());
return;
}
if (count($aIdsResult) == 1) {
$aIdsResult = $aIdsResult[0];
}
$sContent = $this->_oTemplate->parseHtmlByName('set_acl_popup.html', array('content' => $oMenu->getCode($aIdsResult)));
$sContent = BxTemplFunctions::getInstance()->transBox($this->_oModule->_oConfig->getName() . 'set_acl_level_popup', $sContent);
$this->_echoResultJson(array('popup' => $sContent), true);
}
示例12: getForm
public function getForm($iDesignBoxTemplate = BX_DB_PADDING_DEF, $sTitle = false)
{
if ($this->_sMetaType) {
return '';
}
if (false === $sTitle) {
$sTitle = _t("_Search");
}
$aValues = $this->getKeyTitlesPairs();
$aValue = isset($_GET['type']) ? bx_process_input($_GET['type']) : array_keys($aValues);
$sIdForm = $this->_sIdForm . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
$sIdResults = $this->_sIdResults . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
$sIdLoadingContainer = $this->_bLiveSearch ? $sIdResults : $sIdForm;
$sJsParams = "5, '#{$sIdForm}', '#{$sIdResults}', '#{$sIdLoadingContainer}', '{$this->_bLiveSearch}'";
$aForm = array('form_attrs' => array('id' => $sIdForm, 'action' => BX_DOL_URL_ROOT . 'searchKeyword.php', 'method' => 'post'), 'csrf' => array('disable' => true), 'inputs' => array('live_search' => array('type' => 'hidden', 'name' => 'live_search', 'value' => $this->_bLiveSearch ? 1 : 0), 'section' => array('type' => 'checkbox_set', 'name' => 'section', 'caption' => _t('_Section'), 'values' => $aValues, 'value' => $aValue), 'keyword' => array('type' => 'text', 'name' => 'keyword', 'caption' => _t('_Keyword'), 'value' => bx_get('keyword') ? bx_process_input(bx_get('keyword')) : ''), 'search' => array('type' => 'submit', 'name' => 'search', 'value' => _t('_Search'))));
if ($this->_bLiveSearch) {
unset($aForm['inputs']['section']);
unset($aForm['inputs']['search']);
unset($aForm['inputs']['keyword']['caption']);
$aForm['inputs']['keyword']['attrs']['placeholder'] = _t('_sys_search_placeholder');
$aForm['inputs']['keyword']['attrs']['onkeypress'] = "return bx_search_on_type(event, {$sJsParams});";
$aForm['inputs']['keyword']['attrs']['onpaste'] = $aForm['inputs']['keyword']['attrs']['onkeypress'];
}
bx_import('BxTemplFormView');
$oForm = new BxTemplFormView($aForm);
$sForm = $oForm->getCode();
if (!$this->_bLiveSearch) {
bx_import('BxTemplPaginate');
$o = new BxTemplPaginate(array());
$o->addCssJs();
}
return DesignBoxContent($sTitle, $sForm, $iDesignBoxTemplate);
}
示例13: performActionExport
public function performActionExport()
{
$sContentInsert = $sContentDelete = "";
$aIds = bx_get('ids');
if (!$aIds || !is_array($aIds)) {
$iId = (int) bx_get('id');
if (!$iId) {
$this->_echoResultJson(array());
exit;
}
$aIds = array($iId);
}
$iId = $aIds[0];
$aList = array();
$this->oDb->getLists(array('type' => 'by_id', 'value' => $iId), $aList, false);
if (!is_array($aList) || empty($aList)) {
$this->_echoResultJson(array());
exit;
}
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_form_pre_lists', array($aList), "Dumping data for '" . $aList['key'] . "' data list");
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_form_pre_lists', 'key', array($aList), "Deleting data for '" . $aList['key'] . "' data list");
$aValues = array();
$this->oDb->getValues(array('type' => 'by_key', 'value' => $aList['key']), $aValues, false);
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_form_pre_values', $aValues, false, array('id', 'key', 'value', 'lkey', 'lkey2', 'order'));
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_form_pre_values', 'Key', array(array('Key' => $aList['key'])), false);
$aFormStructure = array('form_attrs' => array(), 'inputs' => array('insert' => array('type' => 'textarea', 'name' => 'insert', 'caption' => _t('_bx_dev_frm_txt_prelists_export_insert'), 'value' => $sContentInsert), 'delete' => array('type' => 'textarea', 'name' => 'delete', 'caption' => _t('_bx_dev_frm_txt_prelists_export_delete'), 'value' => $sContentDelete), 'done' => array('type' => 'button', 'name' => 'done', 'value' => _t('_bx_dev_frm_btn_prelists_done'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()"))));
$oForm = new BxTemplStudioFormView($aFormStructure);
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-prelist-export-popup', _t('_bx_dev_frm_txt_prelists_export_popup', _t($aList['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_export.html', array('content' => $oForm->getCode())));
$this->_echoResultJson(array('popup' => $sContent), true);
}
示例14: __construct
function __construct($sPage = "")
{
parent::__construct('builder_permissions');
$this->oDb = new BxDolStudioPermissionsQuery();
$this->sPage = BX_DOL_STUDIO_PRM_TYPE_DEFAULT;
if (is_string($sPage) && !empty($sPage)) {
$this->sPage = $sPage;
}
//--- Check actions ---//
if (($sAction = bx_get('pgt_action')) !== false) {
$sAction = bx_process_input($sAction);
$aResult = array('code' => 1, 'message' => _t('_adm_pgt_err_cannot_process_action'));
switch ($sAction) {
case 'get-page-by-type':
$sValue = bx_process_input(bx_get('pgt_value'));
if (empty($sValue)) {
break;
}
$this->sPage = $sValue;
$aResult = array('code' => 0, 'content' => $this->getPageCode());
break;
}
echo json_encode($aResult);
exit;
}
}
示例15: authorize
protected function authorize()
{
if ($this->isAuthorized()) {
return true;
}
$oConsumer = $this->getServiceObject(false);
try {
$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) {
return $this->getRequestToken($oConsumer);
}
//--- Get access token.
if ($bToken && $mixedSecret !== false) {
return $this->getAccessToken(bx_get('oauth_token'), $mixedSecret, bx_get('oauth_verifier'), (int) bx_get('oauth_user'), $oConsumer);
}
} catch (OAuthException $e) {
return $this->getRequestToken();
}
return $this->getRequestToken();
}