$b_lyftDisplay = false; $a_lyftProductList = json_decode($a_townInfo["LyftProductJson"], TRUE); if(isset($a_lyftProductList["ride_types"])) $b_lyftDisplay = true; /* */ //print('
');print_r($a_taxiProductList);print('
'); /*$a_townPopularRouteId = array(); if (isset($a_townPopularRouteList) && count($a_townPopularRouteList)>0) { foreach ($a_townPopularRouteList as $a_townPopularRoute) { $a_townPopularRouteId[] = $a_townPopularRoute['RouteId']; } } $s_townPopularRouteId = implode($a_townPopularRouteId, "','"); $a_townRouteList = $objDataModel->selectTownRouteListByTownId($a_townInfo['TownId'], 10, $s_townPopularRouteId); */ $a_townPopularRouteList = $objDataModel->selectPopularRouteListByTownId($a_townInfo['TownId'], 8, 15); $a_townRouteList = $objDataModel->selectPopularRouteListByTownId ($a_townInfo['TownId'], 23, 15); //$a_townRouteList = $objDataModel->selectTownRouteListByTownId($a_townInfo['TownId'], 10); if(count($a_townRouteList)<3) { $a_townRouteList = $objDataModel->selectTownRouteListNearby($a_townInfo['TownId'], $a_townInfo['TownLat'], $a_townInfo['TownLong'], 10); } $a_townPopularPlaceList = $objDataModel->selectPopularPlaceListByTownId($a_townInfo['TownId'], 10,15); $a_relatedTownList = $objDataModel->selectRelatedTownList($a_townInfo['TownId'], $a_townInfo['TownLat'], $a_townInfo['TownLong'], 10); $a_taxiList = $objDataModel->selectTaxiListByTownId($a_townInfo['TownId']); $n_maxRouteId = $objDataModel->selectMaxRmap($a_townInfo['TownId']); //print($n_maxRouteId); $n_numberOfLinks = ceil($n_maxRouteId/100); } $a_townName = explode(",", $a_townInfo['TownName'], 2); $s_townNameShort = $a_townName[0]; $s_pricing = ''; if ($a_taxiProductList["products"][0]['price_details']['cost_per_distance']>0) { $s_pricing .= ' start @ '.$a_taxiProductList["products"][0]['price_details']['cost_per_distance']." ".$a_taxiProductList["products"][0]['price_details']['currency_code']." per ". $a_taxiProductList["products"][0]['price_details']['distance_unit']; } $META_TITLE = "Taxi in ".$a_townInfo['TownName'].". Taxi rates".$s_pricing." for Uber, local taxis. Taxi Fare Calculator $s_townNameShort"; $META_DESCRIPTION = "Taxi rates and fares - ".$a_townInfo['TownName'].": calculate the taxi fare based on the current rates - using the taxi price calculator"; $META_KEYWORDS = "$s_townNameShort, taxi prices, taxi fares, taxi fare calculator, taxi fares, Uber fare, Lyft"; include_once(dirname(__FILE__)."/header.tmpl"); include_once(dirname(__FILE__)."/town.tmpl"); include_once(dirname(__FILE__)."/footer.tmpl"); } elseif((substr($subdomain,0,5)=='taxi-') && $route == "/taxi-list") { $s_townSubdomain = substr($subdomain, 5); $a_townInfo = $objDataModel->selectTownInfoBySubdomain($s_townSubdomain); $a_townName = explode(",", $a_townInfo['TownName'], 2); $s_townNameShort = $a_townName[0]; $a_taxiList = $objDataModel->selectTaxiListByTownId($a_townInfo['TownId']); //print_r($a_taxiList); $META_TITLE = "Номера телефонов такси ".$s_townNameShort; include_once(dirname(__FILE__)."/header.tmpl"); include_once(dirname(__FILE__)."/taxiList.tmpl"); include_once(dirname(__FILE__)."/footer.tmpl"); } if (strlen($subdomain)==2 && substr($route,0,5)=='/tmap') { if($route=='/tmap') { $META_TITLE = 'Select a city'; $META_DESCRIPTION = 'Select a city - sitemap'; $META_KEYWORDS = 'Select a city - sitemap'; $n_farelistId = 0; $n_maxRouteId = $objDataModel->selectMaxTmap($subdomain); //print($n_maxRouteId); $n_numberOfLinks = ceil($n_maxRouteId/100); include_once(dirname(__FILE__)."/header.tmpl"); include_once(dirname(__FILE__)."/tmap.tmpl"); include_once(dirname(__FILE__)."/footer.tmpl"); } elseif(substr($route,0,7)=='/tmap/a') { $n_faremapId = preg_replace('/\D/', '', $route); if(empty($n_faremapId)) $n_faremapId = 0; $META_TITLE = $META_DESCRIPTION = $META_KEYWORDS = 'Select a city - a'.$n_faremapId; $a_townList = $objDataModel->selectTownListByA($subdomain, $n_faremapId); include_once(dirname(__FILE__)."/header.tmpl"); include_once(dirname(__FILE__)."/tmap.tmpl"); include_once(dirname(__FILE__)."/footer.tmpl"); } /* } elseif(substr($route,0,20)=='/tmap/b') { $n_faremapId = preg_replace('/\D/', '', $route); if(empty($n_faremapId)) $n_faremapId = 0; $META_TITLE = $META_DESCRIPTION = $META_KEYWORDS = 'Tmap b'.$n_faremapId; $n_numberOfLinks = 100; include_once(dirname(__FILE__)."/header.tmpl"); include_once(dirname(__FILE__)."/tmap.tmpl"); include_once(dirname(__FILE__)."/footer.tmpl"); */ } if((substr($subdomain,0,5)=='taxi-' or strlen($subdomain)==2) && substr($route,0,5)=='/rmap') { if($route=='/rmap') { if(substr($subdomain,0,5)=='taxi-') { $s_townSubdomain = substr($subdomain, 5); $a_town = $objDataModel->selectTownInfoBySubdomain($s_townSubdomain); $n_maxRouteId = $objDataModel->selectMaxRmap($a_town['TownId']); } elseif(strlen($subdomain)==2) { $s_countryCode = substr($subdomain, 0, 2); $a_country = $objDataModel->selectCountryByCountryCode($s_countryCode); //print_r($s_countryCode); $n_maxRouteId = $objDataModel->selectMaxRmap(0, $a_country['CountryId']); } $n_numberOfLinks = ceil($n_maxRouteId/100); $META_TITLE = 'Routes'; $META_DESCRIPTION = 'Routes - sitemap'; $META_KEYWORDS = 'Routes - sitemap'; include_once(dirname(__FILE__)."/header.tmpl"); include_once(dirname(__FILE__)."/rmap.tmpl"); include_once(dirname(__FILE__)."/footer.tmpl"); } elseif(substr($route,0,7)=='/rmap/a') { $n_faremapId = preg_replace('/\D/', '', $route); if(empty($n_faremapId)) $n_faremapId = 0; if(substr($subdomain,0,5)=='taxi-') { $s_townSubdomain = substr($subdomain, 5); $a_town = $objDataModel->selectTownInfoBySubdomain($s_townSubdomain); $a_routeList = $objDataModel->selectRouteListByA($a_town['TownId'], $n_faremapId); } elseif(strlen($subdomain)==2) { $s_countryCode = substr($subdomain, 0, 2); $a_country = $objDataModel->selectCountryByCountryCode($s_countryCode); $a_routeList = $objDataModel->selectRouteListByA_country($a_country['CountryId'], $n_faremapId); } $META_TITLE = $META_DESCRIPTION = $META_KEYWORDS = 'Rmap a'.$n_faremapId; include_once(dirname(__FILE__)."/header.tmpl"); include_once(dirname(__FILE__)."/rmap.tmpl"); include_once(dirname(__FILE__)."/footer.tmpl"); } } if( $subdomain == "taxigator" && substr($route,0,6)=='/taxi/') { //print(end(explode('/',trim($route,'/')))); die(); $n_routeId = ShortURL2::decode(substr($route,6)); //print($n_routeId); die(); $a_routeData = $objDataModel->selectRouteById($n_routeId); if (empty($a_routeData)) redirectHome(); //print($a_routeData["CountryCode"]); $s_redirectLink = "https:".getLinkRoute(ShortURL2::encode($a_routeData["RouteId"]), $a_routeData["CountryCode"], $a_routeData["TownSubdomain"], $a_routeData["RouteCount"]); //die($s_redirectLink); header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$s_redirectLink); } if(substr($route,0,3)=='/r/' && (strlen($subdomain) == 2)) { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://taxigator.net/r/".(end(explode('/',trim($route,'/'))))); } if(substr($route,0,3)=='/r/' && ($subdomain == $_APPLICATION["global"]["subdomain"] || substr($subdomain,0,5)=='taxi-')) { //print(end(explode('/',trim($route,'/')))); die(); $n_routeId = ShortURL2::decode(substr($route,3)); print($n_routeId); //die(); $a_routeData = $objDataModel->selectRouteById($n_routeId); if (empty($a_routeData)) redirectHome(); if($a_routeData["TownId"]>0) { //$a_town = $objDataModel->selectRouteTownById($a_routeData["TownId"]); $n_multiplier += substr($a_routeData["TownId"],-1)/100; //print($n_multiplier); $a_town = $objDataModel->selectRouteTownById($a_routeData["TownId"]); $a_taxiProductList = $objDataModel->mapTaxiProductList(json_decode($a_town["UberProductJson"], TRUE), $n_multiplier); if (count($a_taxiProductList)==0) { $a_townNearby = $objDataModel->selectTownNearby($a_routeData["PickupLat"], $a_routeData["PickupLon"], $a_routeData["CountryId"]); $a_taxiProductList = $objDataModel->mapTaxiProductList(json_decode($a_townNearby["UberProductJson"], TRUE), $n_multiplier); } //print("
"); print_r(json_decode($a_town["UberProductJson"], TRUE)); print("
"); //print("
"); print_r($a_taxiProductList); print("
"); } else { //print("
"); print_r(json_decode($a_routeData['PriceJson'], TRUE)); print("
"); //$a_taxiProductList = $objDataModel->mapTaxiProductList(json_decode($a_routeData['PriceJson'], TRUE), $n_multiplier); $a_townNearby = $objDataModel->selectTownNearby($a_routeData["PickupLat"], $a_routeData["PickupLon"]); $a_taxiProductList = $objDataModel->mapTaxiProductList(json_decode($a_townNearby["UberProductJson"], TRUE), $n_multiplier); //print("
"); print_r($a_taxiProductList); print("
"); } //print("
"); print_r(json_decode($a_routeData['PriceJsonUber'], TRUE)); print("
"); //print("
"); print_r($a_taxiProductList); print("
"); $b_uberDisplay = false; $a_uberPriceData = (json_decode($a_routeData["PriceJson"], TRUE)); $a_uberTimeData = (json_decode($a_routeData["TimeJson"], TRUE)); if(isset($a_uberPriceData["prices"]) && count($a_uberPriceData["prices"])>0) $b_uberDisplay = true; /*$b_yaDisplay = false; $a_yaData = json_decode($a_routeData['YaJson'], true); $a_yaData["options"] = array_sort_by_column($a_yaData["options"], "min_price"); if(isset($a_yaData["options"])) { $b_yaDisplay = true; if (isset($a_yaData["options"][0])) { $a_yaPriceData['prices'] = array(); $a_yaTimeData['times'] = array(); $i = 0; $a_yaData["options"] = array_sort_by_column($a_yaData["options"], "min_price"); foreach ($a_yaData["options"] as $a_yaOption) { $a_yaPriceData['prices'][$i]['localized_display_name'] = $a_yaOption['class_text']; $a_yaPriceData['prices'][$i]['display_name'] = $a_yaOption['class_name']; $a_yaPriceData['prices'][$i]['currency_code'] = $a_yaData['currency']; $a_yaPriceData['prices'][$i]['distance'] = $a_yaData['distance']/1609.34; $a_yaPriceData['prices'][$i]['minimum'] = $a_yaOption['min_price']; $a_yaPriceData['prices'][$i]['low_estimate'] = $a_yaOption['price']; $a_yaPriceData['prices'][$i]['high_estimate'] = $a_yaOption['price']; $a_yaPriceData['prices'][$i]['estimate'] = $a_yaData['currency'].$a_yaOption['price']; $a_yaPriceData['prices'][$i]['duration'] = (int) $a_yaData['time']; if (isset($a_yaOption['waiting_time'])) { $a_yaTimeData['times'][$i]['localized_display_name'] = $a_yaOption['class_name']; $a_yaTimeData['times'][$i]['display_name'] = $a_yaOption['class_name']; $a_yaTimeData['times'][$i]['estimate'] = $a_yaOption['waiting_time']; } $i++; } $a_yaPriceData['prices'] = array_sort_by_column($a_yaPriceData['prices'], "low_estimate"); } } */ $b_lyftDisplay = false; $a_lyftPriceData = (json_decode($a_routeData["LyftPriceJson"], TRUE)); $a_lyftTimeData = (json_decode($a_routeData["LyftTimeJson"], TRUE)); if(isset($a_lyftPriceData['cost_estimates'])) $b_lyftDisplay = true; $a_geoData = json_decode($a_routeData['GeoJson'], true); $s_formtattedPickup = ''; if (isset($a_geoData['pickup_g'][0]['formatted_address'])) { $s_formtattedPickup = $a_geoData['pickup_g'][0]['formatted_address']; } elseif (isset($a_geoData['pickup_g']['formatted_address'])) { $s_formtattedPickup = $a_geoData['pickup_g']['formatted_address']; } $s_formtattedDropoff = ''; if (isset($a_geoData['dropoff_g'][0]['formatted_address'])) { $s_formtattedDropoff = $a_geoData['dropoff_g'][0]['formatted_address']; } elseif (isset($a_geoData['pickup_g']['formatted_address'])) { $s_formtattedDropoff = $a_geoData['dropoff_g']['formatted_address']; } if(isset($a_geoData['pickup_g'])) $s_pickupTown = getTown($a_geoData['pickup_g']); //print($s_pickupTown); $s_displayTown = isset($s_pickupTown) ? $s_pickupTown : (isset($a_town['TownName'])? $a_town['TownName'] : ""); $a_routeRelatedPickupData = $objDataModel->selectRelatedPickup($a_routeData['PickupName'], $n_routeId, "0,3"); $a_routeRelatedDropoffData = $objDataModel->selectRelatedDropoff($a_routeData['DropoffName'], $n_routeId, "0,3"); $a_routeRelatedData = $objDataModel->selectRouteRelatedById($n_routeId, "0,3"); if (empty($a_routeData)) redirectHome(); $a_geoData = json_decode($a_routeData['GeoJson'], true); $a_priceData = json_decode($a_routeData['PriceJson'], true); $a_dmatrixData = mapDMatrix(json_decode($a_routeData['DMatrix'], true), json_decode($a_routeData['PriceJson'], true), json_decode($a_routeData['YaJson'], true)); //print_r(json_decode($a_routeData['DMatrix'], true)); $META_TITLE = 'Taxi from '.$a_routeData['PickupName'].' to '.$a_routeData['DropoffName'].". Taxi fare"; // below is just for adding price tag to page title if (isset($a_taxiProductList["products"]) && count($a_taxiProductList["products"])>0 && isset($a_dmatrixData['duration']) && isset($a_dmatrixData['distance'])) { $a_product0 = $a_taxiProductList["products"][0]; $n_base = round($a_product0['price_details']['base'], 2); $n_costTime = round($a_product0['price_details']['cost_per_minute']*round($a_dmatrixData['duration']/60), 2); if ($a_product0['price_details']['distance_unit'] == "km") { $n_costDistance = $a_product0['price_details']['cost_per_distance']*round($a_dmatrixData['distance']/1000, 2); } elseif ($a_product0['price_details']['distance_unit'] == "mile") { $n_costDistance = $a_product0['price_deta $META_TITLE = $META_DESCRIPTION = $META_KEYWORDS = 'Sitemap c'.$n_farelistId; $n_numberOfLinks = ceil($n_maxRouteId/10000); include_once(dirname(__FILE__)."/header.tmpl"); include_once(dirname(__FILE__)."/sitemap.tmpl"); include_once(dirname(__FILE__)."/footer.tmpl"); } } } function mapDMatrix($a_inputDMatrix, $a_inputUber, $a_inputYandex) { // print_r($a_inputDMatrix["rows"][0]['elements']);die(); $a_outputDMatrix = array(); //print("
"); print_r($a_inputYandex); print("
"); if(isset($a_inputDMatrix["rows"][0]['elements'])) { if(isset($a_inputDMatrix["rows"][0]['elements'][0]['distance'])) $a_outputDMatrix['distance'] = $a_inputDMatrix["rows"][0]['elements'][0]['distance']['value']; if(isset($a_inputDMatrix["rows"][0]['elements'][0]['duration']) ) $a_outputDMatrix['duration'] = $a_inputDMatrix["rows"][0]['elements'][0]['duration']['value']; if(isset($a_inputDMatrix["rows"][0]['elements'][0]['duration_in_traffic']) ) $a_outputDMatrix['duration'] = $a_inputDMatrix["rows"][0]['elements'][0]['duration_in_traffic']['value']; } elseif(isset($a_inputUber["prices"][0]['localized_display_name'])) { if(isset($a_inputUber["prices"][0]['distance'])) $a_outputDMatrix['distance'] = $a_inputUber["prices"][0]['distance']*1609.34; if(isset($a_inputUber["prices"][0]['duration'])) $a_outputDMatrix['duration'] = $a_inputUber["prices"][0]['duration']; } elseif(isset($a_inputYandex["distance"]) && isset($a_inputYandex["time"])) { $a_outputDMatrix['distance'] = $a_inputYandex["distance"]; $a_outputDMatrix['duration'] = $a_inputYandex["time"]; } //print_r($a_inputUber); //print_r($a_outputDMatrix); return $a_outputDMatrix; } ?>