本文整理汇总了PHP中bx_get_logged_profile_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bx_get_logged_profile_id函数的具体用法?PHP bx_get_logged_profile_id怎么用?PHP bx_get_logged_profile_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bx_get_logged_profile_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
$sMsg = $this->_oModule->isAllowedAdd();
if ($sMsg !== CHECK_ACTION_RESULT_ALLOWED) {
$this->_echoResultJson(array('msg' => $sMsg), true);
return;
}
$oForm = BxDolForm::getObjectInstance('bx_sites', 'bx_sites_site_add');
if (!$oForm) {
$this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
return;
}
$oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
$oForm->initChecker();
if (!$oForm->isSubmittedAndValid()) {
$sContent = BxTemplFunctions::getInstance()->popupBox('bx-sites-site-create-popup', _t('_bx_sites_grid_browse_popup_create'), $this->_oModule->_oTemplate->parseHtmlByName('block_create.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
return;
}
$sDomain = $oForm->getCleanValue('domain');
if ($this->_oModule->_oDb->isAccount(array('domain' => $sDomain))) {
$this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_exists')), true);
return;
}
$iAccountId = $oForm->insert(array('owner_id' => bx_get_logged_profile_id(), 'created' => time(), 'status' => BX_SITES_ACCOUNT_STATUS_UNCONFIRMED));
if (!$iAccountId) {
$this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_creation')), true);
return;
}
$oAccount = $this->_oModule->getObject('Account');
$oAccount->onAccountCreated($iAccountId);
$sUrl = $this->_oModule->startSubscription($iAccountId);
$this->_echoResultJson(array('eval' => 'window.open(\'' . $sUrl . '\', \'_self\');', 'popup_not_hide' => 1), true);
}
示例2: createAccountForm
public function createAccountForm()
{
// check access
if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = BxDolAccount::isAllowedCreate(0))) {
return MsgBox($sMsg);
}
// check and display form
$oForm = $this->getObjectFormAdd();
if (!$oForm) {
return MsgBox(_t('_sys_txt_error_occured'));
}
$oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account');
$oForm->initChecker(self::$PROFILE_FIELDS);
if (!$oForm->isSubmittedAndValid()) {
$sCode = $oForm->getCode();
bx_alert('account', 'add_form', 0, 0, array('form_object' => &$oForm, 'form_code' => &$sCode));
return $sCode;
}
// insert data into database
$aValsToAdd = array('email_confirmed' => 0);
$iAccountId = $oForm->insert($aValsToAdd);
if (!$iAccountId) {
if (!$oForm->isValid()) {
return $oForm->getCode();
} else {
return MsgBox(_t('_sys_txt_error_account_creation'));
}
}
$iProfileId = $this->onAccountCreated($iAccountId, $oForm->isSetPendingApproval());
// perform action
BxDolAccount::isAllowedCreate($iProfileId, true);
$this->_iProfileId = bx_get_logged_profile_id();
// redirect
$this->_redirectAndExit(getParam('sys_redirect_after_account_added'), true, array('account_id' => $iAccountId, 'profile_id' => $iProfileId));
}
示例3: addDataForm
/**
* @return add data html
*/
public function addDataForm()
{
$sMsg = $this->_oModule->isAllowedAdd();
if ($sMsg !== CHECK_ACTION_RESULT_ALLOWED) {
return MsgBox($sMsg);
}
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance('bx_sites', 'bx_sites_site_add');
if (!$oForm) {
return MsgBox(_t('_sys_txt_error_occured'));
}
unset($oForm->aInputs['submit_block'][1]);
$oForm->initChecker();
if (!$oForm->isSubmittedAndValid()) {
return $oForm->getCode();
}
$sDomain = $oForm->getCleanValue('domain');
if ($this->_oModule->_oDb->isAccount(array('domain' => $sDomain))) {
return MsgBox(_t('_bx_sites_txt_err_site_exists'));
}
$iAccountId = $oForm->insert(array('owner_id' => bx_get_logged_profile_id(), 'created' => time(), 'status' => BX_SITES_ACCOUNT_STATUS_UNCONFIRMED));
if (!$iAccountId) {
return MsgBox(_t('_bx_sites_txt_err_site_creation'));
}
$oAccount = $this->_oModule->getObject('Account');
$oAccount->onAccountCreated($iAccountId);
$sUrl = $this->_oModule->startSubscription($iAccountId);
header('Location: ' . $sUrl);
exit;
}
示例4: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$CNF = $this->_oModule->_oConfig->CNF;
$iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
$iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
if ($iProfileId) {
$this->_oProfile = BxDolProfile::getInstance($iProfileId);
}
if (!$this->_oProfile && $iContentId) {
$this->_oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->MODULE);
}
if ($this->_oProfile) {
$this->_aProfileInfo = $this->_oProfile->getInfo();
$this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_aProfileInfo['content_id']);
$this->addMarkers($this->_aProfileInfo);
$this->addMarkers(array('profile_id' => $this->_oProfile->id()));
if (isLogged()) {
$oConn = BxDolConnection::getObjectInstance('sys_profiles_friends');
if ($oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $this->_oProfile->id())) {
$this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend_sent']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend_cancel_request'])));
} elseif ($oConn->isConnectedNotMutual($this->_oProfile->id(), bx_get_logged_profile_id())) {
$this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend_confirm']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend_reject_request'])));
} else {
$this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend'])));
}
}
}
}
示例5: _delete
protected function _delete($mixedId)
{
$oModule = BxDolModule::getInstance($this->MODULE);
if ($sErrorMsg = $oModule->deleteConvo($mixedId)) {
return false;
}
return $oModule->_oDb->moveConvo((int) $mixedId, bx_get_logged_profile_id(), BX_CNV_FOLDER_TRASH);
}
示例6: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$CNF =& $this->_oModule->_oConfig->CNF;
$aInformers = array();
// get profile info
$iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
$iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
if ($iProfileId) {
$this->_oProfile = BxDolProfile::getInstance($iProfileId);
}
if (!$this->_oProfile && $iContentId) {
$this->_oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->MODULE);
}
if ($this->_oProfile) {
$this->_aProfileInfo = $this->_oProfile->getInfo();
$this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_aProfileInfo['content_id']);
}
if (!$this->_aContentInfo || !$this->_oProfile) {
return;
}
// select view profile submenu
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
$oMenuSubmenu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], array('title' => $this->_oProfile->getDisplayName(), 'link' => $this->_oProfile->getUrl(), 'icon' => $CNF['ICON']));
// add replaceable markers
$this->addMarkers($this->_aProfileInfo);
// every content field can be used as marker
$this->addMarkers(array('profile_id' => $this->_oProfile->id()));
// profile id field
$this->addMarkers(array('display_name' => $this->_oProfile->getDisplayName()));
// profile display name
$this->addMarkers(array('profile_link' => $this->_oProfile->getUrl()));
// profile link
// display message if profile isn't active
if (bx_get_logged_profile_id() == $this->_oProfile->id() && !empty($CNF['INFORMERS']['status'])) {
$sStatus = $this->_aContentInfo['profile_status'];
if (isset($CNF['INFORMERS']['status']['map'][$sStatus])) {
$aInformers[] = array('name' => $CNF['INFORMERS']['status']['name'], 'msg' => _t($CNF['INFORMERS']['status']['map'][$sStatus]), 'type' => BX_INFORMER_ALERT);
}
}
// display message if it is possible to switch to this profile
$oProfile = $this->_aContentInfo ? BxDolProfile::getInstanceByContentTypeAccount($this->_aContentInfo['id'], $this->MODULE) : false;
if ($oProfile) {
$oProfile->checkSwitchToProfile($this->_oTemplate);
}
// add informers
if ($aInformers) {
$oInformer = BxDolInformer::getInstance($this->_oTemplate);
if ($oInformer) {
foreach ($aInformers as $a) {
$oInformer->add($a['name'], $this->_replaceMarkers($a['msg']), $a['type']);
}
}
}
}
示例7: createAccountForm
public function createAccountForm()
{
// check access
if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = BxDolAccount::isAllowedCreate(0))) {
return MsgBox($sMsg);
}
// check and display form
$oForm = BxDolForm::getObjectInstance('sys_account', 'sys_account_create');
if (!$oForm) {
return MsgBox(_t('_sys_txt_error_occured'));
}
$oForm->initChecker();
if (!$oForm->isSubmittedAndValid()) {
$sCode = $oForm->getCode();
bx_alert('account', 'add_form', 0, 0, array('form_object' => &$oForm, 'form_code' => &$sCode));
return $sCode;
}
// insert data into database
$aValsToAdd = array('email_confirmed' => 0);
$iAccountId = $oForm->insert($aValsToAdd);
if (!$iAccountId) {
if (!$oForm->isValid()) {
return $oForm->getCode();
} else {
return MsgBox(_t('_sys_txt_error_account_creation'));
}
}
// alert
bx_alert('account', 'add', $iAccountId, 0);
// if email_confirmation procedure is enabled - send email confirmation letter
$oAccount = BxDolAccount::getInstance($iAccountId);
if (getParam('sys_email_confirmation') && $oAccount && !$oAccount->isConfirmed()) {
$oAccount->sendConfirmationEmail($iAccountId);
}
// add account and content association
bx_import('BxDolProfile');
$iProfileId = BxDolProfile::add(BX_PROFILE_ACTION_MANUAL, $iAccountId, $iAccountId, BX_PROFILE_STATUS_PENDING, 'system');
$oProfile = BxDolProfile::getInstance($iProfileId);
// approve profile if auto-approval is enabled and profile status is 'pending'
$sStatus = $oProfile->getStatus();
$isAutoApprove = $oForm->isSetPendingApproval() ? false : true;
if ($sStatus == BX_PROFILE_STATUS_PENDING && $isAutoApprove) {
$oProfile->approve(BX_PROFILE_ACTION_AUTO);
}
// perform action
BxDolAccount::isAllowedCreate($iProfileId, true);
// alert
bx_alert('account', 'added', $iAccountId);
// login to the created account automatically
bx_login($iAccountId);
$this->_iProfileId = bx_get_logged_profile_id();
// redirect
$this->_redirectAndExit(getParam('sys_redirect_after_account_added'), true, array('account_id' => $iAccountId, 'profile_id' => $iProfileId));
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->_oQuery = new BxDolLiveUpdatesQuery();
$this->_iInterval = (int) $this->_oQuery->getParam('sys_live_updates_interval');
$this->_iCacheTTL = 86400;
$this->_sCacheKey = 'sys_live_updates_' . bx_get_logged_profile_id();
$this->_sJsClass = 'BxDolLiveUpdates';
$this->_sJsObject = 'oLiveUpdates';
$this->_aSystemsActive = array();
$this->_aSystems = $this->_getCachedSystems();
}
示例9: insert
public function insert($aValsToAdd = array(), $isIgnore = false)
{
$CNF =& $this->_oModule->_oConfig->CNF;
if (isset($CNF['FIELD_AUTHOR']) && empty($aValsToAdd[$CNF['FIELD_AUTHOR']])) {
$aValsToAdd[$CNF['FIELD_AUTHOR']] = bx_get_logged_profile_id();
}
if (isset($CNF['FIELD_ADDED']) && empty($aValsToAdd[$CNF['FIELD_ADDED']])) {
$aValsToAdd[$CNF['FIELD_ADDED']] = time();
}
if (isset($CNF['FIELD_CHANGED']) && empty($aValsToAdd[$CNF['FIELD_CHANGED']])) {
$aValsToAdd[$CNF['FIELD_CHANGED']] = time();
}
return parent::insert($aValsToAdd, $isIgnore);
}
示例10: 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;
}
示例11: isEnabled
/**
* Comments are enabled for collaborators only
*/
public function isEnabled()
{
if (!parent::isEnabled()) {
return false;
}
$oModule = BxDolModule::getInstance('bx_convos');
if (!$oModule->_oDb->getContentInfoById((int) $this->getId())) {
return false;
}
$aCollaborators = $oModule->_oDb->getCollaborators((int) $this->getId());
if (!isset($aCollaborators[bx_get_logged_profile_id()])) {
return false;
}
return true;
}
示例12: __construct
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'));
}
示例13: serviceGetUnconfirmedConnectionsNum
/**
* get number of received unconfirmed connections (friend requests)
* @param $sConnectionsObject connections object to get unconfirmed connections from
* @param $mixedId id to get connections for, if omitted then logged-in profile id is used
* @return number
*/
public function serviceGetUnconfirmedConnectionsNum($sConnectionsObject, $mixedId = 0)
{
$oConnection = BxDolConnection::getObjectInstance($sConnectionsObject);
if (!$oConnection) {
return 0;
}
if (!$mixedId) {
$mixedId = bx_get_logged_profile_id();
}
$i = 0;
$a = $oConnection->getConnectedInitiators($mixedId, 0);
// get received friend requests
foreach ($a as $iId) {
if (BxDolProfile::getInstance($iId)) {
++$i;
}
}
return $i;
}
示例14: handleUploads
/**
* Handle uploads here.
* @param $mixedFiles as usual $_FILES['some_name'] array, but maybe some other params depending on the uploader
* @return nothing, but if some files failed to upload, the actual error message can be determined by calling BxDolUploader::getUploadErrorMessages()
*/
public function handleUploads($iProfileId, $mixedFiles, $isMultiple = true, $iContentId = false, $bPrivate = true)
{
$oStorage = BxDolStorage::getObjectInstance($this->_sStorageObject);
$iProfileId = bx_get_logged_profile_id();
if (!$isMultiple) {
$this->cleanupGhostsForProfile($iProfileId, $iContentId);
}
if (bx_get('qqfile')) {
$iId = $oStorage->storeFileFromXhr(bx_get('qqfile'), $bPrivate, $iProfileId, $iContentId);
} else {
$iId = $oStorage->storeFileFromForm($_FILES['qqfile'], $bPrivate, $iProfileId, $iContentId);
}
if ($iId) {
$aResponse = array('success' => 1);
} else {
$this->appendUploadErrorMessage(_t('_sys_uploader_err_msg', isset($_FILES['qqfile']['name']) ? $_FILES['qqfile']['name'] : bx_get('qqfile'), $oStorage->getErrorString()));
$aResponse = array('error' => $this->getUploadErrorMessages());
}
echo htmlspecialchars(json_encode($aResponse), ENT_NOQUOTES);
}
示例15: getMenuItems
public function getMenuItems()
{
$a = parent::getMenuItems();
if (!isLogged()) {
return $a;
}
foreach ($a as $k => $r) {
if ('account' != $r['name']) {
continue;
}
$oProfile = BxDolProfile::getInstance(bx_get_logged_profile_id());
$sUrlIcon = $oProfile->getThumb();
if (!$sUrlIcon) {
break;
}
$a[$k]['bx_if:image'] = array('condition' => true, 'content' => array('icon_url' => $sUrlIcon));
$a[$k]['bx_if:icon']['condition'] = false;
}
return $a;
}