Пример #1
0
 function getBlockCode_ViewImage()
 {
     $sSiteUrl = $this->_aSite['url'];
     $aFile = BxDolService::call('photos', 'get_photo_array', array($this->_aSite['photo'], 'file'), 'Search');
     $sImage = $aFile['no_image'] ? '' : $aFile['file'];
     // BEGIN STW INTEGRATION
     if (getParam('bx_sites_account_type') != 'No Automated Screenshots') {
         if ($sImage == '') {
             $aSTWOptions = array();
             bx_sites_import('STW');
             $sThumbHTML = getThumbnailHTML($sSiteUrl, $aSTWOptions, false, false);
         }
     }
     // END STW INTEGRATION
     $sVote = '';
     if (strncasecmp($sSiteUrl, 'http://', 7) != 0 && strncasecmp($sSiteUrl, 'https://', 8) != 0) {
         $sSiteUrl = 'http://' . $sSiteUrl;
     }
     if ($this->_oConfig->isVotesAllowed() && $this->_oSites->oPrivacy->check('rate', $this->_aSite['id'], $this->_oSites->iOwnerId)) {
         bx_import('BxTemplVotingView');
         $oVotingView = new BxTemplVotingView('bx_sites', $this->_aSite['id']);
         if ($oVotingView->isEnabled()) {
             $sVote = $oVotingView->getBigVoting();
         }
     }
     $sContent = $this->_oTemplate->parseHtmlByName('view_image.html', array('title' => $this->_aSite['title'], 'site_url' => $sSiteUrl, 'site_url_view' => $this->_aSite['url'], 'bx_if:is_image' => array('condition' => $sThumbHTML == false, 'content' => array('image' => $sImage ? $sImage : $this->_oTemplate->getImageUrl('no-image-thumb.png'))), 'bx_if:is_thumbhtml' => array('condition' => $sThumbHTML != '', 'content' => array('thumbhtml' => $sThumbHTML)), 'vote' => $sVote, 'view_count' => $this->_aSite['views']));
     return array($sContent, array(), array(), false);
 }
Пример #2
0
 function getViewFile(&$aInfo)
 {
     $oVotingView = new BxTemplVotingView('bx_' . $this->_oConfig->getUri(), $aInfo['medID']);
     $iWidth = (int) $this->_oConfig->getGlParam('file_width');
     if ($aInfo['prevItem'] > 0) {
         $aPrev = $this->_oDb->getFileInfo(array('fileId' => $aInfo['prevItem']), true, array('medUri', 'medTitle'));
     }
     if ($aInfo['nextItem'] > 0) {
         $aNext = $this->_oDb->getFileInfo(array('fileId' => $aInfo['nextItem']), true, array('medUri', 'medTitle'));
     }
     $aUnit = array('file' => $this->getFileConcept($aInfo['medID'], array('ext' => $aInfo['medExt'], 'source' => $aInfo['medSource'])), 'width_ext' => $iWidth + 2, 'width' => $iWidth, 'fileUrl' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aInfo['medUri'], 'fileTitle' => $aInfo['medTitle'], 'rate' => $oVotingView->isEnabled() ? $oVotingView->getBigVoting(1, $aInfo['Rate']) : '', 'favInfo' => isset($aInfo['favCount']) ? $aInfo['favCount'] : '', 'viewInfo' => $aInfo['medViews'], 'albumUri' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/album/' . $aInfo['albumUri'] . '/owner/' . $aInfo['NickName'], 'albumCaption' => $aInfo['albumCaption'], 'bx_if:prev' => array('condition' => $aInfo['prevItem'] > 0, 'content' => array('linkPrev' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aPrev['medUri'], 'titlePrev' => $aPrev['medTitle'], 'percent' => $aInfo['nextItem'] > 0 ? 50 : 100)), 'bx_if:next' => array('condition' => $aInfo['nextItem'] > 0, 'content' => array('linkNext' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aNext['medUri'], 'titleNext' => $aNext['medTitle'], 'percent' => $aInfo['prevItem'] > 0 ? 50 : 100)));
     return $this->parseHtmlByName('view_unit.html', $aUnit);
 }
Пример #3
0
 function getBlockCode_RateObject()
 {
     $sMainPrefix = $this->oConfig->getMainPrefix();
     $this->oMedia->oModule->_defineActions();
     $aCheck = checkAction($this->iViewer, $this->oMedia->oModule->_defineActionName('view'));
     if ($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
         $sCode = MsgBox(_t('_' . $sMainPrefix . '_forbidden'));
     } else {
         $aData = $this->getRateObject();
         if (count($aData) > 0) {
             $oVotingView = new BxTemplVotingView($this->sType, $aData[0]['id']);
             $aUnit = array('url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'rate', 'fileBody' => $this->getRateFile($aData), 'ratePart' => $oVotingView->isEnabled() ? $oVotingView->getBigVoting() : '', 'fileTitle' => $aData[0]['title'], 'fileUri' => $this->oMedia->getCurrentUrl('file', $aData[0]['id'], $aData[0]['uri']), 'fileWhen' => defineTimeInterval($aData[0]['date']), 'fileFrom' => getNickName($aData[0]['ownerId']), 'fileFromLink' => getProfileLink($aData[0]['ownerId']));
             $sCode = $this->oMedia->oTemplate->parseHtmlByName('rate_object.html', $aUnit);
             checkAction($this->iViewer, $this->oMedia->oModule->_defineActionName('view'), true);
         } else {
             $sCode = MsgBox(_t('_' . $sMainPrefix . '_no_file_for_rate'));
         }
     }
     return array($sCode, array(), array(), false);
 }
Пример #4
0
 function getBlockCode_RateObject()
 {
     $this->oMedia->oModule->_defineActions();
     $aCheck = checkAction($this->iViewer, $this->oMedia->oModule->_defineActionName('view'));
     if ($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
         $sCode = MsgBox(_t('_' . $this->sType . '_forbidden'));
     } else {
         $aData = $this->getRateObject();
         if (count($aData) > 0) {
             $oFile =& $this->oMedia->oModule;
             $oFile->_oTemplate->addCss('rate_object.css');
             $iInfoWidth = (int) getParam($this->sType . '_file_width');
             $oVotingView = new BxTemplVotingView($this->sType, $aData[0]['id']);
             $aUnit = array('url' => BX_DOL_URL_ROOT . $oFile->_oConfig->getBaseUri() . 'rate', 'fileBody' => $this->oMedia->oTemplate->getFileConcept($aData[0]['id']), 'ratePart' => $oVotingView->isEnabled() ? $oVotingView->getBigVoting() : '', 'fileTitle' => $aData[0]['title'], 'fileUri' => $this->oMedia->getCurrentUrl('file', $aData[0]['id'], $aData[0]['uri']), 'fileWhen' => defineTimeInterval($aData[0]['date']), 'fileFrom' => $aData[0]['ownerName'], 'fileFromLink' => getProfileLink($aData[0]['ownerId']), 'infoWidth' => $iInfoWidth > 0 ? $iInfoWidth + 2 : '');
             $sCode = $this->oMedia->oTemplate->parseHtmlByName('rate_object.html', $aUnit);
             checkAction($this->iViewer, $this->oMedia->oModule->_defineActionName('view'), true);
         } else {
             $sCode = MsgBox(_t('_bx_sounds_no_file_for_rate'));
         }
     }
     return $sCode;
 }
Пример #5
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;
    }
Пример #6
0
 function getRate($iFile)
 {
     $iFile = (int) $iFile;
     $sCode = '<center>' . _t('_rating not enabled') . '</center>';
     $oVotingView = new BxTemplVotingView($this->_oConfig->getMainPrefix(), $iFile);
     if ($oVotingView->isEnabled()) {
         $sCode = $oVotingView->getBigVoting();
     }
     return $sCode;
 }
Пример #7
0
 function getBlockCode_ViewFile()
 {
     $oVotingView = new BxTemplVotingView('bx_files', $this->aFileInfo['medID']);
     if ($this->aFileInfo['prevItem'] > 0) {
         $aPrev = $this->oDb->getFileInfo(array('fileId' => $this->aFileInfo['prevItem']), true, array('medUri', 'medTitle'));
     }
     if ($this->aFileInfo['nextItem'] > 0) {
         $aNext = $this->oDb->getFileInfo(array('fileId' => $this->aFileInfo['nextItem']), true, array('medUri', 'medTitle'));
     }
     //icon
     $sIcon = $this->oDb->getTypeIcon($this->aFileInfo['Type']);
     if (!$sIcon) {
         $sIcon = 'default.png';
     }
     $aUnit = array('pic' => $this->oTemplate->getIconUrl($sIcon), 'fileTitle' => $this->aFileInfo['medTitle'], 'fileSize' => (int) $this->aFileInfo['medSize'] > 0 ? _t_format_size((int) $this->aFileInfo['medSize']) : 0, 'fileExt' => $this->aFileInfo['medExt'], 'fileDescription' => $this->aFileInfo['medDesc'], 'rate' => $oVotingView->isEnabled() ? $oVotingView->getBigVoting(1, $this->aFileInfo['Rate']) : '', 'favInfo' => $this->oDb->getFavoritesCount($this->aFileInfo['medID']), 'viewInfo' => $this->aFileInfo['medViews'], 'albumUri' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'browse/album/' . $this->aFileInfo['albumUri'] . '/owner/' . $this->aFileInfo['NickName'], 'albumCaption' => $this->aFileInfo['albumCaption'], 'bx_if:prev' => array('condition' => $this->aFileInfo['prevItem'] > 0, 'content' => array('linkPrev' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aPrev['medUri'], 'titlePrev' => $aPrev['medTitle'], 'percent' => $this->aFileInfo['nextItem'] > 0 ? 50 : 100)), 'bx_if:next' => array('condition' => $this->aFileInfo['nextItem'] > 0, 'content' => array('linkNext' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aNext['medUri'], 'titleNext' => $aNext['medTitle'], 'percent' => $this->aFileInfo['prevItem'] > 0 ? 50 : 100)));
     $sCode = $this->oTemplate->parseHtmlByName('view_unit.html', $aUnit);
     return array($sCode, array(), array(), false);
 }
 function getConditionArray($logged)
 {
     $aWhere = array();
     $aWhere[] = '1';
     $iUser = 0;
     if (isset($_GET['ownerName'])) {
         $sName = process_db_input($_GET['ownerName']);
         $iUser = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `NickName`='{$sName}'");
     } elseif (isset($_GET['userID'])) {
         $iUser = (int) $_GET['userID'];
     }
     if ($iUser) {
         $aWhere[] = "`{$this->sMainTable}`.`{$this->aTableFields['medProfId']}`={$iUser}";
     }
     if (isset($_GET['tag'])) {
         $sTag = htmlspecialchars_adv($_GET['tag']);
         $aWhere[] = "`{$this->sMainTable}`.`{$this->aTableFields['medTags']}` like '%{$sTag}%'";
     }
     if (isset($_GET['action'])) {
         $sAct = htmlspecialchars_adv($_GET['action']);
         switch ($sAct) {
             case 'fav':
                 $sAddon = $this->getFavoriteCondition($this->iViewer);
                 break;
             case 'del':
                 $sAddon = '';
                 if (isset($_GET['fileID'])) {
                     $this->deleteMedia($_GET['fileID'], $logged);
                 }
                 break;
         }
     }
     $aSqlQuery['sqlWhere'] = "WHERE " . implode(' AND ', $aWhere) . $sAddon . " AND `Approved`= 'true'";
     $iTotalNum = db_value("SELECT COUNT( * ) FROM `{$this->sMainTable}` {$aSqlQuery['sqlWhere']}");
     if (!$iTotalNum) {
         return false;
     }
     $iPerPage = (int) $_GET['per_page'];
     if (!$iPerPage) {
         $iPerPage = 10;
     }
     $iTotalPages = ceil($iTotalNum / $iPerPage);
     $iCurPage = (int) $_GET['page'];
     if ($iCurPage > $iTotalPages) {
         $iCurPage = $iTotalPages;
     }
     if ($iCurPage < 1) {
         $iCurPage = 1;
     }
     $sLimitFrom = ($iCurPage - 1) * $iPerPage;
     $aSqlQuery['sqlLimit'] = "LIMIT {$sLimitFrom}, {$iPerPage}";
     $aSqlQuery['sqlOrder'] = 'ORDER BY `medDate` DESC';
     if (isset($_GET['rate'])) {
         $oVotingView = new BxTemplVotingView('g' . $this->sType, 0, 0);
         $aSql = $oVotingView->getSqlParts('`' . $this->sMainTable . '`', '`' . $this->aTableFields['medID'] . '`');
         $sHow = $_GET['rate'] == 'top' ? "DESC" : "ASC";
         $aSqlQuery['sqlOrder'] = $oVotingView->isEnabled() ? "ORDER BY `voting_rate` {$sHow}, `voting_count` {$sHow}, `medDate` {$sHow}" : $aSqlQuery['sqlOrder'];
         $aSqlQuery['rateFields'] = $aSql['fields'];
         $aSqlQuery['rateJoin'] = $aSql['join'];
     }
     return array('query' => $aSqlQuery, 'total' => $iTotalPages, 'per_page' => $iPerPage, 'cur_page' => $iCurPage);
 }
Пример #9
0
function showPreviousRated($iPhotoID)
{
    global $site;
    global $oTemplConfig;
    global $max_thumb_width;
    global $max_thumb_height;
    $iBarWidth = $oTemplConfig->iRateSmallRatingBar;
    $iBarNum = $oTemplConfig->iRateSmallRatingBarNum;
    $query = "\r\n\t\tSELECT\r\n\t\t\t`media`.`med_id`,\r\n\t\t\t`med_prof_id`,\r\n\t\t\t`med_file`,\r\n\t\t\t`med_title`,\r\n\t\t\t`med_rating_count`,\r\n\t\t\t`med_rating_sum`,\r\n\t\t\t`Profiles`.`NickName`\r\n\t\tFROM `media`\r\n\t\tLEFT JOIN `media_rating` USING (`med_id`)\r\n\t\tLEFT JOIN `Profiles` ON\r\n\t\t\t(`Profiles`.`ID`=`media`.`med_prof_id`)\r\n\t\tWHERE\r\n\t\t\t`med_status` = 'active'\r\n\t\t\tAND `media`.`med_id` = {$iPhotoID}\r\n\t\t";
    $ph_arr = db_arr($query);
    if (!$ph_arr) {
        return '';
    }
    $urlImg = "{$site['profileImage']}{$ph_arr['med_prof_id']}/thumb_{$ph_arr['med_file']}";
    $urlSpacer = getTemplateIcon('spacer.gif');
    $sProfLink = getProfileLink($ph_arr['med_prof_id']);
    $sRatingBar = '';
    $oVotingView = new BxTemplVotingView('media', (int) $iPhotoID);
    if ($oVotingView->isEnabled()) {
        $sRatingBar = $oVotingView->getSmallVoting(false);
    }
    $ret .= <<<EOJ
\t<div class="rate_prev_photo_block">
\t\t<div class="thumbnail_block" style="float:none;">
\t\t\t<a href="{$site['url']}photos_gallery.php?ID={$ph_arr['med_prof_id']}&amp;photoID={$ph_arr['med_id']}" title="{$ph_arr['med_title']}">
\t\t\t\t<img style="width:{$max_thumb_width}px;height:{$max_thumb_height}px;background-image:url({$urlImg});" src="{$urlSpacer}" />
\t\t\t</a>
\t\t</div>
\t\t<div class="rate_prev_photo_nickname">
\t\t\t<a href="{$sProfLink}">{$ph_arr['NickName']}</a>
\t\t</div>
\t\t<div style="position:relative; width:50%; height:30px; overflow:visible; margin-top:10px;">
\t\t\t<div style="position:absolute; right:-94px; width:400px; height:30px;">
\t\t\t\t{$sRatingBar}
\t\t\t</div>\t\t\t
\t\t</div>

\t</div>
EOJ;
    return DesignBoxContent(_t('_Previous rated'), $ret, 1);
}
Пример #10
0
 function getBlockCode_ViewImage()
 {
     $aFile = BxDolService::call('photos', 'get_photo_array', array($this->_aSite['photo'], 'file'), 'Search');
     $sImage = $aFile['no_image'] ? '' : $aFile['file'];
     $sVote = '';
     $sSiteUrl = $this->_aSite['url'];
     if (strncasecmp($sSiteUrl, 'http://', 7) != 0) {
         $sSiteUrl = 'http://' . $sSiteUrl;
     }
     if ($this->_oConfig->isVotesAllowed() && $this->_oSites->oPrivacy->check('rate', $this->_aSite['id'], $this->_oSites->iOwnerId)) {
         bx_import('BxTemplVotingView');
         $oVotingView = new BxTemplVotingView('bx_sites', $this->_aSite['id']);
         if ($oVotingView->isEnabled()) {
             $sVote = $oVotingView->getBigVoting();
         }
     }
     return $this->_oTemplate->parseHtmlByName('view_image.html', array('title' => $this->_aSite['title'], 'site_url' => $sSiteUrl, 'site_url_view' => $this->_aSite['url'], 'image' => $sImage ? $sImage : $this->_oTemplate->getIconUrl('no-photo-110.png'), 'image_fave' => $this->_oTemplate->getIconUrl('action_fave.png'), 'image_view' => $this->_oTemplate->getIconUrl('eye.png'), 'vote' => $sVote, 'view_count' => $this->_aSite['views']));
 }
    function getMediaBlock($iMediaID = 0, $bCouple = false)
    {
        global $site;
        global $votes_pic;
        $ret = '';
        if ($this->iMediaCount > 0) {
            $iMediaID = $iMediaID > 0 ? $iMediaID : $this->aMedia['0']['PrimPhoto'];
            $aCurPhoto = $this->getElementArrayByID($iMediaID);
            if (empty($aCurPhoto)) {
                $sPhotoUrl = getTemplateIcon($this->sSexPic);
            } else {
                $iPhotoID = $aCurPhoto['med_id'];
                $sPhotoUrl = $this->sMediaUrl . 'photo_' . $aCurPhoto['med_file'];
            }
        } else {
            $sPhotoUrl = getTemplateIcon($this->sSexPic);
        }
        $bUseFeature = getParam("profile_gallery_feature") == "on" ? true : false;
        //$bUseFeature = true;
        $bSUseFeature = $bUseFeature ? 'true' : 'false';
        $ret .= $this->getJSCode($aCurPhoto, $bSUseFeature);
        $sFeature = '';
        if ($bUseFeature) {
            for ($i = 0; $i < $this->aMediaConfig['max']['photo']; $i++) {
                $sIconSrc = $this->sMediaDir . 'photo_' . $this->aMedia[$i]['med_file'];
                if (extFileExists($sIconSrc)) {
                    $sIconUrl = $this->sMediaUrl . 'photo_' . $this->aMedia[$i]['med_file'];
                    //$atrib = "'{$this -> aMedia[$i]['med_id']}'";
                    //$sFeatImgs .= '<a href="' . $site['url'] . 'photos_gallery.php?ID=' .  $this -> iProfileID . '">';
                    $sFeatImgs .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="width:' . $this->aMediaConfig['size']['photoWidth'] . 'px; height:' . $this->aMediaConfig['size']['photoHeight'] . 'px; background-image:url(' . $sIconUrl . ');position:absolute;"  alt="" class="icons" />';
                    //$sFeatImgs .= '</a>';
                }
            }
            $sFeatTotalHeight = $this->aMediaConfig['size']['photoHeight'] + 30;
            $sFeature = <<<EOF
<script type="text/javascript" src="{$site['url']}inc/js/jquery.dolPromoT.js"></script>
<script type="text/javascript">
\t\$(document).ready( function() {
\t\t\$( '#iiPPhoto' ).dolPromo( 3000, 1 );
\t} );
</script>
<div style="position:relative;width:100%;height:{$sFeatTotalHeight}px;overflow:hidden;">
\t<div id="iiPPhoto">
\t\t{$sFeatImgs}
\t</div>
</div>
EOF;
            $ret .= $sFeature;
        } else {
            $ret .= '<div class="photoBlock" id="photoKeeper">';
            $style = 'width:' . $this->aMediaConfig['size']['photoWidth'] . 'px;' . 'height:' . $this->aMediaConfig['size']['photoHeight'] . 'px;' . 'background-image:url(' . $sPhotoUrl . ');';
            $ret .= '<a href="' . $site['url'] . 'photos_gallery.php?ID=' . $this->iProfileID . '" id="temThumbLink">';
            $ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="' . $style . '" class="photo" alt="" id="temThumbID" />';
            //$ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="' . $style . '" class="photo" alt="" onload="return setThumb();" id="temThumbID" />';
            $ret .= '</a>';
            $ret .= '</div>';
        }
        $ret .= '<div id="temPhotoTitle" class="photo_title">' . stripslashes($aCurPhoto['med_title']) . '</div>';
        if ($bCouple) {
            return $ret . '<div class="clear_both"></div>';
        }
        $sJsIconsArray = '';
        $iCountPhotos = 0;
        $sIcons = $this->_getIconsList2($sJsIconsArray, $iCountPhotos);
        $oVotingView = new BxTemplVotingView('media', (int) $aCurPhoto['med_id']);
        if ($iCountPhotos && $votes_pic && $oVotingView->isEnabled()) {
            $ret .= $oVotingView->getSmallVoting();
        }
        $ret .= '<div class="clear_both"></div>';
        if (strlen($sIcons)) {
            $ret .= '<div class="scrollIconContainer">';
            $ret .= '<div class="scrollCont" id="scrollCont">';
            $ret .= '<div class="scrollLeft"  onmouseover="moveScrollLeftAuto(  \'iconBlock\', 1 );" onmouseout="moveScrollLeftAuto(  \'iconBlock\', 0 );"><img src="' . getTemplateIcon('left_arrow.gif') . '"/></div>';
            $ret .= '<div class="scrollRight" onmouseover="moveScrollRightAuto( \'iconBlock\', 1 );" onmouseout="moveScrollRightAuto( \'iconBlock\', 0 );"><img src="' . getTemplateIcon('right_arrow.gif') . '"/></div>';
            $ret .= '<div class="clear_both"></div>';
            $ret .= '</div>';
            $ret .= '<div class="iconBlockCont">';
            $ret .= '<div id="iconBlock" class="iconBlock">';
            $ret .= $sIcons;
            $ret .= '</div>';
            $ret .= '</div>';
            $ret .= '</div>';
        }
        $ret .= '<script type="text/javascript">' . $sJsIconsArray . '</script>';
        return $ret;
    }
function PageCompLastFiles()
{
    global $site;
    global $aFile;
    $iLimit = 2;
    $sQuery = "SELECT `medID`,\r\n\t\t\t\t\t  `medTitle`,\r\n\t\t\t\t\t  UNIX_TIMESTAMP(`medDate`) as `medDate`,\r\n\t\t\t\t\t  `medExt`,\r\n\t\t\t\t\t  `medViews`\r\n\t\t\t\t\t  FROM `sharePhotoFiles` \r\n\t\t\t\t\t  WHERE `medProfId`='{$aFile['medProfId']}' \r\n\t\t\t\t\t  AND `medID`<>'{$aFile['medID']}' AND `Approved`='true' ORDER BY `medDate` DESC LIMIT {$iLimit}";
    $rLast = db_res($sQuery);
    $sLinkMore = '';
    if ($aFile['medCount'] - 1 > $iLimit) {
        $sLinkMore = '<a href="browsePhoto.php?userID=' . $aFile['medProfId'] . '">' . _t("_See all photos of this user") . '</a>';
    }
    $sCode = '<div id="lastFiles">';
    while ($aLast = mysql_fetch_array($rLast)) {
        $sImage = $site['sharingImages'] . $aLast['medID'] . '_t.' . $aLast['medExt'];
        $sTitle = strlen($aLast['medTitle']) > 0 ? $aLast['medTitle'] : _t("_Untitled");
        $oVotingView = new BxTemplVotingView('gphoto', $aLast['medID']);
        if ($oVotingView->isEnabled()) {
            $sRate = $oVotingView->getSmallVoting(0);
            $sShowRate = '<div class="galleryRate">' . $sRate . '</div>';
        }
        $sCode .= '<div class="lastFileUnit">';
        $sCode .= '<a href="' . $site['url'] . 'viewPhoto.php?fileID=' . $aLast['medID'] . '">';
        $sCode .= '<img class="lastFilesPic" style="background-image: url(\'' . $sImage . '\');" src="' . getTemplateIcon('spacer.gif') . '" />';
        $sCode .= '</a>';
        $sCode .= '<div><a href="' . $site['url'] . 'viewPhoto.php?fileID=' . $aLast['medID'] . '"><b>' . $sTitle . '</b></a></div>';
        $sCode .= '<div>' . _t("_Added") . ': <b>' . defineTimeInterval($aLast['medDate']) . '</b></div>';
        $sCode .= '<div>' . _t("_Views") . ': <b>' . $aLast['medViews'] . '</b></div>';
        $sCode .= $sShowRate;
        $sCode .= '</div>';
        $sCode .= '<div class="clear_both"></div>';
    }
    $sCode .= '<div class="lastFilesLink">' . $sLinkMore . '</div>';
    $sCode .= '</div>';
    return $sCode;
}
 function getMediaBlock($iMediaID = 0)
 {
     global $site;
     global $votes_pic;
     $ret = '';
     if ($this->iMediaCount > 0) {
         $iMediaID = $iMediaID > 0 ? $iMediaID : $this->aMedia['0']['PrimPhoto'];
         $aCurPhoto = $this->getElementArrayByID($iMediaID);
         if (empty($aCurPhoto)) {
             $sPhotoUrl = getTemplateIcon($this->sSexPic);
         } else {
             $iPhotoID = $aCurPhoto['med_id'];
             $sPhotoUrl = $this->sMediaUrl . 'photo_' . $aCurPhoto['med_file'];
         }
     } else {
         $sPhotoUrl = getTemplateIcon($this->sSexPic);
     }
     $ret .= $this->getJSCode($aCurPhoto);
     $ret .= '<div class="photoBlock" id="photoKeeper">';
     $style = 'width:' . $this->aMediaConfig['size']['photoWidth'] . 'px;' . 'height:' . $this->aMediaConfig['size']['photoHeight'] . 'px;' . 'background-image:url(' . $sPhotoUrl . ');';
     $ret .= '<a href="' . $site['url'] . 'photos_gallery.php?ID=' . $this->iProfileID . '" id="temThumbLink">';
     $ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="' . $style . '" class="photo" alt="" id="temThumbID" />';
     //$ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="' . $style . '" class="photo" alt="" onload="return setThumb();" id="temThumbID" />';
     $ret .= '</a>';
     $ret .= '</div>';
     $ret .= '<div id="temPhotoTitle" class="photo_title">' . stripslashes($aCurPhoto['med_title']) . '</div>';
     $sJsIconsArray = '';
     $iCountPhotos = 0;
     $sIcons = $this->_getIconsList2($sJsIconsArray, $iCountPhotos);
     $oVotingView = new BxTemplVotingView('media', (int) $aCurPhoto['med_id']);
     if ($iCountPhotos && $votes_pic && $oVotingView->isEnabled()) {
         $ret .= $oVotingView->getSmallVoting();
     }
     $ret .= '<div class="clear_both"></div>';
     if (strlen($sIcons)) {
         $ret .= '<div class="scrollIconContainer">';
         $ret .= '<div class="scrollCont" id="scrollCont">';
         $ret .= '<div class="scrollLeft"  onmouseover="moveScrollLeftAuto(  \'iconBlock\', 1 );" onmouseout="moveScrollLeftAuto(  \'iconBlock\', 0 );"><img src="' . getTemplateIcon('left_arrow.gif') . '"/></div>';
         $ret .= '<div class="scrollRight" onmouseover="moveScrollRightAuto( \'iconBlock\', 1 );" onmouseout="moveScrollRightAuto( \'iconBlock\', 0 );"><img src="' . getTemplateIcon('right_arrow.gif') . '"/></div>';
         $ret .= '<div class="clear_both"></div>';
         $ret .= '</div>';
         $ret .= '<div class="iconBlockCont">';
         $ret .= '<div id="iconBlock" class="iconBlock">';
         $ret .= $sIcons;
         $ret .= '</div>';
         $ret .= '</div>';
         $ret .= '</div>';
     }
     $ret .= '<script type="text/javascript">' . $sJsIconsArray . '</script>';
     return $ret;
 }
Пример #14
0
 function getRateBlock()
 {
     if ($this->iPostViewType == 3 && $this->iViewingPostID > 0) {
         bx_import('BxTemplVotingView');
         $bPossibleToRate = $this->oPrivacy->check('rate', $this->iViewingPostID, $this->_iVisitorID);
         $oVotingView = new BxTemplVotingView('blogposts', $this->iViewingPostID);
         if ($oVotingView && $oVotingView->isEnabled() && $bPossibleToRate) {
             $sVotePostRating = $oVotingView->getBigVoting(1);
         } else {
             $sVotePostRating = $oVotingView->getBigVoting(0);
         }
         return $sVotePostRating;
     }
 }
function PageCompPageMainCode()
{
    global $site;
    global $rData;
    global $iTotalPages;
    global $iCurPage;
    global $iPerPage;
    global $member;
    $sCode = '<div style="position: relative; float: left;">';
    if (mysql_num_rows($rData)) {
        while ($aData = mysql_fetch_array($rData)) {
            $sImage = $site['sharingImages'] . $aData['medID'] . '_t.' . $aData['medExt'];
            $sProfLink = '<div>' . _t("_By") . ': <a href="' . getProfileLink($aData['medProfId']) . '">' . $aData['NickName'] . '</a></div>';
            $oVotingView = new BxTemplVotingView('gphoto', $aData['medID']);
            if ($oVotingView->isEnabled()) {
                $sRate = $oVotingView->getSmallVoting(0);
                $sShowRate = '<div class="galleryRate">' . $sRate . '</div>';
            }
            $sHref = $site['url'] . 'viewPhoto.php?fileID=' . $aData['medID'];
            $sImg = '<div class="lastFilesPic" style="background-image: url(\'' . $sImage . '\');">
					  <a href="' . $sHref . '"><img src="' . $site['images'] . 'spacer.gif" width="110" height="110"></a></div>';
            $sPicTitle = strlen($aData['medTitle']) > 0 ? $aData['medTitle'] : _t("_Untitled");
            $sDelLink = $member['ID'] == $aData['medProfId'] ? '<div><a href="' . $_SERVER['PHP_SELF'] . '?action=del&fileID=' . $aData['medID'] . '"
			onClick="return confirm( \'' . _t("_are you sure?") . '\');">' . _t("_Delete") . '</a></div>' : "";
            $sCode .= '<div class="browseUnit">';
            $sCode .= $sImg;
            $sCode .= '<div><a href="' . $sHref . '"><b>' . $sPicTitle . '</b></a></div>';
            $sCode .= $sProfLink;
            $sCode .= '<div>' . _t("_Added") . ': <b>' . defineTimeInterval($aData['medDate']) . '</b></div>';
            $sCode .= '<div>' . _t("_Views") . ': <b>' . $aData['medViews'] . '</b></div>';
            $sCode .= $sShowRate;
            $sCode .= $sDelLink;
            $sCode .= '</div>';
        }
    }
    $sCode .= '<div class="clear_both"></div>';
    // generate pagination
    if ($iTotalPages > 1) {
        $sRequest = $_SERVER['PHP_SELF'] . '?';
        $aFields = array('userID', 'tag', 'rate');
        foreach ($aFields as $field) {
            if (isset($_GET[$field])) {
                $sRequest .= "&amp;{$field}=" . htmlentities(process_pass_data($_GET[$field]));
            }
        }
        $pagination = '<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 {
        $pagination = '';
    }
    return $sCode . $pagination . '</div>';
}
function PageCompLastFiles()
{
    global $site;
    global $aFile;
    $iLimit = 2;
    $sQuery = "SELECT `ID` as `medID`,\r\n\t\t\t\t\t  `Title` as `medTitle`,\r\n\t\t\t\t\t  `Date` as `medDate`,\r\n\t\t\t\t\t  `Views` as `medViews`\r\n\t\t\t\t\t  FROM `RayMovieFiles` \r\n\t\t\t\t\t  WHERE `Owner`='{$aFile['medProfId']}' \r\n\t\t\t\t\t  AND `ID`<>'{$aFile['medID']}' AND `Approved`='true' ORDER BY `Date` DESC LIMIT {$iLimit}";
    $rLast = db_res($sQuery);
    $sLinkMore = '';
    if ($aFile['medCount'] - 1 > $iLimit) {
        $sLinkMore = '<a href="browseVideo.php?userID=' . $aFile['medProfId'] . '">' . _t("_See all videos of this user") . '</a>';
    }
    $sCode = '<div id="lastFiles">';
    while ($aLast = mysql_fetch_array($rLast)) {
        $sTitle = strlen($aLast['medTitle']) > 0 ? $aLast['medTitle'] : _t("_Untitled");
        $oVotingView = new BxTemplVotingView('gvideo', $aLast['medID']);
        if ($oVotingView->isEnabled()) {
            $sRate = $oVotingView->getSmallVoting(0);
            $sShowRate = '<div class="galleryRate">' . $sRate . '</div>';
        }
        $sCode .= '<div class="lastFileUnit">';
        $sCode .= '<div class="lastFilesPic">';
        $sCode .= '<a href="' . $site['url'] . 'viewVideo.php?fileID=' . $aLast['medID'] . '">';
        $sCode .= '<img src="' . $site['url'] . 'ray/modules/movie/files/' . $aLast['medID'] . '_small.jpg">';
        $sCode .= '</a>';
        $sCode .= '</div>';
        $sCode .= '<div><a href="' . $site['url'] . 'viewVideo.php?fileID=' . $aLast['medID'] . '"><b>' . $sTitle . '</b></a></div>';
        $sCode .= '<div>' . _t("_Added") . ': <b>' . defineTimeInterval($aLast['medDate']) . '</b></div>';
        $sCode .= '<div>' . _t("_Views") . ': <b>' . $aLast['medViews'] . '</b></div>';
        $sCode .= $sShowRate;
        $sCode .= '</div>';
        $sCode .= '<div class="clear_both"></div>';
    }
    $sCode .= '<div class="lastFilesLink">' . $sLinkMore . '</div>';
    $sCode .= '</div>';
    return $sCode;
}
function PageCompShareMusicContent($sCaption, $iID = 0)
{
    global $site;
    $max_num = (int) getParam("top_photos_max_num");
    $mode = process_db_input(getParam("top_photos_mode"));
    $mode = $_GET['shMusicMode'];
    if ($mode != 'rand' && $mode != 'top' && $mode != 'last') {
        $mode = 'last';
    }
    $sqlSelect = "SELECT `ID` as `medID`,\r\n\t\t\t\t\t\t `Title` as `medTitle`,\r\n\t\t\t\t\t\t `Date` as `medDate`\r\n\t\t\t\t\t\t ";
    $sqlFrom = " FROM `RayMusicFiles`";
    if ($iID != 0) {
        $sqlWhere = " WHERE `Approved`='true' AND `Owner`='{$iID}'";
    }
    $menu = '<div class="dbTopMenu">';
    foreach (array('last', 'top', 'rand') as $myMode) {
        switch ($myMode) {
            case 'last':
                if ($mode == $myMode) {
                    $sqlOrder = "\r\n\t  \t\tORDER BY `medDate` DESC";
                }
                $modeTitle = _t('_Latest');
                break;
            case 'rand':
                if ($mode == $myMode) {
                    $sqlOrder = "\r\n\t  \t\tORDER BY RAND()";
                }
                $modeTitle = _t('_Random');
                break;
            case 'top':
                if ($mode == $myMode) {
                    $oVotingView = new BxTemplVotingView('gmusic', 0, 0);
                    $aSql = $oVotingView->getSqlParts('`RayMusicFiles`', '`ID`');
                    $sHow = "DESC";
                    $sqlOrderBy = $oVotingView->isEnabled() ? "ORDER BY `voting_rate` {$sHow}, `voting_count` {$sHow}, `medDate` {$sHow}" : $sqlOrderBy;
                    $sqlFields = $aSql['fields'];
                    $sqlLJoin = $aSql['join'];
                    $sqlSelect .= $sqlFields;
                    $sqlFrom .= $sqlLJoin;
                    $sqlOrder = $sqlOrderBy;
                }
                $modeTitle = _t('_Top');
                break;
        }
        //if( $_SERVER['PHP_SELF'] == 'rewrite_name.php' )
        if ($myMode == $mode) {
            $menu .= "<div class=\"active\">{$modeTitle}</div>";
        } else {
            if (basename($_SERVER['PHP_SELF']) == 'rewrite_name.php' || basename($_SERVER['PHP_SELF']) == 'profile.php') {
                $menu .= "<div class=\"notActive\"><a href=\"profile.php?ID={$iID}&shMusicMode={$myMode}\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_shareMusic', this.href+'&amp;show_only=shareMusic'); return false;\">{$modeTitle}</a></div>";
            } else {
                $menu .= "<div class=\"notActive\"><a href=\"{$_SERVER['PHP_SELF']}?shMusicMode={$myMode}\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_shareMusic', this.href+'&amp;show_only=shareMusic'); return false;\">{$modeTitle}</a></div>";
            }
        }
    }
    $menu .= '</div>';
    $aNum = db_arr("SELECT COUNT(`RayMusicFiles`.`ID`) {$sqlFrom} {$sqlWhere}");
    $num = (int) $aNum[0];
    $ret = '';
    if ($num) {
        $pages = ceil($num / $max_num);
        $page = (int) $_GET['page_p'];
        if ($page < 1 or $mode == 'rand') {
            $page = 1;
        }
        if ($page > $pages) {
            $page = $pages;
        }
        $sqlLimitFrom = ($page - 1) * $max_num;
        $sqlLimit = "\r\n\t\tLIMIT {$sqlLimitFrom}, {$max_num}";
        $rData = db_res($sqlSelect . $sqlFrom . $sqlWhere . $sqlOrder . $sqlLimit);
        $sAddon = '';
        $iCounter = 1;
        $ret .= '<div class="clear_both"></div>';
        while ($aData = mysql_fetch_array($rData)) {
            $sHref = $site['url'] . 'viewMusic.php?fileID=' . $aData['medID'];
            $sVidTitle = strlen($aData['medTitle']) > 0 ? $aData['medTitle'] : _t("_Untitled");
            $sImg = '<a href="' . $sHref . '"><img src="' . $site['images'] . 'music.png"></a>';
            $oVotingView = new BxTemplVotingView('gmusic', $aData['medID']);
            if ($oVotingView->isEnabled()) {
                $sRate = $oVotingView->getSmallVoting(0);
                $sShowRate = '<div class="galleryRate">' . $sRate . '</div>';
            }
            if ($iCounter % 3 != 0) {
                $ret .= '<div class="shareMusicContent_1">';
            } else {
                $ret .= '<div class="shareMusicContent_2">';
                $sAddon = '<div class="clear_both"></div>';
            }
            $ret .= '<div class="lastMusicPic">' . $sImg . '</div>';
            $ret .= '<div><a href="' . $sHref . '">' . $sVidTitle . '</a></div>';
            $ret .= $sShowRate . '</div>';
            $ret .= $sAddon;
            $sAddon = '';
            $iCounter++;
        }
        $ret .= '<div class="clear_both"></div>';
        $ret = DesignBoxContent(_t($sCaption), $ret, 1, $menu);
    }
    return $ret;
}
Пример #18
0
 function getBlockCode_ViewFile()
 {
     $oVotingView = new BxTemplVotingView($this->oConfig->getMainPrefix(), $this->aFileInfo['medID']);
     $iWidth = (int) $this->oConfig->getGlParam('file_width');
     if ($this->aFileInfo['prevItem'] > 0) {
         $aPrev = $this->oDb->getFileInfo(array('fileId' => $this->aFileInfo['prevItem']), true, array('medUri', 'medTitle'));
     }
     if ($this->aFileInfo['nextItem'] > 0) {
         $aNext = $this->oDb->getFileInfo(array('fileId' => $this->aFileInfo['nextItem']), true, array('medUri', 'medTitle'));
     }
     $aUnit = array('pic' => $this->oSearch->getImgUrl($this->aFileInfo['Hash'], 'file'), 'width' => $iWidth, 'fileTitle' => $this->aFileInfo['medTitle'], 'fileDescription' => $this->aFileInfo['medDesc'], 'rate' => $oVotingView->isEnabled() ? $oVotingView->getBigVoting(1, $this->aFileInfo['Rate']) : '', 'favInfo' => $this->oDb->getFavoritesCount($this->aFileInfo['medID']), 'viewInfo' => $this->aFileInfo['medViews'], 'albumUri' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'browse/album/' . $this->aFileInfo['albumUri'] . '/owner/' . $this->aFileInfo['NickName'], 'albumCaption' => $this->aFileInfo['albumCaption'], 'bx_if:prev' => array('condition' => $this->aFileInfo['prevItem'] > 0, 'content' => array('linkPrev' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aPrev['medUri'], 'titlePrev' => $aPrev['medTitle'], 'percent' => $this->aFileInfo['nextItem'] > 0 ? 50 : 100)), 'bx_if:next' => array('condition' => $this->aFileInfo['nextItem'] > 0, 'content' => array('linkNext' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aNext['medUri'], 'titleNext' => $aNext['medTitle'], 'percent' => $this->aFileInfo['prevItem'] > 0 ? 50 : 100)));
     $sCode = $this->oTemplate->parseHtmlByName('view_unit.html', $aUnit);
     return array($sCode, array(), array(), false);
 }
Пример #19
0
 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);
 }
Пример #20
0
 function getRateBlock()
 {
     if ($this->iPostViewType != 3 || !$this->iViewingPostID) {
         return false;
     }
     bx_import('BxTemplVotingView');
     $bPossibleToRate = $this->oPrivacy->check('rate', $this->iViewingPostID, $this->_iVisitorID);
     $oVotingView = new BxTemplVotingView($this->_oConfig->getRateSystemName(), $this->iViewingPostID);
     if ($oVotingView && $oVotingView->isEnabled() && $bPossibleToRate) {
         $sVotePostRating = $oVotingView->getBigVoting(1);
     } else {
         $sVotePostRating = $oVotingView->getBigVoting(0);
     }
     $aVars = array('content' => $sVotePostRating);
     return $this->_oTemplate->parseHtmlByName('default_padding.html', $aVars);
 }
 function getBlockCode_Members()
 {
     global $tmpl;
     // number of profiles
     $max_num = (int) getParam("top_members_max_num");
     //	Get Sex from GET data
     if ($_GET['Sex'] && $_GET['Sex'] != "all") {
         $sex = process_db_input($_GET['Sex']);
         $query_add = " AND `Sex` = '{$sex}'";
     } else {
         $sex = "all";
         $query_add = "";
     }
     $query_add .= ' AND (`Couple`=0 OR `Couple`>`ID`)';
     $query = "\r\n\t\t\tSELECT\r\n\t\t\t\t`Profiles`.*\r\n\t\t\t";
     if ($_GET['members_mode'] == 'online' or $_GET['members_mode'] == 'rand' or $_GET['members_mode'] == 'last' or $_GET['members_mode'] == 'top') {
         $mode = $_GET['members_mode'];
     } else {
         $mode = 'last';
     }
     $aDBTopMenu = array();
     //$menu = '<div class="dbTopMenu">';
     foreach (array('last', 'top', 'online', 'rand') as $myMode) {
         switch ($myMode) {
             case 'online':
                 if ($mode == $myMode) {
                     $filter = " FROM `Profiles` WHERE `DateLastNav` > SUBDATE(NOW(), INTERVAL " . (int) getParam("member_online_time") . " MINUTE) AND `Status` = 'Active' AND `PrimPhoto` != 0 {$query_add} ORDER BY `Couple` ASC";
                 }
                 $modeTitle = _t('_Online');
                 break;
             case 'rand':
                 if ($mode == $myMode) {
                     $filter = " FROM `Profiles` WHERE `Status` = 'Active' AND `PrimPhoto` != 0 {$query_add} ORDER BY `Couple` ASC, RAND()";
                 }
                 $modeTitle = _t('_Random');
                 break;
             case 'last':
                 if ($mode == $myMode) {
                     $filter = " FROM `Profiles` WHERE `Status` = 'Active' {$query_add} ORDER BY `Couple` ASC, `DateReg` DESC";
                 }
                 $modeTitle = _t('_Latest');
                 break;
             case 'top':
                 if ($mode == $myMode) {
                     $oVotingView = new BxTemplVotingView('profile', 0, 0);
                     $aSql = $oVotingView->getSqlParts('`Profiles`', '`ID`');
                     $sqlOrderBy = $oVotingView->isEnabled() ? " ORDER BY `Couple` ASC, (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `DateReg` DESC" : $sqlOrderBy;
                     $sqlFields = $aSql['fields'];
                     $sqlLJoin = $aSql['join'];
                     $filter = "{$sqlFields} FROM `Profiles` {$sqlLJoin} WHERE `Status` = 'Active' AND `pr_rating_count` > 2 {$query_add} {$sqlOrderBy}";
                     $filter2 = " FROM `Profiles` {$sqlLJoin} WHERE `Status` = 'Active' AND `pr_rating_count` > 2 {$query_add} {$sqlOrderBy}";
                 }
                 $modeTitle = _t('_Top');
                 break;
         }
         $aDBTopMenu[$modeTitle] = array('href' => "{$_SERVER['PHP_SELF']}?members_mode={$myMode}", 'dynamic' => true, 'active' => $myMode == $mode);
         /*if( $myMode == $mode )
         			$menu .= "<div class=\"active\">$modeTitle</a></div>";
         		else
         			$menu .= "<div class=\"notActive\"><a href=\"{$_SERVER['PHP_SELF']}?members_mode=$myMode&amp;Sex=$sex\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">$modeTitle</a></div>";*/
     }
     /*$menu .= '<div class="clear_both"></div>';
     		$menu .= '</div>';*/
     $ret = '';
     $aNum = db_arr("SELECT COUNT(`Profiles`.`ID`) " . (isset($filter2) ? $filter2 : $filter));
     $num = (int) $aNum[0];
     if ($num) {
         $pages = ceil($num / $max_num);
         $page = (int) $_GET['page'];
         if ($page < 1 or $mode == 'rand') {
             $page = 1;
         }
         if ($page > $pages) {
             $page = $pages;
         }
         $sqlFrom = ($page - 1) * $max_num;
         $limit = " LIMIT {$sqlFrom}, {$max_num}";
         $templ_search = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/topmebers_index.html");
         $result = db_res($query . $filter . $limit);
         $iCounter = 1;
         $ret .= '<div class="clear_both"></div>';
         while ($p_arr = mysql_fetch_array($result)) {
             $ret .= PrintSearhResult($p_arr, $templ_search, 3);
             /*if( ($iCounter % 3) != 0 )
             			$ret .= PrintSearhResult( $p_arr, $templ_search, 1 );
             		else
             			$ret .= PrintSearhResult( $p_arr, $templ_search, 2 );
             		$iCounter++;*/
         }
         $ret .= '<div class="clear_both"></div>';
         $aDBBottomMenu = array();
         if ($pages > 1) {
             //$ret .= '<div class="dbBottomMenu">';
             if ($page > 1) {
                 $prevPage = $page - 1;
                 $aDBBottomMenu[_t('_Back')] = array('href' => "{$_SERVER['PHP_SELF']}?members_mode={$mode}&amp;page={$prevPage}", 'dynamic' => true, 'class' => 'backMembers');
                 /*$ret .= "
                 			<a href=\"{$_SERVER['PHP_SELF']}?members_mode=$mode&amp;page=$prevPage\"
                 			  class=\"backMembers\"
                 			  onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">"._t('_Back')."</a>
                 		";*/
             }
             if ($page < $pages) {
                 $nextPage = $page + 1;
                 $aDBBottomMenu[_t('_Next')] = array('href' => "{$_SERVER['PHP_SELF']}?members_mode={$mode}&amp;page={$nextPage}", 'dynamic' => true, 'class' => 'moreMembers');
                 /*$ret .= "
                 			<a href=\"{$_SERVER['PHP_SELF']}?members_mode=$mode&amp;page=$nextPage\"
                 			  class=\"moreMembers\"
                 			  onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">"._t('_Next')."</a>
                 		";*/
             }
             $sBMViewAllLink = getParam('enable_modrewrite') == 'on' ? "{$site['url']}browse.php" : "{$site['url']}browse.php";
             $aDBBottomMenu[_t('_View All')] = array('href' => $sBMViewAllLink, 'dynamic' => false, 'class' => 'viewAllMembers');
             //$ret .= '</div>';
         }
     } else {
         $ret .= '<div class="no_result">';
         $ret .= '<div>';
         $ret .= _t("_No results found");
         $ret .= '</div>';
         $ret .= '</div>';
     }
     $ret .= '<div class="clear_both"></div>';
     return array($ret, $aDBTopMenu, $aDBBottomMenu);
     //return $ret;
 }
Пример #22
0
 function BxSitesSearchResult($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '')
 {
     $this->_oMain = $this->getSitesMain();
     $this->isError = false;
     $this->sUnitTemplate = 'unit';
     $this->sUnitName = 'unit';
     $this->sThumbSize = 'browse';
     $this->sMode = $sMode;
     bx_import("BxTemplVotingView");
     $oVotingView = new BxTemplVotingView('bx_sites', 0);
     $this->oVotingView = $oVotingView->isEnabled() ? $oVotingView : null;
     $this->aCurrent['title'] = _t('_bx_sites');
     $this->aCurrent['paginate']['perPage'] = getParam('bx_sites_per_page');
     switch ($sMode) {
         case 'pending':
             unset($this->aCurrent['rss']);
             break;
         case 'adminpending':
             unset($this->aCurrent['rss']);
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sSitesBrowseUrl = 'administration';
             break;
         case 'my_pending':
             $this->aCurrent['restriction']['owner'] = array('value' => $this->_oMain->iOwnerId, 'field' => 'ownerid', 'operator' => '=');
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sSitesBrowseUrl = 'browse/my';
             unset($this->aCurrent['rss']);
             break;
         case 'user':
             if ($sValue) {
                 $iProfileId = $this->_oMain->_oDb->getProfileIdByNickName($sValue);
                 if ($iProfileId) {
                     $this->aCurrent['title'] = _t('_bx_sites_caption_browse_by_user') . $sValue;
                     $GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId);
                     $this->aCurrent['restriction']['owner'] = array('value' => $iProfileId, 'field' => 'ownerid', 'operator' => '=');
                     $this->sSitesBrowseUrl = 'browse/user/' . $sValue;
                 } else {
                     $this->isError = true;
                 }
             } else {
                 $this->isError = true;
             }
             break;
         case 'category':
             $sCategory = uri2title($sValue);
             $this->aCurrent['restriction']['category']['value'] = $sCategory;
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_by_category') . ' ' . $sCategory;
             $GLOBALS['oTopMenu']->setCustomSubHeader(_t('_bx_sites_caption_browse_by_category') . ' ' . $sCategory);
             $this->sSitesBrowseUrl = 'browse/category';
             break;
         case 'tag':
             $sTag = uri2title($sValue);
             $this->aCurrent['restriction']['tag']['value'] = $sTag;
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_by_tag') . ' ' . $sTag;
             $GLOBALS['oTopMenu']->setCustomSubHeader(_t('_bx_sites_caption_browse_by_tag') . ' ' . $sTag);
             $this->sSitesBrowseUrl = 'browse/all';
             break;
         case 'all':
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_all');
             $this->sSitesBrowseUrl = 'browse/all';
             break;
         case 'recent':
             $this->aCurrent['paginate']['perPage'] = 1;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             $this->sUnitTemplate = 'block_percent';
             $this->sThumbSize = 'file';
             break;
         case 'featured':
             $this->aCurrent['restriction']['featured']['value'] = 1;
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_featured');
             $this->sSitesBrowseUrl = 'browse/featured';
             $this->sSitesBrowseAll = 'browse/featured';
             break;
         case 'featuredlast':
             $this->aCurrent['paginate']['perPage'] = 1;
             $this->aCurrent['restriction']['featured']['value'] = 1;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             $this->sUnitTemplate = 'block_percent';
             $this->sThumbSize = 'file';
             break;
         case 'featuredshort':
             $this->aCurrent['restriction']['featured']['value'] = 1;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             $this->sUnitTemplate = 'unit_short';
             $this->sSitesBrowseUrl = 'browse/featuredshort';
             $this->sSitesBrowseAll = 'browse/featured';
             $this->aCurrent['paginate']['perPage'] = 5;
             break;
         case 'top':
             $this->aCurrent['sorting'] = 'top';
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_top_rated');
             $this->sSitesBrowseUrl = 'browse/top';
             break;
         case 'popular':
             $this->aCurrent['sorting'] = 'popular';
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_popular');
             $this->sSitesBrowseUrl = 'browse/popular';
             break;
         case 'search':
             if ($sValue) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => $sValue, 'field' => '', 'operator' => 'against');
             }
             $this->aCurrent['title'] = _t('_bx_sites_caption_search_results') . ' ' . $sValue;
             $this->sSitesBrowseUrl = 'browse/search/' . $sValue;
             unset($this->aCurrent['rss']);
             break;
         case 'admin':
             $this->aCurrent['join'] = array('profile' => array('type' => 'left', 'table' => 'Profiles', 'mainField' => 'ownerid', 'onField' => 'ID', 'joinFields' => array('Role')));
             $this->aCurrent['restriction'] = array('admin' => array('value' => '3', 'field' => 'Role', 'operator' => '=', 'table' => 'Profiles'));
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_admin');
             $this->sSitesBrowseUrl = 'browse/admin';
             break;
         case 'users':
             $this->aCurrent['join'] = array('profile' => array('type' => 'left', 'table' => 'Profiles', 'mainField' => 'ownerid', 'onField' => 'ID', 'joinFields' => array('Role')));
             $this->aCurrent['restriction']['role'] = array('value' => '3', 'field' => 'Role', 'operator' => '<>', 'table' => 'Profiles');
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_profile');
             $this->sSitesBrowseUrl = 'browse/profile';
             break;
         case 'calendar':
             $this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')", 'field' => 'date', 'operator' => '>=', 'no_quote_value' => true);
             $this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')", 'field' => 'date', 'operator' => '<=', 'no_quote_value' => true);
             $this->sSitesBrowseUrl = "browse/calendar/{$sValue}/{$sValue2}/{$sValue3}";
             $this->aCurrent['title'] = _t('_bx_sites_caption_browse_by_day') . getLocaleDate(strtotime("{$sValue}-{$sValue2}-{$sValue3}"), BX_DOL_LOCALE_DATE_SHORT);
             $GLOBALS['oTopMenu']->setCustomSubHeader($this->aCurrent['title']);
             break;
         case 'hon_rate':
             $ip = getVisitorIP();
             $aVotedItems = $oVotingView->getVotedItems($ip);
             $aList = array();
             $sPrefix = $oVotingView->_aSystem['row_prefix'] . 'id';
             foreach ($aVotedItems as $iKey => $aVal) {
                 $aList[$iKey] = $aVal[$sPrefix];
             }
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             $this->aCurrent['paginate']['perPage'] = 1;
             $this->aCurrent['sorting'] = 'rand';
             $this->aCurrent['restriction']['id'] = array('value' => $aList, 'field' => 'id', 'operator' => 'not in');
             break;
         case 'hon_prev_rate':
             $this->aCurrent['join']['rateTrack'] = array('type' => 'inner', 'table' => 'bx_sites_rating_track', 'mainField' => 'id', 'onField' => 'sites_id', 'joinFields' => array('sites_ip', 'sites_date'));
             $this->aCurrent['paginate']['perPage'] = 1;
             $this->aCurrent['sorting'] = 'sites_date';
             $sIp = getVisitorIP();
             $this->aCurrent['restriction']['ip'] = array('value' => $sIp, 'field' => 'sites_ip', 'table' => 'bx_sites_rating_track', 'operator' => '=');
             break;
         case 'index':
             $this->sSitesBrowseUrl = 'index';
             $this->sSitesBrowseAll = 'browse/all';
             $this->aCurrent['paginate']['perPage'] = 3;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             break;
         case 'profile':
             if ($sValue) {
                 $iProfileId = $this->_oMain->_oDb->getProfileIdByNickName(process_db_input($sValue));
                 if ($iProfileId) {
                     $this->aCurrent['restriction']['owner'] = array('value' => $iProfileId, 'field' => 'ownerid', 'operator' => '=');
                     $this->sSitesBrowseUrl = 'profile/' . $sValue;
                     $this->sSitesBrowseAll = 'browse/user/' . $sValue;
                     $this->aCurrent['paginate']['perPage'] = 3;
                     $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
                 } else {
                     $this->isError = true;
                 }
             } else {
                 $this->isError = true;
             }
             break;
         case 'home':
             $this->sSitesBrowseUrl = 'browse/home';
             $this->sSitesBrowseAll = 'browse/all';
             $this->aCurrent['paginate']['perPage'] = 5;
             $this->aCurrent['restriction']['public']['value'] = BX_DOL_PG_ALL;
             break;
         case '':
             $this->sSitesBrowseUrl = 'browse/';
             $this->aCurrent['title'] = _t('_bx_sites');
             unset($this->aCurrent['rss']);
             break;
         default:
             $this->isError = true;
     }
     if (!$this->isError) {
         if (isset($this->aCurrent['rss'])) {
             $this->aCurrent['rss']['link'] = BX_DOL_URL_ROOT . $this->_oMain->_oConfig->getBaseUri() . $this->sSitesBrowseUrl;
         }
         if (bx_get('rss') !== false && bx_get('rss')) {
             $this->aCurrent['ownFields'][] = 'description';
             $this->aCurrent['ownFields'][] = 'date';
             $this->aCurrent['paginate']['perPage'] = $this->_oMain->_oDb->getParam('bx_sites_max_rss_num');
         }
     }
     parent::BxTemplSearchResult();
 }
Пример #23
0
function PageCompTopMembersContent($sCaption)
{
    global $tmpl;
    // number of profiles
    $max_num = (int) getParam("top_members_max_num");
    //	Get Sex from GET data
    if ($_GET['Sex'] && $_GET['Sex'] != "all") {
        $sex = process_db_input($_GET['Sex']);
        $query_add = " AND `Sex` = '{$sex}'";
    } else {
        $sex = "all";
        $query_add = "";
    }
    $query = "\r\n\t\tSELECT\r\n\t\t\t`Profiles`.*\r\n\t\t";
    if ($_GET['Mode'] == 'online' or $_GET['Mode'] == 'rand' or $_GET['Mode'] == 'last' or $_GET['Mode'] == 'top') {
        $mode = $_GET['Mode'];
    } else {
        $mode = 'last';
    }
    $menu = '<div class="dbTopMenu">';
    foreach (array('last', 'top', 'online', 'rand') as $myMode) {
        switch ($myMode) {
            case 'online':
                if ($mode == $myMode) {
                    $filter = " FROM `Profiles` WHERE `LastNavTime` > SUBDATE(NOW(), INTERVAL " . (int) getParam("member_online_time") . " MINUTE) AND `Status` = 'Active' AND `PrimPhoto` != 0 {$query_add}";
                }
                $modeTitle = _t('_Online');
                break;
            case 'rand':
                if ($mode == $myMode) {
                    $filter = " FROM `Profiles` WHERE `Status` = 'Active' AND `PrimPhoto` != 0 {$query_add} ORDER BY RAND()";
                }
                $modeTitle = _t('_Random');
                break;
            case 'last':
                if ($mode == $myMode) {
                    $filter = " FROM `Profiles` WHERE `Status` = 'Active' {$query_add} ORDER BY `LastReg` DESC";
                }
                $modeTitle = _t('_Latest');
                break;
            case 'top':
                if ($mode == $myMode) {
                    $oVotingView = new BxTemplVotingView('profile', 0, 0);
                    $aSql = $oVotingView->getSqlParts('`Profiles`', '`ID`');
                    $sqlOrderBy = $oVotingView->isEnabled() ? " ORDER BY (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `LastReg` DESC" : $sqlOrderBy;
                    $sqlFields = $aSql['fields'];
                    $sqlLJoin = $aSql['join'];
                    $filter = "{$sqlFields} FROM `Profiles` {$sqlLJoin} WHERE `Status` = 'Active' AND `pr_rating_count` > 2 {$query_add} {$sqlOrderBy}";
                    $filter2 = " FROM `Profiles` {$sqlLJoin} WHERE `Status` = 'Active' AND `pr_rating_count` > 2 {$query_add} {$sqlOrderBy}";
                }
                $modeTitle = _t('_Top');
                break;
        }
        if ($myMode == $mode) {
            $menu .= "<div class=\"active\">{$modeTitle}</a></div>";
        } else {
            $menu .= "<div class=\"notActive\"><a href=\"{$_SERVER['PHP_SELF']}?Mode={$myMode}&amp;Sex={$sex}\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">{$modeTitle}</a></div>";
        }
    }
    $menu .= '<div class="clear_both"></div>';
    $menu .= '</div>';
    $ret = '';
    $aNum = db_arr("SELECT COUNT(`Profiles`.`ID`) " . (isset($filter2) ? $filter2 : $filter));
    $num = (int) $aNum[0];
    if ($num) {
        $pages = ceil($num / $max_num);
        $page = (int) $_GET['page'];
        if ($page < 1 or $mode == 'rand') {
            $page = 1;
        }
        if ($page > $pages) {
            $page = $pages;
        }
        $sqlFrom = ($page - 1) * $max_num;
        $limit = " LIMIT {$sqlFrom}, {$max_num}";
        $templ_search = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/topmebers_index.html");
        $result = db_res($query . $filter . $limit);
        $iCounter = 1;
        $ret .= '<div class="clear_both"></div>';
        while ($p_arr = mysql_fetch_array($result)) {
            if ($iCounter % 3 != 0) {
                $ret .= PrintSearhResult($p_arr, $templ_search, 1);
            } else {
                $ret .= PrintSearhResult($p_arr, $templ_search, 2);
            }
            $iCounter++;
        }
        $ret .= '<div class="clear_both"></div>';
        if ($pages > 1) {
            $ret .= '<div class="dbBottomMenu">';
            if ($page > 1) {
                $prevPage = $page - 1;
                $ret .= "\r\n\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?Mode={$mode}&amp;page={$prevPage}\"\r\n\t\t\t\t\t  class=\"backMembers\"\r\n\t\t\t\t\t  onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">" . _t('_Back') . "</a>\r\n\t\t\t\t";
            }
            if ($page < $pages) {
                $nextPage = $page + 1;
                $ret .= "\r\n\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?Mode={$mode}&amp;page={$nextPage}\"\r\n\t\t\t\t\t  class=\"moreMembers\"\r\n\t\t\t\t\t  onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">" . _t('_Next') . "</a>\r\n\t\t\t\t";
            }
            $ret .= '</div>';
        }
    } else {
        $ret .= '<div class="no_result">';
        $ret .= '<div>';
        $ret .= _t("_No results found");
        $ret .= '</div>';
        $ret .= '</div>';
    }
    $ret .= '<div class="clear_both"></div>';
    return DesignBoxContent(_t($sCaption), $ret, 1, $menu);
}