function getBlockCode_Map() { $fLat = false; $fLng = false; $iZoom = false; $sFilter = ''; bx_import('BxDolProfileFields'); $oPF = new BxDolProfileFields(9); $aRequestParams = $oPF->collectSearchRequestParams(); $aCountryLocation = false; if ($aRequestParams && isset($aRequestParams['Country']) && 1 == count($aRequestParams['Country']) && preg_match('/^[a-zA-Z]+$/', $aRequestParams['Country'][0])) { $r = $this->oDb->getCountryByCode($aRequestParams['Country'][0]); if ($r) { $fLat = $r['lat']; $fLng = $r['lng']; $iZoom = BX_MAP_ZOOM_CITIES; } } $sProfiles = ''; if ($aRequestParams) { $sFilter = str_replace('/', '-slash-', base64_encode(serialize($_GET))); $sUrlGetProfiles = $this->oConfig->getBaseUri() . 'get_html_profiles/' . $sFilter . '?page={page}&ts={ts}'; $aVars = array('content_id' => 'bx_map_profiles', 'content' => "<script>glBxMapProfilesMapOnLoadCallback = function () { glBxMapPage.loadProfilesList('bx_map_profiles', '{$sUrlGetProfiles}'); }; bx_map_loading('bx_map_profiles', 1) </script>", 'prev_title' => _t('_Prev'), 'prev_onclick' => "glBxMapPage.changePage('bx_map_profiles', '{$sUrlGetProfiles}', -1);", 'prev_href' => 'javascript:void(0);', 'next_title' => _t('_Next'), 'next_onclick' => "glBxMapPage.changePage('bx_map_profiles', '{$sUrlGetProfiles}', 1);", 'next_href' => 'javascript:void(0);'); $sProfiles = $this->oTemplate->parseHtmlByName('pageable_items', $aVars); } return $sProfiles . $this->oMain->serviceSeparatePageBlock($fLat, $fLng, $iZoom, $sFilter); }
case 'quick': $iPFArea = 10; $_page['header_text'] = $sPageHeader = _t('_Quick Search'); break; case 'adv': $iPFArea = 11; $_page['header_text'] = $sPageHeader = _t('_Advanced Search'); break; default: $iPFArea = 9; $sSearchMode = 'simple'; $_page['header_text'] = $sPageHeader = _t('_Simple Search'); } //collect inputs $oPF = new BxDolProfileFields($iPFArea); $aRequestParams = $oPF->collectSearchRequestParams(); if (isset($_REQUEST['ID']) and (int) $_REQUEST['ID']) { $aRequestParams['ID'] = (int) $_REQUEST['ID']; } if (isset($_REQUEST['NickName']) and trim($_REQUEST['NickName'])) { $aRequestParams['NickName'] = trim(process_pass_data($_REQUEST['NickName'])); } if (isset($_REQUEST['Tags']) and trim($_REQUEST['Tags'])) { $aRequestParams['Tags'] = trim(process_pass_data($_REQUEST['Tags'])); } if (isset($_REQUEST['distance']) and (int) $_REQUEST['distance']) { $aRequestParams['distance'] = (int) $_REQUEST['distance']; } // start page generation ob_start(); $bShowForms = false;
function _getProfilesByFilter($sFilter) { $aGetParams = unserialize(base64_decode(str_replace('-slash-', '/', $sFilter))); if ($aGetParams && is_array($aGetParams)) { $aGetParams = $_REQUEST = $_GET = array_merge($_REQUEST, $aGetParams); } bx_import('BxDolProfileFields'); $oPF = new BxDolProfileFields(9); $aRequestParams = $oPF->collectSearchRequestParams(); bx_import('BxTemplProfileView'); $oProfileGenerator = new BxBaseProfileGenerator(getLoggedId()); list($aWhere, $sJoin, $sPossibleOrder) = $oProfileGenerator->GenSqlConditions($oPF->aBlocks, $aRequestParams); $iPage = isset($aGetParams['page']) && (int) $aGetParams['page'] > 0 ? (int) $aGetParams['page'] : 1; $iPerPage = isset($aGetParams['per_page']) && (int) $aGetParams['per_page'] > 0 ? (int) $aGetParams['per_page'] : getParam('bx_map_per_page'); $iStart = ($iPage - 1) * $iPerPage; $sQuery = 'SELECT DISTINCT `Profiles`.`ID`, `Profiles`.`Avatar`, `Profiles`.`NickName`, `m`.`id`, `m`.`lat`, `m`.`lng` FROM `Profiles` INNER JOIN `' . $this->_oDb->_sPrefix . 'profiles` AS `m` ON (`Profiles`.`ID` = `m`.`id`) ' . $sJoin . ' WHERE ' . implode(' AND ', $aWhere) . ' AND `m`.`failed` = 0 ' . $sPossibleOrder . " \n LIMIT {$iStart}, {$iPerPage}"; // ID is ambiguous $sQuery = str_replace(' `ID`', ' `Profiles`.`ID`', $sQuery); $aProfiles = $GLOBALS['MySQL']->getAll($sQuery); return $aProfiles; }