/**
  * @description : function will generate profile block (used the profile template );
  * @return : Html presentation data ;
  */
 function PrintSearhResult($aProfileInfo, $aCoupleInfo = '', $aExtendedKey = null, $sTemplateName = '', $oCustomTemplate = null)
 {
     global $site;
     global $aPreValues;
     $iVisitorID = getLoggedId();
     $bExtMode = !empty($_GET['mode']) && $_GET['mode'] == 'extended' || !empty($_GET['search_result_mode']) && $_GET['search_result_mode'] == 'ext';
     $isShowMatchPercent = $bExtMode && $iVisitorID && $iVisitorID != $aProfileInfo['ID'] && getParam('view_match_percent') && getParam('enable_match');
     $sProfileThumb = get_member_thumbnail($aProfileInfo['ID'], 'none', !$bExtMode, 'visitor');
     $sProfileMatch = $isShowMatchPercent ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aProfileInfo['ID']) : '';
     $sProfileNickname = '<a href="' . getProfileLink($aProfileInfo['ID']) . '">' . getNickName($aProfileInfo['ID']) . '</a>';
     $sProfileInfo = $GLOBALS['oFunctions']->getUserInfo($aProfileInfo['ID']);
     $sProfileDesc = strmaxtextlen($aProfileInfo['DescriptionMe'], 130);
     $sProfileZodiac = $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aProfileInfo['DateOfBirth']) : '';
     $sProfile2ASc1 = $sProfile2ASc2 = $sProfile2Nick = $sProfile2Desc = $sProfile2Info = $sProfile2Zodiac = '';
     if ($aCoupleInfo) {
         $sProfile2Nick = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . getNickName($aCoupleInfo['ID']) . '</a>';
         $sProfile2Info = $GLOBALS['oFunctions']->getUserInfo($aCoupleInfo['ID']);
         $sProfile2Desc = strmaxtextlen($aCoupleInfo['DescriptionMe'], 130);
         $sProfile2Zodiac = $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aCoupleInfo['DateOfBirth']) : '';
         $sProfile2ASc1 = 'float:left;width:31%;margin-right:10px;';
         $sProfile2ASc2 = 'float:left;width:31%;display:block;';
     } else {
         $sProfile2ASc2 = 'display:none;';
     }
     $aKeys = array('thumbnail' => $sProfileThumb, 'match' => $sProfileMatch, 'nick' => $sProfileNickname, 'info' => $sProfileInfo, 'i_am_desc' => $sProfileDesc, 'zodiac_sign' => $sProfileZodiac, 'nick2' => $sProfile2Nick, 'info2' => $sProfile2Info, 'i_am_desc2' => $sProfile2Desc, 'zodiac_sign2' => $sProfile2Zodiac, 'add_style_c1' => $sProfile2ASc1, 'add_style_c2' => $sProfile2ASc2);
     if ($aExtendedKey and is_array($aExtendedKey) and !empty($aExtendedKey)) {
         foreach ($aExtendedKey as $sKey => $sValue) {
             $aKeys[$sKey] = $sValue;
         }
     } else {
         $aKeys['ext_css_class'] = '';
     }
     return $oCustomTemplate ? $oCustomTemplate->parseHtmlByName($sTemplateName, $aKeys) : $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateName, $aKeys);
 }
 function blockInformation($aSite)
 {
     $this->addCss(array('block_info.css'));
     $aResult = array('author_unit' => get_member_thumbnail($aSite['ownerid'], 'none', true), 'date' => getLocaleDate($aSite['date'], BX_DOL_LOCALE_DATE_SHORT), 'date_ago' => defineTimeInterval($aSite['date'], false), 'cats' => $this->parseCategories($aSite['categories']), 'tags' => $this->parseTags($aSite['tags']), 'fields' => '');
     $this->_checkOwner($aSite, $aResult);
     return $this->parseHtmlByName('entry_view_block_info.html', $aResult);
 }
 function getFileAuthor($aInfo)
 {
     if (empty($aInfo)) {
         return '';
     }
     return $this->parseHtmlByName('media_info.html', array('memberPic' => get_member_thumbnail($aInfo['medProfId'], 'none', TRUE)));
 }
 function blockInformation($aSite)
 {
     $this->addCss(array('block_info.css'));
     $aResult = array('owner_thumb' => get_member_thumbnail($aSite['ownerid'], 'none'), 'date_icon' => $this->getIconUrl('clock.png'), 'date' => getLocaleDate($aSite['date'], BX_DOL_LOCALE_DATE_SHORT), 'date_ago' => defineTimeInterval($aSite['date']), 'cats_icon' => $this->getIconUrl('folder.png'), 'cats' => $this->parseCategories($aSite['categories']), 'tags' => $this->parseTags($aSite['tags']), 'tags_icon' => $this->getIconUrl('tgs.gif'));
     $this->_checkOwner($aSite, $aResult);
     return $this->parseHtmlByName('block_info.html', $aResult);
 }
 function getBlockCode_GetMembers($iGroupId)
 {
     $sSearchUnitTmpl = $this->getHtml('ps_search_unit.html');
     $aIds = $this->_oDb->getMembersIds($iGroupId);
     $sResult = "";
     foreach ($aIds as $aId) {
         $sResult .= $this->parseHtmlByContent($sSearchUnitTmpl, array('action' => 'del', 'member_id' => $aId['id'], 'member_thumbnail' => get_member_thumbnail($aId['id'], 'none', true)));
     }
     return $sResult;
 }
 function getFileInfo($aInfo)
 {
     if (empty($aInfo)) {
         return '';
     }
     $aMediaInfo = array();
     $aMediaInfo['memberPic'] = get_member_thumbnail($aInfo['medProfId'], 'none', false);
     $aMediaInfo['memberUrl'] = getProfileLink($aInfo['medProfId']);
     $aMediaInfo['memberNick'] = $aInfo['NickName'];
     $aMediaInfo['dateIcon'] = $this->getIconUrl('clock.png');
     $aMediaInfo['dateInfo'] = getLocaleDate($aInfo['medDate'], BX_DOL_LOCALE_DATE_SHORT);
     $aMediaInfo['dateInfoAgo'] = defineTimeInterval($aInfo['medDate']);
     return $this->parseHtmlByName('media_info.html', $aMediaInfo);
 }
 /**
  * @description : function will generate profile block (used the profile template );
  * @return      : Html presentation data ;
  */
 function PrintSearhResult($aProfileInfo, $aCoupleInfo = '', $aExtendedKey = null, $sTemplateName = '', $oCustomTemplate = null)
 {
     global $site;
     global $aPreValues;
     $iVisitorID = getLoggedId();
     $bExtMode = !empty($_GET['mode']) && $_GET['mode'] == 'extended' || !empty($_GET['search_result_mode']) && $_GET['search_result_mode'] == 'ext';
     $isShowMatchPercent = $bExtMode && $iVisitorID && $iVisitorID != $aProfileInfo['ID'] && getParam('view_match_percent') && getParam('enable_match');
     $bPublic = $bExtMode ? bx_check_profile_visibility($aProfileInfo['ID'], $iVisitorID, true) : true;
     if ($bPublic && $iVisitorID != $aProfileInfo['ID'] && !isAdmin()) {
         $oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id');
         $iBlockID = $GLOBALS['MySQL']->getOne("SELECT `ID` FROM `sys_page_compose` WHERE `Page` = 'profile' AND `Func` = 'Description' AND `Column` != 0");
         $iPrivacyId = (int) $GLOBALS['MySQL']->getOne("SELECT `id` FROM `sys_page_compose_privacy` WHERE `user_id`='{$aProfileInfo['ID']}' AND `block_id`='{$iBlockID}' LIMIT 1");
         $bPublic = !$iBlockID || !$iPrivacyId || $oPrivacy->check('view_block', $iPrivacyId, $iVisitorID);
     }
     $sProfileThumb = get_member_thumbnail($aProfileInfo['ID'], 'none', !$bExtMode, 'visitor');
     $sProfileMatch = $isShowMatchPercent ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aProfileInfo['ID']) : '';
     $sProfileNickname = '<a href="' . getProfileLink($aProfileInfo['ID']) . '">' . getNickName($aProfileInfo['ID']) . '</a>';
     $sProfileInfo = $GLOBALS['oFunctions']->getUserInfo($aProfileInfo['ID']);
     $sProfileDesc = $bPublic ? strmaxtextlen($aProfileInfo['DescriptionMe'], 130) : _t('_sys_profile_private_text_title');
     $sProfileZodiac = $bPublic && $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aProfileInfo['DateOfBirth']) : '';
     $sProfile2ASc1 = $sProfile2ASc2 = $sProfile2Nick = $sProfile2Desc = $sProfile2Info = $sProfile2Zodiac = '';
     if ($aCoupleInfo) {
         $sProfile2Nick = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . getNickName($aCoupleInfo['ID']) . '</a>';
         $sProfile2Info = $GLOBALS['oFunctions']->getUserInfo($aCoupleInfo['ID']);
         $sProfile2Desc = $bPublic ? strmaxtextlen($aCoupleInfo['DescriptionMe'], 130) : _t('_sys_profile_private_text_title');
         $sProfile2Zodiac = $bPublic && $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aCoupleInfo['DateOfBirth']) : '';
         $sProfile2ASc1 = 'float:left;width:31%;margin-right:10px;';
         $sProfile2ASc2 = 'float:left;width:31%;display:block;';
     } else {
         $sProfile2ASc2 = 'display:none;';
     }
     $aKeys = array('thumbnail' => $sProfileThumb, 'match' => $sProfileMatch, 'nick' => $sProfileNickname, 'info' => $sProfileInfo, 'i_am_desc' => $sProfileDesc, 'zodiac_sign' => $sProfileZodiac, 'nick2' => $sProfile2Nick, 'info2' => $sProfile2Info, 'i_am_desc2' => $sProfile2Desc, 'zodiac_sign2' => $sProfile2Zodiac, 'add_style_c1' => $sProfile2ASc1, 'add_style_c2' => $sProfile2ASc2);
     if ($aExtendedKey and is_array($aExtendedKey) and !empty($aExtendedKey)) {
         foreach ($aExtendedKey as $sKey => $sValue) {
             $aKeys[$sKey] = $sValue;
         }
     } else {
         $aKeys['ext_css_class'] = '';
     }
     return $oCustomTemplate ? $oCustomTemplate->parseHtmlByName($sTemplateName, $aKeys) : $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateName, $aKeys);
 }
function getFriendList($id)
{
    global $site;
    global $max_thumb_width;
    global $max_thumb_height;
    $id = (int) $id;
    $friend_list_query = "SELECT `Profiles`.* FROM `FriendList`\r\n\t\t\t\t\t\t\t\t LEFT JOIN `Profiles` ON (`Profiles`.`ID` = `FriendList`.`Profile` AND `FriendList`.`ID` = '{$id}' OR `Profiles`.`ID` = `FriendList`.`ID` AND `FriendList`.`Profile` = '{$id}')\r\n\t\t\t\t\t\t\t\t WHERE (`FriendList`.`Profile` = '{$id}' OR `FriendList`.`ID` = '{$id}') AND `FriendList`.`Check` = '1' ORDER BY `Profiles`.`Picture` DESC";
    $friend_list_res = db_res("{$friend_list_query}");
    $iCounter = 0;
    while ($friend_list_arr = mysql_fetch_assoc($friend_list_res)) {
        $iCounter++;
        $sKey = '1';
        if ($iCounter == 3) {
            $sKey = '1';
        }
        $ret .= '<div class="friends_thumb_' . $sKey . '">' . get_member_thumbnail($friend_list_arr['ID'], 'none') . '<div class="browse_nick"><a href="' . getProfileLink($friend_list_arr['ID']) . '">' . $friend_list_arr['NickName'] . '</a></div><div class="clear_both"></div></div>';
        if ($iCounter == 3) {
            $iCounter = 0;
        }
    }
    return $ret;
}
Exemple #9
0
    /**
     * Generate presentation Advertisement code with images and other
     *
     * @param $iID	ID of Advertisement
     * @return HTML presentation of data
     */
    function ActionPrintAdvertisement($iID)
    {
        global $site;
        global $aPreValues;
        $iAdvertisementID = (int) $iID;
        $sRetHtml = '';
        $sSiteUrl = BX_DOL_URL_ROOT;
        if ($this->bAdminMode && $iAdvertisementID > 0) {
            $iFeaturedStatus = $this->_oDb->getFeaturedStatus($iAdvertisementID);
            $iNewStatus = $iFeaturedStatus == 1 ? 0 : 1;
            if (bx_get('do') == 'cfs') {
                $this->_oDb->UpdateFeatureStatus($iAdvertisementID, $iNewStatus);
            }
        }
        $aSqlResStr = $this->_oDb->getAdInfo($iAdvertisementID);
        if ($aSqlResStr) {
            $iOwnerID = (int) $aSqlResStr['IDProfile'];
            $bPossibleToView = $this->oPrivacy->check('view', $iAdvertisementID, $this->_iVisitorID);
            if ($this->isAllowedView($iOwnerID, true) == false || $bPossibleToView == false) {
                return $this->_oTemplate->displayAccessDenied();
            }
            bx_import('BxDolViews');
            new BxDolViews('ads', $iAdvertisementID);
            $aNameRet = getProfileInfo($aSqlResStr['IDProfile']);
            $sCountryName = $aSqlResStr['Country'];
            $sCountryPic = $sCountryName == '' ? '' : ' <img alt="' . $sCountryName . '" src="' . ($site['flags'] . strtolower($sCountryName)) . '.gif"/>';
            $sCountryName = _t($aPreValues['Country'][$sCountryName]['LKey']);
            $sPostedByC = _t('_bx_ads_Posted_by');
            $sPhoneC = _t('_Phone');
            $sDetailsC = _t('_bx_ads_Details');
            $sUserOtherListC = _t('_bx_ads_Users_other_listing');
            $sActionsC = _t('_Actions');
            $sSureC = _t('_Are_you_sure');
            $sPostedBy .= '<div class="cls_res_info">';
            $sPostedBy .= $sPostedByC . ': <span style="color:#333333;"><a href="' . getProfileLink($aNameRet['ID']) . '">' . $aNameRet['NickName'] . '</a></span>';
            $sPostedBy .= '</div>';
            if ($aNameRet['Phone'] != "") {
                $sPostedBy .= '<div class="cls_res_info">';
                $sPostedBy .= $sPhoneC . ": <div class=\"clr3\">{$aNameRet['Phone']}</div>";
                $sPostedBy .= '</div>';
            }
            $sTimeAgo = defineTimeInterval($aSqlResStr['DateTime_UTS'], false);
            $aTags = array();
            $aTagsLinks = array();
            $aTags = preg_split("/[;,]/", $aSqlResStr['Tags']);
            foreach ($aTags as $sTag) {
                $sSubLink = $this->bUseFriendlyLinks ? "ads/tag/" : $this->sHomeUrl . "classifieds_tags.php?tag=";
                $sTagS = htmlspecialchars(title2uri($sTag));
                $aTagsLinks[] = '<a href="' . "{$sSubLink}{$sTagS}" . '">' . $sTag . '</a>';
            }
            $sTags .= implode(", ", $aTagsLinks);
            $sMemberActionForms = '';
            if ($this->_iVisitorID > 0 && $this->_iVisitorID != $aNameRet['ID']) {
                //print Send PM button and other actions
                if (getParam('bx_ads_enable_paid') == 'on') {
                    $sMemberActionForms .= <<<EOF
<form action="{$this->sCurrBrowsedFile}" name="BuyNowForm" method="post">
    <input type="hidden" name="BuyNow" value="BuyNow" />
    <input type="hidden" name="IDAdv" value="{$iAdvertisementID}" />
    <input type="hidden" name="IDSeller" value="{$aSqlResStr['IDProfile']}" />
</form>
EOF;
                }
                $sMemberActionForms .= <<<EOF
<form action="{$sSiteUrl}mail.php" name="post_pm" id="post_pm" method="get">
    <input type="hidden" name="mode" value="compose" />
    <input type="hidden" name="recipient_id" value="{$aSqlResStr['IDProfile']}" />
    <input type="hidden" name="subject" value="{$aSqlResStr['Subject']}" />
</form>
EOF;
            }
            $sEntryUrl = $this->genUrl($iAdvertisementID, $aSqlResStr['EntryUri'], 'entry');
            $sMediaIDs = $this->_oDb->getMediaOfAd($iAdvertisementID);
            if ($sMediaIDs != '') {
                $aReadyMedia = explode(',', $sMediaIDs);
                $sPictureSectContent = $this->_blockPhoto($aReadyMedia, $iOwnerID);
            }
            $sPictureSect = $sPictureSectContent != '' ? DesignBoxContent(_t('_bx_ads_Ad_photos'), $sPictureSectContent, 1) : '';
            $this->sTAPhotosContent = $sPictureSectContent;
            bx_import('BxDolSubscription');
            $oSubscription = BxDolSubscription::getInstance();
            $aButton = $oSubscription->getButton($this->_iVisitorID, $this->_oConfig->getUri(), '', $iAdvertisementID);
            $aActionKeys = array('BaseUri' => $this->_oConfig->getBaseUri(), 'visitor_id' => $this->_iVisitorID, 'owner_id' => $aNameRet['ID'], 'admin_mode' => "'" . $this->bAdminMode . "'", 'ads_id' => $iAdvertisementID, 'ads_status' => $aSqlResStr['Status'], 'ads_act_type' => $aSqlResStr['Status'] == 'active' ? 'inactive' : 'active', 'ads_featured' => (int) $aSqlResStr['Featured'], 'sure_label' => $sSureC, 'ads_entry_url' => $sEntryUrl, 'only_menu' => 0, 'sbs_ads_title' => $aButton['title'], 'sbs_ads_script' => $aButton['script'], 'TitleShare' => $this->isAllowedShare($aSqlResStr) ? _t('_Share') : '');
            $sActionsTable = $GLOBALS['oFunctions']->genObjectsActions($aActionKeys, 'bx_ads', false);
            $sSubsAddon = $oSubscription->getData();
            $sActionsSectContent = $sSubsAddon . $sMemberActionForms . $sActionsTable;
            $sActionsSect = $this->_iVisitorID > 0 || $this->bAdminMode ? DesignBoxContent($sActionsC, $sActionsSectContent, 1) : '';
            $this->sTAActionsContent = $this->_iVisitorID > 0 || $this->bAdminMode ? $sActionsSectContent : '';
            bx_import('Cmts', $this->_aModule);
            $this->oCmtsView = new BxAdsCmts($this->_oConfig->getCommentSystemName(), $iAdvertisementID);
            $sCommentsSectContent = $this->oCmtsView->getExtraCss();
            $sCommentsSectContent .= $this->oCmtsView->getExtraJs();
            $sCommentsSectContent .= !$this->oCmtsView->isEnabled() ? '' : $this->oCmtsView->getCommentsFirst();
            $this->sTACommentsContent = $sCommentsSectContent;
            $sCommSect = DesignBoxContent($aCaptions['Comments'], $sCommentsSectContent, 1);
            $sUserOtherListing = $this->getMemberAds($aSqlResStr['IDProfile'], 2, $iAdvertisementID);
            $sDataTimeFormatted = getLocaleDate($aSqlResStr['DateTime_UTS']);
            $iViews = (int) $aSqlResStr['Views'];
            $sOwnerThumb = get_member_thumbnail($aSqlResStr['IDProfile'], 'none', true);
            $sAdsMessage = process_html_output($aSqlResStr['Message']);
            $sCategLink = $this->bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'ads/cat/' . $aSqlResStr['CEntryUri'] : "{$this->sCurrBrowsedFile}?bClassifiedID={$aSqlResStr['CatID']}";
            $sSCategLink = $this->bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'ads/subcat/' . $aSqlResStr['SEntryUri'] : "{$this->sCurrBrowsedFile}?bSubClassifiedID={$aSqlResStr['SubID']}";
            $aSubjVariables = array('author_unit' => $sOwnerThumb, 'date' => $sDataTimeFormatted, 'date_ago' => $sTimeAgo, 'cats' => $this->_oTemplate->parseHtmlByTemplateName('category', array('cat_link' => $sCategLink, 'sub_cat_link' => $sSCategLink, 'cat_name' => $aSqlResStr['Name'], 'sub_cat_name' => $aSqlResStr['NameSub'])), 'tags' => $sTags, 'fields' => '');
            $sSubjectSectContent = $this->_oTemplate->parseHtmlByName('entry_view_block_info.html', $aSubjVariables);
            $sSubjectSect = DesignBoxContent(_t('_Info'), $sSubjectSectContent, 1);
            $this->sTAInfoContent = $sSubjectSectContent;
            $sDescriptionContent = '<div class="dbContent bx-def-bc-margin bx-def-font-large">' . $sAdsMessage . '</div>';
            $sDescriptionSect = DesignBoxContent(_t('_Description'), $sDescriptionContent, 1);
            $this->sTADescription = $sDescriptionContent;
            //adding form
            $aForm = array('form_attrs' => array('name' => 'custom_values_form', 'action' => $oAds->sCurrBrowsedFile), 'inputs' => array('Country' => array('type' => 'value', 'name' => 'Country', 'caption' => _t('_Country'), 'value' => $sCountryName . $sCountryPic), 'City' => array('type' => 'value', 'name' => 'City', 'caption' => _t('_City'), 'value' => $aSqlResStr['City'])));
            if ($aSqlResStr['CustomFieldName1'] && $aSqlResStr['CustomFieldValue1']) {
                $aForm['inputs']['Custom1'] = array('type' => 'value', 'name' => 'Custom1', 'caption' => $aSqlResStr['CustomFieldName1'], 'value' => $aSqlResStr['Unit1'] . $aSqlResStr['CustomFieldValue1']);
            }
            if ($aSqlResStr['CustomFieldName2'] && $aSqlResStr['CustomFieldValue2']) {
                $aForm['inputs']['Custom2'] = array('type' => 'value', 'name' => 'Custom2', 'caption' => $aSqlResStr['CustomFieldName2'], 'value' => $aSqlResStr['Unit2'] . $aSqlResStr['CustomFieldValue2']);
            }
            $oForm = new BxTemplFormView($aForm);
            $sOtherInfoContent = $oForm->getCode();
            $sOtherInfoSect = DesignBoxContent(_t('_bx_ads_Custom_Values'), $sOtherInfoContent, 1);
            $this->sTAOtherInfo = $sOtherInfoContent;
            $bPossibleToRate = $this->oPrivacy->check('rate', $iAdvertisementID, $this->_iVisitorID);
            $oVotingView = new BxTemplVotingView('ads', $iAdvertisementID);
            $iVote = $oVotingView && $oVotingView->isEnabled() && $bPossibleToRate ? 1 : 0;
            $sVotePostRating = $oVotingView->getBigVoting($iVote);
            $sRatingSect = DesignBoxContent(_t('_Rate'), $sVotePostRating, 1);
            $this->sTARateContent = '<div class="bx-def-bc-margin">' . $sVotePostRating . '</div>';
            $sOtherListingContent = <<<EOF
<div class="dbContent">
    {$sUserOtherListing}
</div>
EOF;
            $sSPaginateActions = <<<EOF
<div class="paginate bx-def-padding-left bx-def-padding-right">
    <div class="view_all">
        <a href="{$this->sCurrBrowsedFile}" onclick="document.forms['UsersOtherListingForm'].submit(); return false;">{$sUserOtherListC}</a>
        <form action="{$this->sCurrBrowsedFile}" name="UsersOtherListingForm" method="post">
            <input type="hidden" name="UsersOtherListing" value="1" />
            <input type="hidden" name="IDProfile" value="{$aSqlResStr['IDProfile']}" />
        </form>
    </div>
    <div class="pages_section"></div>
</div>
EOF;
            $sOtherListingSect = DesignBoxContent($sUserOtherListC, $sOtherListingContent . $sSPaginateActions, 1);
            $this->sTAOtherListingContent = $sOtherListingContent . $sSPaginateActions;
            $sHomeLink = $this->bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'ads/' : "{$this->sCurrBrowsedFile}?Browse=1";
            $sBrowseAllAds = _t('_bx_ads_Browse_All_Ads');
            $sBreadCrumbs = <<<EOF
<div class="breadcrumbs">
<a href="{$sHomeLink}">{$sBrowseAllAds}</a>
/
<a href="{$sCategLink}">{$aSqlResStr['Name']}</a>
/
<a href="{$sSCategLink}">{$aSqlResStr['NameSub']}</a>
</div>
EOF;
            $aBlocks[1] .= $sActionsSect;
            $aBlocks[1] .= $sSubjectSect;
            $aBlocks[1] .= $sRatingSect;
            $aBlocks[1] .= $sOtherListingSect;
            $aBlocks[2] .= $sPictureSect;
            $aBlocks[2] .= $sCommSect;
            $sRetHtml = <<<EOF
{$sBreadCrumbs}
<div>
    <div class="clear_both"></div>
    <div class="cls_info_left">
        {$aBlocks['1']}
    </div>
    <div class="cls_info">
        {$sDescriptionSect}
        {$aBlocks['2']}
    </div>
    <div class="clear_both"></div>
</div>
<div class="clear_both"></div>
EOF;
            bx_import('BxDolAlerts');
            $oZ = new BxDolAlerts('ads', 'view', $iAdvertisementID, $this->_iVisitorID);
            $oZ->alert();
            $sAdCover = $this->getAdCover($aSqlResStr['Media'], 'icon');
            if ($sAdCover != '' && $aSqlResStr['Media']) {
                $GLOBALS['oTopMenu']->setCustomSubIconUrl($sAdCover);
            }
            $GLOBALS['oTopMenu']->setCustomSubHeader(htmlspecialchars($aSqlResStr['Subject']));
            $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(_t('_bx_ads_Ads') => $sHomeLink, $aSqlResStr['Subject'] => ''));
            $this->_oTemplate->setPageDescription(htmlspecialchars($aSqlResStr['Subject']));
            $this->_oTemplate->addPageKeywords(htmlspecialchars($aSqlResStr['Tags']));
        }
        return $sRetHtml;
    }
 function showBlockMutualFriends($sCaption, $bNoDB = false)
 {
     $iViewer = getLoggedId();
     if ($this->_iProfileID == $iViewer) {
         return;
     }
     if ($this->iCountMutFriends > 0) {
         $sCode = $sPaginate = '';
         $iPerPage = $this->iFriendsPerPage;
         $iPage = (int) $_GET['page'] > 0 ? (int) $_GET['page'] : 1;
         $aTmplVars = array('bx_repeat:friends' => array());
         foreach ($this->aMutualFriends as $iKey => $sValue) {
             $aTmplVars['bx_repeat:friends'][] = array('content' => get_member_thumbnail($iKey, 'none', true));
         }
         $sCode = $GLOBALS['oSysTemplate']->parseHtmlByName('profile_friends.html', $aTmplVars);
         if ($this->iCountMutFriends > $iPerPage) {
             $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'profile.php', 'count' => $this->iCountMutFriends, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'' . getProfileLink($this->_iProfileID) . '?page={page}&per_page={per_page}\');'));
             $sPaginate = $oPaginate->getSimplePaginate('', -1, -1, false);
         }
         if ($bNoDB) {
             return array($sCode, array(), $sPaginate, true);
         } else {
             return DesignBoxContent(_t($sCaption), $sCode, 1);
         }
     }
 }
Exemple #11
0
 /**
  * Function will generate window with reply message or new compose message;
  *
  * @param        : $iRecipientID (integer) - recipient's ID ;
  * @param        : $iMessageID (integer) - message ID (optional parameter);
  * @return        : Html presentation data;
  */
 function genReplayMessage($iRecipientID, $iMessageID = 0)
 {
     global $oSysTemplate;
     $iMessageID = (int) $iMessageID;
     $iRecipientID = (int) $iRecipientID;
     // init some needed variables ;
     $sOutputHtml = '';
     $aMemberInfo = getProfileInfo($this->aMailBoxSettings['member_id']);
     $aRecipientInfo = getProfileInfo($iRecipientID);
     $aLanguageKeys = array('information' => $iMessageID ? _t('_Reply') : _t('_COMPOSE_H1'), 'cancel' => bx_js_string(_t('_Cancel')), 'send' => bx_js_string(_t('_Send')), 'send_copy' => _t('_Send copy to personal email', $aRecipientInfo['NickName']), 'send_copy_my' => _t('_Send copy to my personal email'), 'notify' => _t('_Notify by e-mail', $aRecipientInfo['NickName']), 'error_message' => bx_js_string(_t('_please_fill_next_fields_first')));
     if (!empty($aMemberInfo) && !empty($aRecipientInfo)) {
         // ** generate recipient's information ;
         $sMemberIcon = get_member_thumbnail($this->aMailBoxSettings['member_id'], 'none');
         $sMemberNickName = $aMemberInfo['NickName'];
         $sMemberLocation = getProfileLink($aMemberInfo['ID']);
         $sClockImgPath = getTemplateIcon('clock.png');
         $sCurrentDate = date('d.m.Y G:i');
         $sMessageSubject = $iMessageID ? $this->addReToSubject(db_value("\r\n                            SELECT \r\n                                `Subject` \r\n                            FROM \r\n                                `sys_messages` \r\n                            WHERE \r\n                                `ID` = {$iMessageID} \r\n                                    AND \r\n                                (\r\n                                `Sender` = {$this->aMailBoxSettings['member_id']} \r\n                                    OR \r\n                                `Recipient` = {$this->aMailBoxSettings['member_id']}\r\n                                )\r\n                            ")) : null;
         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['send'], 'attrs' => array('onclick' => 'if(typeof oMailBoxReplayMessage != \'undefined\') oMailBoxReplayMessage.sendMessage(' . $iRecipientID . ')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['cancel'], 'attrs' => array('onclick' => 'if(typeof oMailBoxReplayMessage != \'undefined\') oMailBoxReplayMessage.cancelReplay()')))));
         $oForm = new BxTemplFormView($aForm);
         $sMessageBoxActions = $oForm->getCode();
         $aTemplateKeys = array('error_message' => $aLanguageKeys['error_message'], 'current_page' => 'mail.php', 'information' => $aLanguageKeys['information'], 'member_thumbnail' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation, 'clock_img' => $sClockImgPath, 'date_create' => $sCurrentDate, 'message_subject' => $sMessageSubject, 'send_copy_my' => $aLanguageKeys['send_copy_my'], 'send_copy_to' => $aLanguageKeys['send_copy'], 'notify' => $aLanguageKeys['notify'], 'action_buttons' => $sMessageBoxActions);
         $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['message_replay'], $aTemplateKeys);
     }
     return $sOutputHtml;
 }
 /**
  * Function will generate received rows ;
  *
  * @return  : Html presentation data ;
  */
 function getProcessingRows($bShowEmpty = true)
 {
     global $oSysTemplate, $site, $oFunctions;
     // ** init some needed variables ;
     $sPageContent = $sActionsList = $sSettings = '';
     $bShowSettings = false;
     $aRows = array();
     $sEmptyMessage = '_Empty';
     $sRowsTemplName = $this->aUsedTemplates['communicator_page'];
     $sJsObject = $this->_getJsObject();
     // define the member's nickname;
     $sMemberNickName = getNickName($this->aCommunicatorSettings['member_id']);
     // all primary language's keys ;
     $aLanguageKeys = array('author' => _t('_Author'), 'type' => _t('_Type'), 'date' => _t('_Date'), 'click_sort' => _t('_Click to sort'), 'from_me' => _t('_From') . ' ' . $sMemberNickName, 'to_me' => _t('_To') . ' ' . $sMemberNickName, 'accept' => _t('_sys_cnts_btn_fr_accept'), 'reject' => _t('_sys_cnts_btn_fr_reject'), 'delete' => _t('_Delete'), 'back_invite' => _t('_Back Invite'), 'fave' => _t('_sys_cnts_btn_fave'), 'visitor' => _t('_Visitor'), 'unblock' => _t('_Unblock'), 'block' => _t('_Block'), 'select' => _t('_Select'), 'all' => _t('_All'), 'none' => _t('_None'), 'read' => _t('_Read'), 'unread' => _t('_Unread'));
     // get all requests from DB ;
     switch ($this->aCommunicatorSettings['communicator_mode']) {
         case 'friends_requests':
             $sEmptyMessage = '_sys_cnts_msg_fr_empty';
             $sRowsTemplName = $this->aUsedTemplates['communicator_page_fr'];
             $aTypes = array('from' => _t('_MEMBERS_INVITE_YOU_FRIENDLIST'), 'to' => _t('_MEMBERS_YOU_INVITED_FRIENDLIST'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 0 ');
             break;
         case 'hotlist_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_HOTLISTED'), 'to' => _t('_MEMBERS_YOU_HOTLISTED_BY'));
             $aRows = $this->getRequests('sys_fave_list', $aTypes);
             break;
         case 'greeting_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_KISSED'), 'to' => _t('_MEMBERS_YOU_KISSED_BY'), 'specific_key' => '_N times');
             $aRows = $this->getRequests('sys_greetings', $aTypes, null, 'Number');
             break;
         case 'blocks_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_BLOCKLISTED'), 'to' => _t('_MEMBERS_YOU_BLOCKLISTED_BY'));
             $aRows = $this->getRequests('sys_block_list', $aTypes);
             break;
         case 'friends_list':
             $aTypes = array('from' => _t('_Friend list'), 'to' => _t('_Friend list'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 1 OR ( `sys_friend_list`.`ID` = ' . $this->aCommunicatorSettings['member_id'] . ' AND `sys_friend_list`.`Check` = 1 )');
             break;
         default:
             $aTypes = array('from' => _t('_MEMBERS_INVITE_YOU_FRIENDLIST'), 'to' => _t('_MEMBERS_YOU_INVITED_FRIENDLIST'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 0 ');
     }
     if (empty($aRows) && !$bShowEmpty) {
         return '';
     }
     // ** Generate the page's pagination ;
     // fill array with all necessary `get` parameters ;
     $aNeededParameters = array('communicator_mode', 'person_switcher', 'sorting');
     // collect the page's URL ;
     $sRequest = BX_DOL_URL_ROOT . 'communicator.php?action=get_page';
     // add additional parameters ;
     foreach ($aNeededParameters as $sKey) {
         $sRequest .= (array_key_exists($sKey, $this->aCommunicatorSettings) and $this->aCommunicatorSettings[$sKey]) ? '&' . $sKey . '=' . $this->aCommunicatorSettings[$sKey] : null;
     }
     $sCuttedUrl = $sRequest;
     $sRequest .= '&page={page}&per_page={per_page}';
     // create  the pagination object ;
     $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $this->iTotalRequestsCount, 'per_page' => $this->aCommunicatorSettings['per_page'], 'sorting' => $this->aCommunicatorSettings['sorting'], 'page' => $this->aCommunicatorSettings['page'], 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".getPaginatePage('{$sRequest}')", 'on_change_per_page' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".getPage(this.value, '{$sCuttedUrl}')"));
     $sPagination = $oPaginate->getPaginate();
     // process received requests;
     if ($aRows) {
         $iIndex = 1;
         foreach ($aRows as $iKey => $aItems) {
             // if member not a visitor ;
             if ($aItems['member_id']) {
                 // ** some member's information ;
                 $aProfileInfo = getProfileInfo($aItems['member_id']);
                 // member's Icon ;
                 $sMemberIcon = get_member_thumbnail($aProfileInfo['ID'], 'left', $this->aCommunicatorSettings['communicator_mode'] != 'friends_requests');
                 // member's profile location ;
                 $sMemberLocation = getProfileLink($aProfileInfo['ID']);
                 // member's nickname ;
                 $sMemberNickName = getNickName($aProfileInfo['ID']);
                 // define the member's age ;
                 $sMemberAge = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) : null;
                 // define the member's country, sex, etc ... ;
                 $sMemberCountry = $aProfileInfo['Country'];
                 $sMemberFlag = $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension;
                 $sMemberSexImg = $oFunctions->genSexIcon($aProfileInfo['Sex']);
                 if ($sMemberCountry) {
                     $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />';
                 }
                 $iMemberMutualFriends = getMutualFriendsCount($aItems['member_id'], getLoggedId());
             } else {
                 // ** if it's a visitor
                 // member's Icon ;
                 $sMemberIcon = $aLanguageKeys['visitor'];
                 // member's profile location ;
                 $sMemberLocation = null;
                 $sMemberSexImg = null;
                 $sMemberAge = null;
                 $sMemberCountryFlag = null;
                 $sMemberCountry = null;
             }
             $aProcessedRows[] = array('js_object' => $sJsObject, 'row_value' => $aItems['member_id'], 'member_icon' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation ? '<a href="' . $sMemberLocation . '">' . $sMemberNickName . '</a>' : '', 'member_sex_img' => $sMemberSexImg ? ' <img src="' . $sMemberSexImg . '" alt="' . $aProfileInfo['Sex'] . '" />' : '', 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'member_mutual_friends' => _t('_sys_cnts_txt_mutual_friends', $iMemberMutualFriends > 0 ? $iMemberMutualFriends : _t('_sys_cnts_txt_mf_no')), 'type' => $aItems['type'], 'message_date' => $aItems['date']);
             $iIndex++;
         }
         // init the sort toggle ellements ;
         switch ($this->aCommunicatorSettings['sorting']) {
             case 'date':
                 $aSortToglleElements['date_sort_toggle'] = 'toggle_up';
                 break;
             case 'date_desc':
                 $aSortToglleElements['date_sort_toggle'] = 'toggle_down';
                 break;
             case 'author':
                 $aSortToglleElements['author_sort_toggle'] = 'toggle_up';
                 break;
             case 'author_desc':
                 $aSortToglleElements['author_sort_toggle'] = 'toggle_down';
                 break;
         }
         // define the actions list for type of requests;
         switch ($this->aCommunicatorSettings['communicator_mode']) {
             case 'friends_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['accept'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'accept_friends_request', 'getProcessingRows')")), 1 => array('type' => 'button', 'value' => $aLanguageKeys['reject'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'reject_friends_request', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['back_invite'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_friends_request', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'hotlist_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['fave'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'add_hotlist', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_hotlisted', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'greeting_requests':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_greetings', 'getProcessingRows')")))));
                 $oForm = new BxTemplFormView($aForm);
                 $sActionsList = $oForm->getCode();
                 break;
             case 'blocks_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['block'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'block_unblocked', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['unblock'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'unblock_blocked', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'friends_list':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'reject_friends_request', 'getProcessingRows')")))));
                 $oForm = new BxTemplFormView($aForm);
                 $sActionsList = $oForm->getCode();
                 break;
         }
         // processing the sort link ;
         $sSortLink = getClearedParam('sorting', $sCuttedUrl) . '&page=' . $this->aCommunicatorSettings['page'] . '&per_page=' . $this->aCommunicatorSettings['per_page'];
         // fill array with template keys ;
         $aTemplateKeys = array('js_object' => $sJsObject, 'from_me' => $aLanguageKeys['from_me'], 'to_me' => $aLanguageKeys['to_me'], 'selected_from' => $this->aCommunicatorSettings['person_switcher'] == 'from' ? 'checked="checked"' : null, 'selected_to' => $this->aCommunicatorSettings['person_switcher'] == 'to' ? 'checked="checked"' : null, 'page_sort_url' => $sSortLink, 'sort_date' => $this->aCommunicatorSettings['sorting'] == 'date' ? 'date_desc' : 'date', 'sort_author' => $this->aCommunicatorSettings['sorting'] == 'author' ? 'author_desc' : 'author', 'date_sort_toggle_ellement' => $aSortToglleElements['date_sort_toggle'], 'author_sort_toggle_ellement' => $aSortToglleElements['author_sort_toggle'], 'author' => $aLanguageKeys['author'], 'type' => $aLanguageKeys['type'], 'date' => $aLanguageKeys['date'], 'click_sort' => $aLanguageKeys['click_sort'], 'bx_repeat:rows' => $aProcessedRows, 'actions_list' => $sActionsList, 'current_page' => 'communicator.php', 'select' => $aLanguageKeys['select'], 'all_messages' => $aLanguageKeys['all'], 'none_messages' => $aLanguageKeys['none'], 'read_messages' => $aLanguageKeys['read'], 'unread_messages' => $aLanguageKeys['unread'], 'page_pagination' => $sPagination);
         $sPageContent = $oSysTemplate->parseHtmlByName($sRowsTemplName, $aTemplateKeys);
     } else {
         $sPageContent = $oSysTemplate->parseHtmlByName('default_margin.html', array('content' => MsgBox(_t($sEmptyMessage))));
     }
     // ** Process the final template ;
     // generate the page settings ;
     if ($bShowSettings) {
         $aTemplateKeys = array('js_object' => $sJsObject, 'from_me' => $aLanguageKeys['from_me'], 'to_me' => $aLanguageKeys['to_me'], 'selected_from' => $this->aCommunicatorSettings['person_switcher'] == 'from' ? 'checked="checked"' : null, 'selected_to' => $this->aCommunicatorSettings['person_switcher'] == 'to' ? 'checked="checked"' : null);
         $sSettings = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings'], $aTemplateKeys);
     }
     // fill array with template keys ;
     $aTemplateKeys = array('js_object' => $sJsObject, 'current_page' => 'communicator.php', 'communicator_mode' => $this->aCommunicatorSettings['communicator_mode'], 'communicator_person_mode' => $this->aCommunicatorSettings['person_switcher'], 'error_message' => bx_js_string(_t('_Please, select at least one message')), 'sure_message' => bx_js_string(_t('_Are you sure?')), 'settings' => $sSettings, 'page_content' => $sPageContent);
     return $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings_page'], $aTemplateKeys);
 }
/**
 * page code function
 */
function PageCompGroupMembers()
{
    global $memberID;
    global $groupID;
    global $arrGroup;
    global $site;
    global $oTemplConfig;
    ob_start();
    ?>
		<div class="group_members_pre1">
	<?php 
    $numberMembers = $oTemplConfig->iGroupMembersPreNum;
    $query = "\r\n\t\tSELECT\r\n\t\t\t`GroupsMembers`.`memberID` AS `ID`,\r\n\t\t\t`Profiles`.`NickName`\r\n\t\tFROM `GroupsMembers`, `Profiles`\r\n\t\tWHERE\r\n\t\t\t`GroupsMembers`.`groupID` = {$groupID} AND\r\n\t\t\t`GroupsMembers`.`Status` = 'Active' AND\r\n\t\t\t`GroupsMembers`.`memberID` = `Profiles`.`ID`\r\n\t\tORDER BY RAND()\r\n\t\tLIMIT {$numberMembers}\r\n\t;";
    $resMembers = db_res($query);
    while ($arrMember = mysql_fetch_assoc($resMembers)) {
        ?>
			<div class="group_member_pre">
				<?php 
        echo get_member_thumbnail($arrMember['ID'], 'none');
        ?>
				<a href="<?php 
        echo getProfileLink($arrMember['ID']);
        ?>
"><?php 
        echo htmlspecialchars_adv($arrMember['NickName']);
        ?>
</a>
			</div>
		<?php 
    }
    ?>
		</div>
		<div class="clear_both"></div>
		<div class="view_all_link">
			<a href="<?php 
    echo $site['url'];
    ?>
group_members.php?ID=<?php 
    echo $groupID;
    ?>
"><?php 
    echo _t("_View all members");
    ?>
</a>
		</div>
	<?php 
    $ret = ob_get_clean();
    if ($arrGroup['creatorID'] == $memberID) {
        $creatorEditMembers = "<div class=\"caption_item\"><a href=\"{$site['url']}group_members.php?mode=edit&amp;ID={$groupID}\">" . _t('_Edit members') . "</a></div>";
    } else {
        $creatorEditMembers = '';
    }
    return DesignBoxContent(_t("_Group members"), $ret, 1, $creatorEditMembers);
}
 /**
  * @description : function will generate profile block (used the profile template );
  * @return 		: Html presentation data ;
  */
 function PrintSearhResult($aProfileInfo, $aCoupleInfo = '', $aExtendedKey = null, $sTemplateName = '', $oCustomTemplate = null)
 {
     global $site;
     global $aPreValues;
     $iVisitorID = getLoggedId();
     $bExtMode = !empty($_GET['mode']) && $_GET['mode'] == 'extended' || !empty($_GET['search_result_mode']) && $_GET['search_result_mode'] == 'ext';
     $enable_zodiac = $bExtMode ? getParam('zodiac') : false;
     if ($bExtMode && count($this->aAllovedAvtionsOfVisitor) == 0) {
         //like init
         $aCheckGreet = checkAction($iVisitorID, ACTION_ID_SEND_VKISS);
         $this->aAllovedAvtionsOfVisitor['GREET'] = $aCheckGreet;
         $aCheckMess = checkAction($iVisitorID, ACTION_ID_SEND_MESSAGE);
         $this->aAllovedAvtionsOfVisitor['MESS'] = $aCheckMess;
     }
     $aOnline = array();
     if (isset($aProfileInfo['is_online'])) {
         $aOnline['is_online'] = $aProfileInfo['is_online'];
     }
     $sProfileThumb = get_member_thumbnail($aProfileInfo['ID'], 'none', !$bExtMode, 'visitor', $aOnline);
     // profile Nick/Age/Sex etc.
     $sAgeStr = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) . ' ' : "";
     $sAgeOnly = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? age($aProfileInfo['DateOfBirth']) : "";
     $y_o_sex = $sAgeStr;
     $city = _t("_City") . ": " . process_line_output($aProfileInfo['City']);
     $country = $aProfileInfo['Country'] ? _t("_Country") . ": " . _t($aPreValues['Country'][$aProfileInfo['Country']]['LKey']) . '&nbsp;<img src="' . ($site['flags'] . strtolower($aProfileInfo['Country'])) . '.gif" alt="flag" />' : '';
     // country flag
     $sFlag = $aProfileInfo['Country'] != '' ? '&nbsp;<img src="' . ($site['flags'] . strtolower($aProfileInfo['Country'])) . '.gif" alt="flag" />' : '';
     $sCityName = $aProfileInfo['City'] ? process_line_output($aProfileInfo['City']) . ', ' : null;
     if (!empty($aProfileInfo['Country'])) {
         $city_con = $sFlag . ' ' . $sCityName . _t($aPreValues['Country'][$aProfileInfo['Country']]['LKey']);
     } else {
         $city_con = '';
     }
     $id = _t("_ID") . ": " . $aProfileInfo['ID'];
     // description
     $i_am = $i_am2 = _t("_I am");
     $i_am_desc = trim(strip_tags($aProfileInfo['DescriptionMe']));
     if (mb_strlen($i_am_desc) > 130) {
         $i_am_desc = mb_substr($i_am_desc, 0, 130) . '...';
     }
     $you_are = $you_are2 = _t("_You are");
     $sCity = $aProfileInfo['City'];
     //--- Greeting start ---//
     if ($bExtMode && $aAllovedAvtionsOfVisitor['GREET'][CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $iVisitorID != $aProfileInfo['ID']) {
         $iKissIcon = getTemplateIcon('action_greet_small.gif');
         $sAiKiss = "<img alt=\"" . _t("_Greet") . "\" class=\"links_image\" name=i01{$aProfileInfo['ID']} src=\"" . $iKissIcon . "\" />";
         $al_kiss = '<a target=_blank href="greet.php?sendto=' . $aProfileInfo[ID] . '"';
         $al_kiss .= ">";
         $al_kiss = "<span class=\"links_span\">" . $sAiKiss . $al_kiss . _t("_Greet") . "</a></span>";
     } else {
         $al_kiss = '';
     }
     //--- Greeting end ---//
     //--- Contact start ---//
     if ($bExtMode && $aAllovedAvtionsOfVisitor['MESS'][CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $iVisitorID != $aProfileInfo['ID']) {
         $sSendMsgIcon = getTemplateIcon('action_send_small.gif');
         $ai_sendmsg = "<img alt=\"" . _t("_SEND_MESSAGE") . "\" name=i02{$aProfileInfo['ID']} src=\"{$sSendMsgIcon}\" class=\"links_image\" />";
         $al_sendmsg = "<a href=\"compose.php?ID={$aProfileInfo['ID']}\"";
         $al_sendmsg .= ">";
         $al_sendmsg = "<span class=\"links_span\">" . $ai_sendmsg . $al_sendmsg . _t("_Contact") . "</a></span>";
     } else {
         $al_sendmsg = '';
     }
     //--- Contact end ---//
     $more = '<a href="' . getProfileLink($aProfileInfo['ID']) . '" target="_blank">';
     $more .= '<img src="' . $site['icons'] . 'desc_more.gif" alt="' . _t('_more') . '" />';
     $more .= '</a>';
     $sProfile2ASc1 = $sProfile2ASc2 = $sProfile2Nick = $sProfile2AgeSex = $sProfile2CityCon = $sProfile2Desc = $sProfile2Match = '';
     if ($aCoupleInfo) {
         // profile Nick/Age/Sex etc.
         $sNickName2 = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . $aCoupleInfo['NickName'] . '</a>';
         $sAgeStr2 = $aCoupleInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aCoupleInfo['DateOfBirth'])) . ' ' : "";
         $sAgeOnly2 = $aCoupleInfo['DateOfBirth'] != "0000-00-00" ? age($aCoupleInfo['DateOfBirth']) : "";
         $y_o_sex2 = $sAgeStr2;
         // . _t("_".$aCoupleInfo['Sex']);
         $city2 = _t("_City") . ": " . process_line_output($aCoupleInfo['City']);
         $country2 = _t("_Country") . ": " . _t($aPreValues['Country'][$aCoupleInfo['Country']]['LKey']) . '&nbsp;<img src="' . ($site['flags'] . strtolower($aCoupleInfo['Country'])) . '.gif" alt="flag" />';
         $city_con2 = '&nbsp;&nbsp;' . $sFlag . ' ' . process_line_output($aCoupleInfo['City']) . ", " . _t($aPreValues['Country'][$aCoupleInfo['Country']]['LKey']);
         $city_con2 = preg_replace("/,\$/", '', trim($city_con2));
         $id2 = _t("_ID") . ": " . $aCoupleInfo['ID'];
         // description
         $i_am = $i_am2 = _t("_I am");
         $i_am_desc2 = trim(strip_tags($aCoupleInfo['DescriptionMe']));
         if (mb_strlen($i_am_desc2) > 130) {
             $i_am_desc2 = mb_substr($i_am_desc2, 0, 130) . '...';
         }
         $sCity2 = $aCoupleInfo['City'];
         $sProfile2ASc1 = 'float:left;width:31%;margin-right:10px;';
         $sProfile2ASc2 = 'float:left;width:31%;display:block;';
         $sProfile2Nick = $sNickName2;
         $sProfile2AgeSex = $y_o_sex2;
         $sProfile2CityCon = $city_con2;
         $sProfile2Desc = $i_am_desc2;
         $sProfile2Match = $bExtMode && isLogged() && $iVisitorID != $aCoupleInfo['ID'] && getParam('view_match_percent') ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aCoupleInfo['ID']) : '';
     } else {
         $sProfile2ASc2 = 'display:none;';
     }
     // match progress bar
     $sProfileMatch = $bExtMode && isLogged() && $iVisitorID != $aProfileInfo['ID'] && getParam('view_match_percent') ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aProfileInfo['ID']) : '';
     $sHeadline = null;
     if ($aProfileInfo['Headline']) {
         $sHeadline = mb_strlen($aProfileInfo['Headline']) > 30 ? mb_substr($aProfileInfo['Headline'], 0, 30) . '...' : $aProfileInfo['Headline'];
     }
     $sNickName = getNickName($aProfileInfo['ID']);
     $Link = getProfileLink($aProfileInfo['ID']);
     $sProfileNickname = $sHeadline ? "<a href='{$Link}'>" . $sNickName . '</a> :' : "<a href='{$Link}'>" . $sNickName . '</a>';
     $sSexIcon = $GLOBALS['oFunctions']->genSexIcon($aProfileInfo['Sex']);
     $sProfileZodiac = $enable_zodiac ? $GLOBALS['oFunctions']->getProfileZodiac($aProfileInfo['DateOfBirth']) : '';
     $aKeys = array('thumbnail' => $sProfileThumb, 'nick' => $sProfileNickname, 'head_line' => $sHeadline, 'age' => $y_o_sex, 'city_con' => $city_con, 'i_am_desc' => $i_am_desc, 'sex_image' => $sSexIcon, 'add_style_c1' => $sProfile2ASc1, 'add_style_c2' => $sProfile2ASc2, 'nick2' => $sProfile2Nick, 'age_sex2' => $sProfile2AgeSex, 'city_con2' => $sProfile2CityCon, 'i_am_desc2' => $sProfile2Desc, 'match2' => $sProfile2Match, 'row_title' => process_line_output($aProfileInfo['Headline']), 'thumbnail' => $sProfileThumb, 'match' => $sProfileMatch, 'sex_image' => $sSexIcon, 'age' => $y_o_sex, 'city' => $city, 'just_city' => $sCity, 'just_age' => $sAgeOnly, 'city_con' => $city_con, 'country' => $country, 'id' => $id, 'zodiac_sign' => $sProfileZodiac, 'i_am' => $i_am, 'i_am_desc' => $i_am_desc, 'you_are' => $you_are, 'ai_kiss' => empty($sAiKiss) ? '' : $sAiKiss, 'al_kiss' => $al_kiss, 'ai_sendmsg' => empty($ai_sendmsg) ? '' : $ai_sendmsg, 'al_sendmsg' => $al_sendmsg, 'more' => $more, 'images' => $site['images']);
     if ($aExtendedKey and is_array($aExtendedKey) and !empty($aExtendedKey)) {
         foreach ($aExtendedKey as $sKey => $sValue) {
             $aKeys[$sKey] = $sValue;
         }
     } else {
         $aKeys['ext_css_class'] = '';
     }
     return $oCustomTemplate ? $oCustomTemplate->parseHtmlByName($sTemplateName, $aKeys) : $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateName, $aKeys);
 }
 function displaySearchUnit($aData)
 {
     global $oSysTemplate;
     return $oSysTemplate->parseHtmlByContent($this->_sSearchUnitTmpl, array('action' => 'add', 'member_id' => $aData['id'], 'member_thumbnail' => get_member_thumbnail($aData['id'], 'none', true)));
 }
Exemple #16
0
 function displayFriendAccept($aEvent)
 {
     $aOwner = $this->_oDb->getUser($aEvent['owner_id']);
     $aFriend = $this->_oDb->getUser($aEvent['object_id']);
     if (empty($aOwner) || empty($aFriend)) {
         return array('perform_delete' => true);
     }
     if ($aOwner['status'] != 'Active' || $aFriend['status'] != 'Active') {
         return "";
     }
     $sOwner = getNickName((int) $aEvent['owner_id']);
     $iFriend = (int) $aFriend['id'];
     $sFriend = getNickName($iFriend);
     return array('title' => $sOwner . ' ' . _t('_wall_friends_with') . ' ' . $aFriend['username'], 'description' => '', 'content' => $this->parseHtmlByName('f_accept.html', array('cpt_user_name' => $sOwner, 'cpt_friend_url' => getProfileLink($aFriend['id']), 'cpt_friend_name' => $sFriend, 'cnt_friend' => get_member_thumbnail($iFriend, 'none', true), 'post_id' => $aEvent['id'])));
 }
Exemple #17
0
 function actionGetThumbnail($iId)
 {
     return get_member_thumbnail($iId, "left");
 }
 function getPostOverviewBlock()
 {
     $iMemberID = (int) $this->aViewingPostInfo['OwnerID'];
     $aBlogInfo = $this->_oDb->getBlogInfo($iMemberID);
     $sBlogDescription = '<div class="blog_desc bx-def-margin-sec-top">' . process_html_output($aBlogInfo['Description']) . '</div>';
     $aAuthor = getProfileInfo($iMemberID);
     $aVars = array('author_unit' => get_member_thumbnail($aAuthor['ID'], 'none', true), 'fields' => $sBlogDescription);
     if ($this->iPostViewType == 3 && $this->iViewingPostID > 0) {
         require_once $this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php';
         $oBlogSearch = new BxBlogsSearchUnit();
         bx_import('BxDolCategories');
         bx_import('BxDolTags');
         $oCategories = new BxDolCategories();
         $oTags = new BxDolTags();
         $sCats = '';
         $aCategories = $oCategories->explodeTags($this->aViewingPostInfo['Categories']);
         $aCatLinks = array();
         if (count($aCategories) > 0) {
             foreach ($aCategories as $iKey => $sCatValue) {
                 $sCatLink = $oBlogSearch->getCurrentUrl('category', title2uri(trim($sCatValue)), title2uri(trim($sCatValue)), array('ownerId' => $iMemberID, 'blogOwnerName' => $aAuthor['NickName']));
                 $aCatLinks[] = '<a href="' . $sCatLink . '" rel="nofollow">' . $sCatValue . '</a>';
             }
             $sCats = implode(", ", $aCatLinks);
         }
         $sTags = '';
         $aTags = $oTags->explodeTags($this->aViewingPostInfo['Tags']);
         $aTagLinks = array();
         if (count($aTags) > 0) {
             foreach ($aTags as $sTagKey) {
                 if ($sTagKey != '') {
                     $sTagLink = $oBlogSearch->getCurrentUrl('tag', $iPostID, title2uri(trim($sTagKey)));
                     $aTagLinks[] = '<a href="' . $sTagLink . '" title="' . $sTagKey . '" rel="nofollow">' . $sTagKey . '</a>';
                 }
             }
             $sTags = implode(", ", $aTagLinks);
         }
         $aVars['date'] = getLocaleDate($this->aViewingPostInfo['PostDate'], BX_DOL_LOCALE_DATE_SHORT);
         $aVars['date_ago'] = defineTimeInterval($this->aViewingPostInfo['PostDate'], false);
         $aVars['cats'] = $sCats;
         $aVars['tags'] = $sTags;
         $aVars['fields'] = '';
         return $this->_oTemplate->parseHtmlByName('entry_view_block_info.html', $aVars);
     }
     return $this->_oTemplate->parseHtmlByName('entry_view_empty_block_info.html', $aVars);
 }
 function getBlockCode_Friends()
 {
     $iLimit = 10;
     $sContent = $sPaginate = '';
     $sAllFriends = 'viewFriends.php?iUser='******'page']) ? (int) $_GET['page'] : 1;
     if ($iPage < 1) {
         $iPage = 1;
     }
     if ($iPage > $iPages) {
         $iPage = $iPages;
     }
     $sSqlFrom = ($iPage - 1) * $iLimit;
     $sSqlLimit = "LIMIT {$sSqlFrom}, {$iLimit}";
     $aFriends = getMyFriendsEx($this->iMember, '', 'image', $sSqlLimit);
     $aTmplParams['bx_repeat:friends'] = array();
     foreach ($aFriends as $iId => $aFriend) {
         $aTmplParams['bx_repeat:friends'][] = array('content' => get_member_thumbnail($iId, 'none', true, 'visitor', array('is_online' => $aFriend[5])));
     }
     $sContent = $GLOBALS['oSysTemplate']->parseHtmlByName('member_friends.html', $aTmplParams);
     $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'member.php', 'count' => $iCount, 'per_page' => $iLimit, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'member.php?page={page}&per_page={per_page}\');'));
     $sPaginate = $oPaginate->getSimplePaginate($sAllFriends);
     return array($sContent, array(), $sPaginate);
 }
Exemple #20
0
 function _profilesEdit(&$aProfiles, $isCenterContent = false, $aDataEntry = array())
 {
     $sResult = "";
     foreach ($aProfiles as $aProfile) {
         $aVars = array('id' => $aProfile['ID'], 'thumb' => get_member_thumbnail($aProfile['ID'], 'none', true), 'bx_if:admin' => array('condition' => $aDataEntry && $this->isEntryAdmin($aDataEntry, $aProfile['ID']) ? true : false, 'content' => array()));
         $sResult .= $this->_oTemplate->parseHtmlByName('unit_fan', $aVars);
     }
     return $isCenterContent ? $GLOBALS['oFunctions']->centerContent($sResult, '.sys_fan_unit') : $sResult;
 }
/**
 * page code function
 */
function PageCompMainCode()
{
    global $memberID;
    global $groupID;
    global $arrGroup;
    global $site;
    global $bcd;
    global $oTemplConfig;
    global $_page_cont;
    global $_ni;
    if ($_REQUEST['mode'] == 'edit' and $arrGroup['creatorID'] == $memberID) {
        $editMode = true;
        $editModeReq = 'mode=edit&amp;';
        $editModeSql = "`memberID`!={$arrGroup['creatorID']} AND";
    } else {
        $editMode = false;
        $editModeReq = '';
        $editModeSql = '';
    }
    $breadCrumbs = <<<EOJ
\t\t<div class="groups_breadcrumbs">
\t\t\t<a href="{$site['url']}">{$site['title']}</a> {$bcd}
\t\t\t<a href="{$site['url']}groups_home.php">__Groups__</a> {$bcd}
\t\t\t<a href="{$site['url']}group.php?ID={$groupID}">{$arrGroup['Name_html']}</a> {$bcd}
\t\t\t<span class="active_link">__Group members__</span>
\t\t</div>
EOJ;
    $breadCrumbs = str_replace("__Groups__", _t("_Groups"), $breadCrumbs);
    $breadCrumbs = str_replace("__Group members__", _t("_Group members"), $breadCrumbs);
    $arrMemNum = db_arr("SELECT COUNT(`memberID`) FROM `GroupsMembers` WHERE {$editModeSql} `groupID`={$groupID}  AND `status`='Active'");
    $totalNum = (int) $arrMemNum[0];
    if ($totalNum) {
        $resPerPage = $oTemplConfig->iGroupMembersResPerPage;
        $pagesNum = ceil($totalNum / $resPerPage);
        $page = (int) $_REQUEST['page'];
        if ($page < 1) {
            $page = 1;
        }
        if ($page > $pagesNum) {
            $page = $pagesNum;
        }
        $sqlFrom = ($page - 1) * $resPerPage;
        $query = "\r\n\t\t\tSELECT\r\n\t\t\t\t`GroupsMembers`.`memberID`,\r\n\t\t\t\t`Profiles`.`NickName`,\r\n\t\t\t\tIF( `GroupsMembers`.`memberID`={$arrGroup['creatorID']}, 1, 0 ) AS `isCreator`\r\n\t\t\tFROM\r\n\t\t\t\t`GroupsMembers`, `Profiles`\r\n\t\t\tWHERE\r\n\t\t\t\t{$editModeSql}\r\n\t\t\t\t`GroupsMembers`.`groupID`={$groupID} AND\r\n\t\t\t\t`GroupsMembers`.`status`='Active' AND\r\n\t\t\t\t`GroupsMembers`.`memberID`=`Profiles`.`ID`\r\n\t\t\tORDER BY\r\n\t\t\t\t`isCreator` DESC,\r\n\t\t\t\t`GroupsMembers`.`Date` DESC\r\n\t\t\tLIMIT {$sqlFrom}, {$resPerPage}\r\n\t\t\t";
        $resMembers = db_res($query);
        $numOnPage = mysql_num_rows($resMembers);
        $showingFrom = $sqlFrom + 1;
        $showingTo = $sqlFrom + $numOnPage;
        $showingResults = _t('_Showing results:', $showingFrom, $showingTo, $totalNum);
        if ($pagesNum > 1) {
            $pagesUrl = "{$_SERVER['PHP_SELF']}?{$editModeReq}ID={$groupID}&amp;page={page}";
            $pagination = genPagination($pagesNum, $page, $pagesUrl);
        }
        $_page_cont[$_ni]['bread_crumbs'] = $breadCrumbs;
        $_page_cont[$_ni]['showing_results'] = $showingResults;
        $_page_cont[$_ni]['pagination'] = $pagination;
        ob_start();
        ?>
				<div class="clear_both"></div>
		<?php 
        while ($arrMember = mysql_fetch_assoc($resMembers)) {
            ?>
				<div class="group_member">
			<?php 
            echo get_member_thumbnail($arrMember['memberID'], 'none');
            echo "<a href=\"" . getProfileLink($arrMember['memberID']) . "\">{$arrMember['NickName']}</a>";
            if ((int) $arrMember['isCreator']) {
                echo '<div class="mygroup_leader_is">' . _t('_group creator') . '</div>';
            }
            if ($editMode) {
                echo '<div class="group_member_edit"><a href="' . "{$site['url']}group_actions.php?ID={$groupID}&amp;a=delmem&amp;mem={$arrMember['memberID']}" . '" onclick="return confirm(\'' . _t('_Are you sure want to delete this member?') . '\')">' . _t('_Delete member') . '</a></div>';
            }
            ?>
				</div>
			<?php 
        }
        ?>
				<div class="clear_both"></div>
		<?php 
        $_page_cont[$_ni]['page_main_code'] = ob_get_clean();
    } else {
        $_page_cont[$_ni]['bread_crumbs'] = '';
        $_page_cont[$_ni]['pagination'] = '';
        $_page_cont[$_ni]['showing_results'] = '';
        $_page_cont[$_ni]['page_main_code'] = _t('_Sorry, no members are found');
    }
}
Exemple #22
0
    function getBlockCode_AccountControl()
    {
        global $oTemplConfig, $site, $aPreValues;
        //--- Load cache of sys_account_custom_stat_elements ---//
        $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID');
        //--- Load cache of sys_stat_member ---//
        $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type');
        //--- end of loading caches ---//
        //Labels
        $sUsernameC = _t('_NickName');
        $sProfileStatusC = _t('_Profile status');
        $sPresenceC = _t('_Presence');
        $sMembershipC = _t('_Membership2');
        $sLastLoginC = _t('_Last login');
        $sRegistrationC = _t('_Registration');
        $sEmailC = _t('_Email');
        $sGreetedC = _t('_greeted');
        $sGreetedMeC = _t('_Greeted me');
        $sBlockedC = _t('_blocked');
        $sViewedMeC = _t('_Viewed me');
        $sMembersC = ' ' . _t('_Members');
        $sEditProfileInfoC = _t('_Edit profile info');
        $sProfileC = _t('_Profile');
        $sAccountInfoC = _t('_Account Info');
        $sActivityC = _t('_Tracker');
        $sCustomC = _t('_Custom');
        $sMaleIcon = getTemplateIcon('male.png');
        $sFemaleIcon = getTemplateIcon('female.png');
        // Values
        $sUsername = $this->aMemberInfo['NickName'];
        $sUserLink = getProfileLink($this->aMemberInfo['ID']);
        $sOwnerThumb = get_member_thumbnail($this->aMemberInfo['ID'], 'none', true);
        $iYears = age($this->aMemberInfo['DateOfBirth']);
        $sYearsOld = _t('_y/o', $iYears);
        $sProfileIcon = $this->aMemberInfo['Sex'] == 'male' ? $sMaleIcon : $sFemaleIcon;
        $sCustomElements = '';
        $sCountryName = empty($this->aMemberInfo['Country']) ? '' : _t($aPreValues['Country'][$this->aMemberInfo['Country']]['LKey']);
        $sCityName = $this->aMemberInfo['City'];
        $sCountryPic = $this->aMemberInfo['Country'] == '' ? '' : ' <img alt="' . $this->aMemberInfo['Country'] . '" src="' . ($site['flags'] . strtolower($this->aMemberInfo['Country'])) . '.gif"/>';
        $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", $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;
        }
        $sMembership = '';
        $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']);
        $sMembership = <<<EOF
\t<tr class="account_control_tr">
\t\t<td valign=top class="account_control_left">{$sMembershipC}:</td>
\t\t<td valign=top class="account_control_right">
\t\t\t{$sMembStatus}
\t\t</td>
\t</tr>
EOF;
        $oForm = bx_instance('BxDolFormCheckerHelper');
        if (!$this->aMemberInfo['DateLastLogin'] || $this->aMemberInfo['DateLastLogin'] == "0000-00-00 00:00:00") {
            $sLastLogin = '******';
        } else {
            $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']);
            $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE);
        }
        if (!$this->aMemberInfo['DateReg'] || $this->aMemberInfo['DateReg'] == "0000-00-00 00:00:00") {
            $sRegistration = 'never';
        } else {
            $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']);
            $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE);
        }
        $sEmail = $this->aMemberInfo['Email'];
        $this->aMemberInfo = getProfileInfo($this->aMemberInfo['ID']);
        //my greeted contacts
        $sMGCSQL = $aPQStatisticsElements['mgc']['SQL'];
        $sMGCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGCSQL);
        $iGreetedContactsCnt = (int) db_value($sMGCSQL);
        //my greeted me contacts
        $sMGMCSQL = $aPQStatisticsElements['mgmc']['SQL'];
        $sMGMCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGMCSQL);
        $iGreetedMeContactsCnt = (int) db_value($sMGMCSQL);
        //my blocked contacts
        $sMBCSQL = $aPQStatisticsElements['mbc']['SQL'];
        $sMBCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMBCSQL);
        $iBlockedContactsCnt = (int) db_value($sMBCSQL);
        $iViewedMeContactsCnt = (int) $this->aMemberInfo['Views'];
        $bModuleExists = false;
        $aCustomElements = array();
        $aCustomElements['header5'] = array('type' => 'block_header', 'caption' => $sCustomC, 'collapsable' => true);
        foreach ($aAccountCustomStatElements as $iID => $aMemberStats) {
            $sUnparsedLabel = $aMemberStats['Label'];
            $sUnparsedValue = $aMemberStats['Value'];
            $sLabel = _t($sUnparsedLabel);
            $sUnparsedValue = str_replace('__site_url__', $site['url'], $sUnparsedValue);
            //step 1 - replacements of keys
            $sLblTmpl = '__l_';
            $sTmpl = '__';
            while ($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) {
                $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
                if ($iEndPos > $iStartPos) {
                    $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos - $iStartPos - strlen($sLblTmpl));
                    $sKeyValue = strtolower(_t('_' . $sSubstr));
                    $sUnparsedValue = str_replace($sLblTmpl . $sSubstr . $sTmpl, $sKeyValue, $sUnparsedValue);
                } else {
                    break;
                }
            }
            //step 2 - replacements of Stat keys
            while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) >= 0) {
                $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
                if ($iEndPos > $iStartPos) {
                    $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);
                } else {
                    break;
                }
            }
            $sCustomElements .= <<<EOF
\t<tr class="account_control_tr">
\t    <td class="account_control_left">{$sLabel}: </td>
\t    <td class="account_control_right">
\t\t\t{$sUnparsedValue}
\t\t</td>
\t</tr>
EOF;
            $sTrimmedLabel = trim($sUnparsedLabel, '_');
            $aCustomElements[$sTrimmedLabel] = array('type' => 'custom', 'name' => $sTrimmedLabel, 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue, 'colspan' => true);
            if (!$bModuleExists) {
                $bModuleExists = true;
            }
        }
        $aCustomElements['header5_end'] = array('type' => 'block_end');
        $sProfileInfoCont = <<<EOF
<div class="infoMain">
\t<div class="memberPic" style="margin-left:0px;padding:0px;text-align:center;width:70px;">
\t\t{$sOwnerThumb}
\t</div>
\t<div class="infoText">
\t\t<div class="infoUnit">
\t\t\t<img src="{$sProfileIcon}" />
\t\t\t{$sYearsOld}
\t\t</div>
\t\t<div class="infoUnit">
\t\t\t{$sCountryPic} {$sCountryName}, {$sCityName}
\t\t</div>
\t\t<div class="infoUnit">
\t\t\t<a href="{$site['url']}pedit.php?ID={$this->aMemberInfo['ID']}">{$sEditProfileInfoC}</a>
\t\t</div>
\t</div>
</div>
<div class="clear_both"></div>
EOF;
        require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php';
        $oStatusView = new BxDolUserStatusView();
        $sUserStatus = '';
        if ($oStatusView->aStatuses) {
            foreach ($oStatusView->aStatuses as $sKey => $aItems) {
                $sTitle = _t($aItems['title']);
                $sOnclick = strtolower($this->aMemberInfo['UserStatus']) == strtolower($sKey) ? "" : "onclick=\"if (typeof oBxUserStatus != 'undefined' ) { oBxUserStatus.setUserStatus('{$sKey}', \$(this).parents('ul:first')); \$('#user_status_ac .block_collapse_btn').attr('src', aDolImages['collapse_closed']); \$('#user_status_ac').parent().toggleClass('collapsed').next('tbody').fadeOut(400); location.reload(); }return false\"";
                $aTemplateKeys = array('bx_if:item_img' => array('condition' => true, 'content' => array('item_img_src' => $GLOBALS['oFunctions']->getTemplateIcon($aItems['icon']), 'item_img_alt' => $sTitle, 'item_img_width' => 16, 'item_img_height' => 16)), 'item_link' => 'javascript:void(0)', 'item_onclick' => $sOnclick, 'item_title' => $sTitle, 'extra_info' => null);
                $sUserStatus .= $GLOBALS['oSysTemplate']->parseHtmlByName('account_control_member_status.html', $aTemplateKeys);
            }
        }
        $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' => $sProfileInfoCont, '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'), 'header3' => array('type' => 'block_header', 'caption' => $sAccountInfoC, 'collapsable' => true), 'Username' => array('type' => 'custom', 'name' => 'Username', 'content' => '<b>' . $sUsernameC . ':</b> <a href="' . $sUserLink . '" >' . $sUsername . '</a>', 'colspan' => true), 'Email' => array('type' => 'custom', 'name' => 'Email', 'content' => '<b>' . $sEmailC . ':</b> ' . $sEmail, 'colspan' => true), 'Status' => array('type' => 'custom', 'name' => 'Status', 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . ' ' . $sProfileStatusMess, '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), 'header3_end' => array('type' => 'block_end'), 'header4' => array('type' => 'block_header', 'caption' => $sActivityC, 'collapsable' => true), 'ViewedMe' => array('type' => 'custom', 'name' => 'ViewedMe', 'content' => '<b>' . $sViewedMeC . ':</b> ' . _t('_N times', $iViewedMeContactsCnt), 'colspan' => true), 'Blocked' => array('type' => 'custom', 'name' => 'Blocked', 'content' => '<b>' . $sBlockedC . ':</b> ' . $iBlockedContactsCnt . $sMembersC, 'colspan' => true), 'Greeted' => array('type' => 'custom', 'name' => 'Greeted', 'content' => '<b>' . $sGreetedC . ':</b> ' . _t('_N times', $iGreetedContactsCnt), 'colspan' => true), 'GreetedMe' => array('type' => 'custom', 'name' => 'GreetedMe', 'content' => '<b>' . $sGreetedMeC . ':</b> ' . $iGreetedMeContactsCnt . $sMembersC, 'colspan' => true), 'header4_end' => array('type' => 'block_end')));
        //custom
        if ($bModuleExists) {
            $aForm['inputs'] = array_merge($aForm['inputs'], $aCustomElements);
        }
        $oForm = new BxTemplFormView($aForm);
        return '<div class="dbContent">' . $oForm->getCode() . '</div>';
    }
Exemple #23
0
 /**
  * Function will generate window with reply message or new compose message;
  *
  * @param        : $iRecipientID (integer) - recipient's ID ;
  * @param        : $iMessageID (integer) - message ID (optional parameter);
  * @return        : Html presentation data;
  */
 function genReplayMessage($iRecipientID, $iMessageID = 0)
 {
     global $oSysTemplate;
     $iMessageID = (int) $iMessageID;
     $iRecipientID = (int) $iRecipientID;
     // check if send message is allowed
     $aComposeSettings = array();
     $sErrMsg = $this->sendMessage('', '', $iRecipientID, $aComposeSettings, true);
     if ($sErrMsg) {
         return $sErrMsg;
     }
     // init some needed variables ;
     $sOutputHtml = '';
     $aMemberInfo = getProfileInfo($this->aMailBoxSettings['member_id']);
     $aRecipientInfo = getProfileInfo($iRecipientID);
     $aLanguageKeys = array('information' => $iMessageID ? _t('_Reply') : _t('_COMPOSE_H1'), 'cancel' => bx_js_string(_t('_Cancel')), 'send' => bx_js_string(_t('_Send')), 'send_copy' => _t('_Send copy to personal email', $aRecipientInfo['NickName']), 'send_copy_my' => _t('_Send copy to my personal email'), 'notify' => _t('_Notify by e-mail', $aRecipientInfo['NickName']), 'error_message' => bx_js_string(_t('_please_fill_next_fields_first')));
     if (!empty($aMemberInfo) && !empty($aRecipientInfo)) {
         // ** generate recipient's information ;
         $sMemberIcon = get_member_thumbnail($this->aMailBoxSettings['member_id'], 'none');
         $sMemberNickName = getNickName($aMemberInfo['ID']);
         $sMemberLocation = getProfileLink($aMemberInfo['ID']);
         $sCurrentDate = date('d.m.Y G:i');
         $sMessageSubject = $iMessageID ? $this->addReToSubject(db_value("\n                            SELECT\n                                `Subject`\n                            FROM\n                                `sys_messages`\n                            WHERE\n                                `ID` = {$iMessageID}\n                                    AND\n                                (\n                                `Sender` = {$this->aMailBoxSettings['member_id']}\n                                    OR\n                                `Recipient` = {$this->aMailBoxSettings['member_id']}\n                                )\n                            ")) : null;
         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['send'], 'attrs' => array('onclick' => 'if(typeof oMailBoxReplayMessage != \'undefined\') oMailBoxReplayMessage.sendMessage(' . $iRecipientID . ')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['cancel'], 'attrs' => array('onclick' => 'if(typeof oMailBoxReplayMessage != \'undefined\') oMailBoxReplayMessage.cancelReplay()')))));
         $oForm = new BxTemplFormView($aForm);
         $sMessageBoxActions = $oForm->getCode();
         $aTemplateKeys = array('error_message' => $aLanguageKeys['error_message'], 'current_page' => 'mail.php', 'information' => $aLanguageKeys['information'], 'member_thumbnail' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation, 'date_create' => $sCurrentDate, 'message_subject' => $sMessageSubject, 'send_copy_my' => $aLanguageKeys['send_copy_my'], 'send_copy_to' => $aLanguageKeys['send_copy'], 'notify' => $aLanguageKeys['notify'], 'action_buttons' => $sMessageBoxActions);
         $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['message_replay'], $aTemplateKeys);
     }
     bx_import('BxDolEditor');
     $oEditor = BxDolEditor::getObjectInstance();
     $sEditor = '';
     if ($oEditor) {
         $oEditor->setCustomConf("remove_script_host: false,\nrelative_urls: false,\n");
         $sEditor = $oEditor->attachEditor('#compose_message', BX_EDITOR_FULL);
     }
     return $sEditor . $sOutputHtml;
 }
    /**
     * Generate List of Blogs
     *
     * @param $sType - tyle of list ('top', 'last')
     * @return HTML presentation of data
     */
    function GenBlogLists($sType = '')
    {
        $sDescriptionC = _t('_Description');
        $sPostsC = _t('_Posts');
        $sNoBlogsC = _t('_Sorry, nothing found');
        $sAllBlogsC = _t('_All Blogs');
        $sTopBlogsC = _t('_Top Blogs');
        $iCheckedMemberID = $this->aBlogConf['visitorID'];
        $sRestrictRes = $this->CheckRestrictionToView($iCheckedMemberID);
        if ($sRestrictRes != '') {
            return $sRestrictRes;
        }
        $sBlogsSQL = "\n\t\t\tSELECT `Blogs`. * , `Profiles`.`Nickname` \n\t\t\tFROM `Blogs` \n\t\t\tINNER JOIN `Profiles` ON `Blogs`.`OwnerID` = `Profiles`.`ID`\n\t\t";
        //////////////////pagination addition//////////////////////////
        $iTotalNum = db_value("SELECT COUNT(*) FROM `Blogs` INNER JOIN `Profiles` ON `Blogs`.`OwnerID` = `Profiles`.`ID`");
        if (!$iTotalNum) {
            return MsgBox($sNoBlogsC);
        }
        $iPerPage = (int) $_GET['per_page'];
        if (!$iPerPage) {
            $iPerPage = $this->iPerPageElements;
        }
        $iTotalPages = ceil($iTotalNum / $iPerPage);
        $iCurPage = (int) $_GET['page'];
        if ($iCurPage > $iTotalPages) {
            $iCurPage = $iTotalPages;
        }
        if ($iCurPage < 1) {
            $iCurPage = 1;
        }
        $sLimitFrom = ($iCurPage - 1) * $iPerPage;
        $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
        ////////////////////////////
        $sCaption = $sAllBlogsC;
        if ($sType == 'top') {
            $sBlogsSQL = "\n\t\t\t\tSELECT `Blogs`.`ID` , `Blogs`.`OwnerID` , `Blogs`.`Description` , `Profiles`.`Nickname` , MAX(`PostDate`) AS 'MPD', COUNT(`BlogPosts`.`PostID`) AS 'PostCount'\n\t\t\t\tFROM `Blogs` \n\t\t\t\tINNER JOIN `BlogCategories` ON `BlogCategories`.`OwnerID` = `Blogs`.`OwnerID` \n\t\t\t\tINNER JOIN `Profiles` ON `Profiles`.`ID` = `Blogs`.`OwnerID` \n\t\t\t\tINNER JOIN `BlogPosts` ON `BlogPosts`.`CategoryID` = `BlogCategories`.`CategoryID`\n\t\t\t\tWHERE `PostStatus`='approval'\n\t\t\t\tGROUP BY `Blogs`.`ID` \n\t\t\t\tORDER BY `PostCount` DESC\n\t\t\t\t{$sqlLimit}\n\t\t\t";
            $sCaption = $sTopBlogsC;
        } elseif ($sType == 'last') {
            $sBlogsSQL = "\n\t\t\t\tSELECT `Blogs`.`ID` , `Blogs`.`OwnerID` , `Blogs`.`Description` , `Profiles`.`Nickname` , MAX( `PostDate` ) AS 'MPD', COUNT( `BlogPosts`.`PostID` ) AS 'PostCount'\n\t\t\t\tFROM `Blogs` \n\t\t\t\tINNER JOIN `BlogCategories` ON `BlogCategories`.`OwnerID` = `Blogs`.`OwnerID` \n\t\t\t\tINNER JOIN `Profiles` ON `Profiles`.`ID` = `Blogs`.`OwnerID` \n\t\t\t\tINNER JOIN `BlogPosts` ON `BlogPosts`.`CategoryID` = `BlogCategories`.`CategoryID`\n\t\t\t\tWHERE `PostStatus`='approval'\n\t\t\t\tGROUP BY `Blogs`.`ID`\n\t\t\t\tORDER BY `MPD` DESC\n\t\t\t\t{$sqlLimit}\n\t\t\t";
        }
        // process database queries
        $vBlogsRes = db_res($sBlogsSQL);
        if (mysql_affected_rows() == 0) {
            return MsgBox($sNoBlogsC);
        }
        while ($aBlogsRes = mysql_fetch_assoc($vBlogsRes)) {
            if ($aBlogsRes['PostCount'] == 0 && $sType == 'top') {
                //in Top blogs skip blogs with 0 comments
                continue;
            }
            $sCont = get_member_thumbnail($aBlogsRes['OwnerID'], 'left', TRUE);
            $sBlogOwnerLink = $this->genBlogLink('show_member_blog', array('Permalink' => $aBlogsRes['Nickname'], 'Link' => $aBlogsRes['OwnerID']));
            $sRetHtml .= <<<EOF
<div>
\t<div class="clear_both"></div>
\t\t{$sCont}
\t<div class="cls_res_info_nowidth">
\t\t<div>
\t\t\t<a href="{$sBlogOwnerLink}">
\t\t\t\t{$aBlogsRes['Nickname']} Blog
\t\t\t</a>
\t\t</div>
\t\t<div>
\t\t\t{$aBlogsRes['PostCount']} {$sPostsC}
\t\t</div>
\t\t<div>
\t\t\t{$sDescriptionC}: <div class="clr3">{$aBlogsRes['Description']}</div>
\t\t</div>
\t</div>
\t<div class="clear_both"></div>
</div>
EOF;
        }
        /////////pagination addition//////////////////
        if ($this->isPermalinkEnabled() == false) {
            //old variant
            if ($iTotalPages > 1) {
                $sRequest = $_SERVER['PHP_SELF'] . '?';
                $aFields = array('action');
                foreach ($aFields as $vField) {
                    if (isset($_GET[$vField])) {
                        $sRequest .= "&amp;{$vField}=" . htmlentities(process_pass_data($_GET[$vField]));
                    }
                }
                $sPagination = '<div style="text-align: center; position: relative;">' . _t("_Results per page") . ':
						<select name="per_page" onchange="window.location=\'' . $sRequest . '&amp;per_page=\' + this.value;">
							<option value="10"' . ($iPerPage == 10 ? ' selected="selected"' : '') . '>10</option>
							<option value="20"' . ($iPerPage == 20 ? ' selected="selected"' : '') . '>20</option>
							<option value="50"' . ($iPerPage == 50 ? ' selected="selected"' : '') . '>50</option>
							<option value="100"' . ($iPerPage == 100 ? ' selected="selected"' : '') . '>100</option>
						</select></div>' . genPagination($iTotalPages, $iCurPage, $sRequest . '&amp;page={page}&amp;per_page=' . $iPerPage);
            } else {
                $sPagination = '';
            }
        } else {
            if ($iTotalPages > 1) {
                $sRequest = $_REQUEST['action'] == 'top_blogs' ? 'blogs/top/' : 'blogs/all/';
                $sPaginAddon = '';
                //$sPaginAddon = '/' . process_db_input($_GET['catUri']);
                /*$aFields = array( 'bClassifiedID', 'bSubClassifiedID', 'catUri', 'scatUri' );
                		
                		foreach( $aFields as $field )
                			if( isset( $_GET[$field] ) )
                				$sRequest .= "&amp;{$field}=" . htmlentities( process_pass_data( $_GET[$field] ) );*/
                $sPagination = '<div style="text-align: center; position: relative;">' . _t("_Results per page") . ':
						<select name="per_page" onchange="window.location=\'' . $sRequest . '\' + this.value + \'/1' . $sPaginAddon . '\';">
							<option value="10"' . ($iPerPage == 10 ? ' selected="selected"' : '') . '>10</option>
							<option value="20"' . ($iPerPage == 20 ? ' selected="selected"' : '') . '>20</option>
							<option value="50"' . ($iPerPage == 50 ? ' selected="selected"' : '') . '>50</option>
							<option value="100"' . ($iPerPage == 100 ? ' selected="selected"' : '') . '>100</option>
						</select></div>' . genPagination($iTotalPages, $iCurPage, $sRequest . $iPerPage . '/{page}' . $sPaginAddon);
            } else {
                $sPagination = '';
            }
        }
        ///////////////////////////
        return DesignBoxContent($sCaption, $sRetHtml . $sPagination, 1);
    }
function PrintGuestbook()
{
    global $logged;
    global $site;
    global $records_on_page;
    global $date_format;
    global $oTemplConfig;
    $ret = "";
    $owner = $_REQUEST['owner'] ? (int) $_REQUEST['owner'] : (int) $_COOKIE['memberID'];
    $id = $_COOKIE['memberID'] ? $_COOKIE['memberID'] : 0;
    $from = (int) $_REQUEST['from'];
    if (!$owner) {
        return $ret;
    }
    // Print owner's information
    $ret .= "<br />\r\n\t\t<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan=\"2\">" . ProfileDetails($owner) . "</td>\r\n\t\t\t</tr>\r\n\t\t</table>\n";
    // Print page controls
    $records_num = db_arr("SELECT COUNT( * ) AS `rec_num` FROM `Guestbook` WHERE `Recipient` = '{$owner}'");
    if ($records_num['rec_num'] > $records_on_page) {
        $ret .= "<br />\r\n\t\t\t<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" width=\"100%\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td align=\"center\" class=\"text\">";
        if ($from >= $records_on_page) {
            $nfrom = 0 < $from - $records_on_page ? $from - $records_on_page : 0;
            $ret .= "\r\n\t\t\t\t\t\t<a href=\"guestbook.php?owner={$owner}&from={$nfrom}\">&lt;&lt;&nbsp;</a>";
        }
        $i = 0;
        $pages = 1;
        while ($i < $records_num['rec_num']) {
            if ($i == $from) {
                $ret .= "\r\n\t\t\t\t\t\t{$pages}&nbsp;";
            } else {
                $ret .= "\r\n\t\t\t\t\t\t<a href=\"guestbook.php?owner={$owner}&from=" . $i . "\">{$pages}&nbsp;</a>";
            }
            $i = $i + $records_on_page;
            $pages++;
        }
        if ($records_num['rec_num'] > $from + $records_on_page) {
            $nfrom = $from + $records_on_page;
            $ret .= "\r\n\t\t\t\t\t\t<a href=\"guestbook.php?owner={$owner}&from={$nfrom}\">&nbsp;>></a>";
        }
        $ret .= "\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\n";
    }
    // Print guestbook entries
    $query = "\r\n\t\tSELECT\r\n\t\t\t`Guestbook`.`ID`,\r\n\t\t\tDATE_FORMAT(`Date`, '{$date_format}' ) AS 'Date',\r\n\t\t\t`IP`,\r\n\t\t\t`Sender`,\r\n\t\t\t`Profiles`.`NickName`,\r\n\t\t\t`Recipient`,\r\n\t\t\t`Text`,\r\n\t\t\t`New`\r\n\t\tFROM `Guestbook`\r\n\t\tLEFT JOIN `Profiles` ON\r\n\t\t\t`Profiles`.`ID` = `Sender`\r\n\t\tWHERE\r\n\t\t\t`Recipient`='{$owner}'\r\n\t\tORDER BY `Date` DESC\r\n\t\tLIMIT {$from}, {$records_on_page}\r\n\t\t";
    $records_res = db_res($query);
    if ($records_num['rec_num'] > 0) {
        $ret .= "<br />\r\n\t\t\t<table class=\"gb_msgs_table\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th width=\"20%\">" . _t("_From") . "</th>\r\n\t\t\t\t\t<th width=\"80%\">" . _t("_Text") . "</th>\r\n\t\t\t\t</tr>";
        $tr_class = 'odd';
        while ($records_arr = mysql_fetch_array($records_res)) {
            $record_text = $records_arr['Text'];
            $ret .= "\r\n\t\t\t\t<tr class=\"gb_msg_row_{$tr_class}\">\r\n\t\t\t\t\t<td width=\"20%\" class=\"picPosition\">" . get_member_thumbnail($records_arr['Sender'], 'none') . '<b><a href="' . getProfileLink($owner) . '">' . $records_arr['NickName'] . '</a></b><br />' . $records_arr['Date'] . "</td>\r\n\t\t\t\t\t<td width=\"80%\" valign=\"top\">";
            if ($owner == $id || $logged['admin']) {
                $ret .= "\r\n\t\t\t\t\t\t\t<div class=\"gb_msg_actions\">\r\n\t\t\t\t\t\t\t\t<a href=\"guestbook.php?owner={$owner}&action=delete&delete_id={$records_arr['ID']}\">" . _t("_Delete") . "</a>\r\n\t\t\t\t\t\t\t</div>";
            }
            $ret .= "\r\n\t\t\t\t\t\t\t<div>{$record_text}</div>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>";
            $tr_class = $tr_class == 'odd' ? 'even' : 'odd';
        }
        $ret .= "\r\n\t\t\t</table>";
    }
    // Print add new entry link
    $ret .= "\r\n        \t<div class=\"add_link\">\r\n\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?owner={$owner}&amp;action=show_add\">" . _t("_Add record") . "</a>\r\n\t\t\t</div>";
    return $ret;
}
function ProfileDetails($senderID)
{
    global $site;
    global $prof;
    global $dir;
    //$prof_query = "SELECT `NickName`, `Headline`, `DateOfBirth`, `Sex`, `Country`, `Pic_0_addon`, `Status`  FROM `Profiles` WHERE `ID` = '$senderID'";
    //$prof_arr = db_arr($prof_query);
    $prof_arr = getProfileInfo($senderID);
    $country = _t('__' . $prof['countries'][$prof_arr['Country']]);
    $prof_age = age($prof_arr['DateOfBirth']);
    $prof_sex = _t("_" . $prof_arr['Sex']);
    if ($prof_arr['Status'] == 'Active') {
        $nick_link = '<a href="' . getProfileLink($senderID) . '" target="_blank">' . $prof_arr['NickName'] . '</a>';
    } else {
        $nick_link = $prof_arr['NickName'];
    }
    $ret .= '<div class="prof_details_wrapper">';
    $ret .= '<div class=\\"clear_both\\"></div>';
    $ret .= get_member_thumbnail($senderID, 'left');
    $ret .= '<div class="prof_ditails_block">';
    $ret .= '<div class="li_word">' . _t('_NickName') . ':</div><div class="li_value">' . $nick_link . '</div>';
    $ret .= '<div class="li_word">' . _t('_Sex') . ':</div><div class="li_value">' . $prof_sex . '</div>';
    $ret .= '<div class="li_word">' . _t('_DateOfBirth') . ':</div><div class="li_value">' . $prof_age . '</div>';
    $ret .= '<div class="li_word">' . _t('_From') . ':</div><div class="li_value"> ' . $country . '</div>';
    $ret .= '</div>';
    $ret .= '<div class=\\"clear_both\\"></div>';
    $ret .= '</div>';
    return $ret;
}
Exemple #27
0
                $sErrorMessage = '_Mailbox description empty';
            }
            if (!$vRecipientID) {
                $sErrorMessage = '_Mailbox recipient empty';
            }
            $sOutputHtml = !$sErrorMessage ? $oMailBox->sendMessage($sMessageSubject, $sMessageBody, $vRecipientID, $aComposeSettings) : _t_err($sErrorMessage);
            break;
        case 'auto_complete':
            if ($sAutoCompleteQ) {
                $sOutputHtml = $oMailBox->getAutoCompleteList($sAutoCompleteQ);
            }
            break;
        case 'get_thumbnail':
            $iRecipientID = getId($vRecipientID);
            if ($iRecipientID) {
                $sOutputHtml = get_member_thumbnail($iRecipientID, 'none');
            }
            break;
    }
    // try to define the callback function name ;
    if (isset($_GET['callback_function']) and in_array($_GET['callback_function'], $aCallbackFunctions)) {
        if (method_exists($oMailBox, $_GET['callback_function'])) {
            $sOutputHtml = $oMailBox->{$_GET['callback_function']}();
        }
    }
    header('Content-Type: text/html; charset=utf-8');
    echo $sOutputHtml;
    exit;
}
// ** prepare to output page in normal mode ;
$sPageTitle = _t('_Mailbox');
Exemple #28
0
function getMembersExtended($aProfiles, $sPaginate, $sControls)
{
    $aItems = array();
    foreach ($aProfiles as $aProfile) {
        $aItems[$aProfile['id']] = array('id' => $aProfile['id'], 'thumbnail' => get_member_thumbnail($aProfile['id'], 'none'), 'edit_link' => $GLOBALS['site']['url'] . 'pedit.php?ID=' . $aProfile['id'], 'edit_class' => (int) $aProfile['banned'] == 1 ? 'adm-mp-banned' : ($aProfile['status'] != 'Active' ? 'adm-mp-inactive' : 'adm-mp-active'), 'username' => getNickName($aProfile['id']), 'info' => $GLOBALS['oFunctions']->getUserInfo($aProfile['id']), 'description' => strmaxtextlen($aProfile['description'], 130));
    }
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members_extended.html', array('bx_repeat:items' => array_values($aItems), 'paginate' => $sPaginate, 'control' => $sControls));
}
 function getRepostedBy($iId)
 {
     $sStylePrefix = $this->_oConfig->getPrefix('style');
     $aUserIds = $this->_oDb->getRepostedBy($iId);
     $aTmplUsers = array();
     foreach ($aUserIds as $iUserId) {
         $aTmplUsers[] = array('style_prefix' => $sStylePrefix, 'thumbnail' => get_member_thumbnail($iUserId, 'none', true));
     }
     if (empty($aTmplUsers)) {
         $aTmplUsers = MsgBox(_t('_Empty'));
     }
     $sName = $this->_oConfig->getHtmlIds('repost', 'by_popup') . $iId;
     $sContent = $this->parseHtmlByName('repost_by_list.html', array('style_prefix' => $sStylePrefix, 'bx_repeat:list' => $aTmplUsers));
     return PopupBox($sName, _t('_wall_txt_reposted_by'), $sContent);
 }
 function getMembers($sBlockName, $aParams = array(), $iLimit = 16, $sMode = 'last')
 {
     $aDefFields = array('ID', 'NickName', 'Couple', 'Sex');
     $sCode = '';
     $iOnlineTime = (int) getParam("member_online_time");
     //main fields
     $sqlMainFields = "";
     foreach ($aDefFields as $iKey => $sValue) {
         $sqlMainFields .= "`Profiles`. `{$sValue}`, ";
     }
     $sqlMainFields .= "if(`DateLastNav` > SUBDATE(NOW(), INTERVAL {$iOnlineTime} MINUTE ), 1, 0) AS `is_online`";
     // possible conditions
     $sqlCondition = "WHERE `Profiles`.`Status` = 'Active' and (`Profiles`.`Couple` = 0 or `Profiles`.`Couple` > `Profiles`.`ID`)";
     if (is_array($aParams)) {
         foreach ($aParams as $sField => $sValue) {
             $sqlCondition .= " AND `Profiles`.`{$sField}` = '{$sValue}'";
         }
     }
     // top menu and sorting
     $aModes = array('last', 'top', 'online');
     $aDBTopMenu = array();
     if (empty($_GET[$sBlockName . 'Mode'])) {
         $sMode = 'last';
     } else {
         $sMode = in_array($_GET[$sBlockName . 'Mode'], $aModes) ? $_GET[$sBlockName . 'Mode'] : ($sMode = 'last');
     }
     $sqlOrder = "";
     foreach ($aModes as $sMyMode) {
         switch ($sMyMode) {
             case 'online':
                 if ($sMode == $sMyMode) {
                     $sqlCondition .= " AND `Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $iOnlineTime . " MINUTE)";
                     $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC";
                 }
                 $sModeTitle = _t('_Online');
                 break;
             case 'last':
                 if ($sMode == $sMyMode) {
                     $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `Profiles`.`DateReg` DESC";
                 }
                 $sModeTitle = _t('_Latest');
                 break;
             case 'top':
                 if ($sMode == $sMyMode) {
                     $oVotingView = new BxTemplVotingView('profile', 0, 0);
                     $aSql = $oVotingView->getSqlParts('`Profiles`', '`ID`');
                     $sqlOrder = $oVotingView->isEnabled() ? " ORDER BY `Profiles`.`Couple` ASC, (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `Profiles`.`DateReg` DESC" : $sqlOrder;
                     $sqlMainFields .= $aSql['fields'];
                     $sqlLJoin = $aSql['join'];
                     $sqlCondition .= " AND `pr_rating_count` > 1";
                 }
                 $sModeTitle = _t('_Top');
                 break;
         }
         $aDBTopMenu[$sModeTitle] = array('href' => BX_DOL_URL_ROOT . "index.php?{$sBlockName}Mode={$sMyMode}", 'dynamic' => true, 'active' => $sMyMode == $sMode);
     }
     if (empty($sqlLJoin)) {
         $sqlLJoin = '';
     }
     $iCount = (int) db_value("SELECT COUNT(`Profiles`.`ID`) FROM `Profiles` {$sqlLJoin} {$sqlCondition}");
     $aData = array();
     $sPaginate = '';
     if ($iCount) {
         $iLimit = (int) $iLimit > 0 ? (int) $iLimit : 8;
         $iPages = ceil($iCount / $iLimit);
         $iPage = empty($_GET['page']) ? 1 : (int) $_GET['page'];
         if ($iPage > $iPages) {
             $iPage = $iPages;
         }
         if ($iPage < 1) {
             $iPage = 1;
         }
         $sqlFrom = ($iPage - 1) * $iLimit;
         $sqlLimit = "LIMIT {$sqlFrom}, {$iLimit}";
         $sqlQuery = "SELECT " . $sqlMainFields . " FROM `Profiles` {$sqlLJoin} {$sqlCondition} {$sqlOrder} {$sqlLimit}";
         $rData = db_res($sqlQuery);
         $iCurrCount = mysql_num_rows($rData);
         $aOnline = $aTmplVars = array();
         while ($aData = mysql_fetch_assoc($rData)) {
             $aOnline['is_online'] = $aData['is_online'];
             $aTmplVars[] = array('thumbnail' => get_member_thumbnail($aData['ID'], 'none', true, 'visitor', $aOnline));
         }
         $sCode = $GLOBALS['oSysTemplate']->parseHtmlByName('members_list.html', array('bx_repeat:list' => $aTmplVars));
         if ($iPages > 1) {
             $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'index.php', 'count' => $iCount, 'per_page' => $iLimit, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'index.php?' . $sBlockName . 'Mode=' . $sMode . '&page={page}&per_page={per_page}\');'));
             $sPaginate = $oPaginate->getSimplePaginate(BX_DOL_URL_ROOT . 'browse.php');
         }
     } else {
         $sCode = MsgBox(_t("_Empty"));
     }
     return array($sCode, $aDBTopMenu, $sPaginate, true);
 }