function IIRS_0_akismet_comment_check($author_data) { // Passes back TRUE (its spam) or FALSE (its ham) // or an IIRS_Error if a system level issue occurs $ret = FALSE; // not SPAM $url = 'http://' . IIRS_AKISMET_API_KEY . '.rest.akismet.com/1.1/comment-check'; $akismet_ua = 'WordPress/3.8.1 | Akismet/2.5.9'; $response_body = null; IIRS_0_debug_print("akismet spam check:"); IIRS_0_debug_var_dump($author_data); $response_body = IIRS_0_http_request($url, $author_data, null, $akismet_ua); if (IIRS_is_error($response_body)) { // the low level HTTP request got an error, so return it $ret = $response_body; } elseif ('' == $response_body) { $ret = new IIRS_Error(IIRS_AKISMET_NOTHING, 'Failed to check the entries against the Akismet SPAM database. Please try again tomorrow :)', 'Akismet returned an invalid response (empty string)', IIRS_MESSAGE_EXTERNAL_SYSTEM_ERROR, IIRS_MESSAGE_NO_USER_ACTION, $author_data); } elseif (is_null($response_body)) { $ret = new IIRS_Error(IIRS_AKISMET_FAILED, 'Failed to check the entries against the Akismet SPAM database. Please try again tomorrow :)', 'Akismet returned a big fat nothing', IIRS_MESSAGE_EXTERNAL_SYSTEM_ERROR, IIRS_MESSAGE_NO_USER_ACTION, $author_data); } else { IIRS_0_debug_print("Akismet HTTP response:"); IIRS_0_debug_var_dump($response_body); $ret = 'true' == $response_body; IIRS_0_debug_print($ret ? 'is SPAM' : 'not spam'); } return $ret; }
function IIRS_0_location_to_HTML($location_array, &$location_uniques = array(), $select = false, $town_name = '') { static $option = 1; $location_description = $location_array['description']; $location_latitude = $location_array['latitude']; $location_longitude = $location_array['longitude']; $location_full_address = $location_array['full_address']; $location_country = $location_array['country']; $location_granuality = $location_array['granuality']; $location_bounds = $location_array['bounds']; if (IIRS_is_error($location_array)) { $location_output = $location_array; } else { // unique identity output $unique_id = "{$location_latitude},{$location_longitude}"; if (!$location_uniques || !$unique_id || !isset($location_uniques[$unique_id])) { if (is_numeric($location_latitude) && is_numeric($location_longitude)) { $google_map_URL = "https://www.google.com/maps/@{$location_latitude},{$location_longitude},16z"; $google_map_link = '<a target="_blank" href="' . $google_map_URL . '\\">' . IIRS_0_translation('view on map') . '</a>'; $selected = $select ? 'checked="1"' : ''; $selected_class = $select ? 'selected' : ''; $location_value_serialised = urlencode(serialize($location_array)); // status, description, links // SECURITY: $location_status is un-escaped output // $location_latitude && $location_longitude in $google_map_link are numeric // translations are the responsibility of the administrator if (IIRS_0_TI_search_result_already_registered($town_name, $location_latitude, $location_longitude, $location_description)) { $location_status = IIRS_0_translation(IGNORE_TRANSLATION, 'transition initiative already registered') . " {$google_map_link}<br/>"; $location_status .= '<input class="IIRS_0_button" type="button" value="' . IIRS_0_translation(IGNORE_TRANSLATION, 'join!') . '"/>'; $location_status .= '<input class="IIRS_0_button" type="button" value="' . IIRS_0_translation(IGNORE_TRANSLATION, 'message') . '"/>'; $disabled = 'disabled="1"'; } else { $location_status = IIRS_0_translation('transition initiative not registered yet!') . " {$google_map_link}<br/>"; // $location_status .= IIRS_0_translation( IGNORE_TRANSLATION, 'closest initiative' ) . ': 5' . IIRS_0_translation( IGNORE_TRANSLATION, 'km' ); $disabled = ''; } // HTML assemble $location_description_escaped = IIRS_0_escape_for_HTML_text($location_description); $location_full_address_escaped = IIRS_0_escape_for_HTML_text("{$location_granuality}: {$location_full_address}"); $location_output = <<<HTML <li class="{$selected_class}"> <input {$disabled} {$selected} name="place" class="IIRS_0_radio IIRS_0_required" value="{$location_value_serialised}" type="radio" id="IIRS_0_location_{$option}_input" /> <label for="IIRS_0_location_{$option}_input"> {$location_description_escaped} <div class="IIRS_0_full_address">{$location_full_address_escaped}</div> <div class="IIRS_0_status">{$location_status}</div> </label> </li> HTML; // record for uniqueness if ($unique_id && $location_uniques) { $location_uniques[$unique_id] = 1; } } } $option++; } return $location_output; }
//domain_other will be filled out if it has not already been checked by the previous domain_lookup if ($is_unchecked_domain) { $domain = trim($domain); $domain = preg_replace('/^(https?:\\/\\/)?(www\\.)?([^\\/?]*).*/i', '$3', $domain); IIRS_0_debug_print("domain: carrying out DNS [and WHOIS] lookup on [{$domain}]"); $ip_address = gethostbyname($domain); // gethostbyname PHP 4,5 $valid_dns = $ip_address != $domain; } if ($valid_dns) { IIRS_0_debug_print("DNS valid [{$ip_address}], updating domain to [{$domain}]"); IIRS_0_TI_update_TI(array('domain' => $domain)); //----------------------------------------------------- about us section from domain $old_error_reporting = error_reporting(0); $timeout = 1.0; if (!IIRS_is_error($aboutus = IIRS_0_http_request("http://{$domain}/aboutus", null, $timeout)) || !IIRS_is_error($aboutus = IIRS_0_http_request("http://{$domain}/about", null, $timeout)) || !IIRS_is_error($aboutus = IIRS_0_http_request("http://{$domain}/about_us", null, $timeout)) || !IIRS_is_error($aboutus = IIRS_0_http_request("http://{$domain}/", null, $timeout))) { $oAboutUs = new DOMDocument(); $oAboutUs->loadHTML($aboutus); $xpath = new DOMXpath($oAboutUs); $elements = $xpath->query("//*[@id='content'] | //*[@class='layout-container']"); if (!is_null($elements) && $elements->length) { $summary_from_website .= ' (' . IIRS_0_translation('from the website') . ')'; foreach ($elements as $element) { $summaryFromDomain .= $element->textContent . "\n"; } $summaryFromDomain = preg_replace('/\\n\\s*\\n/', "\n", $summaryFromDomain); $summaryFromDomain = preg_replace('/\\n\\s*\\n/', "\n", $summaryFromDomain); $summaryFromDomain = preg_replace('/^\\s+|\\s+$|^\\s+/', "", $summaryFromDomain); } else { IIRS_0_debug_print("cannot find content in the aboutus response."); }
if ('update account details' == $form) { // current user logged in is required here IIRS_0_debug_print("updating account details..."); $values = array('name' => $name, 'email' => $email, 'password' => $pass == IIRS_0_CLEAR_PASSWORD ? NULL : $pass); $ret = IIRS_0_TI_update_user($values); if (IIRS_is_error($ret)) { $IIRS_error = $ret; } } if ('update transition initiative' == $form) { // current user logged in is required here // to get the correct TI IIRS_0_debug_print("updating TI details..."); $values = array('name' => $initiative_name, 'summary' => $summary, 'domain' => $domain, 'town_name' => $town_name, 'location_latitude' => $location_latitude, 'location_longitude' => $location_longitude, 'location_description' => $location_description, 'location_country' => $location_country, 'location_full_address' => $location_full_address, 'location_granuality' => $location_granuality, 'location_bounds' => $location_bounds); $ret = IIRS_0_TI_update_TI($values); if (IIRS_is_error($ret)) { $IIRS_error = $ret; } } // ------------------------------------------------------------- load current values // this page only works with a single user that has only 1 registered TI // it does not handle users who have registered multiple TIs $is_user_with_one_TI = false; $location_uniques = array(); if (IIRS_0_logged_in()) { IIRS_0_debug_print("loading user details..."); if ($user = IIRS_0_details_user()) { $name = $user['name']; $email = $user['email']; $phone = isset($user['phone']) ? $user['phone'] : null; IIRS_0_debug_print("loading TI [" . IIRS_0_CONTENT_TYPE . "] details...");
function IIRS_0_TI_verify_add_TI($user_ID, $IIRS_host_domain, $initiative_name, $town_name, $location_latitude, $location_longitude, $location_description, $location_country, $location_full_address, $location_granuality, $location_bounds, $domain) { // on success returns the native TI ID // on failure returns NULL $ret = null; // --------------------------------------- 1) check data input validity // the user is already registered, so we can use IIRS_0_details_user() // TODO: concurrency issues with registration if (!is_numeric($location_latitude) || !is_numeric($location_longitude)) { $ret = new IIRS_Error(IIRS_INVALID_TI_INPUTS, 'We think you are a SPAM robot. please email us to resolve this issue.', 'location data is not numeric', IIRS_MESSAGE_USER_ERROR, IIRS_MESSAGE_NO_USER_ACTION, array('$location_latitude' => $location_latitude, '$location_longitude' => $location_longitude)); } // --------------------------------------- 2) check user 1-1 TI relation if (!$ret) { $TI = IIRS_0_details_TI_user(); // returns NULL if no TI associated if (is_array($TI)) { $ret = new IIRS_Error(IIRS_USER_ALREADY_HAS_TI, 'You have already registered a Transition Initiative under this username. Please logout and re-register', "User already associated with TI [{$TI['name']}]", IIRS_MESSAGE_USER_ERROR, IIRS_MESSAGE_NO_USER_ACTION, $TI); } elseif (IIRS_is_error($TI)) { $ret = $TI; } } // --------------------------------------- 3) check duplicate registration by vicinity // currently disabled. will always return ok if (!$ret) { $vicinity_match = IIRS_0_TI_vicinity_match($location_latitude, $location_longitude, $location_description); if ($vicinity_match === TRUE || IIRS_is_error($vicinity_match)) { $ret = $vicinity_match; } } // --------------------------------------- 4) check duplicate TI name if (!$ret) { $TI_same_name = IIRS_0_TI_same_name($initiative_name); // returns a TI or FALSE or [system] IIRS_Error if (is_array($TI_same_name)) { // ok, so we have a registration with an identical name // same name entries are not necessarily close by. America and UK will have many name conflicts // reject this currently. ask for an alternative name // this might cause the user to experience surprise, anger, competition. // needs to be handled with emotional intelligence, i.e.: // hey! we've found someone you can chat and work with in your space! // OR // someone OWNS this name and you are not permitted to create an Initiative here. IIRS_0_debug_var_dump($TI_same_name); $ret = new IIRS_Error(IIRS_TI_EXISTS_SAME_NAME, 'A Transition Initiative already exists with this name. Please add something to the name or change it and try again', 'TI Name matched exactly in data verification stage', IIRS_MESSAGE_USER_WARNING, IIRS_MESSAGE_NO_USER_ACTION, array('$TI_same_name' => $TI_same_name)); } elseif (IIRS_is_error($TI_same_name)) { $ret = $TI_same_name; } } // --------------------------------------- 5) check for SPAM using AKISMET // IIRS_0_akismet_check_ti_registration_name() returns true for is SPAM if (!$ret) { $is_SPAM = IIRS_0_akismet_check_ti_registration_name(IIRS_0_details_user(), $initiative_name); if ($is_SPAM === TRUE) { $ret = new IIRS_Error(IIRS_AKISMET_SAYS_SPAM, 'Akismet thinks that your entry is SPAM. So we cannot accept it. Sorry.', 'Akismet returned true for SPAM detection', IIRS_MESSAGE_USER_ERROR, IIRS_MESSAGE_NO_USER_ACTION, array('$initiative_name' => $initiative_name)); } elseif (IIRS_is_error($is_SPAM)) { $ret = $is_SPAM; } } // --------------------------------------- F) FINAL: if no vertification issues registrered then everything ok if (!$ret) { // ask host framework to add the TI $ret = IIRS_0_TI_add_TI($user_ID, $IIRS_host_domain, $initiative_name, $town_name, $location_latitude, $location_longitude, $location_description, $location_country, $location_full_address, $location_granuality, $location_bounds, $domain); } return $ret; }
function IIRS_0_geocode($town_name, $format = 'xml') { global $location_is_example, $IIRS_host_TLD, $IIRS_common_dir; $location_arrays = array(); // http://open.mapquestapi.com/geocoding/ // see also http://en.wikipedia.org/wiki/Country_code_top-level_domain // for region bias codes // NOTE: the country bias DOES NOT work for MapQuest. we are using a calculated bounding box instead // boundingBox=61.06,-14.02,49.67,2.09 $bounds_param = ''; $region_bias = IIRS_0_setting('region_bias'); if (!$region_bias || $region_bias == 'region_bias') { $region_bias = $IIRS_host_TLD; } if ($region_bias == 'dev' || $region_bias == 'org') { $region_bias = 'uk'; } if ($bounds_details = IIRS_0_tld_bounds($region_bias)) { $bounds_min = $bounds_details['min']; $bounds_max = $bounds_details['max']; $bounds_min_lng = $bounds_min['lng']; $bounds_min_lat = $bounds_min['lat']; $bounds_max_lng = $bounds_max['lng']; $bounds_max_lat = $bounds_max['lat']; $bounds_param = 'boundingBox=' . $bounds_max_lat . ',' . $bounds_min_lng . ',' . $bounds_min_lat . ',' . $bounds_max_lng; IIRS_0_debug_print("located the country bounds for [{$IIRS_host_TLD} / {$region_bias}] => [{$bounds_param}]"); } else { IIRS_0_debug_print("failed to locate the country bounds for [{$IIRS_host_TLD} / {$region_bias}]"); } $town_name_encoded = urlencode($town_name); $url_request = "http://open.mapquestapi.com/geocoding/v1/address?key=Fmjtd%7Cluu829uan1%2C8n%3Do5-9w1a9r&location={$town_name_encoded}&callback=renderGeocode&outFormat={$format}&{$bounds_param}"; IIRS_0_debug_print("region_bias:[" . IIRS_0_setting('region_bias') . "] => {$region_bias}"); IIRS_0_debug_print($url_request); // http://wiki.openstreetmap.org/wiki/Nominatim#Parameters if ($location_is_example) { IIRS_0_debug_print("loading example file..."); $xml = file_get_contents("{$IIRS_common_dir}/location_providers/example_data/mapquest.{$format}"); } else { $xml = IIRS_0_http_request($url_request); } IIRS_0_debug_print($xml); if (IIRS_is_error($xml)) { $location_arrays = $xml; } else { $doc = new DOMDocument(); $doc->loadXML($xml); $oXPath = new DOMXpath($doc); // translate the results in to a standardised array if (!$doc->documentElement || !$doc->documentElement->childNodes) { $location_arrays = new IIRS_Error(IIRS_LOCATION_XML_INVALID, 'Oops, it seems that the our servers are not responding! The manager has been informed and is trying to solve the problem. Please come back here tomorrow :)', 'Invalid XML returned', IIRS_MESSAGE_EXTERNAL_SYSTEM_ERROR, IIRS_MESSAGE_NO_USER_ACTION); } else { // handle no results (not an error as such!) if ($doc->documentElement->childNodes->length == 0) { IIRS_0_debug_print("no results from lookup"); } else { // get places info into an associative array $placeNodes = $oXPath->query('/response/results/result/locations/location'); IIRS_0_debug_print("{$placeNodes->length} results from lookup"); foreach ($placeNodes as $placeNode) { if ($placeNode->nodeType == XML_ELEMENT_NODE) { /* <street></street> <adminArea5 type="City"></adminArea5> <adminArea3 type="State">England</adminArea3> <adminArea4 type="County">Bedford</adminArea4> <postalCode></postalCode> <adminArea1 type="Country">GB</adminArea1> <geocodeQuality>COUNTY</geocodeQuality> <geocodeQualityCode>A4XAX</geocodeQualityCode> <dragPoint>false</dragPoint> <sideOfStreet>N</sideOfStreet> <displayLatLng><latLng><lat>52.136381</lat><lng>-0.467504</lng></latLng></displayLatLng> <linkId>0</linkId> <type>s</type> <latLng><lat>52.136381</lat><lng>-0.467504</lng></latLng> <mapUrl> */ $location_array = array(); // assemble place description $description = ''; foreach ($placeNode->childNodes as $placeValueNode) { $sPlaceKey = $placeValueNode->nodeName; if ($sPlaceKey != 'geocodeQuality' && $sPlaceKey != 'geocodeQualityCode' && $sPlaceKey != 'dragPoint' && $sPlaceKey != 'sideOfStreet' && $sPlaceKey != 'displayLatLng' && $sPlaceKey != 'linkId' && $sPlaceKey != 'type' && $sPlaceKey != 'latLng' && $sPlaceKey != 'mapUrl') { $sPlaceValue = trim($placeValueNode->nodeValue); if ($sPlaceValue) { $description .= "{$sPlaceValue}, "; } } } if ($description) { $description = substr($description, 0, -2); } // entry and add in to the array $location_array['description'] = $description; $location_array['latitude'] = IIRS_0_get_DOM_value($placeNode, 'latLng/lat'); $location_array['longitude'] = IIRS_0_get_DOM_value($placeNode, 'latLng/lng'); $location_array['granuality'] = IIRS_0_get_DOM_value($placeNode, 'geocodeQuality'); $location_array['country'] = IIRS_0_get_DOM_value($placeNode, "adminArea1[@type='Country']"); $location_array['full_address'] = $description; $location_array['bounds'] = ''; $location_arrays[] = $location_array; } } } } } return $location_arrays; }
$city = preg_replace('/\..*|transition|town|transicao/i', '', $domain); if ($city) $town_name = $city; else { IIRS_0_debug_print("no registrant city found in the domain name either, try to get the city name from the IP"); //TODO: try to get the town from the IP address //... } } } */ } // ------------------------------------------------------------------------- process as town name // user input appears to not be a domain, so treat it as a town name IIRS_0_debug_print("treating as a town name"); $location_options = IIRS_0_location_search_options($town_name); if (IIRS_is_error($location_options)) { $IIRS_error = $location_options; } else { $towns_found = !empty($location_options); } if (!$towns_found) { $no_towns_found_disabled = 'disabled="1"'; $no_towns_found_disabled_class = 'IIRS_0_disabled'; IIRS_0_debug_print("sending extra geocode fail message"); $non_fatal_error_email = "No towns found for [{$town_name}]"; //prevent the error appearing in the translations system new IIRS_Error(IIRS_GEOCODE_RESULTS_EMPTY, $non_fatal_error_email, "Geocode [{$mapping_provider}] returned zero results for [{$town_name}]", IIRS_MESSAGE_EXTERNAL_SYSTEM_ERROR, NULL); } // ------------------------------------------------------------------------- check for already registered initiative_name $TI_same_name = IIRS_0_TI_same_name($town_name); // returns a TI or FALSE or [system] IIRS_Error
function IIRS_0_geocode($town_name, $format = 'xml') { global $location_is_example, $IIRS_host_TLD, $IIRS_common_dir; $location_arrays = array(); // http://maps.google.com/maps/api/geocode/xml?sensor=false&address=bedford // see also http://en.wikipedia.org/wiki/Country_code_top-level_domain // for region bias codes $region_bias = IIRS_0_setting('region_bias'); if (!$region_bias || $region_bias == 'region_bias') { $region_bias = $IIRS_host_TLD; } if ($region_bias == 'dev' || $region_bias == 'org') { $region_bias = 'uk'; } $town_name_encoded = urlencode($town_name); $url_request = "https://maps.google.com/maps/api/geocode/{$format}?sensor=false®ion={$region_bias}&address={$town_name_encoded}&key=" . IIRS_GOOGLE_API_KEY; IIRS_0_debug_print($url_request); if ($location_is_example) { IIRS_0_debug_print("loading example file..."); $xml = file_get_contents("{$IIRS_common_dir}/location_providers/example_data/google.{$format}"); } else { $xml = IIRS_0_http_request($url_request, null, 5.0); } IIRS_0_debug_print($xml); if (IIRS_is_error($xml)) { $location_arrays = $xml; } else { // DOMDocument and DOMXpath ( PHP5 ) // PHP >= 5 should be checked for in the installation procedure ( IIRS.install ) $doc = new DOMDocument(); $doc->loadXML($xml); $oXPath = new DOMXpath($doc); // translate the results in to a standardised array if (!$doc->documentElement || !$doc->documentElement->childNodes) { $location_arrays = new IIRS_Error(IIRS_LOCATION_XML_INVALID, 'Oops, it seems that the our servers are not responding! The manager has been informed and is trying to solve the problem. Please come back here tomorrow :)', 'Invalid XML returned', IIRS_MESSAGE_EXTERNAL_SYSTEM_ERROR, IIRS_MESSAGE_NO_USER_ACTION, array('$url_request' => $url_request)); } else { // IIRS_0_debug_var_dump( $xml ); if ($doc->documentElement->childNodes->length == 0) { // handle no results IIRS_0_debug_print("no results for lookup"); } else { // get places info into an associative array $placeNodes = $doc->documentElement->childNodes; foreach ($placeNodes as $placeNode) { if ($placeNode->nodeType == XML_ELEMENT_NODE && $placeNode->nodeName == 'result') { $location_array = array(); // entry and add in to the array // basic values $location_array['description'] = IIRS_0_get_DOM_value($placeNode, 'formatted_address'); $location_array['latitude'] = IIRS_0_get_DOM_value($placeNode, 'geometry/location/lat'); $location_array['longitude'] = IIRS_0_get_DOM_value($placeNode, 'geometry/location/lng'); $location_array['granuality'] = IIRS_0_get_DOM_value($placeNode, 'type'); // full address $fullAddress = ''; $nodeList = $oXPath->query('address_component', $placeNode); foreach ($nodeList as $address_component) { $address_level = IIRS_0_get_DOM_value($address_component, "type[1]"); $address_name = IIRS_0_get_DOM_value($address_component, 'long_name'); $fullAddress .= $address_name . ', '; if ($address_level == 'country') { $location_array['country'] = $address_name; } } if ($fullAddress) { $fullAddress = substr($fullAddress, 0, -2); } $location_array['full_address'] = $fullAddress; // bounds $northeast = IIRS_0_get_DOM_value($placeNode, 'geometry/bounds/northeast/lat') . ',' . IIRS_0_get_DOM_value($placeNode, 'geometry/bounds/northeast/lng'); $southwest = IIRS_0_get_DOM_value($placeNode, 'geometry/bounds/southwest/lat') . ',' . IIRS_0_get_DOM_value($placeNode, 'geometry/bounds/southwest/lng'); $location_array['bounds'] = "{$northeast};{$southwest}"; $location_arrays[] = $location_array; } } } } } return $location_arrays; }
function IIRS_0_geocode($town_name, $format = 'xml') { global $location_is_example, $IIRS_host_TLD, $IIRS_common_dir; $location_arrays = array(); // OSM has a usage limit, use of Nominatim is discouraged... // 403 Forbidden codes can come through if you over use the OSM API // http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy // Open Street Map does not support post codes! // not using Services_Openstreetmap module because it requires PEAR HTTP_Request2 // http://wiki.openstreetmap.org/wiki/API // https://github.com/kenguest/Services_Openstreetmap/tree/master/examples // $osm = new Services_OpenStreetMap( ); // IIRS_0_debug_var_dump( $osm->getPlace( $town_name )); $town_name_encoded = urlencode($town_name); $url_request = "http://nominatim.openstreetmap.org/search?q={$town_name_encoded}&format={$format}&polygon_kml=1&addressdetails=1"; IIRS_0_debug_print($url_request); // http://wiki.openstreetmap.org/wiki/Nominatim#Parameters if ($location_is_example) { IIRS_0_debug_print("loading example file..."); $xml = file_get_contents("{$IIRS_common_dir}/registration/example_data/openstreetmap.{$format}"); } else { $xml = IIRS_0_http_request($url_request); } if (IIRS_is_error($xml)) { $location_arrays = $xml; } else { $doc = new DOMDocument(); $doc->loadXML($xml); // translate the results in to a standardised array if (!$doc->documentElement || !$doc->documentElement->childNodes) { $location_arrays = new IIRS_Error(IIRS_LOCATION_XML_INVALID, 'Oops, it seems that the our servers are not responding! The manager has been informed and is trying to solve the problem. Please come back here tomorrow :)', 'Invalid XML returned', IIRS_MESSAGE_EXTERNAL_SYSTEM_ERROR, IIRS_MESSAGE_NO_USER_ACTION); } else { // handle no results (not an error as such!) if ($doc->documentElement->childNodes->length == 0) { IIRS_0_debug_print("no results for lookup"); } else { // get places info into an associative array $placeNodes = $doc->documentElement->childNodes; foreach ($placeNodes as $placeNode) { if ($placeNode->nodeType == XML_ELEMENT_NODE && $placeNode->nodeName == 'place') { $location_array = array(); // assemble place description $description = ''; foreach ($placeNode->childNodes as $placeValueNode) { $sPlaceKey = $placeValueNode->nodeName; if ($sPlaceKey != 'geokml' && $sPlaceKey != 'country_code' && $sPlaceKey != 'station') { $sPlaceValue = trim($placeValueNode->nodeValue); if ($sPlaceValue) { $description .= "{$sPlaceValue}, "; } } } if ($description) { $description = substr($description, 0, -2); } // entry and add in to the array $location_array['description'] = $description; // TODO: calculate the centre point from the geoxml // we can do this *if* we choose to use OSM again... $location_array['latitude'] = '52'; $location_array['longitude'] = '0'; $location_array['granuality'] = ''; $location_array['country'] = ''; $location_array['full_address'] = ''; $location_array['bounds'] = ''; $location_arrays[] = $location_array; } } } } } return $location_arrays; }
$body = IIRS_0_registration_email_html($name, $pass); //user email IIRS_0_debug_print("Email user registration [{$body}]"); $email_ok = IIRS_0_send_email($email, $subject, $body); if (IIRS_is_error($email_ok)) { IIRS_0_debug_print("email failed to send [{$email_ok}]"); } //admin registration alert email if ($admin_email_address = IIRS_0_setting('registration_notification_email')) { $admin_subject = IIRS_0_translation('[IIRS admin notice] new Transition account registered'); if (IIRS_0_debug()) { $admin_email_address = '*****@*****.**'; } IIRS_0_debug_print("Email administration of user registration"); $email_ok = IIRS_0_send_email($admin_email_address, $admin_subject, $body); if (IIRS_is_error($email_ok)) { IIRS_0_debug_print("administration registration heads up email failed to send [{$email_ok}]"); } } } } } if (!$TI_save_error) { //------------------------------------- debug IIRS_0_debug_print("details:"); IIRS_0_debug_print(" native_user_ID:{$native_user_ID} (don't forget that all emails on dev point to annesley newholms yahoo email address)"); IIRS_0_debug_print(" native_ti_ID:{$native_ti_ID}"); //------------------------------------- get some nice domain names for this town $domains_found = false; $domain_part = $location_is_example ? 'bedford' : $town_name; $nice_domains_html = '';