/** * 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' => $aItems['Message'], 'by' => $aLanguageKeys['by'], 'owner_nick' => $sNickName, 'date' => getLocaleDate(strtotime($aItems['Date']), BX_DOL_LOCALE_DATE), '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; }
function blockInformation($aSite) { $this->addCss(array('block_info.css')); $aResult = array('author_unit' => get_member_thumbnail($aSite['ownerid'], 'none', true), 'date' => getLocaleDate($aSite['date'], BX_DOL_LOCALE_DATE_SHORT), 'date_ago' => defineTimeInterval($aSite['date'], false), 'cats' => $this->parseCategories($aSite['categories']), 'tags' => $this->parseTags($aSite['tags']), 'fields' => ''); $this->_checkOwner($aSite, $aResult); return $this->parseHtmlByName('entry_view_block_info.html', $aResult); }
function blockInformation($aSite) { $this->addCss(array('block_info.css')); $aResult = array('owner_thumb' => get_member_thumbnail($aSite['ownerid'], 'none'), 'date_icon' => $this->getIconUrl('clock.png'), 'date' => getLocaleDate($aSite['date'], BX_DOL_LOCALE_DATE_SHORT), 'date_ago' => defineTimeInterval($aSite['date']), 'cats_icon' => $this->getIconUrl('folder.png'), 'cats' => $this->parseCategories($aSite['categories']), 'tags' => $this->parseTags($aSite['tags']), 'tags_icon' => $this->getIconUrl('tgs.gif')); $this->_checkOwner($aSite, $aResult); return $this->parseHtmlByName('block_info.html', $aResult); }
function 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 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; }
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); }
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 __construct($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '') { parent::__construct(); $this->iRate = 0; switch ($sParamName) { case 'calendar': $GLOBALS['_page']['header'] = _t('_sys_profiles_caption_browse_by_day') . ': ' . getLocaleDate(strtotime("{$sParamValue}-{$sParamValue1}-{$sParamValue2}"), BX_DOL_LOCALE_DATE_SHORT); $sParamValue = (int) $sParamValue; $sParamValue1 = (int) $sParamValue1; $sParamValue2 = (int) $sParamValue2; $this->aCurrent['restriction']['calendar-min'] = array('value' => "'{$sParamValue}-{$sParamValue1}-{$sParamValue2} 00:00:00'", 'field' => 'DateReg', 'operator' => '>=', 'no_quote_value' => true); $this->aCurrent['restriction']['calendar-max'] = array('value' => "'{$sParamValue}-{$sParamValue1}-{$sParamValue2} 23:59:59'", 'field' => 'DateReg', 'operator' => '<=', 'no_quote_value' => true); $this->aCurrent['title'] = $GLOBALS['_page']['header']; break; } }
function displayList($aParams) { $sSampleType = $aParams['sample_type']; $iViewerId = isset($aParams['viewer_id']) ? (int) $aParams['viewer_id'] : 0; $iViewerType = $aParams['viewer_type']; $iStart = isset($aParams['start']) ? (int) $aParams['start'] : -1; $iPerPage = isset($aParams['count']) ? (int) $aParams['count'] : -1; $bShowEmpty = isset($aParams['show_empty']) ? $aParams['show_empty'] : true; $bAdminPanel = $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (isset($aParams['admin_panel']) && $aParams['admin_panel'] || $sSampleType == 'admin'); $sModuleUri = $this->_oConfig->getUri(); $aEntries = $this->_oDb->getEntries($aParams); if (empty($aEntries)) { return $bShowEmpty ? MsgBox(_t('_' . $sModuleUri . '_msg_no_results')) : ""; } $oTags = new BxDolTags(); $oCategories = new BxDolCategories(); //--- Language translations ---// $sLKLinkApprove = _t('_' . $sModuleUri . '_lcaption_approve'); $sLKLinkReject = _t('_' . $sModuleUri . '_lcaption_reject'); $sLKLinkEdit = _t('_' . $sModuleUri . '_lcaption_edit'); $sLKLinkDelete = _t('_' . $sModuleUri . '_lcaption_delete'); $sBaseUri = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri(); $sJsMainObject = $this->_oConfig->getJsObject(); $aResult['sample'] = $sSampleType; $aResult['bx_repeat:entries'] = array(); foreach ($aEntries as $aEntry) { $sVotes = ""; if ($this->_oConfig->isVotesEnabled() && $aEntry['is_vote'] == 1) { $oVotes = $this->_oModule->_createObjectVoting($aEntry['id']); $sVotes = $oVotes->getJustVotingElement(0, $aEntry['id']); } $aResult['bx_repeat:entries'][] = array('id' => $this->_oConfig->getSystemPrefix() . $aEntry['id'], 'author_icon' => get_member_icon($aEntry['author_id'], 'left'), 'caption' => str_replace("\$", "$", $aEntry['caption']), 'class' => !in_array($sSampleType, array('view')) ? ' ' . $this->sCssPrefix . '-text-snippet' : '', 'date' => getLocaleDate($aEntry['date']), 'content' => str_replace("\$", "$", $aEntry['content']), 'link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aEntry['uri'], 'voting' => $sVotes, 'bx_if:checkbox' => array('condition' => $bAdminPanel, 'content' => array('id' => $aEntry['id'])), 'bx_if:status' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_MEMBER && $iViewerId == $aEntry['author_id'] || $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('status' => _t('_' . $sModuleUri . '_status_' . $aEntry['status']))), 'bx_if:edit_link' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_MEMBER && $iViewerId == $aEntry['author_id'] || $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('edit_link_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/' . $aEntry['uri'], 'edit_link_caption' => $sLKLinkEdit))); } $aResult['paginate'] = ''; if (!in_array($sSampleType, array('id', 'uri', 'view', 'search_unit'))) { if (!empty($sSampleType)) { $this->_updatePaginate($aParams); } $aResult['paginate'] = $this->oPaginate->getPaginate($iStart, $iPerPage); } $aResult['loading'] = LoadingBox($sModuleUri . '-' . $sSampleType . '-loading'); return $this->parseHtmlByName('list.html', $aResult); }
/** * generate rss feed using any custom data fields * but you need to describe fields in $aFields array * * Required fileds: * Link * Title * DateTimeUTS * Desc * * Optional fields: * Photo */ function GenRssByCustomData($aRssData, $sUnitTitleC, $sMainLink, $aFields, $sImage = '', $iPID = 0) { global $site; $sUnits = ''; $sRSSLast = ''; if (isset($aRssData[0])) { $sRSSLast = getLocaleDate($aRssData[0][$aFields['DateTimeUTS']], 6); } if ($iPID > 0) { $aPIDOwnerInfo = getProfileInfo($iPID); } $iUnitLimitChars = 2000; //(int)getParam('max_blog_preview'); if ($aRssData) { foreach ($aRssData as $iUnitID => $aUnitInfo) { $sUnitUrl = $aUnitInfo[$aFields['Link']]; $sUnitGuid = $aUnitInfo[$aFields['Guid']]; $sUnitTitle = strmaxwordlen(strip_tags($aUnitInfo[$aFields['Title']]), 100); $sUnitDate = getLocaleDate($aUnitInfo[$aFields['DateTimeUTS']], 6); $sLinkMore = ''; if (strlen($aUnitInfo[$aFields['Desc']]) > $iUnitLimitChars) { $sLinkMore = "... <a href=\"" . $sUnitUrl . "\">" . _t('_Read more') . "</a>"; } $sUnitDescVal = mb_substr(strip_tags($aUnitInfo[$aFields['Desc']]), 0, $iUnitLimitChars) . $sLinkMore; $sUnitDesc = $sUnitDescVal; $sUnitRSSFeed .= "<item><title><![CDATA[{$sUnitTitle}]]></title><link><![CDATA[{$sUnitUrl}]]></link><guid><![CDATA[{$sUnitGuid}]]></guid><description><![CDATA[{$sUnitDesc}]]></description><pubDate>{$sUnitDate}</pubDate></item>"; } } $sRSSTitle = _t('_RSS_Feed_Title_Common', $sUnitTitleC); if ($iPID > 0) { $sRSSTitle = _t('_RSS_Feed_Title_Profile', $aPIDOwnerInfo['NickName'], $sUnitTitleC); } if (substr($sMainLink, 0, 7) != 'http://') { $sMainLink = BX_DOL_URL_ROOT . $sMainLink; } $sRSSImage = ''; if ($sImage) { $sRSSImage = "<image><url>{$sImage}</url><title>{$sRSSTitle}</title><link>{$sMainLink}</link></image>"; } return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss version=\"2.0\"><channel><title>{$sRSSTitle}</title><link>{$sMainLink}</link><description>{$sRSSTitle}</description><lastBuildDate>{$sRSSLast}</lastBuildDate>{$sRSSImage}{$sUnitRSSFeed}</channel></rss>"; }
function GenIPBlackListTable() { $sSQL = "SELECT *, FROM_UNIXTIME(`LastDT`) AS `LastDT_U` FROM `sys_ip_list` ORDER BY `From` ASC"; $rIPList = db_res($sSQL); $aTmplVarsItems = array(); while ($aIPList = mysql_fetch_assoc($rIPList)) { $iID = (int) $aIPList['ID']; $sFrom = long2ip($aIPList['From']); $sTo = $aIPList['To'] == 0 ? '' : long2ip($aIPList['To']); $sType = process_html_output($aIPList['Type']); $sLastDT_Formatted = getLocaleDate($aIPList['LastDT'], BX_DOL_LOCALE_DATE); $sLastDT = preg_replace('/([\\d]{2}):([\\d]{2}):([\\d]{2})/', '$1:$2', $aIPList['LastDT_U']); $sDesc = process_html_output($aIPList['Desc']); $sDescAttr = bx_html_attribute(bx_js_string($aIPList['Desc'], BX_ESCAPE_STR_APOS)); $aTmplVarsItems[] = array('id' => $iID, 'from' => $sFrom, 'to' => $sTo, 'type' => $sType, 'date' => $sLastDT, 'date_uf' => $sLastDT_Formatted, 'description' => $sDesc, 'description_attr' => $sDescAttr, 'delete_action_url' => bx_append_url_params($this->_sActionUrl, array('action' => 'apply_delete', 'id' => $iID))); } if (empty($aTmplVarsItems)) { return MsgBox(_t('_Empty')); } return $GLOBALS['oAdmTemplate']->parseHtmlByName('ip_blacklist_list_filters.html', array('bx_repeat:items' => $aTmplVarsItems)); }
/** * Generate List of Posts for calendar * * @return HTML presentation of data */ function GenPostCalendarDay() { // date=2009/3/18 $sCode = MsgBox(_t('_Empty')); $sDate = bx_get('date'); $aDate = explode('/', $sDate); $iValue1 = (int) $aDate[0]; $iValue2 = (int) $aDate[1]; $iValue3 = (int) $aDate[2]; if ($iValue1 > 0 && $iValue2 > 0 && $iValue3 > 0) { $this->iPostViewType = 4; $sCaption = _t('_bx_blog_caption_browse_by_day') . getLocaleDate(strtotime("{$iValue1}-{$iValue2}-{$iValue3}"), BX_DOL_LOCALE_DATE_SHORT); if (!$this->isAllowedBlogsPostsBrowse()) { return DesignBoxContent($sCaption, $this->_oTemplate->displayAccessDenied(), 1); } require_once $this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php'; $oTmpBlogSearch = new BxBlogsSearchUnit($this); $oTmpBlogSearch->PerformObligatoryInit($this, $this->iPostViewType); $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage(); $oTmpBlogSearch->aCurrent['sorting'] = 'last'; $oTmpBlogSearch->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 00:00:00')", 'field' => 'PostDate', 'operator' => '>=', 'no_quote_value' => true); $oTmpBlogSearch->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 23:59:59')", 'field' => 'PostDate', 'operator' => '<=', 'no_quote_value' => true); $sCode = $oTmpBlogSearch->displayResultBlock(); $sCode = $oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0 ? MsgBox(_t('_Empty')) : $sCode; $sRequest = BX_DOL_URL_ROOT . 'modules/boonex/blogs/blogs.php?action=show_calendar_day&date=' . "{$iValue1}/{$iValue2}/{$iValue3}" . '&page={page}&per_page={per_page}'; $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $sRequest; $sPagination = $oTmpBlogSearch->showPagination3(); } $sRetHtmlVal = <<<EOF <div class="bx-def-bc-padding"> {$sCode} </div> {$sPagination} EOF; return DesignBoxContent($sCaption, $sRetHtmlVal, 1); }
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(); }
function getInstanceUploadAlbumTempName($aAlbums, $iAttempt = 1) { $sTemp = getLocaleDate(time()); $sNewName = $iAttempt > 1 ? _t('_sys_album_caption_new', $sTemp, $iAttempt) : $sTemp; if (in_array($sNewName, $aAlbums)) { $iAttempt++; $sNewName = $this->getInstanceUploadAlbumTempName($aAlbums, $iAttempt); } return $sNewName; }
/** * Function will generate page with nedded polls by date; */ function actionViewCalendar($iYear = 0, $iMonth = 0, $iDay = 0) { global $_page; global $_page_cont; $sCaption = _t('_bx_poll_browse_by_day') . ': ' . getLocaleDate(strtotime("{$iYear}-{$iMonth}-{$iDay}"), BX_DOL_LOCALE_DATE_SHORT); $iIndex = 57; $_page['name_index'] = $iIndex; $_page['css_name'] = 'main.css'; $_page['header'] = $sCaption; $_page['header_text'] = $sCaption; $sSearchResult = $this->searchByDate($sCaption, $iYear, $iMonth, $iDay); $_page_cont[$iIndex]['page_main_code'] = $sSearchResult; PageCode($this->_oTemplate); }
function GenIPBlackListTable() { $sSitePluginsUrl = BX_DOL_URL_PLUGINS; $sFromC = _t('_From'); $sToC = _t('_To'); $sTypeC = _t('_adm_ipbl_IP_Role'); $sDescriptionC = _t('_Description'); $sDatatimeC = _t('_adm_ipbl_Date_of_finish'); $sActionC = _t('_Action'); $sEditC = _t('_Edit'); $sDeleteC = _t('_Delete'); $sSQL = "SELECT *, FROM_UNIXTIME(`LastDT`) AS `LastDT_U` FROM `sys_ip_list` ORDER BY `From` ASC"; $rIPList = db_res($sSQL); $sRows = ''; while ($aIPList = mysql_fetch_assoc($rIPList)) { $iID = (int) $aIPList['ID']; $sFrom = long2ip($aIPList['From']); $sTo = $aIPList['To'] == 0 ? '' : long2ip($aIPList['To']); $sType = process_html_output($aIPList['Type']); $sLastDT_Formatted = getLocaleDate($aIPList['LastDT'], BX_DOL_LOCALE_DATE); $sLastDT = preg_replace('/([\\d]{2}):([\\d]{2}):([\\d]{2})/', '$1:$2', $aIPList['LastDT_U']); $sDesc = process_html_output($aIPList['Desc']); $sRows .= <<<EOF <tr> <td class="bx-def-border">{$sFrom}</td> <td class="bx-def-border">{$sTo}</td> <td class="bx-def-border">{$sType}</td> <td class="bx-def-border">{$sLastDT_Formatted}</td> <td class="bx-def-border">{$sDesc}</td> <td class="bx-def-border"> <a href="javascript:void(0)" onclick="ip_accept_values_to_form('{$iID}', '{$sFrom}', '{$sTo}', '{$sType}', '{$sLastDT}', '{$sDesc}'); return false;">{$sEditC}</a> | <a href="{$this->_sActionUrl}?action=apply_delete&id={$iID}">{$sDeleteC}</a> </td> </tr> EOF; } if (!$sRows) { return MsgBox(_t('_Empty')); } return <<<EOF <table style="width:99%; border-collapse:collapse;" cellpadding="4"> <tr> <td class="bx-def-border">{$sFromC}</td> <td class="bx-def-border">{$sToC}</td> <td class="bx-def-border">{$sTypeC}</td> <td class="bx-def-border">{$sDatatimeC}</td> <td class="bx-def-border">{$sDescriptionC}</td> <td class="bx-def-border">{$sActionC}</td> </tr> {$sRows} </table> <div class="clear_both"></div> <script type="text/javascript"> function ip_accept_values_to_form(id_val, from_val, to_val, type_val, lastdt_val, desc_val) { \$('.form_input_hidden[name="id"]').val(id_val); \$('.form_input_text[name="from"]').val(from_val); \$('.form_input_text[name="to"]').val(to_val); \$('.form_input_select[name="type"]').val(type_val); \$('.form_input_datetime[name="LastDT"]').val(lastdt_val); \$('.form_input_text[name="desc"]').val(desc_val); } </script> EOF; }
function GenAdsByDate() { $sCode = MsgBox(_t('_Empty')); $sDate = bx_get('date'); $aDate = explode('/', $sDate); $iValue1 = (int) $aDate[0]; $iValue2 = (int) $aDate[1]; $iValue3 = (int) $aDate[2]; if ($iValue1 > 0 && $iValue2 > 0 && $iValue3 > 0) { $sCaption = _t('_bx_ads_caption_browse_by_day') . getLocaleDate(strtotime("{$iValue1}-{$iValue2}-{$iValue3}"), BX_DOL_LOCALE_DATE_SHORT); require_once $this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php'; $oTmpAdsSearch = new BxAdsSearchUnit(); $oTmpAdsSearch->aCurrent['sorting'] = 'last'; $oTmpAdsSearch->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 00:00:00')", 'field' => 'DateTime', 'operator' => '>=', 'no_quote_value' => true); $oTmpAdsSearch->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 23:59:59')", 'field' => 'DateTime', 'operator' => '<=', 'no_quote_value' => true); $sLastAds = $oTmpAdsSearch->displayResultBlock(); if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] == 0) { $sLastAds = MsgBox(_t('_Empty')); } else { $oTmpAdsSearch->aCurrent['paginate']['page_url'] = $sRequest; $sLastAds .= $oTmpAdsSearch->showPagination(); } $sRetHtmlVal = <<<EOF <div class="dbContent"> {$sLastAds} </div> EOF; return DesignBoxContent($sCaption, $sRetHtmlVal, 1); } }
function _blockInfo($aData, $sFields = '', $sLocation = '') { $aAuthor = getProfileInfo($aData['author_id']); $aVars = array('author_unit' => get_member_thumbnail($aAuthor['ID'], 'none', true), 'date' => getLocaleDate($aData['created'], BX_DOL_LOCALE_DATE_SHORT), 'date_ago' => defineTimeInterval($aData['created']), 'cats' => $this->_oTemplate->parseCategories($aData['categories']), 'tags' => $this->_oTemplate->parseTags($aData['tags']), 'fields' => $sFields, 'author_unit' => $GLOBALS['oFunctions']->getMemberThumbnail($aAuthor['ID'], 'none', true), 'location' => $sLocation); return $this->_oTemplate->parseHtmlByName('entry_view_block_info', $aVars); }
function _getInviteParams($aDataEntry, $aInviter) { return array('EventName' => $aDataEntry['Title'], 'EventLocation' => _t($GLOBALS['aPreValues']['Country'][$aDataEntry['Country']]['LKey']) . (trim($aDataEntry['City']) ? ', ' . $aDataEntry['City'] : '') . ', ' . $aDataEntry['Place'], 'EventStart' => getLocaleDate($aDataEntry['EventStart'], BX_DOL_LOCALE_DATE), 'EventUrl' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry['EntryUri'], 'InviterUrl' => $aInviter ? getProfileLink($aInviter['ID']) : 'javascript:void(0);', 'InviterNickName' => $aInviter ? getNickName($aInviter['ID']) : _t('_bx_events_user_unknown'), 'InvitationText' => nl2br(process_pass_data(strip_tags($_POST['inviter_text'])))); }
function getBlockCode_AccountControl() { global $oTemplConfig, $site, $aPreValues; //--- Load cache of sys_account_custom_stat_elements ---// $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID'); //--- Load cache of sys_stat_member ---// $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type'); //--- end of loading caches ---// //Labels $sUsernameC = _t('_NickName'); $sProfileStatusC = _t('_Profile status'); $sPresenceC = _t('_Presence'); $sMembershipC = _t('_Membership2'); $sLastLoginC = _t('_Last login'); $sRegistrationC = _t('_Registration'); $sEmailC = _t('_Email'); $sGreetedC = _t('_greeted'); $sGreetedMeC = _t('_Greeted me'); $sBlockedC = _t('_blocked'); $sViewedMeC = _t('_Viewed me'); $sMembersC = ' ' . _t('_Members'); $sEditProfileInfoC = _t('_Edit profile info'); $sProfileC = _t('_Profile'); $sAccountInfoC = _t('_Account Info'); $sActivityC = _t('_Tracker'); $sCustomC = _t('_Custom'); $sMaleIcon = getTemplateIcon('male.png'); $sFemaleIcon = getTemplateIcon('female.png'); // Values $sUsername = $this->aMemberInfo['NickName']; $sUserLink = getProfileLink($this->aMemberInfo['ID']); $sOwnerThumb = get_member_thumbnail($this->aMemberInfo['ID'], 'none', true); $iYears = age($this->aMemberInfo['DateOfBirth']); $sYearsOld = _t('_y/o', $iYears); $sProfileIcon = $this->aMemberInfo['Sex'] == 'male' ? $sMaleIcon : $sFemaleIcon; $sCustomElements = ''; $sCountryName = empty($this->aMemberInfo['Country']) ? '' : _t($aPreValues['Country'][$this->aMemberInfo['Country']]['LKey']); $sCityName = $this->aMemberInfo['City']; $sCountryPic = $this->aMemberInfo['Country'] == '' ? '' : ' <img alt="' . $this->aMemberInfo['Country'] . '" src="' . ($site['flags'] . strtolower($this->aMemberInfo['Country'])) . '.gif"/>'; $sProfileStatus = _t("__{$this->aMemberInfo['Status']}"); $sProfileStatusMess = ''; switch ($this->aMemberInfo['Status']) { case 'Unconfirmed': $sProfileStatusMess = _t("_ATT_UNCONFIRMED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; case 'Approval': $sProfileStatusMess = _t("_ATT_APPROVAL", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; case 'Active': $sProfileStatusMess = _t("_ATT_ACTIVE", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; case 'Rejected': $sProfileStatusMess = _t("_ATT_REJECTED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; case 'Suspended': $sProfileStatusMess = _t("_ATT_SUSPENDED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; } $sMembership = ''; $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']); $sMembership = <<<EOF \t<tr class="account_control_tr"> \t\t<td valign=top class="account_control_left">{$sMembershipC}:</td> \t\t<td valign=top class="account_control_right"> \t\t\t{$sMembStatus} \t\t</td> \t</tr> EOF; $oForm = bx_instance('BxDolFormCheckerHelper'); if (!$this->aMemberInfo['DateLastLogin'] || $this->aMemberInfo['DateLastLogin'] == "0000-00-00 00:00:00") { $sLastLogin = '******'; } else { $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']); $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE); } if (!$this->aMemberInfo['DateReg'] || $this->aMemberInfo['DateReg'] == "0000-00-00 00:00:00") { $sRegistration = 'never'; } else { $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']); $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE); } $sEmail = $this->aMemberInfo['Email']; $this->aMemberInfo = getProfileInfo($this->aMemberInfo['ID']); //my greeted contacts $sMGCSQL = $aPQStatisticsElements['mgc']['SQL']; $sMGCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGCSQL); $iGreetedContactsCnt = (int) db_value($sMGCSQL); //my greeted me contacts $sMGMCSQL = $aPQStatisticsElements['mgmc']['SQL']; $sMGMCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGMCSQL); $iGreetedMeContactsCnt = (int) db_value($sMGMCSQL); //my blocked contacts $sMBCSQL = $aPQStatisticsElements['mbc']['SQL']; $sMBCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMBCSQL); $iBlockedContactsCnt = (int) db_value($sMBCSQL); $iViewedMeContactsCnt = (int) $this->aMemberInfo['Views']; $bModuleExists = false; $aCustomElements = array(); $aCustomElements['header5'] = array('type' => 'block_header', 'caption' => $sCustomC, 'collapsable' => true); foreach ($aAccountCustomStatElements as $iID => $aMemberStats) { $sUnparsedLabel = $aMemberStats['Label']; $sUnparsedValue = $aMemberStats['Value']; $sLabel = _t($sUnparsedLabel); $sUnparsedValue = str_replace('__site_url__', $site['url'], $sUnparsedValue); //step 1 - replacements of keys $sLblTmpl = '__l_'; $sTmpl = '__'; while ($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) { $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1); if ($iEndPos > $iStartPos) { $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos - $iStartPos - strlen($sLblTmpl)); $sKeyValue = strtolower(_t('_' . $sSubstr)); $sUnparsedValue = str_replace($sLblTmpl . $sSubstr . $sTmpl, $sKeyValue, $sUnparsedValue); } else { break; } } //step 2 - replacements of Stat keys while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) >= 0) { $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1); if ($iEndPos > $iStartPos) { $iCustomCnt = 0; $sSubstr = process_db_input(substr($sUnparsedValue, $iStartPos + strlen($sTmpl), $iEndPos - $iStartPos - strlen($sTmpl)), BX_TAGS_STRIP); if ($sSubstr) { $sCustomSQL = $aPQStatisticsElements[$sSubstr]['SQL']; $sCustomSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sCustomSQL); $sCustomSQL = str_replace('__profile_media_define_photo__', _t('_ProfilePhotos'), $sCustomSQL); $sCustomSQL = str_replace('__profile_media_define_music__', _t('_ProfileMusic'), $sCustomSQL); $sCustomSQL = str_replace('__profile_media_define_video__', _t('_ProfileVideos'), $sCustomSQL); $sCustomSQL = str_replace('__member_nick__', process_db_input($this->aMemberInfo['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), $sCustomSQL); $iCustomCnt = $sCustomSQL != '' ? (int) db_value($sCustomSQL) : ''; } $sUnparsedValue = str_replace($sTmpl . $sSubstr . $sTmpl, $iCustomCnt, $sUnparsedValue); } else { break; } } $sCustomElements .= <<<EOF \t<tr class="account_control_tr"> \t <td class="account_control_left">{$sLabel}: </td> \t <td class="account_control_right"> \t\t\t{$sUnparsedValue} \t\t</td> \t</tr> EOF; $sTrimmedLabel = trim($sUnparsedLabel, '_'); $aCustomElements[$sTrimmedLabel] = array('type' => 'custom', 'name' => $sTrimmedLabel, 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue, 'colspan' => true); if (!$bModuleExists) { $bModuleExists = true; } } $aCustomElements['header5_end'] = array('type' => 'block_end'); $sProfileInfoCont = <<<EOF <div class="infoMain"> \t<div class="memberPic" style="margin-left:0px;padding:0px;text-align:center;width:70px;"> \t\t{$sOwnerThumb} \t</div> \t<div class="infoText"> \t\t<div class="infoUnit"> \t\t\t<img src="{$sProfileIcon}" /> \t\t\t{$sYearsOld} \t\t</div> \t\t<div class="infoUnit"> \t\t\t{$sCountryPic} {$sCountryName}, {$sCityName} \t\t</div> \t\t<div class="infoUnit"> \t\t\t<a href="{$site['url']}pedit.php?ID={$this->aMemberInfo['ID']}">{$sEditProfileInfoC}</a> \t\t</div> \t</div> </div> <div class="clear_both"></div> EOF; require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php'; $oStatusView = new BxDolUserStatusView(); $sUserStatus = ''; if ($oStatusView->aStatuses) { foreach ($oStatusView->aStatuses as $sKey => $aItems) { $sTitle = _t($aItems['title']); $sOnclick = strtolower($this->aMemberInfo['UserStatus']) == strtolower($sKey) ? "" : "onclick=\"if (typeof oBxUserStatus != 'undefined' ) { oBxUserStatus.setUserStatus('{$sKey}', \$(this).parents('ul:first')); \$('#user_status_ac .block_collapse_btn').attr('src', aDolImages['collapse_closed']); \$('#user_status_ac').parent().toggleClass('collapsed').next('tbody').fadeOut(400); location.reload(); }return false\""; $aTemplateKeys = array('bx_if:item_img' => array('condition' => true, 'content' => array('item_img_src' => $GLOBALS['oFunctions']->getTemplateIcon($aItems['icon']), 'item_img_alt' => $sTitle, 'item_img_width' => 16, 'item_img_height' => 16)), 'item_link' => 'javascript:void(0)', 'item_onclick' => $sOnclick, 'item_title' => $sTitle, 'extra_info' => null); $sUserStatus .= $GLOBALS['oSysTemplate']->parseHtmlByName('account_control_member_status.html', $aTemplateKeys); } } $aForm = array('form_attrs' => array('action' => '', 'method' => 'post'), 'params' => array('remove_form' => true), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sProfileC, 'collapsable' => true), 'Info' => array('type' => 'custom', 'name' => 'Info', 'content' => $sProfileInfoCont, 'colspan' => true), 'header1_end' => array('type' => 'block_end'), 'header2' => array('type' => 'block_header', 'caption' => $sPresenceC, 'collapsable' => true, 'collapsed' => true, 'attrs' => array('id' => 'user_status_ac')), 'UserStatus' => array('type' => 'custom', 'name' => 'Info', 'content' => $sUserStatus, 'colspan' => true), 'header2_end' => array('type' => 'block_end'), 'header3' => array('type' => 'block_header', 'caption' => $sAccountInfoC, 'collapsable' => true), 'Username' => array('type' => 'custom', 'name' => 'Username', 'content' => '<b>' . $sUsernameC . ':</b> <a href="' . $sUserLink . '" >' . $sUsername . '</a>', 'colspan' => true), 'Email' => array('type' => 'custom', 'name' => 'Email', 'content' => '<b>' . $sEmailC . ':</b> ' . $sEmail, 'colspan' => true), 'Status' => array('type' => 'custom', 'name' => 'Status', 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . ' ' . $sProfileStatusMess, 'colspan' => true), 'Membership' => array('type' => 'custom', 'name' => 'Membership', 'content' => '<b>' . $sMembershipC . ':</b> ' . $sMembStatus, 'colspan' => true), 'LastLogin' => array('type' => 'custom', 'name' => 'LastLogin', 'content' => '<b>' . $sLastLoginC . ':</b> ' . $sLastLogin, 'colspan' => true), 'Registration' => array('type' => 'custom', 'name' => 'Registration', 'content' => '<b>' . $sRegistrationC . ':</b> ' . $sRegistration, 'colspan' => true), 'header3_end' => array('type' => 'block_end'), 'header4' => array('type' => 'block_header', 'caption' => $sActivityC, 'collapsable' => true), 'ViewedMe' => array('type' => 'custom', 'name' => 'ViewedMe', 'content' => '<b>' . $sViewedMeC . ':</b> ' . _t('_N times', $iViewedMeContactsCnt), 'colspan' => true), 'Blocked' => array('type' => 'custom', 'name' => 'Blocked', 'content' => '<b>' . $sBlockedC . ':</b> ' . $iBlockedContactsCnt . $sMembersC, 'colspan' => true), 'Greeted' => array('type' => 'custom', 'name' => 'Greeted', 'content' => '<b>' . $sGreetedC . ':</b> ' . _t('_N times', $iGreetedContactsCnt), 'colspan' => true), 'GreetedMe' => array('type' => 'custom', 'name' => 'GreetedMe', 'content' => '<b>' . $sGreetedMeC . ':</b> ' . $iGreetedMeContactsCnt . $sMembersC, 'colspan' => true), 'header4_end' => array('type' => 'block_end'))); //custom if ($bModuleExists) { $aForm['inputs'] = array_merge($aForm['inputs'], $aCustomElements); } $oForm = new BxTemplFormView($aForm); return '<div class="dbContent">' . $oForm->getCode() . '</div>'; }
function getAlbumInfo(&$aInfo) { $aForm = array('form_attrs' => array('id' => $this->_oConfig->getMainPrefix() . '_album_view_form'), 'params' => array('remove_form' => true), 'inputs' => array('location' => array('type' => 'value', 'value' => bx_linkify(process_text_output($aInfo['Location'])), 'caption' => _t('_Location')), 'description' => array('type' => 'value', 'value' => bx_linkify(process_html_output($aInfo['Description'])), 'caption' => _t('_Description')), 'date' => array('type' => 'value', 'value' => getLocaleDate($aInfo['Date'], BX_DOL_LOCALE_DATE_SHORT) . ' (' . defineTimeInterval($aInfo['Date'], false) . ')', 'caption' => _t('_Date')))); $aForm['inputs'] = array_filter($aForm['inputs'], function ($aInput) { return !!$aInput['value']; }); $oForm = new BxTemplFormView($aForm); return array($oForm->getCode(), array(), array(), false); }
function _blockInfo($aData, $sFields = '') { $aAuthor = getProfileInfo($aData['author_id']); $aVars = array('author_thumb' => get_member_thumbnail($aAuthor['ID'], 'none'), 'date' => getLocaleDate($aData['created'], BX_DOL_LOCALE_DATE_SHORT), 'date_ago' => defineTimeInterval($aData['created']), 'cats' => $this->_oTemplate->parseCategories($aData['categories']), 'tags' => $this->_oTemplate->parseTags($aData['tags']), 'fields' => $sFields, 'author_username' => $aAuthor['NickName'], 'author_url' => $aAuthor ? getProfileLink($aAuthor['ID']) : 'javascript:void(0)'); return $this->_oTemplate->parseHtmlByName('entry_view_block_info', $aVars); }
/** * Convert timestamp to "ago" date format * @param $iTime date/time stamp in seconds * @param $bAutoDateConvert automatically convert dates to full date format instead of "ago" format for old dates (older than 14 days) * @param $bShort use short format for relative time * @return formatted date string */ function defineTimeInterval($iTime, $bAutoDateConvert = true, $bShort = false) { $iTimeDiff = time() - (int) $iTime; if ($bAutoDateConvert && $iTimeDiff > 14 * 24 * 60 * 60) { // don't show "ago" dates for more than 14 days return getLocaleDate((int) $iTime); } return _format_when($iTimeDiff, $bShort); }
function actionBrowse($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '') { $bAlbumView = false; if ($sParamName == 'album' && $sParamValue1 == 'owner') { $bAlbumView = true; $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => $sParamValue, 'owner' => getID($sParamValue2)), array('ID', 'Caption', 'Owner', 'AllowAlbumView')); $GLOBALS['oTopMenu']->setCustomSubHeader($aAlbumInfo['Caption']); $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(_t('_' . $this->_oConfig->getMainPrefix()) => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'home/', $aAlbumInfo['Caption'] => '')); $sAlbumPreview = ''; if ($this->_oConfig->getGlParam('album_slideshow_on') == 'on') { $sAlbumPreview = $this->_oTemplate->getAlbumPreview('rss/album/' . $sParamValue . '/owner/' . $sParamValue2); if (strlen($sAlbumPreview) > 0) { $sAlbumPreview = DesignBoxContent($aAlbumInfo['Caption'], $sAlbumPreview, 1); } } } if (!empty($aAlbumInfo) && $aAlbumInfo['Owner'] == $this->_iProfileId && $sParamValue2 === getNickName($this->_iProfileId)) { $this->actionAlbumsViewMy('main_objects', $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3); return; } if ($bAlbumView && !empty($aAlbumInfo['AllowAlbumView']) && !$this->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->_iProfileId)) { $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied'); $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1); $this->aPageTmpl['header'] = $sKey; $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode)); return; } $sClassName = $this->_oConfig->getClassPrefix() . 'Search'; bx_import('Search', $this->_aModule); $oSearch = new $sClassName($sParamName, $sParamValue, $sParamValue1, $sParamValue2); $sRss = bx_get('rss'); if ($sRss !== false && $sRss) { $oSearch->aCurrent['paginate']['perPage'] = 10; echo $oSearch->rss(); exit; } $sTopPostfix = isset($oSearch->aCurrent['restriction'][$sParamName]) || $oSearch->aCurrent['sorting'] == $sParamName ? $sParamName : 'all'; $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_' . $sTopPostfix); if (mb_strlen($sParamValue) > 0 && isset($oSearch->aCurrent['restriction'][$sParamName])) { $sParamValue = $this->getBrowseParam($sParamName, $sParamValue); $oSearch->aCurrent['restriction'][$sParamName]['value'] = $sParamValue; $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, process_pass_data($sParamValue)); } if ($bAlbumView) { $oSearch->aCurrent['restriction']['allow_view']['value'] = array($aAlbumInfo['AllowAlbumView']); $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, $aAlbumInfo['Caption']); } if ($sParamName == 'calendar') { $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_caption_browse_by_day') . ': ' . getLocaleDate(strtotime("{$sParamValue}-{$sParamValue1}-{$sParamValue2}"), BX_DOL_LOCALE_DATE_SHORT); } $oSearch->aCurrent['paginate']['perPage'] = (int) $this->_oConfig->getGlParam('number_all'); $sCode = $oSearch->displayResultBlock(); if ($oSearch->aCurrent['paginate']['totalNum'] > 0) { $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit'); $aAdd = array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3); foreach ($aAdd as $sValue) { if (strlen($sValue) > 0) { $sArg .= '/' . rawurlencode($sValue); } else { break; } } $sLink = $this->_oConfig->getBaseUri() . 'browse' . $sArg; $oPaginate = new BxDolPaginate(array('page_url' => $sLink . '&page={page}&per_page={per_page}', 'count' => $oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_per_page' => 'document.location=\'' . BX_DOL_URL_ROOT . $sLink . '&page=1&per_page=\' + this.value;')); $sPaginate = $oPaginate->getPaginate(); } else { $sCode = MsgBox(_t('_Empty')); } $aMenu = array(); $sCode = DesignBoxContent($sCaption, $sCode . $sPaginate, 1, $this->_oTemplate->getExtraTopMenu($aMenu, BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri())); $this->aPageTmpl['css_name'] = array('browse.css'); $this->aPageTmpl['header'] = $sCaption; $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode . $sAlbumPreview)); }
function getBlockCode_AccountControl() { global $oTemplConfig, $aPreValues; //Labels $sProfileStatusC = _t('_Profile status'); $sPresenceC = _t('_Presence'); $sMembershipC = _t('_Membership2'); $sLastLoginC = _t('_Last login'); $sRegistrationC = _t('_Registration'); $sEmailC = _t('_Email'); $sMembersC = ' ' . _t('_Members'); $sProfileC = _t('_Profile'); $sContentC = _t('_Content'); //--- General Info block ---// $sProfileStatus = _t("__{$this->aMemberInfo['Status']}"); $sProfileStatusMess = ''; switch ($this->aMemberInfo['Status']) { case 'Unconfirmed': $sProfileStatusMess = _t("_ATT_UNCONFIRMED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; case 'Approval': $sProfileStatusMess = _t("_ATT_APPROVAL", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; case 'Active': $sProfileStatusMess = _t("_ATT_ACTIVE", $this->aMemberInfo['ID'], $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; case 'Rejected': $sProfileStatusMess = _t("_ATT_REJECTED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; case 'Suspended': $sProfileStatusMess = _t("_ATT_SUSPENDED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight); break; } $oForm = bx_instance('BxDolFormCheckerHelper'); $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']); $sLastLogin = '******'; if (!empty($this->aMemberInfo['DateLastLogin']) && $this->aMemberInfo['DateLastLogin'] != "0000-00-00 00:00:00") { $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']); $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE); } $sRegistration = 'never'; if (!empty($this->aMemberInfo['DateReg']) && $this->aMemberInfo['DateReg'] != "0000-00-00 00:00:00") { $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']); $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE); } //--- Presence block ---// require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php'; $oStatusView = new BxDolUserStatusView(); $sUserStatus = $oStatusView->getMemberMenuStatuses(); //--- Content block ---// $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID'); $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type'); $aCustomElements = array(); foreach ($aAccountCustomStatElements as $iID => $aMemberStats) { $sUnparsedLabel = $aMemberStats['Label']; $sUnparsedValue = $aMemberStats['Value']; $sLabel = _t($sUnparsedLabel); $sUnparsedValue = str_replace('__site_url__', BX_DOL_URL_ROOT, $sUnparsedValue); //step 1 - replacements of keys $sLblTmpl = '__l_'; $sTmpl = '__'; while (($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) !== false) { $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1); if ($iEndPos <= $iStartPos) { break; } $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos - $iStartPos - strlen($sLblTmpl)); $sKeyValue = mb_strtolower(_t('_' . $sSubstr)); $sUnparsedValue = str_replace($sLblTmpl . $sSubstr . $sTmpl, $sKeyValue, $sUnparsedValue); } //step 2 - replacements of Stat keys while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) !== false) { $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1); if ($iEndPos <= $iStartPos) { break; } $iCustomCnt = 0; $sSubstr = process_db_input(substr($sUnparsedValue, $iStartPos + strlen($sTmpl), $iEndPos - $iStartPos - strlen($sTmpl)), BX_TAGS_STRIP); if ($sSubstr) { $sCustomSQL = $aPQStatisticsElements[$sSubstr]['SQL']; $sCustomSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sCustomSQL); $sCustomSQL = str_replace('__profile_media_define_photo__', _t('_ProfilePhotos'), $sCustomSQL); $sCustomSQL = str_replace('__profile_media_define_music__', _t('_ProfileMusic'), $sCustomSQL); $sCustomSQL = str_replace('__profile_media_define_video__', _t('_ProfileVideos'), $sCustomSQL); $sCustomSQL = str_replace('__member_nick__', process_db_input($this->aMemberInfo['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), $sCustomSQL); $iCustomCnt = $sCustomSQL != '' ? (int) db_value($sCustomSQL) : ''; } $sUnparsedValue = str_replace($sTmpl . $sSubstr . $sTmpl, $iCustomCnt, $sUnparsedValue); } $sTrimmedLabel = trim($sUnparsedLabel, '_'); $aCustomElements[$sTrimmedLabel] = array('type' => 'custom', 'name' => $sTrimmedLabel, 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue, 'colspan' => true); } $aForm = array('form_attrs' => array('action' => '', 'method' => 'post'), 'params' => array('remove_form' => true), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sProfileC, 'collapsable' => true), 'Info' => array('type' => 'custom', 'name' => 'Info', 'content' => get_member_thumbnail($this->aMemberInfo['ID'], 'none', true), 'colspan' => true), 'Status' => array('type' => 'custom', 'name' => 'Status', 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . '<br />' . $sProfileStatusMess, 'colspan' => true), 'Email' => array('type' => 'custom', 'name' => 'Email', 'content' => '<b>' . $sEmailC . ':</b> ' . $this->aMemberInfo['Email'] . '<br />' . _t('_sys_txt_ac_manage_subscriptions'), 'colspan' => true), 'Membership' => array('type' => 'custom', 'name' => 'Membership', 'content' => '<b>' . $sMembershipC . ':</b> ' . $sMembStatus, 'colspan' => true), 'LastLogin' => array('type' => 'custom', 'name' => 'LastLogin', 'content' => '<b>' . $sLastLoginC . ':</b> ' . $sLastLogin, 'colspan' => true), 'Registration' => array('type' => 'custom', 'name' => 'Registration', 'content' => '<b>' . $sRegistrationC . ':</b> ' . $sRegistration, 'colspan' => true), 'header1_end' => array('type' => 'block_end'), 'header2' => array('type' => 'block_header', 'caption' => $sPresenceC, 'collapsable' => true, 'collapsed' => true, 'attrs' => array('id' => 'user_status_ac')), 'UserStatus' => array('type' => 'custom', 'name' => 'Info', 'content' => $sUserStatus, 'colspan' => true), 'header2_end' => array('type' => 'block_end'))); //custom if (!empty($aCustomElements)) { $aForm['inputs'] = array_merge($aForm['inputs'], array('header5' => array('type' => 'block_header', 'caption' => $sContentC, 'collapsable' => true, 'collapsed' => true)), $aCustomElements, array('header5_end' => array('type' => 'block_end'))); } $oForm = new BxTemplFormView($aForm); $sContent = $GLOBALS['oSysTemplate']->parseHtmlByName('member_account_control.html', array('content' => $oForm->getCode())); return array($sContent, array(), array(), false); }
/** * Entry view page for mobile app */ function actionMobileEntry($iId) { bx_import('BxDolMobileTemplate'); $oMobileTemplate = new BxDolMobileTemplate($this->_oConfig, $this->_oDb); $oMobileTemplate->pageStart(); $aParams = array('sample_type' => 'id', 'id' => (int) $iId); $aEntry = $this->_oDb->getEntries($aParams); if (empty($aEntry)) { $oMobileTemplate->displayPageNotFound(); return; } echo '<h1>' . $aEntry['caption'] . '</h1>'; echo getLocaleDate($aEntry['when_uts'], BX_DOL_LOCALE_DATE); echo $aEntry['content']; $oMobileTemplate->pageCode($aEntry['caption']); }
function __construct($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '') { switch ($sMode) { case 'pending': if (false !== bx_get('bx_store_filter')) { $this->aCurrent['restriction']['keyword'] = array('value' => process_db_input(bx_get('bx_store_filter'), BX_TAGS_STRIP), 'field' => '', 'operator' => 'against'); } $this->aCurrent['restriction']['activeStatus']['value'] = 'pending'; $this->sBrowseUrl = "administration"; $this->aCurrent['title'] = _t('_bx_store_page_title_pending_approval'); unset($this->aCurrent['rss']); break; case 'my_pending': $oMain = $this->getMain(); $this->aCurrent['restriction']['owner']['value'] = $oMain->_iProfileId; $this->aCurrent['restriction']['activeStatus']['value'] = 'pending'; $this->sBrowseUrl = "browse/user/" . getNickName($oMain->_iProfileId); $this->aCurrent['title'] = _t('_bx_store_page_title_pending_approval'); unset($this->aCurrent['rss']); break; case 'search': if ($sValue) { $this->aCurrent['restriction']['keyword'] = array('value' => $sValue, 'field' => '', 'operator' => 'against'); } if ($sValue2) { $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => ''); $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name']; $this->aCurrent['restriction']['category']['value'] = $sValue2; if (is_array($sValue2)) { $this->aCurrent['restriction']['category']['operator'] = 'in'; } } $sValue = $GLOBALS['MySQL']->unescape($sValue); $sValue2 = $GLOBALS['MySQL']->unescape($sValue2); $this->sBrowseUrl = "search/{$sValue}/" . (is_array($sValue2) ? implode(',', $sValue2) : $sValue2); $this->aCurrent['title'] = _t('_bx_store_page_title_search_results') . ' ' . (is_array($sValue2) ? implode(', ', $sValue2) : $sValue2) . ' ' . $sValue; unset($this->aCurrent['rss']); break; case 'user': $iProfileId = $GLOBALS['oBxStoreModule']->_oDb->getProfileIdByNickName($sValue, false); $GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId); // select profile subtab, instead of module tab if (!$iProfileId) { $this->isError = true; } else { $this->aCurrent['restriction']['owner']['value'] = $iProfileId; } $sValue = $GLOBALS['MySQL']->unescape($sValue); $this->sBrowseUrl = "browse/user/{$sValue}"; $iProfileId = getID($sValue); $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_author', $iProfileId ? getNickName($iProfileId) : $sValue); if (bx_get('rss')) { $aData = getProfileInfo($iProfileId); if ($aData['Avatar']) { $a = array('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']); $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search'); if (!$aImage['no_image']) { $this->aCurrent['rss']['image'] = $aImage['file']; } } } break; case 'admin': $this->aCurrent['restriction']['owner']['value'] = 0; $this->sBrowseUrl = "browse/admin"; $this->aCurrent['title'] = _t('_bx_store_page_title_admin_products'); break; case 'category': $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => ''); $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name']; $this->aCurrent['restriction']['category']['value'] = $sValue; $sValue = $GLOBALS['MySQL']->unescape($sValue); $this->sBrowseUrl = "browse/category/" . title2uri($sValue); $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_category', $sValue); break; case 'tag': $this->aCurrent['restriction']['tag']['value'] = $sValue; $sValue = $GLOBALS['MySQL']->unescape($sValue); $this->sBrowseUrl = "browse/tag/" . title2uri($sValue); $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_tag', $sValue); break; case 'free': $this->aCurrent['restriction']['price'] = array('value' => 'Free', 'field' => 'price_range', 'operator' => '='); $this->sBrowseUrl = "browse/free"; $this->aCurrent['title'] = _t('_bx_store_page_title_browse_free_products') . ' ' . $sValue; break; case 'recent': $this->sBrowseUrl = 'browse/recent'; $this->aCurrent['title'] = _t('_bx_store_page_title_browse_recent'); break; case 'top': $this->sBrowseUrl = 'browse/top'; $this->aCurrent['sorting'] = 'top'; $this->aCurrent['title'] = _t('_bx_store_page_title_browse_top_rated'); break; case 'popular': $this->sBrowseUrl = 'browse/popular'; $this->aCurrent['sorting'] = 'popular'; $this->aCurrent['title'] = _t('_bx_store_page_title_browse_popular'); break; case 'featured': $this->aCurrent['restriction']['featured'] = array('value' => 1, 'field' => 'featured', 'operator' => '='); $this->sBrowseUrl = 'browse/featured'; $this->aCurrent['title'] = _t('_bx_store_page_title_browse_featured'); break; case 'calendar': $this->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 00:00:00')", 'field' => 'created', 'operator' => '>=', 'no_quote_value' => true); $this->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$sValue}-{$sValue2}-{$sValue3} 23:59:59')", 'field' => 'created', 'operator' => '<=', 'no_quote_value' => true); $this->sEventsBrowseUrl = "browse/calendar/{$sValue}/{$sValue2}/{$sValue3}"; $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_day', getLocaleDate(strtotime("{$sValue}-{$sValue2}-{$sValue3}"), BX_DOL_LOCALE_DATE_SHORT)); break; case '': $this->sBrowseUrl = 'browse/'; $this->aCurrent['title'] = _t('_bx_store'); unset($this->aCurrent['rss']); break; default: $this->isError = true; } $oMain = $this->getMain(); $this->aCurrent['paginate']['perPage'] = $oMain->_oDb->getParam('bx_store_perpage_browse'); if (isset($this->aCurrent['rss'])) { $this->aCurrent['rss']['link'] = BX_DOL_URL_ROOT . $oMain->_oConfig->getBaseUri() . $this->sBrowseUrl; } if (bx_get('rss')) { $this->aCurrent['ownFields'][] = 'desc'; $this->aCurrent['ownFields'][] = 'created'; $this->aCurrent['paginate']['perPage'] = $oMain->_oDb->getParam('bx_store_max_rss_num'); } bx_store_import('Voting', $this->getModuleArray()); $oVotingView = new BxStoreVoting('bx_store', 0); $this->oVotingView = $oVotingView->isEnabled() ? $oVotingView : null; $this->sFilterName = 'bx_store_filter'; parent::__construct(); }
/** * Function will procces recived activites; * * @param : $aActivites (array); * @param : $sExtraStyles (string) - extra css styles; * @param : $bSetViewed (boolean) - if isset this parameter activity will; set as viwed; * @return : (mixed) - html presentation data or array; */ function _proccesActivites($aActivites, $sExtraStyles = '', $inArray = false, $bSetViewed = false, $sExtraCssClass = null) { $sOutputCode = null; $aProcessedActivites = array(); if (is_array($aActivites)) { foreach ($aActivites as $iKey => $aItems) { $aParams = unserialize($aItems['params']); if ($bSetViewed) { $this->_oDb->setViewed($aItems['id']); } // procces activity text; $sActivity = $this->_parseParameters(_t($aItems['lang_key']), $aParams); // define activity's sender; if ($aItems['sender_id']) { $aTemplateKeys = array('sender_thumb' => get_member_icon($aItems['sender_id'], 'none'), 'event_caption' => $sActivity, 'extra_styles' => $sExtraStyles, 'extra_css_class' => $sExtraCssClass, 'date_add' => getLocaleDate(strtotime($aItems['date']), BX_DOL_LOCALE_DATE)); $sTemplateName = 'activity.html'; } else { $aTemplateKeys = array('event_caption' => $sActivity, 'extra_styles' => $sExtraStyles, 'extra_css_class' => $sExtraCssClass, 'date_add' => getLocaleDate(strtotime($aItems['date']), BX_DOL_LOCALE_DATE)); $sTemplateName = 'non_member_activity.html'; } // build data; if (!$inArray) { $sOutputCode .= $this->_oTemplate->parseHtmlByName($sTemplateName, $aTemplateKeys); } else { $aProcessedActivites[] = array('event' => $this->_oTemplate->parseHtmlByName($sTemplateName, $aTemplateKeys)); } } } return !$inArray ? $sOutputCode : $aProcessedActivites; }
/** * Get viewable date * * @param $sDate string * @param $iFormat integer * @return string */ function getViewableDate($sDate, $iFormat = BX_DOL_LOCALE_DATE_SHORT) { $sViewableDate = $sDate != '0000-00-00 00:00:00' && $sDate != '0000-00-00' ? getLocaleDate(strtotime($sDate), $iFormat) : _t('_undefined'); return $sViewableDate; }
function actionBrowse($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '') { $bAlbumView = false; if ($sParamName == 'album' && $sParamValue1 == 'owner') { $bAlbumView = true; $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => $sParamValue, 'owner' => getID($sParamValue2)), array('ID', 'Caption', 'Owner', 'AllowAlbumView', 'Description')); if (empty($aAlbumInfo)) { $this->_oTemplate->displayPageNotFound(); exit; } else { if ($aAlbumInfo['Owner'] == $this->_iProfileId && $sParamValue2 === getUsername($this->_iProfileId)) { $this->actionAlbumsViewMy('main_objects', $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3); return; } elseif (!empty($aAlbumInfo['AllowAlbumView']) && !$this->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->_iProfileId)) { $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied'); $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1); $this->aPageTmpl['header'] = $sKey; $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode)); return; } else { $GLOBALS['oTopMenu']->setCustomSubHeader($aAlbumInfo['Caption']); } } } if ('calendar' == $sParamName) { $sParamValue = (int) $sParamValue; $sParamValue1 = (int) $sParamValue1; $sParamValue2 = (int) $sParamValue2; } $sClassName = $this->_oConfig->getClassPrefix() . 'Search'; bx_import('Search', $this->_aModule); $oSearch = new $sClassName($sParamName, $sParamValue, $sParamValue1, $sParamValue2); $sRss = bx_get('rss'); if ($sRss !== false && $sRss) { $oSearch->aCurrent['paginate']['perPage'] = 10; header('Content-Type: text/xml; charset=UTF-8'); echo $oSearch->rss(); exit; } $sTopPostfix = isset($oSearch->aCurrent['restriction'][$sParamName]) || $oSearch->aCurrent['sorting'] == $sParamName ? $sParamName : 'all'; $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_' . $sTopPostfix); if (!empty($sParamValue) && isset($oSearch->aCurrent['restriction'][$sParamName])) { $sParamValue = $this->getBrowseParam($sParamName, $sParamValue); $oSearch->aCurrent['restriction'][$sParamName]['value'] = $sParamValue; $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, htmlspecialchars_adv(process_pass_data($sParamValue))); } if ($bAlbumView) { $oSearch->aCurrent['restriction']['allow_view']['value'] = array($aAlbumInfo['AllowAlbumView']); $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, $aAlbumInfo['Caption']); $this->_oTemplate->setPageDescription(substr(strip_tags($aAlbumInfo['Description']), 0, 255)); } else { $oSearch->aCurrent['restriction']['not_allow_view']['value'] = array(BX_DOL_PG_HIDDEN); } if ($sParamName == 'calendar') { $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_caption_browse_by_day') . ': ' . getLocaleDate(strtotime("{$sParamValue}-{$sParamValue1}-{$sParamValue2}"), BX_DOL_LOCALE_DATE_SHORT); } $oSearch->aCurrent['paginate']['perPage'] = (int) $this->_oConfig->getGlParam('number_all'); $sCode = $oSearch->displayResultBlock(); $sPaginate = ''; if ($oSearch->aCurrent['paginate']['totalNum'] > 0) { $aAdd = array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3); foreach ($aAdd as $sValue) { if (strlen($sValue) > 0) { $sArg .= '/' . $sValue; } else { break; } } $sLink = $this->_oConfig->getBaseUri() . 'browse' . $sArg; $oPaginate = new BxDolPaginate(array('page_url' => $sLink . '&page={page}&per_page={per_page}', 'count' => $oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'on_change_per_page' => 'return !loadDynamicBlock(1, \'' . $sLink . '&page=1&per_page=\' + this.value);')); $sPaginate = $oPaginate->getPaginate(); } else { $sCode = MsgBox(_t('_Empty')); } $aMenu = array(); $sCode = DesignBoxContent($sCaption, $sCode . $sPaginate, 1); if ($bAlbumView) { $sCode = $this->getAlbumPageView($aAlbumInfo, $sCode); } $this->aPageTmpl['css_name'] = array('browse.css'); $this->aPageTmpl['header'] = $sCaption; $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode)); }