Exemplo n.º 1
0
 function getBlockCode_AccountControl()
 {
     global $oTemplConfig, $aPreValues;
     //Labels
     $sProfileStatusC = _t('_Profile status');
     $sPresenceC = _t('_Presence');
     $sMembershipC = _t('_Membership2');
     $sLastLoginC = _t('_Last login');
     $sRegistrationC = _t('_Registration');
     $sEmailC = _t('_Email');
     $sMembersC = ' ' . _t('_Members');
     $sProfileC = _t('_Profile');
     $sContentC = _t('_Content');
     //--- General Info block ---//
     $sProfileStatus = _t("__{$this->aMemberInfo['Status']}");
     $sProfileStatusMess = '';
     switch ($this->aMemberInfo['Status']) {
         case 'Unconfirmed':
             $sProfileStatusMess = _t("_ATT_UNCONFIRMED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
         case 'Approval':
             $sProfileStatusMess = _t("_ATT_APPROVAL", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
         case 'Active':
             $sProfileStatusMess = _t("_ATT_ACTIVE", $this->aMemberInfo['ID'], $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
         case 'Rejected':
             $sProfileStatusMess = _t("_ATT_REJECTED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
         case 'Suspended':
             $sProfileStatusMess = _t("_ATT_SUSPENDED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
             break;
     }
     $oForm = bx_instance('BxDolFormCheckerHelper');
     $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']);
     $sLastLogin = '******';
     if (!empty($this->aMemberInfo['DateLastLogin']) && $this->aMemberInfo['DateLastLogin'] != "0000-00-00 00:00:00") {
         $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']);
         $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE);
     }
     $sRegistration = 'never';
     if (!empty($this->aMemberInfo['DateReg']) && $this->aMemberInfo['DateReg'] != "0000-00-00 00:00:00") {
         $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']);
         $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE);
     }
     //--- Presence block ---//
     require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php';
     $oStatusView = new BxDolUserStatusView();
     $sUserStatus = $oStatusView->getMemberMenuStatuses();
     //--- Content block ---//
     $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID');
     $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type');
     $aCustomElements = array();
     foreach ($aAccountCustomStatElements as $iID => $aMemberStats) {
         $sUnparsedLabel = $aMemberStats['Label'];
         $sUnparsedValue = $aMemberStats['Value'];
         $sLabel = _t($sUnparsedLabel);
         $sUnparsedValue = str_replace('__site_url__', BX_DOL_URL_ROOT, $sUnparsedValue);
         //step 1 - replacements of keys
         $sLblTmpl = '__l_';
         $sTmpl = '__';
         while (($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) !== false) {
             $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
             if ($iEndPos <= $iStartPos) {
                 break;
             }
             $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos - $iStartPos - strlen($sLblTmpl));
             $sKeyValue = mb_strtolower(_t('_' . $sSubstr));
             $sUnparsedValue = str_replace($sLblTmpl . $sSubstr . $sTmpl, $sKeyValue, $sUnparsedValue);
         }
         //step 2 - replacements of Stat keys
         while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) !== false) {
             $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
             if ($iEndPos <= $iStartPos) {
                 break;
             }
             $iCustomCnt = 0;
             $sSubstr = process_db_input(substr($sUnparsedValue, $iStartPos + strlen($sTmpl), $iEndPos - $iStartPos - strlen($sTmpl)), BX_TAGS_STRIP);
             if ($sSubstr) {
                 $sCustomSQL = $aPQStatisticsElements[$sSubstr]['SQL'];
                 $sCustomSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sCustomSQL);
                 $sCustomSQL = str_replace('__profile_media_define_photo__', _t('_ProfilePhotos'), $sCustomSQL);
                 $sCustomSQL = str_replace('__profile_media_define_music__', _t('_ProfileMusic'), $sCustomSQL);
                 $sCustomSQL = str_replace('__profile_media_define_video__', _t('_ProfileVideos'), $sCustomSQL);
                 $sCustomSQL = str_replace('__member_nick__', process_db_input($this->aMemberInfo['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), $sCustomSQL);
                 $iCustomCnt = $sCustomSQL != '' ? (int) db_value($sCustomSQL) : '';
             }
             $sUnparsedValue = str_replace($sTmpl . $sSubstr . $sTmpl, $iCustomCnt, $sUnparsedValue);
         }
         $sTrimmedLabel = trim($sUnparsedLabel, '_');
         $aCustomElements[$sTrimmedLabel] = array('type' => 'custom', 'name' => $sTrimmedLabel, 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue, 'colspan' => true);
     }
     $aForm = array('form_attrs' => array('action' => '', 'method' => 'post'), 'params' => array('remove_form' => true), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sProfileC, 'collapsable' => true), 'Info' => array('type' => 'custom', 'name' => 'Info', 'content' => get_member_thumbnail($this->aMemberInfo['ID'], 'none', true), 'colspan' => true), 'Status' => array('type' => 'custom', 'name' => 'Status', 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . '<br />' . $sProfileStatusMess, 'colspan' => true), 'Email' => array('type' => 'custom', 'name' => 'Email', 'content' => '<b>' . $sEmailC . ':</b> ' . $this->aMemberInfo['Email'] . '<br />' . _t('_sys_txt_ac_manage_subscriptions'), 'colspan' => true), 'Membership' => array('type' => 'custom', 'name' => 'Membership', 'content' => '<b>' . $sMembershipC . ':</b> ' . $sMembStatus, 'colspan' => true), 'LastLogin' => array('type' => 'custom', 'name' => 'LastLogin', 'content' => '<b>' . $sLastLoginC . ':</b> ' . $sLastLogin, 'colspan' => true), 'Registration' => array('type' => 'custom', 'name' => 'Registration', 'content' => '<b>' . $sRegistrationC . ':</b> ' . $sRegistration, 'colspan' => true), 'header1_end' => array('type' => 'block_end'), 'header2' => array('type' => 'block_header', 'caption' => $sPresenceC, 'collapsable' => true, 'collapsed' => true, 'attrs' => array('id' => 'user_status_ac')), 'UserStatus' => array('type' => 'custom', 'name' => 'Info', 'content' => $sUserStatus, 'colspan' => true), 'header2_end' => array('type' => 'block_end')));
     //custom
     if (!empty($aCustomElements)) {
         $aForm['inputs'] = array_merge($aForm['inputs'], array('header5' => array('type' => 'block_header', 'caption' => $sContentC, 'collapsable' => true, 'collapsed' => true)), $aCustomElements, array('header5_end' => array('type' => 'block_end')));
     }
     $oForm = new BxTemplFormView($aForm);
     $sContent = $GLOBALS['oSysTemplate']->parseHtmlByName('member_account_control.html', array('content' => $oForm->getCode()));
     return array($sContent, array(), array(), false);
 }
Exemplo n.º 2
0
/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'tags.inc.php';
check_logged();
$iLoggedID = getLoggedId();
if (isset($_GET['action']) && $_GET['action'] == 'get_prof_status_mess') {
    if ($iLoggedID) {
        bx_import('BxDolUserStatusView');
        header('Content-Type: text/html; charset=utf-8');
        echo BxDolUserStatusView::getStatusPageLight($iLoggedID);
    }
    exit;
}
$sAction = bx_get('action');
if ($sAction !== false && $sAction == 'get_prof_comment_block') {
    $iProfileID = (int) bx_get('id');
    if ($iProfileID) {
        $sCloseC = _t('_Close');
        bx_import('BxTemplCmtsView');
        $oCmtsView = new BxTemplCmtsView('profile', $iProfileID);
        if (!$oCmtsView->isEnabled()) {
            exit;
        }
        $sCloseImg = getTemplateImage('close.gif');
        $sCaptionItem = <<<BLAH
 /**
  * Function will generate chat block for current member ;
  *
  * @param  : $iSender (integer)     - sender member's Id;
  * @return : (array);
  */
 function getChatBox($iSender)
 {
     global $oFunctions;
     $iSender = (int) $iSender;
     $oModuleDb = new BxDolModuleDb();
     $oUserStatus = new BxDolUserStatusView();
     $sMemberThumb = $oFunctions->getMemberThumbnail($iSender, 'none');
     $sMemberIcon = $oFunctions->getMemberIcon($iSender, 'none', false, '_plain');
     $aSenderInfo = getProfileInfo($iSender);
     $sSenderLink = getProfileLink($iSender);
     $sStatusIcon = $oUserStatus->getStatusIcon($iSender);
     // language keys;
     $aLanguageKeys = array('minimize' => _t('_simple_messenger_minimize_button'), 'close' => _t('_simple_messenger_close_button'), 'video_mess' => _t('_simple_messenger_switch_to_video'));
     // contain data for sender block;
     $aSenderBlock = array('sender_thumb' => $sMemberThumb, 'sender_link' => $sSenderLink, 'status_text' => $aSenderInfo['UserStatusMessage'], 'sender_nick' => getNickName($aSenderInfo['ID']), 'reduce_title' => $aLanguageKeys['minimize'], 'close_title' => $aLanguageKeys['close'], 'history_window_id' => $this->aCoreSettings['history_block_prefix'] . $iSender, 'sender_id' => $iSender, 'bx_if:video_messenger' => array('condition' => $oModuleDb->isModule('messenger'), 'content' => array('sender_id' => $this->iLoggedMemberId, 'sender_passw' => getPassword($this->iLoggedMemberId), 'recipient_id' => $iSender, 'video_messenger' => $aLanguageKeys['video_mess'])));
     $aMessagesList = $this->getMessagesHistory($this->iLoggedMemberId, $iSender, 0, false);
     // process nick name;
     $sNickName = getNickName($aSenderInfo['ID']);
     if (mb_strlen($sNickName) > $this->iMaxNickLength) {
         $sNickName = mb_substr($sNickName, 0, $this->iMaxNickLength) . '...';
     }
     $aTemplateKeys = array('block_indent' => $this->sMemberMenuPosition == 'bottom' ? 'bottom_indent' : 'top_indent', 'chat_block_position' => $this->sMemberMenuPosition == 'bottom' ? 'chat_block_bottom_position' : 'chat_block_top_position', 'sender_nick' => $sNickName, 'sender_icon' => $sMemberIcon, 'member_status' => $sStatusIcon, 'history_window_id' => $this->aCoreSettings['history_block_prefix'] . $iSender, 'history_block_position' => $this->sMemberMenuPosition == 'bottom' ? 'history_bottom_position' : 'history_top_position', 'recipient_id' => $iSender, 'bx_if:menu_pos_top' => array('condition' => $this->sMemberMenuPosition == 'bottom', 'content' => $aSenderBlock), 'bx_if:menu_pos_bottom' => array('condition' => $this->sMemberMenuPosition != 'bottom', 'content' => $aSenderBlock), 'messages' => $aMessagesList['messages_list']);
     // generate the chat box's content;
     $sOutputCode = $this->_oTemplate->parseHtmlByName('chat_block.html', $aTemplateKeys);
     $aRetArray = array('chat_box' => $sOutputCode, 'last_message' => $aMessagesList['last_message'], 'count_messages' => $aMessagesList['count_messages']);
     return $aRetArray;
 }
Exemplo n.º 4
0
<?php

/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'params.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
bx_import('BxDolPrivacy');
bx_import('BxDolUserStatusView');
bx_import('BxDolSubscription');
$iMemberId = getLoggedId();
if (!isset($_GET['ID']) && !(int) $_GET['ID']) {
    exit;
}
$iProfId = (int) $_GET['ID'];
$aProfileInfo = getProfileInfo($iProfId);
$sProfLink = '<a href="' . getProfileLink($iProfId) . '">' . getNickName($aProfileInfo['ID']) . '</a> ';
$oUserStatus = new BxDolUserStatusView();
$sUserIcon = $oUserStatus->getStatusIcon($iProfId);
$sUserStatus = $oUserStatus->getStatus($iProfId);
$aUnit = array('status_icon' => $sUserIcon, 'profile_status' => _t('_prof_status', $sProfLink, $sUserStatus), 'profile_status_message' => $aProfileInfo['status_message'], 'profile_actions' => $oFunctions->getProfileViewActions($iProfId, true));
header('Content-type:text/html;charset=utf-8');
echo $oFunctions->transBox($oSysTemplate->parseHtmlByName('short_profile_info.html', $aUnit) . $sAddon);
Exemplo n.º 5
0
        $aProfileInfo['cpt_unblock'] = _t('_Unblock');
    } else {
        $aProfileInfo['cpt_edit'] = '';
        $aProfileInfo['cpt_send_letter'] = '';
        $aProfileInfo['cpt_fave'] = '';
        $aProfileInfo['cpt_befriend'] = '';
        $aProfileInfo['cpt_remove_friend'] = '';
        $aProfileInfo['cpt_greet'] = '';
        $aProfileInfo['cpt_get_mail'] = '';
        $aProfileInfo['cpt_share'] = '';
        $aProfileInfo['cpt_report'] = '';
        $aProfileInfo['cpt_block'] = '';
        $aProfileInfo['cpt_unblock'] = '';
    }
    $sProfLink = '<a href="' . getProfileLink($iProfId) . '">' . $aProfileInfo['NickName'] . '</a> ';
    $oUserStatus = new BxDolUserStatusView();
    $sUserIcon = $oUserStatus->getStatusIcon($iProfId, $aProfileInfo['UserStatus']);
    $sUserStatus = $oUserStatus->getStatus($iProfId);
    $aUnit = array('status_pic' => getTemplateIcon($sUserIcon), 'profile_status' => _t('_prof_status', $sProfLink, $sUserStatus), 'profile_status_message' => $aProfileInfo['status_message'], 'profile_actions' => $oFunctions->genObjectsActions($aProfileInfo, 'Profile'), 'bx_if:profile_status_cond' => array('condition' => $aProfileInfo['status'] == 'online', 'content' => array('chat_invite' => $sChat)));
    $sCloseIcon = getTemplateIcon('reduce.png');
    ob_start();
    ?>
        <div class="reduce">
            <img src="<?php 
    echo $sCloseIcon;
    ?>
" class="login_ajx_close" />
        </div>
    <?php 
    $sClose = ob_get_clean();
    $sClose = str_replace('__site_images__', $site['images'], $sClose);
Exemplo n.º 6
0
 /**
  * Parse member menu structure
  *
  * @param $aMemberInfo    array
  * @param $aMenuStructure array
  * @return text
  */
 function _parseStructure($aMemberInfo, $aMenuStructure)
 {
     global $oSysTemplate, $oFunctions;
     if (!$aMenuStructure) {
         return;
     }
     $oCache = $this->getCacheObject();
     $oPermalinks = new BxDolPermalinks();
     $aReplaced = $aDefinedMenuItems = array();
     $memberID = $aMemberInfo['ID'];
     $iIndex = 0;
     $sStartPosition = '';
     //-- process menu structure --//
     $aDefinedMenuItems = $oCache->getData($this->getCacheKey($aMemberInfo['ID']), $this->iKeysFileTTL);
     if (!$aDefinedMenuItems) {
         foreach ($aMenuStructure as $sPosition => $aMenuItems) {
             foreach ($aMenuItems as $iKey => $aItems) {
                 $isSkipItem = false;
                 foreach ($aItems as $sMenuKey => $sValue) {
                     if ($sMenuKey != 'PopupMenu' && $sMenuKey != 'linked_items') {
                         if ($sMenuKey == 'Caption') {
                             $aReplaced[$sPosition][$iKey][$sMenuKey] = $oFunctions->markerReplace($aMemberInfo, $sValue, $aItems['Eval'], true);
                         } else {
                             $aReplaced[$sPosition][$iKey][$sMenuKey] = $oFunctions->markerReplace($aMemberInfo, $sValue, $aItems['Eval']);
                         }
                     } else {
                         $aReplaced[$sPosition][$iKey][$sMenuKey] = $sValue;
                     }
                 }
                 if ($sStartPosition != $sPosition) {
                     $iIndex = 0;
                     $sStartPosition = $sPosition;
                 }
                 //-- process next --//
                 // collect the link;
                 if ($aReplaced[$sPosition][$iKey]['Type'] == 'link' && $aReplaced[$sPosition][$iKey]['Caption'] && ($aReplaced[$sPosition][$iKey]['Link'] || $aReplaced[$sPosition][$iKey]['Script'])) {
                     $sMenuClass = $sPosition == 'top_extra' ? 'extra_item' : '';
                     $sPartCaption = $aReplaced[$sPosition][$iKey]['Caption'];
                     //define some settings for "Add Content"
                     if ($aReplaced[$sPosition][$iKey]['Name'] == 'AddContent') {
                         $sMenuClass .= ' extra_item_add_content';
                     }
                     //define some settings for "Member block" ;
                     if ($aReplaced[$sPosition][$iKey]['Name'] == 'MemberBlock') {
                         $oUserStatus = new BxDolUserStatusView();
                         $sUserThumbnail = $GLOBALS['oFunctions']->getMemberAvatar($aMemberInfo['ID'], 'small');
                         $sUserThumbnailDouble = $GLOBALS['oFunctions']->getMemberAvatar($aMemberInfo['ID'], 'small', true);
                         if (empty($sUserThumbnailDouble)) {
                             $sUserThumbnailDouble = $sUserThumbnail;
                         }
                         $bUserThumbnail = !empty($sUserThumbnail);
                         $sMenuImage = $GLOBALS['oSysTemplate']->parseHtmlByName('member_menu_thumbnail.html', array('bx_if:show_thumbnail_image' => array('condition' => $bUserThumbnail, 'content' => array('thumbnail_url' => $sUserThumbnail, 'thumbnail_url_2x' => $sUserThumbnailDouble)), 'bx_if:show_thumbnail_icon' => array('condition' => !$bUserThumbnail, 'content' => array()), 'status_icon' => $oUserStatus->getStatusIcon($aMemberInfo['ID'], 'icon8'), 'status_title' => $oUserStatus->getStatus($aMemberInfo['ID'])));
                         $sReduceImage = '';
                     } else {
                         $sMenuImage = $aReplaced[$sPosition][$iKey]['Icon'];
                         if (strpos($sMenuImage, '.') !== false) {
                             $sMenuImage = getTemplateIcon($sMenuImage);
                         }
                         $sReduceImage = $sMenuImage;
                         $sMenuImage = $this->getImage($sMenuImage);
                     }
                     if ($aReplaced[$sPosition][$iKey]['Caption'] == '{system}') {
                         $sMenuImage = $aReplaced[$sPosition][$iKey]['Icon'] ? $aReplaced[$sPosition][$iKey]['Icon'] : 'spacer.gif';
                         if (strpos($sMenuImage, '.') !== false) {
                             $sMenuImage = getTemplateIcon($sMenuImage);
                         }
                         $sMenuImage = $this->getImage($sMenuImage);
                         $sPartCaption = eval($aReplaced[$sPosition][$iKey]['Eval']);
                     }
                     if ($aReplaced[$sPosition][$iKey]['Bubble']) {
                         $sCode = str_replace('{iOldCount}', 0, $aReplaced[$sPosition][$iKey]['Bubble']);
                         $sCode = str_replace('{ID}', $memberID, $sCode);
                         eval($sCode);
                         $this->sBubbles .= "\"{$aReplaced[$sPosition][$iKey]['Name']}\" : {count:'{$aRetEval['count']}'}, \n";
                     }
                     if ($isSkipItem) {
                         continue;
                     }
                     $sDescription = _t(!empty($aReplaced[$sPosition][$iKey]['Description']) ? $aReplaced[$sPosition][$iKey]['Description'] : $aReplaced[$sPosition][$iKey]['Caption']);
                     $aDefinedMenuItems[$sPosition][$iIndex] = array('bx_if:show_class' => array('condition' => !empty($sMenuClass), 'content' => array('class' => $sMenuClass)), 'menu_caption' => $aReplaced[$sPosition][$iKey]['Name'] == 'MemberBlock' || $aReplaced[$sPosition][$iKey]['Caption'] == '{system}' ? $sPartCaption : null, 'menu_link' => $aReplaced[$sPosition][$iKey]['Script'] ? 'javascript:void(0)' : $oPermalinks->permalink($aReplaced[$sPosition][$iKey]['Link']), 'extended_action' => $aReplaced[$sPosition][$iKey]['Script'] ? 'onclick="' . $aReplaced[$sPosition][$iKey]['Script'] . '"' : null, 'target' => $aReplaced[$sPosition][$iKey]['Target'] == '_blank' ? 'target="_blank"' : null, 'menu_image' => $sMenuImage, 'bubble_box' => $aReplaced[$sPosition][$iKey]['Bubble'] ? $oSysTemplate->parseHtmlByName('member_menu_bubble.html', array('extra_styles' => $aRetEval['count'] ? null : 'style="display:none"', 'count' => $aRetEval['count'], 'bubble_id' => $this->sBubblePrefix . $aReplaced[$sPosition][$iKey]['Name'])) : null, 'indent' => $this->sMemberMenuPosition == 'bottom' ? 'menu_item_bottom' : 'menu_item_top', 'item_link_indent' => $this->sMemberMenuPosition == 'bottom' ? 'bottom_indent' : 'top_indent', 'menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'bx_if:menu_desc' => array('condition' => !empty($sDescription), 'content' => array('menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'desc_window' => $this->getDescriptionWindow($sDescription), 'desc_indent' => $this->sMemberMenuPosition == 'bottom' ? 'description_bottom' : 'description_top')));
                     if ($aReplaced[$sPosition][$iKey]['Caption'] == '{system}') {
                         $sPartCaption = _t($aReplaced[$sPosition][$iKey]['Description']);
                     }
                     // define top menu's popup section ;
                     $aContentKeys = array('menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'menu_name' => $aReplaced[$sPosition][$iKey]['Name'], 'bx_if:reduce_element_top' => array('condition' => $this->sMemberMenuPosition == 'bottom', 'content' => array('menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'item_link' => $aReplaced[$sPosition][$iKey]['Link'], 'extended_action' => empty($aReplaced[$sPosition][$iKey]['extended_action']) ? '' : $aReplaced[$sPosition][$iKey]['extended_action'], 'cover' => 'top_cover', 'item_name' => $sPartCaption, 'bx_if:part_image' => array('condition' => $sReduceImage, 'content' => array('item_img' => $this->getImage($sReduceImage, strip_tags($aReplaced[$sPosition][$iKey]['Caption'])))))), 'bx_if:reduce_element_bottom' => array('condition' => $this->sMemberMenuPosition == 'top' || $this->sMemberMenuPosition == 'static', 'content' => array('menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'item_link' => $aReplaced[$sPosition][$iKey]['Link'], 'extended_action' => empty($aReplaced[$sPosition][$iKey]['extended_action']) ? '' : $aReplaced[$sPosition][$iKey]['extended_action'], 'cover' => 'bottom_cover', 'item_name' => $sPartCaption, 'bx_if:part_image' => array('condition' => $sReduceImage, 'content' => array('item_img' => $this->getImage($sReduceImage, strip_tags($aReplaced[$sPosition][$iKey]['Caption'])))))));
                     if ($aReplaced[$sPosition][$iKey]['PopupMenu']) {
                         $aDefinedMenuItems[$sPosition][$iIndex]['menu_link'] = 'javascript:void(0)';
                         $aDefinedMenuItems[$sPosition][$iIndex]['extended_action'] = null;
                     }
                     $aDefinedMenuItems[$sPosition][$iIndex]['bx_if:sub_menu'] = array('condition' => $aReplaced[$sPosition][$iKey]['PopupMenu'], 'content' => $aContentKeys);
                     $iIndex++;
                 }
                 //--
             }
         }
         //generate cache file
         $aBubbles = array('bubbles' => $this->sBubbles);
         $aDefinedMenuItems = array_merge($aDefinedMenuItems, $aBubbles);
         $oCache->setData($this->getCacheKey($aMemberInfo['ID']), $aDefinedMenuItems, $this->iKeysFileTTL);
     }
     //--
     if (BxDolRequest::serviceExists('pageac', 'menu_items_filter')) {
         BxDolService::call('pageac', 'menu_items_filter', array('member', &$aDefinedMenuItems));
     }
     //define bubble list
     $sBubbleList = isset($aDefinedMenuItems['bubbles']) ? trim($aDefinedMenuItems['bubbles']) : trim($this->sBubbles);
     //generate data
     $aTemplateKeys = array('items' => $oSysTemplate->parseHtmlByName('extra_top_menu_items.html', array('bx_repeat:items' => $aDefinedMenuItems['top'])), 'items_extra' => $oSysTemplate->parseHtmlByName('extra_top_menu_items.html', array('bx_repeat:items' => $aDefinedMenuItems['top_extra'])), 'site_url' => BX_DOL_URL_ROOT, 'menu_position' => $this->sMemberMenuPosition, 'is_profile_page' => defined('BX_PROFILE_PAGE') ? 'true' : 'false', 'bubbles_list' => preg_replace('/,$/', '', $sBubbleList), 'bubbles_update_time' => $this->iBubblesUpdateTime, 'notify_destroy_time' => $this->iNotifyDestroyTime, 'page_reciver' => $this->sQueryPageReciver, 'bubble_prefix' => $this->sBubblePrefix, 'menu_popup_prefix' => $this->sMenuPopupPrefix, 'description_prefix' => $this->sDescriptionPrefix);
     $oSysTemplate->addJs('user_status.js');
     return $oSysTemplate->parseHtmlByName('extra_top_menu.html', $aTemplateKeys);
 }
Exemplo n.º 7
0
/**
 * Change profile status
 *
 * @param $iProfileId integer
 * @param $sStatus text
 * @return text
 */
function ActionChangeStatus($iProfileId, $sStatus = '')
{
    $iProfileId = (int) $iProfileId;
    $sOutputCode = '';
    $oUserStatus = new BxDolUserStatusView();
    if ($oUserStatus->getRegisteredStatus($sStatus)) {
        //process status
        $sStatus = process_db_input($sStatus, BX_TAGS_STRIP, BX_SLASHES_AUTO);
        $sQuery = "UPDATE `Profiles` SET `UserStatus`='{$sStatus}', `DateLastNav` = NOW()\n            WHERE `ID` = '{$iProfileId}'";
        if (db_res($sQuery, 0)) {
            // send system event
            bx_import('BxDolAlerts');
            $oZ = new BxDolAlerts('profile', 'edit_status', $iProfileId, $iProfileId);
            $oZ->alert();
            bx_import('BxTemplMemberMenu');
            $oMemberMenu = new BxTemplMemberMenu();
            $oMemberMenu->deleteMemberMenuKeyFile($iProfileId);
            createUserDataFile($iProfileId);
            $sOutputCode = $oUserStatus->getStatusIcon($iProfileId);
        }
    }
    return $sOutputCode;
}
Exemplo n.º 8
0
 /**
  * Parse member menu structure 
  * 
  * @param $aMemberInfo array
  * @param $aMenuStructure array
  * @return text
  */
 function _parseStructure($aMemberInfo, $aMenuStructure)
 {
     global $oSysTemplate, $oFunctions;
     if (!$aMenuStructure) {
         return;
     }
     $oCache = $this->getCacheObject();
     $oPermalinks = new BxDolPermalinks();
     $oUserStatus = new BxDolUserStatusView();
     $sMemberStatus = $oUserStatus->getStatusIcon($aMemberInfo['ID']);
     $aReplaced = $aDefinedMenuItems = array();
     $memberID = $aMemberInfo['ID'];
     $iIndex = 0;
     $sStartPosition = '';
     //-- process menu structure --//
     $aDefinedMenuItems = $oCache->getData($this->getCacheKey($aMemberInfo['ID']), $this->iKeysFileTTL);
     if (!$aDefinedMenuItems) {
         foreach ($aMenuStructure as $sPosition => $aMenuItems) {
             foreach ($aMenuItems as $iKey => $aItems) {
                 foreach ($aItems as $sMenuKey => $sValue) {
                     if ($sMenuKey != 'PopupMenu' && $sMenuKey != 'linked_items') {
                         if ($sMenuKey == 'Caption') {
                             $aReplaced[$sPosition][$iKey][$sMenuKey] = $oFunctions->markerReplace($aMemberInfo, $sValue, $aItems['Eval'], true);
                         } else {
                             $aReplaced[$sPosition][$iKey][$sMenuKey] = $oFunctions->markerReplace($aMemberInfo, $sValue, $aItems['Eval']);
                         }
                     } else {
                         $aReplaced[$sPosition][$iKey][$sMenuKey] = $sValue;
                     }
                 }
                 if ($sStartPosition != $sPosition) {
                     $iIndex = 0;
                     $sStartPosition = $sPosition;
                 }
                 //-- process next --//
                 // collect the link;
                 if ($aReplaced[$sPosition][$iKey]['Type'] == 'link' && $aReplaced[$sPosition][$iKey]['Caption'] && ($aReplaced[$sPosition][$iKey]['Link'] || $aReplaced[$sPosition][$iKey]['Script'])) {
                     $sPartCaption = $aReplaced[$sPosition][$iKey]['Caption'];
                     //define some settings for member's block ;
                     $sMenuImage = $aReplaced[$sPosition][$iKey]['Name'] == 'MemberBlock' ? getTemplateIcon($sMemberStatus) : getTemplateIcon($aReplaced[$sPosition][$iKey]['Icon']);
                     $sItemImgId = $aReplaced[$sPosition][$iKey]['Name'] == 'MemberBlock' ? 'current_members_status_img' : null;
                     $sReduceImg = $aReplaced[$sPosition][$iKey]['Name'] != 'MemberBlock' ? $sMenuImage : null;
                     if ($aReplaced[$sPosition][$iKey]['Caption'] == '{system}') {
                         $sMenuImage = $aReplaced[$sPosition][$iKey]['Icon'] ? getTemplateIcon($aReplaced[$sPosition][$iKey]['Icon']) : getTemplateIcon('spacer.gif');
                         $sPartCaption = eval($aReplaced[$sPosition][$iKey]['Eval']);
                     }
                     if ($aReplaced[$sPosition][$iKey]['Bubble']) {
                         $sCode = str_replace('{iOldCount}', 0, $aReplaced[$sPosition][$iKey]['Bubble']);
                         $sCode = str_replace('{ID}', $memberID, $sCode);
                         eval($sCode);
                         $this->sBubbles .= "\"{$aReplaced[$sPosition][$iKey]['Name']}\" : {count:'{$aRetEval['count']}'}, \n";
                     }
                     $aDefinedMenuItems[$sPosition][$iIndex] = array('menu_caption' => $aReplaced[$sPosition][$iKey]['Name'] == 'MemberBlock' || $aReplaced[$sPosition][$iKey]['Caption'] == '{system}' ? $sPartCaption : null, 'menu_link' => $aReplaced[$sPosition][$iKey]['Script'] ? 'javascript:void(0)' : $oPermalinks->permalink($aReplaced[$sPosition][$iKey]['Link']), 'extended_action' => $aReplaced[$sPosition][$iKey]['Script'] ? 'onclick="' . $aReplaced[$sPosition][$iKey]['Script'] . '"' : null, 'target' => $aReplaced[$sPosition][$iKey]['Target'] == '_blank' ? 'target="_blank"' : null, 'menu_image' => $sMenuImage, 'bubble_box' => $aReplaced[$sPosition][$iKey]['Bubble'] ? $oSysTemplate->parseHtmlByName('member_menu_bubble.html', array('extra_styles' => $aRetEval['count'] ? null : 'style="display:none"', 'count' => $aRetEval['count'], 'bubble_id' => $this->sBubblePrefix . $aReplaced[$sPosition][$iKey]['Name'])) : null, 'indent' => $this->sMemberMenuPosition == 'bottom' ? 'menu_item_bottom' : 'menu_item_top', 'item_link_indent' => $this->sMemberMenuPosition == 'bottom' ? 'bottom_indent' : 'top_indent', 'bx_if:item_id' => array('condition' => $sItemImgId, 'content' => array('item_img_id' => $sItemImgId)), 'menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'bx_if:menu_desc' => array('condition' => $aReplaced[$sPosition][$iKey]['Description'], 'content' => array('menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'desc_window' => $this->getDescriptionWindow(_t($aReplaced[$sPosition][$iKey]['Description'])), 'desc_indent' => $this->sMemberMenuPosition == 'bottom' ? 'description_bottom' : 'description_top')));
                     if ($aReplaced[$sPosition][$iKey]['Caption'] == '{system}') {
                         $sPartCaption = _t($aReplaced[$sPosition][$iKey]['Description']);
                     }
                     // define top menu's popup section ;
                     $aContentKeys = array('menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'bx_if:reduce_element_top' => array('condition' => $this->sMemberMenuPosition == 'bottom', 'content' => array('menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'item_link' => $aReplaced[$sPosition][$iKey]['Link'], 'extended_action' => empty($aReplaced[$sPosition][$iKey]['extended_action']) ? '' : $aReplaced[$sPosition][$iKey]['extended_action'], 'cover' => 'top_cover', 'item_name' => $sPartCaption, 'bx_if:part_image' => array('condition' => $sReduceImg, 'content' => array('item_img_src' => $sReduceImg, 'cleared_item_name' => strip_tags($aReplaced[$sPosition][$iKey]['Caption']))))), 'bx_if:reduce_element_bottom' => array('condition' => $this->sMemberMenuPosition == 'top' || $this->sMemberMenuPosition == 'static', 'content' => array('menu_id' => $aReplaced[$sPosition][$iKey]['ID'], 'item_link' => $aReplaced[$sPosition][$iKey]['Link'], 'extended_action' => empty($aReplaced[$sPosition][$iKey]['extended_action']) ? '' : $aReplaced[$sPosition][$iKey]['extended_action'], 'cover' => 'bottom_cover', 'item_name' => $sPartCaption, 'bx_if:part_image' => array('condition' => $sReduceImg, 'content' => array('item_img_src' => $sReduceImg, 'cleared_item_name' => strip_tags($aReplaced[$sPosition][$iKey]['Caption']))))));
                     if ($aReplaced[$sPosition][$iKey]['PopupMenu']) {
                         $aDefinedMenuItems[$sPosition][$iIndex]['menu_link'] = 'javascript:void(0)';
                         $aDefinedMenuItems[$sPosition][$iIndex]['extended_action'] = null;
                     }
                     $aDefinedMenuItems[$sPosition][$iIndex]['bx_if:sub_menu'] = array('condition' => $aReplaced[$sPosition][$iKey]['PopupMenu'], 'content' => $aContentKeys);
                     $iIndex++;
                 }
                 //--
             }
         }
         //generate cache file
         $aBubbles = array('bubbles' => $this->sBubbles);
         $aDefinedMenuItems = array_merge($aDefinedMenuItems, $aBubbles);
         $oCache->setData($this->getCacheKey($aMemberInfo['ID']), $aDefinedMenuItems, $this->iKeysFileTTL);
     }
     //--
     //define bubble list
     $sBubbleList = isset($aDefinedMenuItems['bubbles']) ? trim($aDefinedMenuItems['bubbles']) : trim($this->sBubbles);
     //generate data
     $aTemplateKeys = array('bx_repeat:items' => $aDefinedMenuItems['top'], 'bx_repeat:extra_items' => $aDefinedMenuItems['top_extra'], 'site_url' => BX_DOL_URL_ROOT, 'menu_position' => $this->sMemberMenuPosition, 'is_profile_page' => defined('BX_PROFILE_PAGE') ? 'true' : 'false', 'bubbles_list' => preg_replace('/,$/', '', $sBubbleList), 'bubbles_update_time' => $this->iBubblesUpdateTime, 'notify_destroy_time' => $this->iNotifyDestroyTime, 'page_reciver' => $this->sQueryPageReciver, 'bubble_prefix' => $this->sBubblePrefix);
     $oSysTemplate->addJs('user_status.js');
     return $oSysTemplate->parseHtmlByName('extra_top_menu.html', $aTemplateKeys);
 }