Example #1
0
 function blockFiles(&$aData)
 {
     $iEntryId = $aData['id'];
     $aReadyMedia = array();
     if ($iEntryId) {
         $aReadyMedia = $GLOBALS['oBxStoreModule']->_oDb->getFiles($iEntryId, true);
     }
     if (!$aReadyMedia) {
         return '';
     }
     $aVars = array('bx_repeat:files' => array());
     $sCurrencySign = getParam('pmt_default_currency_sign');
     foreach ($aReadyMedia as $r) {
         $iMediaId = $r['media_id'];
         $a = BxDolService::call('files', 'get_file_array', array($iMediaId), 'Search');
         if (!$a['date']) {
             continue;
         }
         bx_import('BxTemplFormView');
         $oForm = new BxTemplFormView(array());
         $aInputBtnDownload = array('type' => 'submit', 'name' => 'bx_store_download', 'value' => _t('_bx_store_download'), 'attrs' => array('onclick' => "window.open ('" . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . "download/{$r['id']}','_self');"));
         $aVars['bx_repeat:files'][] = array('id' => $iMediaId, 'title' => $a['title'], 'icon' => $a['file'], 'price' => $sCurrencySign . ' ' . $r['price'], 'for_group' => sprintf(_t('_bx_store_for_group'), $GLOBALS['oBxStoreModule']->getGroupName($r['allow_purchase_to'])), 'date' => defineTimeInterval($a['date']), 'bx_if:purchase' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedPurchase($r), 'content' => array('btn_purchase' => BxDolService::call('payment', 'get_add_to_cart_link', array($r['author_id'], $this->_oConfig->getId(), $r['id'], 1)))), 'bx_if:download' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedDownload($r), 'content' => array('btn_download' => $oForm->genInputButton($aInputBtnDownload))));
     }
     if (!$aVars['bx_repeat:files']) {
         return '';
     }
     return $this->parseHtmlByName('block_files', $aVars);
 }
 /**
  * Get processed message
  *
  * @param $aMessages array
  * @param $bDeleteAllowed boolean
  * @param $bBlockAllowed boolean
  * @return text
  */
 function getProcessedMessages($aMessages = array(), $bDeleteAllowed = false, $bBlockAllowed = false)
 {
     global $oFunctions;
     if (!$aMessages) {
         return;
     }
     $sOutputCode = '';
     $aLanguageKeys = array('by' => _t('_bx_shoutbox_by'), 'visitor' => _t('_Visitor'), 'delete' => _t('_bx_shoutbox_delete_message'), 'sure' => _t('_Are_you_sure'), 'block' => _t('_bx_shoutbox_block_ip'));
     foreach ($aMessages as $iKey => $aItems) {
         $sMemberIcon = '';
         $aProfileInfo = $aItems['OwnerID'] > 0 ? getProfileInfo($aItems['OwnerID']) : array();
         // define some profile's data;
         if ($aProfileInfo) {
             $sNickName = getNickName($aProfileInfo['ID']);
             $sLink = getProfileLink($aItems['OwnerID']);
             $sMemberIcon = $oFunctions->getMemberIcon($aItems['OwnerID']);
         } else {
             $sLink = 'javascript:void(0)';
             $sNickName = $aLanguageKeys['visitor'];
         }
         $aKeys = array('owner_icon' => $sMemberIcon, 'message' => WordWrapStr($aItems['Message']), 'by' => $aLanguageKeys['by'], 'owner_nick' => $sNickName, 'date' => defineTimeInterval($aItems['DateTS'], true, true), 'owner_link' => $sLink, 'bx_if:delete_allowed' => array('condition' => $bDeleteAllowed, 'content' => array('delete_cpt' => bx_html_attribute($aLanguageKeys['delete']), 'sure_cpt' => bx_js_string($aLanguageKeys['sure']), 'message_id' => $aItems['ID'])), 'bx_if:block_allowed' => array('condition' => $bBlockAllowed, 'content' => array('block_cpt' => bx_html_attribute($aLanguageKeys['block']), 'sure_cpt' => bx_js_string($aLanguageKeys['sure']), 'message_id' => $aItems['ID'])));
         $sTemplateName = $aProfileInfo ? 'message.html' : 'visitor_message.html';
         $sOutputCode .= $this->parseHtmlByName($sTemplateName, $aKeys);
     }
     return $sOutputCode;
 }
Example #3
0
 function blockInfo(&$aEvent)
 {
     if (null == $this->_oMain) {
         $this->_oMain = BxDolModule::getInstance('BxEventsModule');
     }
     $aAuthor = getProfileInfo($aEvent['ResponsibleID']);
     $aVars = array('author_unit' => $GLOBALS['oFunctions']->getMemberThumbnail($aAuthor['ID'], 'none', true), 'date' => getLocaleDate($aEvent['Date'], BX_DOL_LOCALE_DATE_SHORT), 'date_ago' => defineTimeInterval($aEvent['Date'], false), 'cats' => $this->parseCategories($aEvent['Categories']), 'tags' => $this->parseTags($aEvent['Tags']), 'location' => $this->_oMain->_formatLocation($aEvent, true, true), 'fields' => $this->blockFields($aEvent), 'author_username' => $aAuthor ? $aAuthor['NickName'] : _t('_bx_events_admin'), 'author_url' => $aAuthor ? getProfileLink($aAuthor['ID']) : 'javascript:void(0)');
     return $this->parseHtmlByName('block_info', $aVars);
 }
 function displayItem($aParams, &$aEntry)
 {
     $sSampleType = $aParams['sample_type'];
     $iViewerType = $aParams['viewer_type'];
     $bAdminPanel = $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (isset($aParams['admin_panel']) && $aParams['admin_panel'] || $sSampleType == 'admin');
     $sModuleUri = $this->_oConfig->getUri();
     $sLKLinkEdit = _t('_' . $sModuleUri . '_lcaption_edit');
     $aTmplVars = array('id' => $this->_oConfig->getSystemPrefix() . $aEntry['id'], 'caption' => str_replace("\$", "$", $aEntry['caption']), 'class' => !in_array($sSampleType, array('view')) ? ' ' . $this->sCssPrefix . '-text-snippet ' : '', 'date' => defineTimeInterval($aEntry['when_uts']), 'content' => str_replace("\$", "$", $aEntry['content']), 'link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aEntry['uri'], 'bx_if:checkbox' => array('condition' => $bAdminPanel, 'content' => array('id' => $aEntry['id'])), 'bx_if:status' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('status' => _t('_' . $sModuleUri . '_status_' . $aEntry['status']))), 'bx_if:featured' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (int) $aEntry['featured'] == 1, 'content' => array()), 'bx_if:edit_link' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('edit_link_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'admin/' . $aEntry['uri'], 'edit_link_caption' => $sLKLinkEdit)));
     return $this->parseHtmlByName('item.html', $aTmplVars);
 }
Example #5
0
 function getBasicFileInfoForm(&$aInfo, $sUrlPref = '')
 {
     $aForm = array('date' => array('type' => 'value', 'value' => getLocaleDate($aInfo['medDate'], BX_DOL_LOCALE_DATE_SHORT) . ' (' . defineTimeInterval($aInfo['medDate']) . ')', 'caption' => _t('_Date')));
     if (!empty($aInfo['Categories'])) {
         $aForm['category'] = array('type' => 'value', 'value' => getLinkSet($aInfo['Categories'], $sUrlPref . 'browse/category/', CATEGORIES_DIVIDER), 'caption' => _t('_Category'));
     }
     if (!empty($aInfo['medTags'])) {
         $aForm['tags'] = array('type' => 'value', 'value' => getLinkSet($aInfo['medTags'], $sUrlPref . 'browse/tag/'), 'caption' => _t('_Tags'));
     }
     return $aForm;
 }
Example #6
0
 function getBlockCode_UpcomingPhoto()
 {
     $aEvent = $this->oDb->getUpcomingEvent(getParam('bx_events_main_upcoming_event_from_featured_only') ? true : false);
     if (!$aEvent) {
         return MsgBox(_t('_Empty'));
     }
     $aAuthor = getProfileInfo($aEvent['ResponsibleID']);
     $a = array('ID' => $aEvent['ResponsibleID'], 'Avatar' => $aEvent['PrimPhoto']);
     $aImage = BxDolService::call('photos', 'get_image', array($a, 'file'), 'Search');
     bx_events_import('Voting');
     $oRating = new BxEventsVoting('bx_events', (int) $aEvent['ID']);
     $aVars = array('image_url' => !$aImage['no_image'] && $aImage['file'] ? $aImage['file'] : $this->oTemplate->getIconUrl('no-photo-110.png'), 'image_title' => !$aImage['no_image'] && $aImage['title'] ? $aImage['title'] : '', 'event_url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aEvent['EntryUri'], 'event_title' => $aEvent['Title'], 'event_start' => getLocaleDate($aEvent['EventStart']), 'event_start_in' => defineTimeInterval($aEvent['EventStart']), 'author_title' => _t('_From'), 'author_username' => $aAuthor['NickName'], 'author_url' => getProfileLink($aAuthor['ID']), 'rating' => $oRating->isEnabled() ? $oRating->getJustVotingElement(true, $aEvent['ID']) : '', 'participants' => $aEvent['FansCount'], 'country_city' => '<a href="' . $this->oConfig->getBaseUri() . 'browse/country/' . strtolower($aEvent['Country']) . '">' . _t($GLOBALS['aPreValues']['Country'][$aEvent['Country']]['LKey']) . '</a>' . (trim($aEvent['City']) ? ', ' . $aEvent['City'] : ''), 'place' => $aEvent['Place'], 'flag_image' => genFlag($aEvent['Country']));
     return $this->oTemplate->parseHtmlByName('main_event', $aVars);
 }
 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);
 }
Example #8
0
 function getComment($iId, $iCmtId, $iAuthorId = 0)
 {
     global $sHomeUrl;
     $iTimestamp = time();
     $sFields = "'' AS `cmt_rated`,";
     $sJoin = '';
     if ($iAuthorId) {
         $sFields = '`r`.`cmt_rate` AS `cmt_rated`,';
         $sJoin = "LEFT JOIN {$this->_sTableTrack} AS `r` ON (`r`.`cmt_system_id` = " . $this->_aSystem['system_id'] . " AND `r`.`cmt_id` = `c`.`cmt_id` AND `r`.`cmt_rate_author_id` = {$iAuthorId})";
     }
     $aComment = $this->getRow("SELECT\n                {$sFields}\n                `c`.`cmt_id`,\n                `c`.`cmt_parent_id`,\n                `c`.`cmt_object_id`,\n                `c`.`cmt_author_id`,\n                `c`.`cmt_text`,\n                `c`.`cmt_mood`,\n                `c`.`cmt_rate`,\n                `c`.`cmt_rate_count`,\n                `c`.`cmt_replies`,\n                UNIX_TIMESTAMP(`c`.`cmt_time`) AS `cmt_time_ts`,\n                ({$iTimestamp} - UNIX_TIMESTAMP(`c`.`cmt_time`)) AS `cmt_secs_ago`,\n                `p`.`NickName` AS `cmt_author_name`\n            FROM {$this->_sTable} AS `c`\n            LEFT JOIN `Profiles` AS `p` ON (`p`.`ID` = `c`.`cmt_author_id`)\n            {$sJoin}\n            WHERE `c`.`cmt_object_id` = '{$iId}' AND `c`.`cmt_id` = '{$iCmtId}'\n            LIMIT 1");
     $aComment['cmt_text'] = str_replace("[ray_url]", $sHomeUrl, $aComment['cmt_text']);
     $aComment['cmt_ago'] = defineTimeInterval($aComment['cmt_time_ts']);
     return $aComment;
 }
 function getBlockCode_LatestFeaturedProduct()
 {
     $aDataEntry = $this->oDb->getLatestFeaturedItem();
     if (!$aDataEntry) {
         return false;
     }
     $aAuthor = getProfileInfo($aDataEntry['author_id']);
     $sImageUrl = '';
     $sImageTitle = '';
     $a = array('ID' => $aDataEntry['author_id'], 'Avatar' => $aDataEntry['thumb']);
     $aImage = BxDolService::call('photos', 'get_image', array($a, 'file'), 'Search');
     bx_store_import('Voting');
     $oRating = new BxStoreVoting('bx_store', $aDataEntry['id']);
     $aVars = array('bx_if:image' => array('condition' => !$aImage['no_image'] && $aImage['file'], 'content' => array('image_url' => !$aImage['no_image'] && $aImage['file'] ? $aImage['file'] : '', 'image_title' => !$aImage['no_image'] && $aImage['title'] ? $aImage['title'] : '', 'product_url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aDataEntry['uri'])), 'product_url' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'view/' . $aDataEntry['uri'], 'product_title' => $aDataEntry['title'], 'author_title' => _t('_From'), 'author_username' => getNickName($aAuthor['ID']), 'author_url' => getProfileLink($aAuthor['ID']), 'rating' => $oRating->isEnabled() ? $oRating->getJustVotingElement(true, $aDataEntry['id']) : '', 'created' => defineTimeInterval($aDataEntry['created']), 'price_range' => $this->oMain->_formatPriceRange($aDataEntry));
     return $this->oTemplate->parseHtmlByName('latest_featured_product', $aVars);
 }
Example #10
0
 function unit($aData, $sTemplateName, &$oVotingView, $isShort = false)
 {
     if (null == $this->_oMain) {
         $this->_oMain = BxDolModule::getInstance('BxGroupsModule');
     }
     if (!$this->_oMain->isAllowedView($aData)) {
         $aVars = array('extra_css_class' => 'bx_groups_unit');
         return $this->parseHtmlByName('twig_unit_private', $aVars);
     }
     $sImage = '';
     if ($aData['thumb']) {
         $a = array('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']);
         $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search');
         $sImage = $aImage['no_image'] ? '' : $aImage['file'];
     }
     $aVars = array('id' => $aData['id'], 'thumb_url' => $sImage ? $sImage : $this->getImageUrl('no-image-thumb.png'), 'group_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aData['uri'], 'group_title' => $aData['title'], 'created' => defineTimeInterval($aData['created']), 'fans_count' => $aData['fans_count'], 'country_city' => $this->_oMain->_formatLocation($aData), 'snippet_text' => $this->_oMain->_formatSnippetText($aData), 'bx_if:full' => array('condition' => !$isShort, 'content' => array('author' => getNickName($aData['author_id']), 'author_url' => $aData['author_id'] ? getProfileLink($aData['author_id']) : 'javascript:void(0);', 'created' => defineTimeInterval($aData['created']), 'rate' => $oVotingView ? $oVotingView->getJustVotingElement(0, $aData['id'], $aData['rate']) : '&#160;')));
     return $this->parseHtmlByName($sTemplateName, $aVars);
 }
Example #11
0
 function unit($aData, $sTemplateName, &$oVotingView)
 {
     if (null == $this->_oMain) {
         $this->_oMain = BxDolModule::getInstance('BxGroupsModule');
     }
     if (!$this->_oMain->isAllowedView($aData)) {
         $aVars = array('extra_css_class' => 'bx_groups_unit');
         return $this->parseHtmlByName('browse_unit_private', $aVars);
     }
     $sImage = '';
     if ($aData['thumb']) {
         $a = array('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']);
         $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search');
         $sImage = $aImage['no_image'] ? '' : $aImage['file'];
     }
     $aVars = array('id' => $aData['id'], 'thumb_url' => $sImage ? $sImage : $this->getIconUrl('no-photo.png'), 'group_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aData['uri'], 'group_title' => $aData['title'], 'created' => defineTimeInterval($aData['created']), 'author' => $aData['NickName'], 'author_url' => $aData['author_id'] ? getProfileLink($aData['author_id']) : 'javascript:void(0);', 'fans_count' => $aData['fans_count'], 'country_city' => _t($GLOBALS['aPreValues']['Country'][$aData['country']]['LKey']) . (trim($aData['city']) ? ', ' . $aData['city'] : ''));
     $aVars['rate'] = $oVotingView ? $oVotingView->getJustVotingElement(0, $aData['id'], $aData['rate']) : '&#160;';
     return $this->parseHtmlByName($sTemplateName, $aVars);
 }
Example #12
0
 function actionGetCurrentImage($iPicId)
 {
     $iPicId = (int) $iPicId;
     if ($iPicId > 0) {
         bx_import('Search', $this->_aModule);
         $oMedia = new BxPhotosSearch();
         $aInfo = $oMedia->serviceGetPhotoArray($iPicId, 'file');
         $aInfo['ownerUrl'] = getProfileLink($aInfo['owner']);
         $aInfo['ownerName'] = getNickName($aInfo['owner']);
         $aInfo['date'] = defineTimeInterval($aInfo['date']);
         $oMedia->getRatePart();
         $aInfo['rate'] = $oMedia->oRate->getJustVotingElement(0, 0, $aInfo['rate']);
         $aLinkAddon = $oMedia->getLinkAddByPrams();
         $oPaginate = new BxDolPaginate(array('count' => (int) $_GET['total'], 'per_page' => 1, 'page' => (int) $_GET['page'], 'on_change_page' => 'getCurrentImage({page})'));
         $aInfo['paginate'] = $oPaginate->getPaginate();
         header('Content-Type:text/javascript; charset=utf-8');
         echo json_encode($aInfo);
     }
 }
function video_getList($sId)
{
    global $sModule;
    global $aXmlTemplates;
    global $sFilesPath;
    $sMode = getSettingValue($sModule, "listSource");
    $iCount = (int) getSettingValue($sModule, "listCount");
    if (!is_numeric($iCount) || $iCount <= 0) {
        $iCount = 10;
    }
    $oSource = new BxVideosSearch();
    $oSource->aCurrent['sorting'] = 'top';
    $oSource->aCurrent['paginate']['perPage'] = $iCount;
    $oSource->aCurrent['restriction']['id'] = array('value' => $sId, 'field' => 'ID', 'operator' => '<>');
    switch ($sMode) {
        case "Member":
            $sOwner = getValue("SELECT `Owner` FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "'");
            $oSource->aCurrent['restriction']['owner'] = array('value' => $sOwner, 'field' => 'Owner', 'operator' => '=');
            break;
        case "Related":
            $aFile = getArray("SELECT * FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "'");
            $oSource->aCurrent['restriction']['keyword'] = array('value' => $aFile['Title'] . " " . $aFile['Tags'] . " " . $aFile['Description'], 'field' => '', 'operator' => 'against');
            break;
        case "Top":
        default:
            $oSource->aCurrent['restriction']['id'] = array('value' => $sId, 'field' => 'ID', 'operator' => '<>');
            break;
    }
    $aData = $oSource->getSearchData();
    $sResult = "";
    for ($i = 0; $i < count($aData); $i++) {
        $aData[$i]['uri'] = $oSource->getCurrentUrl('file', $aData[$i]['id'], $aData[$i]['uri']);
        $aData[$i]['date'] = defineTimeInterval($aData[$i]['date']);
        $sImageFile = $aData[$i]['id'] . IMAGE_EXTENSION;
        $sThumbFile = $aData[$i]['id'] . THUMB_FILE_NAME . IMAGE_EXTENSION;
        if (!file_exists($sFilesPath . $sThumbFile)) {
            $sThumbFile = $sImageFile;
        }
        $sResult .= parseXml($aXmlTemplates['file'], $sThumbFile, $aData[$i]['size'], $aData[$i]['ownerName'], $aData[$i]['view'], $aData[$i]['voting_rate'], $aData[$i]['date'], $aData[$i]['title'], BX_DOL_URL_ROOT . $aData[$i]['uri']);
    }
    return $sResult;
}
Example #14
0
 function actionGetCurrentImage($iPicId)
 {
     $iPicId = (int) $iPicId;
     if ($iPicId > 0) {
         require_once 'BxPhotosSearch.php';
         $oMedia = new BxPhotosSearch();
         $aInfo = $oMedia->serviceGetPhotoArray($iPicId, 'file');
         $aInfo['ownerUrl'] = getProfileLink($aInfo['owner']);
         $aInfo['ownerName'] = getNickName($aInfo['owner']);
         $aInfo['date'] = defineTimeInterval($aInfo['date']);
         $oMedia->getRatePart();
         $aInfo['rate'] = $oMedia->oRate->getJustVotingElement(0, 0, $aInfo['rate']);
         $aLinkAddon = $oMedia->getLinkAddByPrams();
         $oPaginate = new BxDolPaginate(array('count' => (int) $_GET['total'], 'per_page' => 1, 'page' => (int) $_GET['page'], 'info' => false, 'per_page_changer' => false, 'page_reloader' => false, 'on_change_page' => 'getCurrentImage({page})'));
         $aInfo['paginate'] = $oPaginate->getPaginate();
         header('Content-Type:text/javascript');
         $oJSON = new Services_JSON();
         echo $oJSON->encode($aInfo);
     }
 }
Example #15
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);
 }
Example #16
0
 function displaySearchUnit($aApplInfo)
 {
     global $oFunctions;
     $iAppID = (int) $aApplInfo['id'];
     $iOwnerID = (int) $aApplInfo['ownerId'];
     $sOwnerName = getNickname($iOwnerID);
     $sOwnerLink = getProfileLink($iOwnerID);
     $sAppUrl = process_text_output($aApplInfo['url']);
     $sAppDate = defineTimeInterval($aApplInfo['date']);
     $sAppTitle = process_text_output($aApplInfo['title']);
     $sStatusColor = $aApplInfo['status'] == 'active' ? '#00CC00' : '#CC0000';
     $aUnitReplace = array();
     $aUnitReplace['status_color'] = $sStatusColor;
     $aUnitReplace['appl_id'] = $iAppID;
     $aUnitReplace['appl_url'] = $sAppUrl;
     $aUnitReplace['appl_title'] = $sAppTitle;
     $aUnitReplace['owner_url'] = $sOwnerLink;
     $aUnitReplace['owner_name'] = $sOwnerName;
     $aUnitReplace['appl_date'] = $sAppDate;
     return $this->oOsiTemplate->parseHtmlByTemplateName('unit_application', $aUnitReplace);
 }
 function _getMessages($sUser, $sPwd, $isInbox)
 {
     $aRet = array();
     if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     $aMsgs = array();
     if ($isInbox) {
         $sWhere = "`Recipient` = '{$iId}' AND NOT FIND_IN_SET('recipient', `Trash`)";
     } else {
         $sWhere = "`Sender` = '{$iId}' AND NOT FIND_IN_SET('sender', `Trash`)";
     }
     $sFieldsAdd = $isInbox ? ", `m`.`Sender` AS `AuthorID`" : ", `m`.`Recipient` AS `AuthorID` ";
     $r = db_res("SELECT\n                `m`.`ID`, UNIX_TIMESTAMP(`m`.`Date`) AS `Date`, `m`.`Sender`, `m`.`Recipient`, `m`.`Subject`, `m`.`New` {$sFieldsAdd}\n            FROM `sys_messages` AS `m`\n            INNER JOIN `Profiles` as `p` ON (`p`.`ID` = `m`.`Sender`)\n            WHERE {$sWhere}\n            ORDER BY `Date` DESC");
     while ($aRow = $r->fetch()) {
         $sIcon = BxDolXMLRPCUtil::getThumbLink($isInbox ? $aRow['Sender'] : $aRow['Recipient'], 'thumb');
         $aMsg = array('ID' => new xmlrpcval($aRow['ID']), 'Date' => new xmlrpcval(defineTimeInterval($aRow['Date'])), 'Sender' => new xmlrpcval($aRow['Sender']), 'Recipient' => new xmlrpcval($aRow['Recipient']), 'Subject' => new xmlrpcval($aRow['Subject']), 'New' => new xmlrpcval($aRow['New']), 'Nick' => new xmlrpcval(getUsername($aRow['AuthorID'])), 'UserTitleInterlocutor' => new xmlrpcval(getNickName($aRow['AuthorID'])), 'Thumb' => new xmlrpcval($sIcon));
         $aMsgs[] = new xmlrpcval($aMsg, 'struct');
     }
     return new xmlrpcval($aMsgs, "array");
 }
Example #18
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;
 }
 function displaySearchUnit($aData)
 {
     $sFileLink = $this->getCurrentUrl('file', $aData['id'], $aData['uri']);
     $sCategoryLink = $this->getCurrentUrl('category', $aData['categoryId'], $aData['categoryUri'], array('ownerId' => $aData['ownerId'], 'ownerName' => $aData['ownerName']));
     // ownerPic
     $aUnit['ownerPic'] = get_member_icon($aData['ownerId'], 'left');
     // category
     $aUnit['category'] = isset($aData['categoryName']) ? _t('_In') . ' <a href="' . $sCategoryLink . '">' . $aData['categoryName'] . '</a>' : '';
     // comment(s)
     $aUnit['comment'] = isset($aData['countComment']) ? '<a href="' . $sFileLink . '">' . $aData['countComment'] . ' ' . _t('_comments') . '</a>' : '';
     // tag
     if (isset($aData['tag'])) {
         $aTags = explode(',', $aData['tag']);
         foreach ($aTags as $sValue) {
             $sLink = $this->getCurrentUrl('tag', 0, $sValue);
             $aUnit['tag'] .= '<a href="' . $sLink . '">' . $sValue . '</a>, ';
         }
     }
     $aUnit['tag'] .= trim($aUnit['tag'], ', ');
     // rate
     if (!is_null($this->oRate) && $this->oRate->isEnabled()) {
         $aUnit['rate'] = $this->oRate->getJustVotingElement(0, 0, $aData['voting_rate']);
     } else {
         $aUnit['rate'] = '';
     }
     // title
     $aUnit['title'] = isset($aData['title']) ? '<a href="' . $sFileLink . '">' . $aData['title'] . '</a>' : '';
     // when
     $aUnit['when'] = defineTimeInterval($aData['date']);
     // from
     $aUnit['from'] = $aData['ownerId'] != 0 ? _t('_By') . ': <a href="' . getProfileLink($aData['ownerId']) . '">' . $aData['ownerName'] . '</a>' : _t('_By') . ': ' . _t('_Admin');
     // view
     $aUnit['view'] = isset($aData['view']) ? _t("_Views") . ': ' . $aData['view'] : '';
     // body
     $aUnit['body'] = isset($aData['bodyText']) ? process_html_output(strmaxtextlen(strip_tags($aData['bodyText']), 200)) : '';
     return $GLOBALS['oSysTemplate']->parseHtmlByName('browseTextUnit.html', $aUnit, array('{', '}'));
 }
Example #20
0
function orca_format_date($iTimestamp)
{
    return defineTimeInterval($iTimestamp);
}
Example #21
0
 function getSwitcherUnit(&$aData, $aShowParams = array(), $aAddElems = array())
 {
     if (!is_array($aData)) {
         return;
     }
     $iWidth = (int) $aAddElems['switchWidth'] > 0 ? (int) $aAddElems['switchWidth'] : 602;
     $aUnit = array('switchWidth' => $iWidth, 'switchWidthOut' => $iWidth + 4, 'imgWidth' => strlen($aAddElems['imgWidth']) > 0 ? $aAddElems['imgWidth'] : '', 'picUrl' => $this->getImgUrl($aData['Hash'], 'file'), 'bx_if:href' => array('condition' => (int) $aShowParams['showLink'] != 0, 'content' => array('href' => $this->getCurrentUrl('file', $aData['id'], $aData['uri']), 'title' => $aData['title'])), 'bx_if:rate' => array('condition' => (int) $aShowParams['showRate'] != 0, 'content' => array('rate' => $this->oRate && $this->oRate->isEnabled() ? $this->oRate->getJustVotingElement(1, $aData['id'], $aData['Rate']) : $this->oRate->getJustVotingElement(0, 0, $aData['Rate']))), 'bx_if:date' => array('condition' => (int) $aShowParams['showDate'] != 0, 'content' => array('date' => defineTimeInterval($aData['date']))), 'bx_if:from' => array('condition' => (int) $aShowParams['showFrom'] != 0, 'content' => array('fromKey' => _t('_from'), 'profileUrl' => getProfileLink($aData['ownerId']), 'nick' => $aData['ownerName'])));
     return $this->oTemplate->parseHtmlByName('switcher_unit.html', $aUnit);
 }
Example #22
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 showBrowseUnit($aData, $bAdmin = false)
    {
        $sHref = $this->getFileUrl($aData['medID'], $aData['medUri']);
        $sTitle = strlen($aData['medTitle']) > 0 ? $aData['medTitle'] : _t("_Untitled");
        $sViews = _t('_Views');
        $sActionLinks = $this->iViewer == $aData['medProfId'] ? '<div><a href="' . $_SERVER['PHP_SELF'] . '?action=del&fileID=' . $aData['medID'] . '"
			onClick="return confirm( \'' . _t("_are you sure?") . '\');">' . _t("_Delete") . '</a></div>' : '';
        if (!$bAdmin) {
            $oVotingView = new BxTemplVotingView('g' . $this->sType, $aData['medID']);
            if ($oVotingView->isEnabled()) {
                $sRate = $oVotingView->getSmallVoting(0);
                $sShowRate = '<div class="galleryRate">' . $sRate . '</div>';
            }
            $sProfLink = '<div class="addInfo">' . _t("_By") . ': <a href="' . getProfileLink($aData['medProfId']) . '">' . $aData['NickName'] . '</a></div>';
            $sCheck = '';
        } else {
            $sShowRate = '';
            $sStyle = isset($aData['Approved']) && $aData['Approved'] == 'true' ? ' style="border: 2px solid #00CC00;"' : ' style="border: 2px solid #CC0000;"';
            $sProfLink = '<div>' . _t("_By") . ': <a href="' . $this->aConfigSite['url'] . 'pedit.php?ID=' . $aData['medProfId'] . '">' . $aData['NickName'] . '</a></div>';
            $sCheck = '<div class="browseCheckbox"><input type="checkbox" name="Check[]" value="' . $aData['medID'] . '" id="ch' . $aData['medID'] . '"></div>';
        }
        switch ($this->sType) {
            case 'photo':
                $sImg = $this->sFilesUrl . $aData['medID'] . '_t.' . $aData['medExt'];
                $sImage = '<div class="lastFilesPic" style="background-image: url(\'' . $sImg . '\');">
					  <a href="' . $sHref . '"><img src="' . $this->aConfigSite['images'] . 'spacer.gif" width="110" height="110"></a></div>';
                if ($this->iViewer == $aData['medProfId']) {
                    $sActionLinks = '<div><a href="javascript: void(0);"
						onClick="window.open(\'' . $this->aConfigSite['url'] . $this->sType . 'Actions.php?fileID=' . $aData['medID'] . '&amp;action=edit\', 
						\'photo\', \'width=500, height=380, menubar=no,status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no\');">' . _t("_Edit") . '</a></div>' . $sActionLinks;
                }
                break;
            case 'music':
                $sImage = '<div class="lastFilesPic"><a href="' . $sHref . '"><img src="' . $this->aConfigSite['images'] . 'music.png"></a></div>';
                break;
            case 'video':
                $sImage = '<div class="lastFilesPic"><a href="' . $sHref . '"><img src="' . $this->sFilesUrl . $aData['medID'] . '_small.jpg"></a></div>';
                break;
        }
        ob_start();
        ?>
		<div class="browseUnit"<?php 
        echo $sStyle;
        ?>
>
			<?php 
        echo $sCheck;
        ?>
			<?php 
        echo $sImage;
        ?>
			<div class="addInfo">
				<a href="<?php 
        echo $sHref;
        ?>
"><b><?php 
        echo $sTitle;
        ?>
</b></a>
			</div>
			<?php 
        echo $sProfLink;
        ?>
			<div class="addInfo"><?php 
        echo _t("_Added");
        ?>
: <b><?php 
        echo defineTimeInterval($aData['medDate']);
        ?>
</b></div>
			<div class="addInfo"><?php 
        echo $sViews;
        ?>
: <b><?php 
        echo $aData['medViews'];
        ?>
</b></div>
			<?php 
        echo $sShowRate . $sActionLinks;
        ?>
		</div>
		<?php 
        $sCode = ob_get_clean();
        return $sCode;
    }
Example #24
0
    function displaySearchUnit($aResSQL)
    {
        $iVisitorID = getLoggedId();
        $oMain = $this->getBlogsMain();
        $iPostID = (int) $aResSQL['id'];
        $sBlogsImagesUrl = BX_BLOGS_IMAGES_URL;
        $bPossibleToView = $oMain->oPrivacy->check('view', $iPostID, $oMain->_iVisitorID);
        if (!$bPossibleToView) {
            if ($this->sMobileWrapper) {
                return $this->_wrapMobileUnit($oMain->_oTemplate->parseHtmlByTemplateName('browse_unit_private_mobile', array()), $iPostID, $oMain);
            } else {
                return $oMain->_oTemplate->parseHtmlByName('browse_unit_private.html', array('extra_css_class' => ''));
            }
        }
        $sCategories = $aResSQL['Categories'];
        $aCategories = $oMain->getTagLinks($aResSQL['Categories'], 'category', CATEGORIES_DIVIDER);
        $sStyle = '';
        $sFriendStyle = '';
        $sPostVote = '';
        $sPostMode = '';
        $sVotePostRating = $this->oRate->getJustVotingElement(0, 0, $aResSQL['Rate']);
        $aProfileInfo = getProfileInfo($aResSQL['ownerId']);
        $sAuthorTitle = process_line_output(getNickName($aProfileInfo['ID']));
        $sAuthorUsername = getUsername($aProfileInfo['ID']);
        $sAuthorLink = getProfileLink($aProfileInfo['ID']);
        $sCategoryName = $aResSQL['Categories'];
        $sPostLink = $this->getCurrentUrl('file', $iPostID, $aResSQL['uri']) . $sCategoryUrlAdd;
        $sAllCategoriesLinks = '';
        if (count($aCategories) > 0) {
            foreach ($aCategories as $iKey => $sCatValue) {
                $sCatLink = $this->getCurrentUrl('category', title2uri($sCatValue), title2uri($sCatValue), array('ownerId' => $aResSQL['ownerId'], 'ownerName' => $sAuthorUsername));
                $sCatName = process_line_output($sCatValue);
                $aAllCategoriesLinks[] = '<a href="' . $sCatLink . '">' . $sCatName . '</a>';
            }
            $aAllCategoriesLinkHrefs = implode(", ", $aAllCategoriesLinks);
            $sAllCategoriesLinks = <<<EOF
<span class="margined">
    <span>{$aAllCategoriesLinkHrefs}</span>
</span>
EOF;
        }
        $sAdminCheck = $sAdminStatus = '';
        if ($this->bShowCheckboxes) {
            $sAdminCheck = <<<EOF
<div class="browseCheckbox"><input id="ch{$iPostID}" type="checkbox" name="bposts[]" value="{$iPostID}" /></div>
EOF;
            $sPostStatus = process_line_output($aResSQL['PostStatus']);
            $sAdminStatus = <<<EOF
&nbsp;({$sPostStatus})
EOF;
        }
        $sPostCaption = process_line_output($aResSQL['title']);
        $sPostCaptionHref = <<<EOF
<a class="unit_title bx-def-font-h2" href="{$sPostLink}">{$sPostCaption}</a>{$sAdminStatus}
EOF;
        if ($this->iPostViewType == 3 || $this->sMobileWrapper) {
            $sFriendStyle = "2";
            $sPostMode = '_post';
            $sPostCaptionHref = '<div class="unit_title bx-def-font-h2">' . $sPostCaption . '</div>';
        }
        $sDateTime = defineTimeInterval($aResSQL['date']);
        //$oCmtsView = new BxTemplCmtsView ('blogposts', (int)$iPostID);
        $iCommentsCnt = (int) $aResSQL['CommentsCount'];
        $sTagsCommas = $aResSQL['tag'];
        //$aTags = split(',', $sTagsCommas);
        $aTags = preg_split("/[;,]/", $sTagsCommas);
        //search by tag skiping
        if ($this->sSearchedTag != '' && in_array($this->sSearchedTag, $aTags) == false) {
            return;
        }
        $sTagsHrefs = '';
        $aTagsHrefs = array();
        foreach ($aTags as $sTagKey) {
            if ($sTagKey != '') {
                $sTagLink = $this->getCurrentUrl('tag', $iPostID, htmlspecialchars(title2uri($sTagKey)));
                $sTagsHrefAny = <<<EOF
<a href="{$sTagLink}" title="{$sTagKey}">{$sTagKey}</a>
EOF;
                $aTagsHrefs[] = $sTagsHrefAny;
            }
        }
        $sTagsHrefs = implode(", ", $aTagsHrefs);
        $sTags = <<<EOF
<span class="margined">
    <span>{$sTagsHrefs}</span>
</span>
EOF;
        $sPostText = $aResSQL['bodyText'];
        $bOwner = $iVisitorID == $aResSQL['ownerId'] ? true : false;
        $sOwnerThumb = $sPostPicture = $sPreviewPicture = '';
        if ($aResSQL['PostPhoto'] && $this->iPostViewType == 3) {
            $oMain->_oTemplate->addJs('plugins/fancybox/|jquery.fancybox.js');
            $oMain->_oTemplate->addCss('plugins/fancybox/|jquery.fancybox.css');
            $sPostPicture = $oMain->_oTemplate->parseHtmlByName('picture_preview.html', array('img_url_big' => $sBlogsImagesUrl . 'orig_' . $aResSQL['PostPhoto'], 'img_url_small' => $sBlogsImagesUrl . 'big_' . $aResSQL['PostPhoto']));
        }
        if ($aResSQL['PostPhoto'] && ($this->iPostViewType == 1 || $this->iPostViewType == 4 || $this->iPostViewType == 5)) {
            $sStyle = 'padding-right:' . ($this->iThumbSize + 10) . 'px; min-height:' . $this->iThumbSize . 'px;';
            $sPreviewPicture = '<div class="unit_img"><img class="bx-def-shadow bx-def-round-corners" src="' . $sBlogsImagesUrl . 'big_' . $aResSQL['PostPhoto'] . '" /></div>';
        }
        if ($this->iPostViewType == 4) {
            $sOwnerThumb = $GLOBALS['oFunctions']->getMemberIcon($aResSQL['ownerId'], 'left');
        }
        if ($this->iPostViewType == 4 || $this->iPostViewType == 1 || $this->iPostViewType == 5) {
            $iBlogLimitChars = (int) getParam('max_blog_preview');
            $sPostText = trim(strip_tags($sPostText));
            if (mb_strlen($sPostText) > $iBlogLimitChars) {
                $sPostText = mb_substr($sPostText, 0, $iBlogLimitChars);
                $sLinkMore = $this->sMobileWrapper ? '' : ' <a title="' . htmlspecialchars_adv(_t('_Read more')) . '" href="' . $sPostLink . '">&hellip;</a>';
            }
            $sPostText = htmlspecialchars_adv($sPostText) . $sLinkMore;
        }
        $aUnitReplace = array('checkbox' => $sAdminCheck, 'post_caption' => $sPostCaptionHref, 'author_title' => $sAuthorTitle, 'author_username' => $sAuthorUsername, 'author_link' => $sAuthorLink, 'post_date' => $sDateTime, 'all_categories' => $sAllCategoriesLinks, 'comments_count' => $iCommentsCnt, 'post_tags' => $sTags, 'friend_style' => $sFriendStyle, 'post_uthumb' => $sOwnerThumb, 'post_picture2' => $sPostPicture, 'preview_picture' => $sPreviewPicture, 'post_description' => $sPostText, 'post_vote' => $sVotePostRating, 'post_mode' => $sPostMode, 'style' => $sStyle, 'bx_if:full' => array('condition' => $this->iPostViewType != 5, 'content' => array('author_title' => $sAuthorTitle, 'author_username' => $sAuthorUsername, 'author_link' => $sAuthorLink, 'post_date' => $sDateTime)));
        if ($this->sMobileWrapper) {
            return $this->_wrapMobileUnit($oMain->_oTemplate->parseHtmlByTemplateName('blogpost_unit_mobile', $aUnitReplace), $iPostID, $oMain);
        } else {
            return $oMain->_oTemplate->parseHtmlByTemplateName('blogpost_unit', $aUnitReplace);
        }
    }
 function displayAlbumUnit($aData, $bCheckPrivacy = true)
 {
     $bOwner = $this->oModule->_iProfileId == $aData['Owner'];
     if (!$this->bAdminMode && $bCheckPrivacy) {
         if (!$this->oPrivacy->check('album_view', $aData['ID'], $this->oModule->_iProfileId)) {
             $aUnit = array('type' => $this->aCurrent['name']);
             return $this->oTemplate->parseHtmlByName('album_unit_private.html', $aUnit);
         }
     }
     $sLink = $this->getCurrentUrl('album', $aData['ID'], $aData['Uri']) . '/owner/' . getUsername($aData['Owner']);
     $aUnit = array('type' => $aData['Type'], 'bx_if:editMode' => array('condition' => $this->bAdminMode, 'content' => array('id' => $aData['ID'], 'checked' => $this->sCurrentAlbum == $aData['Uri'] ? 'checked="checked"' : '')), 'albumUrl' => $sLink, 'bx_repeat:units' => array(), 'title' => $aData['Caption'], 'titleLink' => stripcslashes($sLink), 'from' => getNickName($aData['Owner']), 'fromLink' => getProfileLink($aData['Owner']), 'view' => isset($aData['ObjCount']) ? $aData['ObjCount'] . ' ' . _t($this->aCurrent['title']) : '', 'when' => defineTimeInterval($aData['Date']));
     $iPics = isset($this->aConstants['filesInAlbumCover']) ? (int) $this->aConstants['filesInAlbumCover'] : 15;
     $aPics = $this->getAlbumCovers($aData['ID'], array('filesInAlbumCover' => $iPics));
     $bPics = is_array($aPics) && count($aPics) > 0;
     if (!$bPics && !$bOwner) {
         $this->aCurrent['paginate']['totalAlbumNum']--;
         return '';
     } else {
         if (!$bPics && $bOwner) {
             if (isset($this->aConstants['filesInEmptyAlbumCover'])) {
                 $iPics = $this->aConstants['filesInEmptyAlbumCover'];
             }
         }
     }
     $aUnit['bx_repeat:units'] = array();
     for ($i = 0; $i < $iPics; $i++) {
         $aUnit['bx_repeat:units'][] = $this->_getAlbumUnitItem($i, array_shift($aPics), array('album_url' => $sLink));
     }
     $sResult = $this->oTemplate->parseHtmlByName('album_unit.html', $aUnit, array('{', '}'));
     if (!empty($aData['show_as_list'])) {
         $sResult .= $this->addAlbumJsCss($this->bDynamic);
         $sResult = $this->oTemplate->parseHtmlByName('album_units.html', array('content' => $sResult));
         if (!empty($aData['enable_center'])) {
             $sResult = $GLOBALS['oFunctions']->centerContent($sResult, '.sys_album_unit');
         }
     }
     return $sResult;
 }
 /**
 * Function will generate member's messages history ;
 *
 * @param  : $iSender (integer)         - sender member's Id;
 * @param  : $iRecipient (integer)      -  recipient member's Id;
 * @param  : $iLastMessageId (integer)  - last message's Id of current message Block ;
 * @param  : $bLimit (boolean)          - if isset this parameter function will return qualified messages;
 * @return : (array);
        [messages_list]  - (text) messages list;
        [last_message]   - (integer) last message's Id;
        [count_messages] - (integer) count of generated messages;
 */
 function getMessagesHistory($iRecipient, $iSender, $iLastMessageId = 0, $bLimit = true)
 {
     $sOutputMessages = '';
     if ($bLimit) {
         $aMessages = $this->_oDb->getHistoryList($this->aCoreSettings, $iRecipient, $iSender, $iLastMessageId, $this->aCoreSettings['limit_returning_messages']);
     } else {
         $aMessages = $this->_oDb->getHistoryList($this->aCoreSettings, $iRecipient, $iSender, $iLastMessageId);
     }
     // procces received mesasges;
     $iLastMessageId = 0;
     $iCountMessages = 0;
     if ($aMessages && is_array($aMessages)) {
         foreach ($aMessages as $iKey => $aItems) {
             $iKey = (int) $iKey;
             $iCountMessages++;
             $iLastMessageId = $aMessages[$iKey]['ID'];
             $aTemplateKeys = array('message' => $aMessages[$iKey]['Message'], 'sender_nickname' => $aMessages[$iKey]['SenderID'] == $this->iLoggedMemberId ? _t('_simple_messenger_me') : getNickName($aMessages[$iKey]['SenderID']), 'date_add' => defineTimeInterval($aMessages[$iKey]['DateTS'], true, true), 'owner_nick_extra' => $aMessages[$iKey]['SenderID'] == $this->iLoggedMemberId ? 'sender' : 'recipient');
             $sOutputMessages .= $this->_oTemplate->parseHtmlByName('message.html', $aTemplateKeys);
         }
     }
     if (!$iLastMessageId) {
         $iLastMessageId = $this->_oDb->getLastMessagesId($iRecipient, $iSender);
     }
     $aRetArray = array('messages_list' => $sOutputMessages, 'last_message' => $iLastMessageId, 'count_messages' => $iCountMessages);
     return $aRetArray;
 }
Example #27
0
 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);
 }
Example #28
0
/**
 * Print code for membership status
 * $memberID - member ID
 * $offer_upgrade - will this code be printed at [c]ontrol [p]anel
 */
function GetMembershipStatus($memberID, $bOfferUpgrade = true, $bViewActions = true)
{
    $ret = '';
    $aMembership = getMemberMembershipInfo($memberID);
    $sViewActions = $bViewActions ? "<a onclick=\"javascript:loadHtmlInPopup('explanation_popup', '" . BX_DOL_URL_ROOT . "explanation.php?explain=membership&amp;type=" . $aMembership['ID'] . "');\" href=\"javascript:void(0);\">" . _t("_VIEW_MEMBERSHIP_ACTIONS") . "</a>" : "";
    // Show colored membership name
    if ($aMembership['ID'] == MEMBERSHIP_ID_STANDARD) {
        $ret .= $aMembership['Name'];
        if ($bOfferUpgrade && BxDolRequest::serviceExists('membership', 'get_upgrade_url')) {
            $sViewActions = _t('_MEMBERSHIP_UPGRADE_FROM_STANDARD', BxDolService::call('membership', 'get_upgrade_url')) . '<span class="sys-bullet"></span>' . $sViewActions;
        }
        $ret .= '<br />' . $sViewActions;
    } else {
        $ret .= '<font color="red">' . $aMembership['Name'] . '</font>';
        $sExpiration = '';
        if (!is_null($aMembership['DateExpires'])) {
            $sExpiration = _t("_MEMBERSHIP_EXPIRES", defineTimeInterval($aMembership['DateExpires']));
        } else {
            $sExpiration = _t("_MEMBERSHIP_EXPIRES_NEVER");
        }
        $ret .= '<br />' . $sViewActions . '<span class="sys-bullet"></span>' . $sExpiration;
    }
    return $ret;
}
function browseCode()
{
    global $site;
    global $rData;
    global $iTotalPages;
    global $iCurPage;
    $sCode = '<div id = "browseMain">';
    $sCode .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
    if (mysql_num_rows($rData)) {
        while ($aData = mysql_fetch_array($rData)) {
            $sStyle = $aData['Approved'] == 'true' ? ' style="border: 2px solid #00CC00;"' : ' style="border: 2px solid #CC0000;"';
            $sProf = '<a href="' . $site['url'] . 'profile_edit.php?ID=' . $aData['medProfId'] . '">' . $aData['NickName'] . '</a>';
            $sCode .= '<div class="browseUnit"' . $sStyle . '>';
            $sCode .= '<div class="browseCheckbox"><input type="checkbox" name="Check[]" value="' . $aData['medID'] . '"></div>';
            $sCode .= '<div class="lastFilesPic"><img src="' . $site['url_admin'] . 'images/music.png"></div>';
            $sCode .= '<div class="browseInfo"><div><a href="' . $site['url'] . 'viewMusic.php?fileID=' . $aData['medID'] . '"><b>' . $aData['medTitle'] . '</b></a></div>';
            $sCode .= '<div>' . _t("_Added") . ': <b>' . defineTimeInterval($aData['medDate']) . '</b> by ' . $sProf . '</div>';
            $sCode .= '<div>' . _t("_Playbacks") . ': <b>' . $aData['medListens'] . '</b></div></div>';
            $sCode .= '</div>';
        }
    } else {
        $sCode .= '<div>There are no files</div>';
    }
    $sCode .= '</div>';
    $sCode .= '<div class="clear_both"></div>';
    $sCode .= '<div class="bottomPart"><input type="submit" name="Delete" value="Delete"><input type="submit" name="Approve" value="Change status"></div>';
    // generate pagination
    if ($iTotalPages > 1) {
        $sRequest = $_SERVER['PHP_SELF'] . '?page={page}';
        $aFields = array('userID', 'tag');
        foreach ($aFields as $field) {
            if (isset($_GET[$field])) {
                $sRequest .= "&{$field}=" . htmlentities(process_pass_data($_GET[$field]));
            }
        }
        $pagination = '<div style="text-align:center;">' . genPagination($iTotalPages, $iCurPage, $sRequest) . '</div>';
    } else {
        $pagination = '';
    }
    return $sCode . $pagination . '</form>';
}
 function getSwitcherUnit(&$aData, $aShowParams = array(), $aAddElems = array())
 {
     if (!is_array($aData)) {
         return;
     }
     $iPhotoWidth = (int) $this->oModule->_oConfig->getGlParam('file_width') ? (int) $this->oModule->_oConfig->getGlParam('file_width') : 602;
     $iWidth = (int) $aAddElems['switchWidth'] > 0 ? (int) $aAddElems['switchWidth'] : $iPhotoWidth;
     $sImgUrl = $this->getCurrentUrl('file', $aData['id'], $aData['uri']);
     $aUnit = array('switchWidth' => $iWidth, 'imgWidth' => !empty($aAddElems['imgWidth']) ? $aAddElems['imgWidth'] : '', 'picUrl' => $this->getImgUrl($aData['Hash'], 'file'), 'href' => isset($aShowParams['linkUnitTo']) && !empty($aShowParams['linkUnitTo']) ? $aShowParams['linkUnitTo'] : $sImgUrl, 'bx_if:href' => array('condition' => (int) $aShowParams['showLink'] != 0, 'content' => array('href' => $sImgUrl, 'title' => $aData['title'])), 'bx_if:rate' => array('condition' => (int) $aShowParams['showRate'] != 0, 'content' => array('rate' => $this->oRate && $this->oRate->isEnabled() ? $this->oRate->getJustVotingElement(1, $aData['id'], $aData['Rate']) : $this->oRate->getJustVotingElement(0, 0, $aData['Rate']))), 'bx_if:date' => array('condition' => (int) $aShowParams['showDate'] != 0, 'content' => array('date' => defineTimeInterval($aData['date']))), 'bx_if:from' => array('condition' => (int) $aShowParams['showFrom'] != 0, 'content' => array('profileUrl' => getProfileLink($aData['ownerId']), 'nick' => getNickName($aData['ownerId']))));
     return $this->oTemplate->parseHtmlByName('switcher_unit.html', $aUnit);
 }