[TYPO3-english] Re: WEC Map FE User Coordinates

Mike Kane sara_bets at hotmail.com
Tue Feb 4 02:49:22 CET 2014


I have been studying this extension and i thought about one thing:  when the user changes in the frontend the "user_lat" and "user_lon" fields,  when the form is saved, the address that the user put in is hashed. If there is a row in the cache corresponding to that hash, then that row is updated with the coordinates given by the user, otherwise a new row is inserted.

So i am checking the file "class.tx_wecmap_cache.php" and in this file i noticed this snippet:

function insert($street, $city, $state, $zip, $country, $lat, $long) {

		/* Check if value is already in DB */

		if (tx_wecmap_cache::find($street,$city,$state,$zip,$country)) {

			/* Update existing entry */

			$latlong = array('latitude' => $lat, 'longitude' => $long);

			$result = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_wecmap_cache', "address_hash='".tx_wecmap_cache::hash($street, $city, $state, $zip, $country)."'", $latlong);

		} else {

			/* Insert new entry */

			$insertArray = array();

			$insertArray['address_hash'] = tx_wecmap_cache::hash($street, $city, $state, $zip, $country);

			$insertArray['address'] = $street.' '.$city.' '.$state.' '.$zip.' '.$country;

			$insertArray['latitude'] = $lat;

			$insertArray['longitude'] = $long;



			/* Write address to cache table */

			$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_wecmap_cache', $insertArray);

		}

	}


So if we define that the array  "$latlong = array('latitude' => $lat, 'longitude' => $long);" get their values from the fields "user_lat" and "user_lon"  (inside fe_users table) shouldn't they update the fields from tx_wecmap_cache table?




More information about the TYPO3-english mailing list