setTemplateDir('templates/templates')->addTemplateDir('./modules'); $smarty->setCompileDir('templates/templates_c'); $smarty->setCacheDir('templates/cache'); $smarty->setConfigDir('templates/configs'); $smarty->addPluginsDir('templates/plugins'); //$smarty->force_compile = true; // $smarty->debugging_ctrl = 'URL'; $smarty->debugging = false; $smarty->caching = false; $smarty->cache_lifetime = -1; // $smarty->loadFilter('output', 'trimwhitespace'); require_once('modules/init.php'); ///////////////////////////////////////////////////////////////////////////////////////// // Debug ///////////////////////////////////////////////////////////////////////////////////////// $localhost = ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' || $_SERVER['REMOTE_ADDR'] == '::1') ? 1 : 0; $smarty->assign("localhost", $localhost); $smarty->assign("debugGET", '
'.print_r(@$_GET, true).''); $smarty->assign("debugPOST", '
'.print_r(@$_POST, true).''); $smarty->assign("debugCOOKIE", '
'.print_r(@$_COOKIE, true).''); $smarty->assign("debugSESSION", '
'.print_r(@$_SESSION, true).''); ///////////////////////////////////////////////////////////////////////////////////////// // INSIGHTS ///////////////////////////////////////////////////////////////////////////////////////// $isInsights = false; $isInsights = false; if (strpos($_SERVER ['HTTP_USER_AGENT'], 'Insights') !== false || strpos($_SERVER ['HTTP_USER_AGENT'], 'Chrome-Lighthouse') !== false) { $isInsights = true; } $smarty->assign("isInsights", $isInsights); ///////////////////////////////////////////////////////////////////////////////////////// // Mobile detect -> https://github.com/serbanghita/Mobile-Detect ///////////////////////////////////////////////////////////////////////////////////////// $detect = new Mobile_Detect; $smarty->assign("isMobile", $detect->isMobile()); $smarty->assign("isTablet", $detect->isTablet()); ///////////////////////////////////////////////////////////////////////////////////////// // Comprobar navegador ///////////////////////////////////////////////////////////////////////////////////////// $ua=getBrowser(); $smarty->assign('navegador', $ua['name']); ///////////////////////////////////////////////////////////////////////////////////////// // Idiomas ///////////////////////////////////////////////////////////////////////////////////////// $smarty->assign("languages_names", $languages_names); $smarty->assign("languages", $languages); $smarty->assign("language", $language); ///////////////////////////////////////////////////////////////////////////////////////// // Preferencias ///////////////////////////////////////////////////////////////////////////////////////// $smarty->assign("Activarzonas", $actZonas); $smarty->assign("actVenderPropiedad", $actVenderPropiedad); $smarty->assign("googleMapsApiKey", $googleMapsApiKey); $smarty->assign("phoneRespBar", $phoneRespBar); $smarty->assign("thumbnailsSizes", $thumbnailsSizes); $smarty->assign("actWhatsapp", $actWhatsapp); $smarty->assign("seccion_lang", $urlStr[$urlStr[$seccion]["master"]]); $smarty->assign("opcionSimilares", $opcionSimilares); $smarty->assign("actTestimonials", $actTestimonials); //connections/conf/config.php $smarty->assign("nombreEmpresa", $nombreEmpresa); $smarty->assign("nombreEmpresaSL", $nombreEmpresaSL); $smarty->assign("telefonoEmpresa", $telefonoEmpresa); $smarty->assign("correoEmpresa", $correoEmpresa); $smarty->assign("direccionEmpresa", $direccionEmpresa); $smarty->assign("tipoGaleria", $tipoGaleria); $smarty->assign("actMenuBurger", $actMenuBurger); $smarty->assign("actBuscadorHeader", $actBuscadorHeader); $smarty->assign("actOnlineViewings", $actOnlineViewings); $smarty->assign("actSaveSearch", $actSaveSearch); ///////////////////////////////////////////////////////////////////////////////////////// // Default Meta ///////////////////////////////////////////////////////////////////////////////////////// $smarty->assign("metaTitle", $metaTitleDefault); $smarty->assign("metaDescription", $metaDescriptionDefault); $smarty->assign("metaKeywords", $metaKeywordsDefault); ///////////////////////////////////////////////////////////////////////////////////////// // Mailto encode ///////////////////////////////////////////////////////////////////////////////////////// $encode_values = array('hex'); $random_encode_values = array_rand($encode_values); $smarty->assign("mailtoencode", $encode_values[$random_encode_values]); ///////////////////////////////////////////////////////////////////////////////////////// // Level Check ///////////////////////////////////////////////////////////////////////////////////////// require_once($_SERVER["DOCUMENT_ROOT"] . '/includes/common/KT_common.php'); require_once($_SERVER["DOCUMENT_ROOT"] . '/includes/tng/tNG.inc.php'); $isLevel1 = false; $conn_inmoconn = new KT_connection($inmoconn, $database_inmoconn); $isLoggedIn1 = new tNG_UserLoggedIn($conn_inmoconn); $isLoggedIn1->addLevel("1"); if ($isLoggedIn1->Execute()) { $isLevel1 = true; } $smarty->assign("isLevel1", $isLevel1); ///////////////////////////////////////////////////////////////////////////////////////// // Preferencias ///////////////////////////////////////////////////////////////////////////////////////// $smarty->assign("actBajadaPrecios", $actBajadaPrecios); $smarty->assign("responsive", $responsive); $smarty->assign("actUsuarios", $actUsuarios); $smarty->assign("actCalendar", $actCalendar); $smarty->assign("actLanding", $actLanding); $smarty->assign("actQuicklinks", $actQuicklinks); $smarty->assign("google_captcha_sitekey", $google_captcha_sitekey); $smarty->assign("google_captcha_privatekey", $google_captcha_privatekey); $smarty->assign("actMailchimp", $actMailchimp); $smarty->assign("actMapaPropiedades", $actMapaPropiedades); $smarty->assign("actNoticias", $actNoticias); $smarty->assign("fromMail", $fromMail); $smarty->assign("texto_formularios_GDPR", $texto_formularios_GDPR); ///////////////////////////////////////////////////////////////////////////////////////// // Banners ///////////////////////////////////////////////////////////////////////////////////////// $smarty->assign("actBanner", $actBanner); $smarty->assign("actBannerTxt", $actBannerTxt); $smarty->assign("actBannerDesc", $actBannerDesc); $smarty->assign("actBannerUrl", $actBannerUrl); $bannersQuery = " SELECT banners.id_ban, CONCAT('/media/images/banner/', banners.image_ban) as img, banners.caption_".$lang."_ban as caption, banners.description_".$lang."_ban as description, banners.url_".$lang."_ban as url FROM banners ORDER BY RAND() LIMIT 1 "; $smarty->assign("banners", getRecords($bannersQuery)); ///////////////////////////////////////////////////////////////////////////////////////// // Últimas Noticias ///////////////////////////////////////////////////////////////////////////////////////// $lastNewsQuery = " SELECT news.id_nws, news.title_".$lang."_nws as titulo, news.titlew_".$lang."_nws as titulometa, news.content_".$lang."_nws as contenido, news.date_nws, (SELECT imagen_img FROM news_fotos WHERE noticia_img = id_nws ORDER BY orden_img LIMIT 1) AS img FROM news WHERE news.title_".$lang."_nws != '' AND news.content_".$lang."_nws != '' AND type_nws = 1 AND activate_nws = 1 ORDER BY news.date_nws DESC LIMIT 2 "; $smarty->assign("lastNews", getRecordsAndCache($lastNewsQuery, 'last-news')); ///////////////////////////////////////////////////////////////////////////////////////// // Últimos Testimonios ///////////////////////////////////////////////////////////////////////////////////////// $lastTestimonialsQuery = " SELECT news.id_nws, news.title_".$lang."_nws as titulo, news.titlew_".$lang."_nws as titulometa, news.content_".$lang."_nws as contenido, news.date_nws, (SELECT imagen_img FROM news_fotos WHERE noticia_img = id_nws ORDER BY orden_img LIMIT 1) AS img FROM news WHERE news.title_".$lang."_nws != '' AND news.content_".$lang."_nws != '' AND type_nws = 10 AND activate_nws = 1 ORDER BY news.date_nws DESC LIMIT 9 "; $smarty->assign("lastTestimonials", getRecordsAndCache($lastTestimonialsQuery, 'last-testimonials')); ///////////////////////////////////////////////////////////////////////////////////////// // Landing pages ///////////////////////////////////////////////////////////////////////////////////////// $langingPagesQuery = " SELECT news.title_".$lang."_nws as titulo FROM news WHERE news.title_".$lang."_nws != '' AND news.content_".$lang."_nws != '' AND type_nws = 3 AND activate_nws = 1 ORDER BY news.date_nws DESC LIMIT 4 "; $smarty->assign("langingPages", getRecordsAndCache($langingPagesQuery, 'landing-pages')); ///////////////////////////////////////////////////////////////////////////////////////// // Landing pages Destacadas ///////////////////////////////////////////////////////////////////////////////////////// $quicklinksQueryDest = " SELECT news.title_".$lang."_nws as titulo FROM news WHERE news.title_".$lang."_nws != '' AND news.content_".$lang."_nws != '' AND type_nws = 4 AND activate_nws = 1 AND destacado_nws = 1 ORDER BY news.date_nws DESC LIMIT 4 "; $smarty->assign("quicklinksdest", getRecordsAndCache($quicklinksQueryDest, 'quick-links-dest')); ///////////////////////////////////////////////////////////////////////////////////////// // Quicklinks ///////////////////////////////////////////////////////////////////////////////////////// $quicklinksQuery = " SELECT news.title_".$lang."_nws as titulo FROM news WHERE news.title_".$lang."_nws != '' AND news.content_".$lang."_nws != '' AND type_nws = 4 AND activate_nws = 1 AND destacado_nws = 0 ORDER BY news.date_nws DESC LIMIT 4 "; $smarty->assign("quicklinks", getRecordsAndCache($quicklinksQuery, 'quick-links')); ///////////////////////////////////////////////////////////////////////////////////////// // Labels ///////////////////////////////////////////////////////////////////////////////////////// $labelsStylesQuery = " SELECT id_tag, color_tag, text_color_tag FROM properties_tags "; $smarty->assign("labelsStyles", getRecordsAndCache($labelsStylesQuery, 'labels-styles')); $smarty->assign("test", array('uno','2','3')); ///////////////////////////////////////////////////////////////////////////////////////// // Home Search ///////////////////////////////////////////////////////////////////////////////////////// $countryQuery = " SELECT DISTINCT properties_loc1.name_".$lang."_loc1 AS country, properties_loc1.id_loc1 AS id FROM properties_loc4 towns INNER JOIN properties_properties ON properties_properties.localidad_prop = towns.id_loc4 INNER JOIN properties_loc3 areas1 ON towns.loc3_loc4 = areas1.id_loc3 LEFT OUTER JOIN properties_loc3 ON areas1.parent_loc3 = properties_loc3.id_loc3 INNER JOIN properties_loc2 province1 ON areas1.loc2_loc3 = province1.id_loc2 LEFT OUTER JOIN properties_loc2 ON province1.parent_loc2 = properties_loc2.id_loc2 INNER JOIN properties_loc1 ON province1.loc1_loc2 = province1.id_loc2 LEFT OUTER JOIN properties_loc4 ON towns.parent_loc4 = properties_loc4.id_loc4 WHERE properties_properties.activado_prop = 1 AND alquilado_prop = 0 AND vendido_prop = 0 AND force_hide_prop != 1 GROUP BY properties_loc1.name_".$lang."_loc1 ORDER BY country ASC "; $smarty->assign("country", getRecordsAndCache($countryQuery, 'countries-search')); $provinceQuery = " SELECT DISTINCT CASE WHEN properties_loc2.name_".$lang."_loc2 IS NOT NULL THEN properties_loc2.name_".$lang."_loc2 ELSE province1.name_".$lang."_loc2 END AS province, CASE WHEN properties_loc2.id_loc2 IS NOT NULL THEN properties_loc2.id_loc2 ELSE province1.id_loc2 END AS id FROM properties_loc4 towns LEFT OUTER JOIN properties_properties ON properties_properties.localidad_prop = towns.id_loc4 LEFT OUTER JOIN properties_loc3 areas1 ON towns.loc3_loc4 = areas1.id_loc3 LEFT OUTER JOIN properties_loc3 ON areas1.parent_loc3 = properties_loc3.id_loc3 LEFT OUTER JOIN properties_loc2 province1 ON areas1.loc2_loc3 = province1.id_loc2 LEFT OUTER JOIN properties_loc2 ON province1.parent_loc2 = properties_loc2.id_loc2 LEFT OUTER JOIN properties_loc1 ON province1.loc1_loc2 = properties_loc1.id_loc1 LEFT OUTER JOIN properties_loc4 ON towns.parent_loc4 = properties_loc4.id_loc4 WHERE properties_properties.activado_prop = 1 AND alquilado_prop = 0 AND vendido_prop = 0 AND force_hide_prop != 1 GROUP BY id ORDER BY province ASC "; $smarty->assign("province", getRecordsAndCache($provinceQuery, 'province-search')); $cityQuery = " SELECT DISTINCT CASE WHEN properties_loc3.name_".$lang."_loc3 IS NOT NULL THEN properties_loc3.name_".$lang."_loc3 ELSE areas1.name_".$lang."_loc3 END AS area, CASE WHEN properties_loc3.id_loc3 IS NOT NULL THEN properties_loc3.id_loc3 ELSE areas1.id_loc3 END AS id FROM properties_loc4 towns LEFT OUTER JOIN properties_properties ON properties_properties.localidad_prop = towns.id_loc4 LEFT OUTER JOIN properties_loc3 areas1 ON towns.loc3_loc4 = areas1.id_loc3 LEFT OUTER JOIN properties_loc3 ON areas1.parent_loc3 = properties_loc3.id_loc3 LEFT OUTER JOIN properties_loc2 province1 ON areas1.loc2_loc3 = province1.id_loc2 LEFT OUTER JOIN properties_loc2 ON province1.parent_loc2 = properties_loc2.id_loc2 LEFT OUTER JOIN properties_loc1 ON province1.loc1_loc2 = properties_loc1.id_loc1 LEFT OUTER JOIN properties_loc4 ON towns.parent_loc4 = properties_loc4.id_loc4 WHERE properties_properties.activado_prop = 1 AND alquilado_prop = 0 AND vendido_prop = 0 AND force_hide_prop != 1 GROUP BY id ORDER BY area ASC "; $smarty->assign("city", getRecordsAndCache($cityQuery, 'city-search')); $localizacionQuery = " SELECT DISTINCT CASE WHEN properties_loc4.name_".$lang."_loc4 IS NOT NULL THEN properties_loc4.name_".$lang."_loc4 ELSE towns.name_".$lang."_loc4 END AS town, CASE WHEN properties_loc4.id_loc4 IS NOT NULL THEN properties_loc4.id_loc4 ELSE towns.id_loc4 END AS id FROM properties_loc4 towns LEFT OUTER JOIN properties_properties ON properties_properties.localidad_prop = towns.id_loc4 LEFT OUTER JOIN properties_loc3 areas1 ON towns.loc3_loc4 = areas1.id_loc3 LEFT OUTER JOIN properties_loc3 ON areas1.parent_loc3 = properties_loc3.id_loc3 LEFT OUTER JOIN properties_loc2 province1 ON areas1.loc2_loc3 = province1.id_loc2 LEFT OUTER JOIN properties_loc2 ON province1.parent_loc2 = properties_loc2.id_loc2 LEFT OUTER JOIN properties_loc1 ON province1.loc1_loc2 = properties_loc1.id_loc1 LEFT OUTER JOIN properties_loc4 ON towns.parent_loc4 = properties_loc4.id_loc4 WHERE properties_properties.activado_prop = 1 AND alquilado_prop = 0 AND vendido_prop = 0 AND force_hide_prop != 1 GROUP BY id ORDER BY town ASC "; $smarty->assign("localizacion", getRecordsAndCache($localizacionQuery, 'localizacion-search')); $typeQuery = " SELECT CASE WHEN properties_types.types_".$lang."_typ IS NOT NULL THEN properties_types.types_".$lang."_typ ELSE types.types_".$lang."_typ END AS type, CASE WHEN properties_types.id_typ IS NOT NULL THEN properties_types.id_typ ELSE types.id_typ END AS id_type FROM properties_properties INNER JOIN properties_types types ON properties_properties.tipo_prop = types.id_typ LEFT OUTER JOIN properties_types ON types.parent_typ = properties_types.id_typ WHERE properties_properties.activado_prop = 1 AND alquilado_prop = 0 AND vendido_prop = 0 AND force_hide_prop != 1 GROUP BY id_type ORDER BY type "; $smarty->assign("type", getRecordsAndCache($typeQuery, 'type-search')); $statusQuery = " SELECT properties_status.status_".$lang."_sta as sale, properties_status.id_sta as id, CASE WHEN properties_properties.activado_prop = 1 AND properties_properties.alquilado_prop = 0 AND properties_properties.vendido_prop = 0 THEN 1 ELSE 0 END as visible FROM properties_status LEFT JOIN properties_properties ON properties_properties.operacion_prop = properties_status.id_sta AND properties_properties.activado_prop = 1 AND properties_properties.alquilado_prop = 0 AND properties_properties.vendido_prop = 0 GROUP BY id_sta ORDER BY sale "; $status = getRecordsAndCache($statusQuery, 'status-search'); $smarty->assign("status", $status); ///////////////////////////////////////////////////////////////////////////////////////// // Promociones ///////////////////////////////////////////////////////////////////////////////////////// $PromocionesQuery = " SELECT title_".$lang."_nws as titulo, id_nws, (SELECT imagen_img FROM news_fotos WHERE noticia_img = id_nws ORDER BY orden_img LIMIT 1) AS img FROM news where type_nws = 1000 "; $smarty->assign("promociones", getRecords($PromocionesQuery)); ///////////////////////////////////////////////////////////////////////////////////////// // Featured properties ///////////////////////////////////////////////////////////////////////////////////////// $featuredQuery = " SELECT properties_loc1.name_".$lang."_loc1 AS country, CASE WHEN properties_loc2.name_".$lang."_loc2 IS NOT NULL THEN properties_loc2.name_".$lang."_loc2 ELSE province1.name_".$lang."_loc2 END AS province, CASE WHEN properties_loc3.name_".$lang."_loc3 IS NOT NULL THEN properties_loc3.name_".$lang."_loc3 ELSE areas1.name_".$lang."_loc3 END AS area, CASE WHEN properties_loc4.name_".$lang."_loc4 IS NOT NULL THEN properties_loc4.name_".$lang."_loc4 ELSE towns.name_".$lang."_loc4 END AS town, CASE WHEN properties_types.types_".$lang."_typ IS NOT NULL THEN properties_types.types_".$lang."_typ ELSE types.types_".$lang."_typ END AS type, properties_status.status_".$lang."_sta as sale, properties_properties.descripcion_".$lang."_prop as descr, properties_properties.m2_prop, properties_properties.promocion_pro, news.title_".$lang."_nws AS promo_name, properties_properties.precio_prop as old_precio, properties_properties.preci_reducidoo_prop as precio, properties_properties.habitaciones_prop, properties_properties.aseos_prop, properties_properties.referencia_prop as ref, properties_properties.m2_parcela_prop as m2p_prop, id_prop, id_img, properties_properties.vendido_tag_prop, properties_properties.nuevo_prop, (SELECT pool_".$lang."_pl FROM properties_pool WHERE id_pl = piscina_prop ) AS piscina_prop, (SELECT parking_".$lang."_prk FROM properties_parking WHERE id_prk = parking_prop ) AS parking_prop, properties_properties.alquilado_prop, properties_properties.reservado_prop, properties_properties.watermark_prop, properties_properties.aseos2_prop, properties_properties.precio_desde_prop, title_".$lang."_prop as metatitle FROM properties_loc4 towns LEFT OUTER JOIN properties_properties ON properties_properties.localidad_prop = towns.id_loc4 LEFT OUTER JOIN properties_loc3 areas1 ON towns.loc3_loc4 = areas1.id_loc3 LEFT OUTER JOIN properties_loc3 ON areas1.parent_loc3 = properties_loc3.id_loc3 LEFT OUTER JOIN properties_loc2 province1 ON areas1.loc2_loc3 = province1.id_loc2 LEFT OUTER JOIN properties_loc2 ON province1.parent_loc2 = properties_loc2.id_loc2 LEFT OUTER JOIN properties_loc1 ON province1.loc1_loc2 = properties_loc1.id_loc1 LEFT OUTER JOIN properties_loc4 ON towns.parent_loc4 = properties_loc4.id_loc4 LEFT OUTER JOIN properties_types types ON properties_properties.tipo_prop = types.id_typ LEFT OUTER JOIN properties_types ON types.parent_typ = properties_types.id_typ LEFT OUTER JOIN properties_images ON properties_properties.id_prop = properties_images.property_img AND order_img = 1 AND procesada_img = 1 LEFT OUTER JOIN properties_status ON properties_properties.operacion_prop = properties_status.id_sta LEFT OUTER JOIN news ON properties_properties.promocion_pro = news.id_nws WHERE activado_prop = 1 AND alquilado_prop = 0 AND vendido_prop = 0 AND destacado_prop = 1 AND image_img != '' AND force_hide_prop != 1 GROUP BY id_prop ORDER BY order_img, RAND() LIMIT 9 "; $smarty->assign("featured", getRecordsAndCache($featuredQuery, 'featured-props')); $smarty->assign("showprecioReduc", $showprecioReduc); if ($showprecioReduc == 1) { $ofertasQuery = " SELECT properties_loc1.name_".$lang."_loc1 AS country, CASE WHEN properties_loc2.name_".$lang."_loc2 IS NOT NULL THEN properties_loc2.name_".$lang."_loc2 ELSE province1.name_".$lang."_loc2 END AS province, CASE WHEN properties_loc3.name_".$lang."_loc3 IS NOT NULL THEN properties_loc3.name_".$lang."_loc3 ELSE areas1.name_".$lang."_loc3 END AS area, CASE WHEN properties_loc4.name_".$lang."_loc4 IS NOT NULL THEN properties_loc4.name_".$lang."_loc4 ELSE towns.name_".$lang."_loc4 END AS town, CASE WHEN properties_types.types_".$lang."_typ IS NOT NULL THEN properties_types.types_".$lang."_typ ELSE types.types_".$lang."_typ END AS type, properties_status.status_".$lang."_sta as sale, properties_properties.descripcion_".$lang."_prop as descr, properties_properties.m2_prop, properties_properties.precio_prop as old_precio, properties_properties.preci_reducidoo_prop as precio, properties_properties.habitaciones_prop, properties_properties.aseos_prop, properties_properties.referencia_prop as ref, properties_properties.m2_parcela_prop as m2p_prop, id_prop, id_img, properties_properties.vendido_tag_prop, properties_properties.nuevo_prop, (SELECT pool_".$lang."_pl FROM properties_pool WHERE id_pl = piscina_prop ) AS piscina_prop, (SELECT parking_".$lang."_prk FROM properties_parking WHERE id_prk = parking_prop ) AS parking_prop, properties_properties.alquilado_prop, properties_properties.reservado_prop, properties_properties.watermark_prop, properties_properties.aseos2_prop, properties_properties.precio_desde_prop, title_".$lang."_prop as metatitle FROM properties_loc4 towns LEFT OUTER JOIN properties_properties ON properties_properties.localidad_prop = towns.id_loc4 LEFT OUTER JOIN properties_loc3 areas1 ON towns.loc3_loc4 = areas1.id_loc3 LEFT OUTER JOIN properties_loc3 ON areas1.parent_loc3 = properties_loc3.id_loc3 LEFT OUTER JOIN properties_loc2 province1 ON areas1.loc2_loc3 = province1.id_loc2 LEFT OUTER JOIN properties_loc2 ON province1.parent_loc2 = properties_loc2.id_loc2 LEFT OUTER JOIN properties_loc1 ON province1.loc1_loc2 = properties_loc1.id_loc1 LEFT OUTER JOIN properties_loc4 ON towns.parent_loc4 = properties_loc4.id_loc4 LEFT OUTER JOIN properties_types types ON properties_properties.tipo_prop = types.id_typ LEFT OUTER JOIN properties_types ON types.parent_typ = properties_types.id_typ LEFT OUTER JOIN properties_images ON properties_properties.id_prop = properties_images.property_img AND order_img = 1 AND order_img = 1 LEFT OUTER JOIN properties_status ON properties_properties.operacion_prop = properties_status.id_sta WHERE activado_prop = 1 AND alquilado_prop = 0 AND vendido_prop = 0 AND oferta_prop = 1 GROUP BY id_prop ORDER BY order_img, RAND() LIMIT 9 "; $smarty->assign("ofertas", getRecordsAndCache($ofertasQuery, 'ofertas-props')); } ///////////////////////////////////////////////////////////////////////////////////////// // Zonas ///////////////////////////////////////////////////////////////////////////////////////// if ($actZonas == 1) { $zonasmenQuery = " SELECT direccion_gp_prop, lat_long_gp_prop, zoom_gp_prop, provinces_ct, id_ct, category_".$lang."_ct as titulo, descripcion_".$lang."_ct as contenido, title_".$lang."_ct as titulow, description_".$lang."_ct as contenidow, keywords_".$lang."_ct as keywords, (SELECT image_img FROM zonas_images WHERE zona_img = id_ct ORDER BY order_img LIMIT 1) AS img, (SELECT video_vid FROM news_videos WHERE news_vid = id_ct ORDER BY order_vid) as id_ct FROM news_categories WHERE type_ct = 6 ORDER BY category_".$lang."_ct "; $smarty->assign("zonasmen", getRecordsAndCache($zonasmenQuery, 'zonas-menu')); $ciudassrQuery = " SELECT news.id_nws, news.title_".$lang."_nws as titulo, news.titlew_".$lang."_nws as titulometa, news.content_".$lang."_nws as contenido, news.date_nws, news.zonas_nws, news.categoria_nws, news.lat_long_gp_prop, (SELECT imagen_img FROM news_fotos WHERE noticia_img = id_nws ORDER BY orden_img LIMIT 1) AS img, (SELECT alt_".$lang."_img FROM news_fotos WHERE noticia_img = id_nws ORDER BY orden_img LIMIT 1) AS alt FROM news WHERE news.title_".$lang."_nws != '' AND news.content_".$lang."_nws != '' AND type_nws = 6 ORDER BY news.title_".$lang."_nws "; $smarty->assign("ciudassr", getRecordsAndCache($ciudassrQuery, 'ciudades-menu')); } ///////////////////////////////////////////////////////////////////////////////////////// // Favorites ///////////////////////////////////////////////////////////////////////////////////////// $theFavs = explode(",",$_COOKIE['fav']); $totalFavs = (isset($_COOKIE['fav']) ? count($theFavs) : 0); $smarty->assign("theFavs", $theFavs); $smarty->assign("totalFavs", $totalFavs); ///////////////////////////////////////////////////////////////////////////////////////// // Wheather ///////////////////////////////////////////////////////////////////////////////////////// $weatherCities = array('Alicante' => 'EUR|ES|SP016|ALICANTE'); foreach ($weatherCities as $key => $value) { $name = "weather_".clean($key).".xml"; $xml = "weather/".$name; if ( !file_exists($xml) || strtotime('+15 minutes',filemtime($xml)) < strtotime("now") || !filesize($xml) ) { $ch = file_get_contents('http://forecastfox.accuweather.com/adcbin/forecastfox/weather_data.asp?partner=forecastfox&location='.$value.'&metric=17'); $fp = fopen($xml , "w"); fwrite($fp, $ch); fclose($fp); } $theXML = simplexml_load_string(mb_convert_encoding(file_get_contents($xml),'UTF-8','UTF-8')); $iconW = (string)$theXML->currentconditions->weathericon; $cityW = (string)$key; $temperatureW = (string)$theXML->currentconditions->temperature; $hightemperatureW = (string)$theXML->forecast->day[0]->daytime->hightemperature; $lowtemperatureW = (string)$theXML->forecast->day[0]->daytime->lowtemperature; $weather[] = array($iconW, $cityW, $temperatureW, $hightemperatureW, $lowtemperatureW); } $smarty->assign("weather", $weather); ///////////////////////////////////////////////////////////////////////////////////////// // Cambio vistas propiedades ///////////////////////////////////////////////////////////////////////////////////////// $urlBox = str_replace($urlStr['property-map']['url'], $urlStr['properties']['url'], $_SERVER['REQUEST_URI']); $urlList = str_replace($urlStr['property-map']['url'], $urlStr['properties']['url'], $_SERVER['REQUEST_URI']); foreach ($status as $stat) { if ($seccion == $urlStr['properties']['url'] . '-' . slug(getFromArray($status, $stat['id'], 'id', 'sale'))) { $urlMap = str_replace($urlStr['properties']['url'] . '-' . slug(getFromArray($status, $stat['id'], 'id', 'sale')), $urlStr['property-map']['url'], $_SERVER['REQUEST_URI']); $urlMap = KT_addReplaceParam($urlMap, 'st[]', $stat['id']); } } if ($seccion == $urlStr['properties']['url']) { $urlMap = str_replace($urlStr['properties']['url'], $urlStr['property-map']['url'], $_SERVER['REQUEST_URI']); } $smarty->assign("urlBox", $urlBox); $smarty->assign("urlList", $urlList); $smarty->assign("urlMap", $urlMap); ///////////////////////////////////////////////////////////////////////////////////////// // Secciones ///////////////////////////////////////////////////////////////////////////////////////// if ($_GET['zon'] != '' && $_GET['ciu'] != '') { include($_SERVER["DOCUMENT_ROOT"] . '/modules/ciudades/properties.php'); $smarty->display('modules/ciudades/view/index.tpl'); die(); } if ($_GET['zon'] != '') { include($_SERVER["DOCUMENT_ROOT"] . '/modules/zonas/properties.php'); $smarty->display('modules/zonas/view/index.tpl'); die(); } switch ($seccion) { case '': $numpag = 3; include($_SERVER["DOCUMENT_ROOT"] . '/modules/inicio/inicio.php'); $smarty->assign("addCanonical", 1); $smarty->display('modules/inicio/view/index.tpl'); break; case 'landing': $numpag = $tokens[1]; include($_SERVER["DOCUMENT_ROOT"] . '/modules/inicio/inicio.php'); $smarty->display('modules/inicio/view/index.tpl'); break; case $urlStr['about-us']['url']: $numpag = 4; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; case $urlStr['try-before-you-buy']['url']: $numpag = 104; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; case $urlStr['services']['url']: $numpag = 105; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; case $urlStr['regions']['url']: $numpag = 106; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; case $urlStr['agency-access']['url']: $numpag = 107; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; case $urlStr['promotions']['url']: $numpag = 117; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); if(isset($tokens[1]) && $tokens[1] != '' && $tokens[1] != 0){ $idpromo = $tokens[1]; $smarty->assign("idpromo", $idpromo); $_GET['setidpromo'] = 1; include($_SERVER["DOCUMENT_ROOT"] . '/modules/properties/properties.php'); $smarty->display('modules/properties/view/index.tpl'); } else { $smarty->display('modules/pages/view/promotions.tpl'); } break; case $urlStr['advanced-search']['url']: $numpag = 13; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/search/search.php'); $smarty->display('modules/search/view/index.tpl'); break; case $urlStr['properties']['url']: $numpag = 5; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); if ($_GET['idquick'] != '') { $numpag = $_GET['idquick']; include($_SERVER["DOCUMENT_ROOT"] . '/modules/inicio/inicio.php'); } else { $smarty->assign("addCanonical", 1); } include($_SERVER["DOCUMENT_ROOT"] . '/modules/properties/properties.php'); $smarty->display('modules/properties/view/index.tpl'); break; case $urlStr['areas']['url']: $numpag = 81; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; case $urlStr['property-map']['url']: $numpag = 85; $smarty->assign("addCanonical", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/properties/properties-map.php'); $smarty->display('modules/properties/view/map.tpl'); break; case $urlStr['property']['url']: include($_SERVER["DOCUMENT_ROOT"] . '/modules/property/property.php'); if ($property[0]['id_prop'] == '') { if ($property[0]['id_prop'] == '') { header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$urlStart."" . $urlStr['properties']['url']); die(); } else { $smarty->display('modules/property/view/index.tpl'); } } else { $smarty->display('modules/property/view/index.tpl'); } break; case $urlStr['favorites']['url']: $numpag = 6; if ( $tokens[1] == 'print') { include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/favorites/print.php'); $smarty->display('modules/favorites/view/print.tpl'); } else { include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/favorites/properties.php'); $smarty->display('modules/favorites/view/index.tpl'); } break; case 'favorites-print': $numpag = 6; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/favorites/properties-adm.php'); $smarty->display('modules/favorites/view/index-adm.tpl'); break; case $urlStr['news']['url']: include($_SERVER["DOCUMENT_ROOT"] . '/modules/news/sidebar.php'); if ($tokens[3] == '' && $tokens[2] != $urlStr['category']['url'] && $tokens[2] != '') { include($_SERVER["DOCUMENT_ROOT"] . '/modules/news/new.php'); $smarty->display('modules/news/view/new.tpl'); } else { $numpag = 7; $smarty->assign("addCanonical", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/news/news.php'); $smarty->display('modules/news/view/index.tpl'); } break; case $urlStr['estado-de-la-obra']['url']: include($_SERVER["DOCUMENT_ROOT"] . '/modules/estado-de-la-obra/sidebar.php'); if ($tokens[3] == '' && $tokens[2] != $urlStr['category']['url'] && $tokens[2] != '') { include($_SERVER["DOCUMENT_ROOT"] . '/modules/estado-de-la-obra/new.php'); $smarty->display('modules/estado-de-la-obra/view/new.tpl'); } else { $numpag = 174; $smarty->assign("addCanonical", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/estado-de-la-obra/news.php'); $smarty->display('modules/estado-de-la-obra/view/index.tpl'); } break; case $urlStr['testimonials']['url']: include($_SERVER["DOCUMENT_ROOT"] . '/modules/testimonials/sidebar.php'); $actWatermark = 0; $smarty->assign("pageBreadcrumb", $langStr["Testimonials"]); if ($tokens[3] == '' && $tokens[2] != $urlStr['category']['url'] && $tokens[2] != '') { include($_SERVER["DOCUMENT_ROOT"] . '/modules/testimonials/new.php'); $smarty->display('modules/testimonials/view/new.tpl'); } else { $numpag = 99; $smarty->assign("addCanonical", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/testimonials/news.php'); $smarty->display('modules/testimonials/view/index.tpl'); } break; case $urlStr['contact']['url']: $numpag = 8; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/contact/view/index.tpl'); break; case $urlStr['sell-your-property']['url']: $numpag = 83; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/vender/view/index.tpl'); break; case $urlStr['legal-note']['url']: $numpag = 9; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; case $urlStr['sitemap']['url']: $numpag = 19; include($_SERVER["DOCUMENT_ROOT"] . '/modules/sitemap/sitemap.php'); $smarty->display('modules/sitemap/view/index.tpl'); break; case $urlStr['privacy']['url']: $numpag = 10; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; case 'login': $numpag = 15; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/login/login.php'); $smarty->display('modules/login/view/index.tpl'); break; case 'drop': include($_SERVER["DOCUMENT_ROOT"] . '/modules/drop/drop.php'); $smarty->display('modules/drop/view/index.tpl'); break; case 'forgot': $numpag = 16; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/login/forgot.php'); $smarty->display('modules/login/view/forgot.tpl'); break; case 'register': $numpag = 17; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/login/register.php'); $smarty->display('modules/login/view/register.tpl'); break; case 'update': $numpag = 18; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/login/update.php'); $smarty->display('modules/login/view/update.tpl'); break; case 'tv': $numpag = "0"; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/tv.php'); $smarty->display('modules/pages/view/tv.tpl'); break; case 'unsubscribe': $numpag = "0"; include($_SERVER["DOCUMENT_ROOT"] . '/modules/mail_partials/unsubscribe.php'); $smarty->assign("aviso", $aviso); $smarty->display('modules/mail_partials/index.tpl'); break; case 'favorites-user': $numpag = 6; if ( $tokens[1] == 'print') { include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/favorites/print.php'); $smarty->display('modules/favorites/view/print.tpl'); } else { include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/favorites/properties.php'); $smarty->display('modules/favorites/view/index.tpl'); } break; case 'logout': $smarty->assign("noIndex", 1); $tNGs = new tNG_dispatcher("../"); $conn_inmoconn = new KT_connection($inmoconn, $database_inmoconn); $logoutTransaction = new tNG_logoutTransaction($conn_inmoconn); $tNGs->addTransaction($logoutTransaction); $logoutTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "VALUE", "true"); $logoutTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "/login/?info=LOGOUT"); $tNGs->executeTransactions(); $rscustom = $tNGs->getRecordset("custom"); $row_rscustom = mysql_fetch_assoc($rscustom); $totalRows_rscustom = mysql_num_rows($rscustom); break; case 'reporte': $numpag = 23; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/reporte/reporte.php'); $smarty->display('modules/reporte/view/index.tpl'); break; case 'cookies': $numpag = 78; $smarty->assign("noIndex", 1); include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/pages/view/index.tpl'); break; default: foreach (getRecordsAndCache($statusQuery, 'status-search') as $key => $value) { $statusValue = $value; if($seccion == $urlStr['properties']['url']."-".slug($statusValue["sale"])){ $numpag = 5; if ($statusValue["id"] == 1) { $numpag = 101; } if ($statusValue["id"] == 2) { $numpag = 102; } if ($statusValue["id"] == 3) { $numpag = 103; } if ($statusValue["id"] == 4) { $numpag = 100; } $statusLink = 1; $_GET["st"][] = $statusValue["id"]; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); include($_SERVER["DOCUMENT_ROOT"] . '/modules/properties/properties.php'); $langQuery = ""; foreach ($languages as $key => $lan) { $langQuery .= "properties_status.status_".$lan."_sta as sale_".$lan.", "; } $statusUrl = getRecords(" SELECT ".$langQuery." properties_status.id_sta as id FROM properties_properties LEFT OUTER JOIN properties_status ON properties_properties.operacion_prop = properties_status.id_sta WHERE activado_prop = 1 AND alquilado_prop = 0 AND vendido_prop = 0 AND properties_status.id_sta = '".simpleSanitize(($statusValue["id"]))."' ".simpleSanitize(($remoteProp))." GROUP BY id_sta ORDER BY sale_".$language." LIMIT 1 "); foreach ($languages as $lan) { if ($lan == $language) { if ( $statusUrl[0]['sale_'.$lan] != '' ) { $urlDefault = '/'. $urlStr["properties"][$lan]."-". slug($statusUrl[0]['sale_'.$lan]) . '/'; } else { $urlDefault = '/'; } $smarty->assign('urlDefault', $urlDefault); } else { $langUpper = strtoupper($lan); if ( $statusUrl[0]['sale_'.$lan] != '' ) { $urlLang = '/'.$lan. '/'.$urlStr["properties"][$lan]."-". slug($statusUrl[0]['sale_'.$lan]) . '/'; } else { $urlLang = '/'.$lan.'/'; } $smarty->assign('url'.$langUpper, $urlLang); } } $smarty->assign("addCanonical", 1); $smarty->assign("seccion", $urlStr['properties']['url']); $smarty->display('modules/properties/view/index.tpl'); die(); } } $urlFullList = array(); foreach ($urlStr as $u => $l) { foreach ($l as $ll => $uu) { if($ll != "master" && $uu != ""){ $urlFullList[$uu] = $l; } } } if( isset($urlFullList[$seccion][$lang]) ) { header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$urlStart."" . $urlFullList[$seccion][$lang]."/"); exit; } header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found"); header("Status: 404 Not Found"); $_SERVER['REDIRECT_STATUS'] = 404; $numpag = 79; include($_SERVER["DOCUMENT_ROOT"] . '/modules/pages/pages.php'); $smarty->display('modules/404/view/index.tpl'); } if (isset($_GET['debug_time'])) { $executionEndTime = microtime(true); $seconds = $executionEndTime - $executionStartTime; echo "