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_whois($domain) { $aAssocEntries = NULL; IIRS_0_debug_print("whois lookup of [{$domain}]..."); if (IIRS_0_validateIP($domain)) { $whois_text = IIRS_0_lookupIP($domain); } elseif (IIRS_0_validateDomain($domain)) { $whois_text = IIRS_0_lookupDomain($domain); } //$whois_text may contain an error if ($whois_text) { $aEntries = explode("\n", $whois_text); $aAssocEntries = array(); foreach ($aEntries as $entry) { $aEntry = explode(":", $entry); if (count($aEntry) == 2) { $aAssocEntries[$aEntry[0]] = $aEntry[1]; } } // Error? // array(1) { ["Error"] => string(54) " No appropriate Whois server found for abc.com domain!" } if (count($aAssocEntries) == 1 && isset($aAssocEntries['Error'])) { // IIRS_0_translation(IGNORE_TRANSLATION, 'Could not find extended information about your website' ) $message = 'Could not find extended information about your website'; $message_detail = $aAssocEntries['Error']; if ($message_detail == "No appropriate Whois server found for {$domain} domain!") { $aAssocEntries = new IIRS_Error(IIRS_WHOIS_NO_DOMAIN_SERVER, $message, $message_detail, IIRS_MESSAGE_EXTERNAL_SYSTEM_ERROR, IIRS_MESSAGE_NO_USER_ACTION, array('$domain' => $domain)); } else { $aAssocEntries = new IIRS_Error(IIRS_WHOIS_ERROR, $message, $message_detail, IIRS_MESSAGE_EXTERNAL_SYSTEM_ERROR, IIRS_MESSAGE_NO_USER_ACTION, array('$domain' => $domain)); } } } return $aAssocEntries; }
function IIRS_0_location_lookup($town_name) { // town lookup and options // RETURNS an array of places global $location_is_example, $IIRS_host_TLD, $IIRS_common_dir, $mapping_provider; $location_provider = "{$IIRS_common_dir}/location_providers/{$mapping_provider}.php"; $location_arrays = array(); IIRS_0_debug_print("looking up [{$town_name}] on [{$mapping_provider}]"); if (file_exists($location_provider)) { require_once $location_provider; $location_arrays = IIRS_0_geocode($town_name); } else { $location_arrays = new IIRS_Error(IIRS_LOCATION_PROVIDER_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 :)', 'Mapping provider not valid, please set one', IIRS_MESSAGE_SYSTEM_ERROR, IIRS_MESSAGE_NO_USER_ACTION, array('$mapping_provider' => $mapping_provider)); } if (IIRS_is_error($location_arrays)) { IIRS_0_debug_print($location_arrays); } return $location_arrays; }
$summaryFromDomain = preg_replace('/^\\s+|\\s+$|^\\s+/', "", $summaryFromDomain); } else { IIRS_0_debug_print("cannot find content in the aboutus response."); } } else { IIRS_0_debug_print("aboutus attemps all returned blank strings or [404] errors."); } error_reporting($old_error_reporting); } else { // $valid_dns $IIRS_error = new IIRS_Error(IIRS_INVALID_WEBSITE_DNS, 'Your website was not found, please re-enter it or select "No Website"', 'DNS lookup failed', IIRS_MESSAGE_USER_WARNING, IIRS_MESSAGE_NO_USER_ACTION, array('$domain' => $domain)); IIRS_0_debug_print($IIRS_error); } } else { // $domain_entered IIRS_0_debug_print("no domain entered, or 'none' entered"); } ?> </pre></div> <?php if (IIRS_0_setting('image_entry')) { ?> <script src="https://www.google.com/jsapi?key=<?php IIRS_0_print(IIRS_GOOGLE_API_KEY); ?> " type="text/javascript"></script> <script type="text/javascript"> function IIRS_0_OnLoad() { var searchControl = new google.search.SearchControl();
<div id="IIRS_0_debug"><pre> debug output: <?php /* Manual Initiative Profile listing page * NOTE: this should NOT normally be used * The framework system should list the posts / nodes / whatevers natively * thus using the local templating system and all fitting in rather nicely * use that page instead and override the edit function * * Redirect all TI editing to /IIRS/edit to prevent users from going in to the host framework editing suite */ global $debug_environment; require_once IIRS__COMMON_DIR . 'utility.php'; require_once IIRS__COMMON_DIR . 'framework_abstraction_layer.php'; require_once IIRS__COMMON_DIR . 'environment.php'; IIRS_0_debug_print($debug_environment); $all_TIs = IIRS_0_TIs_all(); usort($all_TIs, 'IIRS_0_sort_date_desc'); $usersTI = IIRS_0_details_TI_user(); ?> </pre></div> <div id="IIRS_0"> <style> body .entry-meta {display:block;} </style> <div class="IIRS_0_h1"><?php IIRS_0_print_translated_HTML_text(IGNORE_TRANSLATION, 'list of Transition Initiative around the world'); ?> <?php
// need to get a specific TI in this view // by default we use the users TI // but also this view can display one if already set // and also the mode to view the data is sent through: // list_mode: true indicates that the TI is appearing in a list $IIRS_error = NULL; if (!isset($TI)) { $TI = IIRS_0_details_TI_user(); } if (!isset($list_mode)) { $list_mode = false; } $full_mode = !$list_mode; if (!$TI || !is_array($TI)) { $IIRS_error = new IIRS_Error(IIRS_USER_NO_ASSOCIATED_TI, 'There is no Initiative associated with this user', 'TI not linked to this user', IIRS_MESSAGE_USER_ERROR, IIRS_MESSAGE_NO_USER_ACTION); IIRS_0_debug_print($IIRS_error); } // ------------------------------------------------------- field pre-formatting $website = NULL; if (!isset($TI['domain']) || empty($TI['domain'])) { $website = IIRS_0_translation('currently no website'); } else { $website = '<a target="_blank" href="http://' . IIRS_0_escape_for_HTML_href($TI['domain']) . '">' . IIRS_0_translation('website') . '</a>'; } $maps_href = "https://www.google.com/maps/@{$TI['location_latitude']},{$TI['location_longitude']},16z"; ?> </pre></div> <div id="IIRS_0"> <?php if ($IIRS_error) {
// SECURITY: IIRS_RAW_USER_INPUT indicates that the dangerous USER INPUT will not have slashes added before single quotes // pay attention to appropriately escape when outputting these values into the HTML stream $town_name = IIRS_0_input('town_name', IIRS_RAW_USER_INPUT); $initiative_name = IIRS_0_input('initiative_name', IIRS_RAW_USER_INPUT); $native_ti_ID = IIRS_0_input('native_ti_ID'); $town_name_base = IIRS_0_input('town_name_base'); $summary = IIRS_0_input('summary'); $domain = IIRS_0_input('domain'); $domain_other = IIRS_0_input('domain_other'); if (!isset($domain) || empty($domain)) { $domain = $domain_other; } if ($location_value_serialised = IIRS_0_input('place')) { $location_array = unserialize(urldecode($location_value_serialised)); if ($location_array == $location_array_not_specified) { IIRS_0_debug_print('location not specified'); } $location_description = $location_array['description']; $location_latitude = $location_array['latitude']; $location_longitude = $location_array['longitude']; $location_country = $location_array['country']; $location_full_address = $location_array['full_address']; $location_granuality = $location_array['granuality']; $location_bounds = $location_array['bounds']; } //-------------------------------------------------------------------- user $native_user_ID = IIRS_0_input('native_user_ID'); $name = IIRS_0_input('name'); $email = IIRS_0_input('email'); $pass = IIRS_0_input('pass'); $phone = IIRS_0_input('phone');
<?php /* Copyright 2015, 2016 Transition Network ltd * This program is distributed under the terms of the GNU General Public License * as detailed in the COPYING file included in the root of this plugin */ ?> <?php if (!class_exists('Thread')) { IIRS_0_debug_print('no PECL Thread class: implementing synchronous domain checking'); class Thread { // implement a non-Threaded solution public function start() { $this->run(); } } } class IIRS_DomainChecker_Thread extends Thread { /* DNS checking domains asynchronously * PECL pthreads >= 2.0.0 * http://php.net/manual/en/class.thread.php */ static $thread_count = 0; static $valid_domains = array(); public function __construct($_domain) { $this->domain = $_domain;
<?php /* Copyright 2015, 2016 Transition Network ltd * This program is distributed under the terms of the GNU General Public License * as detailed in the COPYING file included in the root of this plugin */ ?> <div id="IIRS_0_debug"><pre> debug output: <?php require_once IIRS__COMMON_DIR . 'utility.php'; require_once IIRS__COMMON_DIR . 'framework_abstraction_layer.php'; require_once IIRS__COMMON_DIR . 'environment.php'; require_once IIRS__COMMON_DIR . 'registration/inputs.php'; //------------------------------------- values IIRS_0_TI_update_TI(array('summary' => $summary)); $url = IIRS_0_setting('thankyou_for_registering_url'); if (empty($url)) { $url = IIRS_0_URL_view_TI(); } if ($url) { IIRS_0_redirect($url); } IIRS_0_debug_print("thankyou_for_registering_url: [{$url}]"); ?> </pre></div>
// values fo the desciption LI $location_array['description'] = $TI['location_description']; $location_array['latitude'] = $TI['location_latitude']; $location_array['longitude'] = $TI['location_longitude']; $location_array['country'] = $TI['location_country']; $location_array['full_address'] = $TI['location_full_address']; $location_array['granuality'] = $TI['location_granuality']; $location_array['bounds'] = $TI['location_bounds']; $location_options = IIRS_0_location_to_HTML($location_array, $location_uniques, true); // true = selected } else { $IIRS_error = new IIRS_Error(IIRS_USER_NO_ASSOCIATED_TI, 'There is no Initiative associated with this user', 'TI not linked to this user', IIRS_MESSAGE_USER_ERROR, IIRS_MESSAGE_NO_USER_ACTION, $user); IIRS_0_debug_print($IIRS_error); } } else { IIRS_0_debug_print("could not load user: show login screen"); } } // ------------------------------------------------------------- location control if ($towns_searched_for) { // append to the original option // still select the first option in this new list though // which will effectively anull the first selection above $location_options .= IIRS_0_location_search_options($town_name, $location_uniques); $towns_found = !empty($location_options); } // ------------------------------------------------------------- editing area ?> </pre></div> <div id="IIRS_0">
function IIRS_0_set_not_supported_message($function_name) { // recoverable lack of function // but notify programmer that this could be implemented to improve functionality // use IIRS_0_function_required() for fatal requirement IIRS_0_debug_print("[{$function_name}] not supported currently (non-fatal)"); return FALSE; }
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; }
} */ } // ------------------------------------------------------------------------- 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 if (is_array($TI_same_name)) { // ok, so we have a registration with an identical initiative 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
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; }
$selected_class = $option == 1 ? 'selected' : ''; // SECURITY: $full_domain is constructed from user input $full_domain_escaped = IIRS_0_escape_for_HTML_href($full_domain); $view_in_new_window = IIRS_0_translation('view in new window'); $nice_domains_html .= <<<HTML <li class="{$selected_class}"> <input {$selected} name="domain" class="IIRS_0_radio" value="{$full_domain}" type="radio" id="IIRS_0_domain_{$option}_input" /> <label for="IIRS_0_domain_{$option}_input"> {$full_domain} <div class="IIRS_0_status"><a target="_blank" href="http://{$full_domain}">{$view_in_new_window}</a></div> </label> </li> HTML; $option++; } else { IIRS_0_debug_print(" invalid"); } } } } } ?> </pre></div> <div id="IIRS_0"> <?php if ($TI_save_error) { // IIRS_0_set_translated_error_message( ... ) uses IIRS_0_set_message( ... ) IIRS_0_set_translated_error_message($TI_save_error); } else { // IIRS_0_set_message() will escape the