本文整理汇总了PHP中bx_alert函数的典型用法代码示例。如果您正苦于以下问题:PHP bx_alert函数的具体用法?PHP bx_alert怎么用?PHP bx_alert使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bx_alert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: serviceLoginForm
public function serviceLoginForm($sParams = '', $sForceRelocate = '')
{
if (isLogged()) {
return false;
}
// get all auth types
$aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
// define additional auth types
if ($aAuthTypes) {
$aAddInputEl[''] = _t('_Basic');
// procces all additional menu's items
foreach ($aAuthTypes as $iKey => $aItems) {
$aAddInputEl[$aItems['Link']] = _t($aItems['Title']);
}
$aAuthTypes = array('type' => 'select', 'caption' => _t('_Auth type'), 'values' => $aAddInputEl, 'value' => '', 'attrs' => array('onchange' => 'if (this.value) { location.href = "' . BX_DOL_URL_ROOT . '" + this.value }'));
} else {
$aAuthTypes = array('type' => 'hidden');
}
$oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
$sCustomHtmlBefore = '';
$sCustomHtmlAfter = '';
bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
$oForm->aInputs['relocate']['value'] = $sForceRelocate;
} elseif ('homepage' == $sForceRelocate) {
$oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
}
$sFormCode = $oForm->getCode();
$sJoinText = '';
if (strpos($sParams, 'no_join_text') === false) {
$sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div>' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
}
BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
return $sCustomHtmlBefore . $sFormCode . $sCustomHtmlAfter . $sJoinText;
}
示例2: 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;
}
示例3: serviceLoginForm
public function serviceLoginForm($sParams = '', $sForceRelocate = '')
{
if (isLogged()) {
return false;
}
// get all auth types
$aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
$oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
$sCustomHtmlBefore = '';
$sCustomHtmlAfter = '';
bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
$oForm->aInputs['relocate']['value'] = $sForceRelocate;
} elseif ('homepage' == $sForceRelocate) {
$oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
}
$sFormCode = $oForm->getCode();
$sJoinText = '';
if (strpos($sParams, 'no_join_text') === false) {
$sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div class="bx-def-font-align-center">' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
}
BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
$sAuth = $this->serviceMemberAuthCode($aAuthTypes);
return $sCustomHtmlBefore . $sAuth . $sFormCode . $sCustomHtmlAfter . $sJoinText;
}
示例4: finish
protected function finish()
{
bx_alert('system', 'pruning', 0);
if (!($sOutput = ob_get_clean())) {
return;
}
$aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('t_Pruning', array('pruning_output' => $sOutput, 'site_title' => getParam('site_title')), 0, 0);
if ($aTemplate) {
sendMail(getParam('site_email'), $aTemplate['Subject'], $aTemplate['Body'], 0, array(), BX_EMAIL_NOTIFY);
}
}
示例5: isValid
function isValid()
{
if (!parent::isValid()) {
return false;
}
$sErrorMsg = '';
bx_alert('account', 'check_join', 0, false, array('error_msg' => &$sErrorMsg, 'email' => $this->getCleanValue('email'), 'approve' => &$this->_bSetPendingApproval));
if ($sErrorMsg) {
$this->_setCustomError($sErrorMsg);
}
return $sErrorMsg ? false : true;
}
示例6: deleteData
public function deleteData($iContentId, $aContentInfo = false, $oProfile = null, $oForm = null)
{
$CNF =& $this->_oModule->_oConfig->CNF;
if ($sErrorMsg = $this->_oModule->deleteConvoForever($iContentId)) {
return $sErrorMsg;
}
if ($sResult = $this->onDataDeleteAfter($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $oProfile)) {
return $sResult;
}
// create an alert
bx_alert($this->_oModule->getName(), 'deleted', $aContentInfo[$CNF['FIELD_ID']]);
return '';
}
示例7: insert
public function insert($aValsToAdd = array(), $isIgnore = false)
{
$aValsToAdd['last_reply_timestamp'] = time();
$aValsToAdd['last_reply_profile_id'] = bx_get_logged_profile_id();
$bSaveToDrafts = bx_get('draft_save');
$iContentId = bx_get('draft_id');
$bDraft = $iContentId ? BX_CNV_FOLDER_DRAFTS == $this->_oModule->_oDb->getConversationFolder($iContentId, bx_get_logged_profile_id()) : false;
if ($iContentId) {
if (!$bDraft) {
return 0;
}
if (!parent::update($iContentId, $aValsToAdd, $isIgnore)) {
return 0;
}
} else {
$iContentId = parent::insert($aValsToAdd, $isIgnore);
if (!$iContentId) {
return 0;
}
}
if ($bSaveToDrafts) {
if (!$bDraft) {
$this->_oModule->_oDb->conversationToFolder($iContentId, BX_CNV_FOLDER_DRAFTS, bx_get_logged_profile_id(), 0);
}
// draft is saved via ajax call only, upon successfull draft saving content id is returned
echo $iContentId;
exit;
} else {
bx_import('BxDolProfile');
// check for spam
$bSpam = false;
bx_alert('system', 'check_spam', 0, getLoggedId(), array('is_spam' => &$bSpam, 'content' => $this->getCleanValue('text'), 'where' => $this->MODULE));
$iFolder = $bSpam ? BX_CNV_FOLDER_SPAM : BX_CNV_FOLDER_INBOX;
// place conversation to "inbox" (or "spam" - in case of spam) folder
$aRecipients = array_unique(array_merge($this->getCleanValue('recipients'), array(bx_get_logged_profile_id())), SORT_NUMERIC);
foreach ($aRecipients as $iProfile) {
$oProfile = BxDolProfile::getInstance($iProfile);
if (!$oProfile) {
continue;
}
if ($bDraft && $oProfile->id() == bx_get_logged_profile_id()) {
$this->_oModule->_oDb->moveConvo($iContentId, $oProfile->id(), $iFolder);
} else {
$this->_oModule->_oDb->conversationToFolder($iContentId, $iFolder, $oProfile->id(), $oProfile->id() == bx_get_logged_profile_id() ? 0 : -1);
}
}
}
return $iContentId;
}
示例8: onProfileCreated
public function onProfileCreated($sProfileId, $sToken)
{
if (empty($sProfileId) || empty($sToken)) {
return;
}
$sSid = encryptUserPwd($sProfileId, genRndSalt());
$this->_oModule->_oDb->updatePaymentDetails(array('profile_id' => $sProfileId, 'profile_sid' => $sSid), array('token' => $sToken));
$aAccount = $this->_oModule->_oDb->getAccount(array('type' => 'profile_id', 'value' => $sProfileId));
if (!empty($aAccount) && is_array($aAccount)) {
$this->_oModule->_oDb->updateAccount(array('status' => BX_SITES_ACCOUNT_STATUS_PENDING), array('id' => $aAccount['id']));
// perform action
$this->_oModule->isAllowedAdd(true);
// alert
bx_alert($this->_oModule->getName(), 'added', $aAccount['id']);
}
}
示例9: onDataAddAfter
protected function onDataAddAfter($iContentId)
{
$CNF =& $this->_oModule->_oConfig->CNF;
// add account and content association
$iProfileId = BxDolProfile::add(BX_PROFILE_ACTION_MANUAL, getLoggedId(), $iContentId, BX_PROFILE_STATUS_PENDING, $this->_oModule->getName());
$oProfile = BxDolProfile::getInstance($iProfileId);
// approve profile if auto-approval is enabled and profile status is 'pending'
$sStatus = $oProfile->getStatus();
$isAutoApprove = getParam($CNF['PARAM_AUTOAPPROVAL']) ? true : false;
if ($sStatus == BX_PROFILE_STATUS_PENDING && $isAutoApprove) {
$oProfile->approve(BX_PROFILE_ACTION_AUTO);
}
// set created profile some default membership
bx_import('BxDolAcl');
$iAclLevel = isAdmin() ? MEMBERSHIP_ID_ADMINISTRATOR : getParam($CNF['PARAM_DEFAULT_ACL_LEVEL']);
BxDolAcl::getInstance()->setMembership($iProfileId, $iAclLevel, 0, true);
// alert
bx_alert($this->_oModule->getName(), 'added', $iContentId);
// switch context to the created profile
bx_import('BxDolAccount');
$oAccount = BxDolAccount::getInstance();
$oAccount->updateProfileContext($iProfileId);
return '';
}
示例10: _editAccountForm
protected function _editAccountForm($iAccountId, $sDisplayName)
{
$oAccount = BxDolAccount::getInstance($iAccountId);
$aAccountInfo = $oAccount ? $oAccount->getInfo() : false;
if (!$aAccountInfo) {
return MsgBox(_t('_sys_txt_error_account_is_not_defined'));
}
// check access
if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = BxDolAccount::isAllowedEdit($this->_iProfileId, $aAccountInfo))) {
return MsgBox($sMsg);
}
// check and display form
$oForm = BxDolForm::getObjectInstance('sys_account', $sDisplayName);
if (!$oForm) {
return MsgBox(_t('_sys_txt_error_occured'));
}
if (!$oForm->isSubmitted()) {
unset($aAccountInfo['password']);
}
$oForm->initChecker($aAccountInfo);
if (!$oForm->isSubmittedAndValid()) {
return $oForm->getCode();
}
$aTrackTextFieldsChanges = array();
// track text fields changes, not-null(for example empty array) - means track, null - means don't track
// update email and email setting in DB
if (!$oForm->update($aAccountInfo['id'], array(), $aTrackTextFieldsChanges)) {
if (!$oForm->isValid()) {
return $oForm->getCode();
} else {
return MsgBox(_t('_sys_txt_error_account_update'));
}
}
// check if email was changed
if (!empty($aTrackTextFieldsChanges['changed_fields']) && in_array('email', $aTrackTextFieldsChanges['changed_fields'])) {
$oAccount->updateEmailConfirmed(false);
}
// mark email as unconfirmed
// check if password was changed
if ($oForm->getCleanValue('password')) {
// relogin with new password
bx_logout();
bx_login($aAccountInfo['id']);
}
// check if other text info was changed - if auto-appproval is off
$isAutoApprove = $oForm->isSetPendingApproval() ? false : true;
if (!$isAutoApprove) {
bx_import('BxDolProfile');
$oProfile = BxDolProfile::getInstanceAccountProfile($aAccountInfo['id']);
// get profile associated with account, not current porfile
$aProfileInfo = $oProfile->getInfo();
unset($aTrackTextFieldsChanges['changed_fields']['email']);
// email confirmation is automatic and separate, don't need to deactivate whole profile if email is changed
if (BX_PROFILE_STATUS_ACTIVE == $aProfileInfo['status'] && !empty($aTrackTextFieldsChanges['changed_fields'])) {
$oProfile->disapprove(BX_PROFILE_ACTION_AUTO);
}
// change profile to 'pending' only if some text fields were changed and profile is active
}
// create an alert
bx_alert('account', 'edited', $aAccountInfo['id'], $aAccountInfo['id'], array('display' => $sDisplayName));
// display result message
$sMsg = MsgBox(_t('_sys_txt_data_successfully_submitted'));
return $sMsg . $oForm->getCode();
}
示例11: deleteDataForm
public function deleteDataForm($iContentId, $sDisplay = false)
{
$CNF =& $this->_oModule->_oConfig->CNF;
if (false === $sDisplay) {
$sDisplay = $CNF['OBJECT_FORM_ENTRY_DISPLAY_DELETE'];
}
// get content data and profile info
list($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
if (!$aContentInfo) {
return MsgBox(_t('_sys_txt_error_entry_is_not_defined'));
}
// check access
if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedDelete($aContentInfo))) {
return MsgBox($sMsg);
}
// check and display form
$oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sDisplay);
if (!$oForm) {
return MsgBox(_t('_sys_txt_error_occured'));
}
$oForm->initChecker($aContentInfo);
if (!$oForm->isSubmittedAndValid()) {
return $oForm->getCode();
}
if (!$oForm->delete($aContentInfo[$CNF['FIELD_ID']], $aContentInfo)) {
return MsgBox(_t('_sys_txt_error_entry_delete'));
}
$sResult = $this->onDataDeleteAfter($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $oProfile);
if ($sResult) {
return $sResult;
}
// perform action
$this->_oModule->checkAllowedDelete($aContentInfo, true);
// create an alert
bx_alert($this->_oModule->getName(), 'deleted', $aContentInfo[$CNF['FIELD_ID']]);
// redirect
bx_import('BxDolPermalinks');
$this->_redirectAndExit($CNF['URL_HOME'], true, array('account_id' => $oProfile->getAccountId(), 'profile_id' => $oProfile->id()));
}
示例12: deleteDataForm
/**
* @return delete data html
*/
public function deleteDataForm($aAccount, $sDisplay = 'bx_sites_site_delete')
{
$sMsg = $this->_oModule->isAllowedDelete($aAccount);
if ($sMsg !== CHECK_ACTION_RESULT_ALLOWED) {
return MsgBox($sMsg);
}
// check and display form
$oForm = BxDolForm::getObjectInstance('bx_sites', $sDisplay);
if (!$oForm) {
return MsgBox(_t('_sys_txt_error_occured'));
}
$oForm->initChecker($aAccount);
if (!$oForm->isSubmittedAndValid()) {
return $oForm->getCode();
}
if (!$oForm->delete($aAccount['id'], $aAccount)) {
return MsgBox(_t('_bx_sites_txt_err_site_delete'));
}
//delete payment details and history
if (!empty($aAccount['id'])) {
$this->_oModule->_oDb->deletePaymentDetails(array('account_id' => $aAccount['id']));
$this->_oModule->_oDb->deletePaymentHistory(array('account_id' => $aAccount['id']));
}
// cancel subscription
if (!empty($aAccount['pd_profile_id'])) {
bx_import('Paypal', $this->_oModule->_aModule);
$oPaypal = new BxSitesPaypal($this->_oModule);
$oPaypal->performAction($aAccount['pd_profile_id']);
}
// perform action
$this->_oModule->isAllowedDelete($aAccount, true);
// create an alert
bx_alert($this->_oModule->getName(), 'deleted', $aAccount['id']);
// redirect
$this->_redirectAndExit('page.php?i=sites-home');
}
示例13: disable
public function disable($aParams)
{
$bHtmlResponce = isset($aParams['html_response']) && (bool) $aParams['html_response'];
$aModule = $this->oDb->getModuleByUri($this->_aConfig['home_uri']);
//--- Check whether the module is installed ---//
if (empty($aModule) || !is_array($aModule)) {
return array('message' => _t('_adm_err_modules_module_not_installed'), 'result' => false);
}
//--- Check whether the module is already disabled ---//
if ((int) $aModule['enabled'] == 0) {
return array('message' => _t('_adm_err_modules_already_disabled'), 'result' => false);
}
$aResult = array();
bx_alert('system', 'before_disable', 0, false, array('config' => $this->_aConfig, 'result' => &$aResult));
if ($aResult && !$aResult['result']) {
return $aResult;
}
//--- Check for dependent modules ---//
$bDependent = false;
$aDependents = $this->oDb->getDependent($this->_aConfig['home_uri']);
if (is_array($aDependents) && !empty($aDependents)) {
$bDependent = true;
$sMessage = '<br />' . _t('_adm_err_modules_wrong_dependency_disable') . '<br />';
foreach ($aDependents as $aDependent) {
$sMessage .= $aDependent['title'] . '<br />';
}
}
if ($bDependent) {
return array('message' => $this->_displayResult('check_dependencies', false, $sMessage, $bHtmlResponce), 'result' => false);
}
$aResult = $this->_perform('disable', $aParams);
if ($aResult['result']) {
$this->oDb->disableModuleByUri($aModule['uri']);
$this->oDb->cleanMemory('sys_modules_' . $aModule['uri']);
$this->oDb->cleanMemory('sys_modules_' . $aModule['id']);
$this->oDb->cleanMemory('sys_modules');
if (!empty($this->_aConfig['disable_success'])) {
$this->_perform('disable_success', $aParams);
}
} else {
if (!empty($this->_aConfig['disable_failed'])) {
$this->_perform('disable_failed', $aParams);
}
}
bx_alert('system', 'disable', 0, false, array('config' => $this->_aConfig, 'result' => &$aResult));
return $aResult;
}
示例14: generateUserNewPwd
/**
* Generate new password.
*/
protected function generateUserNewPwd($iAccountId)
{
$sPwd = genRndPwd();
$sSalt = genRndSalt();
$sPasswordHash = encryptUserPwd($sPwd, $sSalt);
$this->_oAccountQuery->updatePassword($sPasswordHash, $sSalt, $iAccountId);
bx_alert('account', 'edit', $iAccountId, $iAccountId, array('action' => 'forgot_password'));
return $sPwd;
}
示例15: bx_check_password
/**
* Check unencrypted password
* @return empty string on success or error string on error
*/
function bx_check_password($sLogin, $sPassword, $iRole = BX_DOL_ROLE_MEMBER)
{
bx_import('BxDolAccount');
$oAccount = BxDolAccount::getInstance($sLogin);
if (!$oAccount) {
bx_import('BxDolLanguages');
return _t("_sys_txt_login_error");
}
$aAccountInfo = $oAccount->getInfo();
$sPassCheck = encryptUserPwd($sPassword, $aAccountInfo['salt']);
if ($sErrorMsg = bx_check_login($aAccountInfo['id'], $sPassCheck, $iRole)) {
return $sErrorMsg;
}
// Admin can always login even if he is blocked/banned/suspended/etc
if (isAdmin($aAccountInfo['id'])) {
return '';
}
$sErrorMsg = '';
bx_alert('account', 'check_login', $aAccountInfo['id'], false, array('error_msg' => &$sErrorMsg));
return $sErrorMsg;
}