function IIRS_0_registration_email_html($name, $password = null)
 {
     $body = '<h1>' . IIRS_0_translation('welcome to Transition') . '</h1>';
     $body .= '<p>' . IIRS_0_translation('here are your registration details') . '<br/>';
     $body .= '<b>' . IIRS_0_translation('username') . '</b>: ' . $name;
     if ($password) {
         $body .= ', <b>' . IIRS_0_translation('password') . '</b>: ' . $password;
     }
     $body .= '</p>';
     $body .= '<p>' . IIRS_0_translation('reply to this email with any thoughts / excitement / ideas / congratulations / bugs / other things :)') . '</p>';
     return $body;
 }
     // 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.");
         }
     } else {
         IIRS_0_debug_print("aboutus attemps all returned blank strings or [404] errors.");
     }
     error_reporting($old_error_reporting);
 } else {
     // $valid_dns
<?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 
require_once IIRS__COMMON_DIR . 'utility.php';
require_once IIRS__COMMON_DIR . 'framework_abstraction_layer.php';
require_once IIRS__COMMON_DIR . 'environment.php';
?>
*/

<?php 
IIRS_0_print_javascript_variable('g_tSystemError', IIRS_0_translation('system error'));
IIRS_0_print_javascript_variable('g_tFormNotValid', IIRS_0_translation('form not valid'));
IIRS_0_print_javascript_variable('g_tEmailNotValidFormat', IIRS_0_translation('email address not valid format'));
IIRS_0_print_javascript_variable('g_tDomainRequired', IIRS_0_translation('a website selection option is required'));
IIRS_0_print_javascript_variable('g_tViewFullProfile', IIRS_0_translation('view full profile'));
    $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) {
    // IIRS_0_set_translated_error_message( ... ) uses IIRS_0_set_message( ... )
    IIRS_0_set_translated_error_message($IIRS_error);
} else {
    ?>
    <div>
      <!-- the framework always prints the title -->
      <?php 
  </style>

  <div class="IIRS_0_h1"><?php 
IIRS_0_print_translated_HTML_text(IGNORE_TRANSLATION, 'list of Transition Initiative around the world');
?>
    <?php 
IIRS_0_print_language_selector();
?>
  </div>

  <ul id="list" class="IIRS_0_bare_list">
    <?php 
foreach ($all_TIs as $TI) {
    $date = $TI['date'];
    $editable = $usersTI && $usersTI['native_ID'] == $TI['native_ID'];
    $edit_link = $editable ? '<a class="IIRS_0_edit_link post-edit-link" href="/IIRS/edit">' . IIRS_0_translation(IGNORE_TRANSLATION, 'edit') . '</a>' : '';
    $name_escaped = IIRS_0_escape_for_HTML_text($TI['name']);
    $html = <<<HTML
        <li>
          <h2 class="entry-title"><a href="/IIRS/view?ID={$TI['native_ID']}">{$name_escaped}</a></h2>
          <div class="entry-meta">
            <span class="edit-link">{$edit_link}</span>
          </div>
          <div class="IIRS_0_status">{$date}</div>
        </li>
HTML;
    IIRS_0_print_HTML($html);
}
?>
  </ul>
</div>
function IIRS_0_message_html($mess_no, $message, $message_detail = null, $level = IIRS_MESSAGE_USER_INFORMATION, $user_action = null, $args = null)
{
    // SECURITY: $message is text, NOT HTML. it will be pushed through IIRS_0_escape_for_HTML_text()
    // SECURITY: $message_detail is text. SHOULD NOT be dynamic. it will be translated
    // the caller should NOT escape the input
    // IIRS_0_message_html() output should be pushed through IIRS_0_print_HTML()
    // $message is also NOT translated. the caller must use the translation functions
    // this is because the message may comprise of several separately translated parts
    $class = IIRS_0_message_class($level);
    $html = "<div class=\"IIRS_0_message IIRS_Error IIRS_Error_{$mess_no} IIRS_0_message_level_{$class}\">";
    if ($user_action) {
        $html .= '<a class="IIRS_0_user_action" href="' . $user_action . '">' . IIRS_0_translation('continue') . '</a>';
    }
    if ($message) {
        $html .= '<div class="IIRS_friendly_err_message">' . IIRS_0_escape_for_HTML_text($message) . '</div>';
    }
    $html .= '<div class="IIRS_message_detail">';
    $html .= IIRS_0_translation($message_detail);
    if ($args) {
        $html .= '<ul>';
        foreach ($args as $key => $value) {
            $html .= "<li>{$key} = {$value}</li>";
        }
        $html .= '</ul>';
    }
    $html .= '</div>';
    $html .= '</div>';
    return $html;
}
        IIRS_0_print_HTML_form_value($domain);
        ?>
" />
      </div>

      <ul id="IIRS_0_list_selector">
        <?php 
        if ($towns_searched_for && !$towns_found) {
            ?>
          <li class="IIRS_0_place IIRS_0_message IIRS_0_message_level_information">
            <img src="<?php 
            IIRS_0_print_HTML_image_src("{$IIRS_URL_image_stem}/information");
            ?>
" />
            <?php 
            IIRS_0_print_HTML_text(IIRS_0_translation('no towns found matching') . " {$town_name} " . '<br/>' . IIRS_0_translation('you will need to email') . ' ' . IIRS_EMAIL_TEAM_LINK . ' ' . IIRS_0_translation('to register by email because we cannot find your town on our maps system!'));
            ?>
          </li>
        <?php 
        }
        ?>
        <?php 
        IIRS_0_print_HTML($location_options);
        ?>
        <li id="IIRS_0_other" class="IIRS_0_place">
          <?php 
        IIRS_0_print_translated_HTML_text('change location');
        ?>
:
          <input id="IIRS_0_research_town_name_new" value="<?php 
        IIRS_0_print_HTML_form_value($town_name);
      <div id="IIRS_0_details_teaser">
        <?php 
    IIRS_0_print_translated_HTML_text('This email address may be used by people in your area who would like to contact you and / or join your projects.');
    ?>
      </div>

      <br class="IIRS_0_clear" />
      <?php 
    /* this is the submit button for the initial POST data in to the IIRS database
     * we are creating several buttons and hiding one of them to prevent robots from clicking anything
     * the previous screen of course requires a valid location which will also thwart robots
     */
    $false_submit_HTML = '<input name="false_submit" type="submit" class="IIRS_0_bigbutton IIRS_0_false_submit" value="register" />';
    print $false_submit_HTML;
    print $false_submit_HTML;
    print $false_submit_HTML;
    print $false_submit_HTML;
    print "<input name=\"submit\" type=\"submit\" {$no_towns_found_disabled} class=\"IIRS_0_bigbutton {$no_towns_found_disabled_class} \" value=\"" . IIRS_0_translation('join network') . " &gt;&gt;\" />";
    print $false_submit_HTML;
    print $false_submit_HTML;
    ?>

      <?php 
    IIRS_0_print_translated_HTML_text('and then connect with local Transition Initiatives :)');
    ?>
    </div></form>
  <?php 
}
?>
</div>
//<title>Registration SCREEN #1 (usually a sidebar WIDGET)</title>
?>

<div id="IIRS_0_debug"><pre>
debug output:
<?php 
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';
require_once IIRS__COMMON_DIR . 'registration/inputs.php';
IIRS_0_debug_print($debug_environment);
// Why register can be a short text or a link
// Links must start with http://
$why_register_html = '';
$why_register_link_details = IIRS_0_translation('(why register link. format: http://[web address] [link text])');
if ($why_register_link_details != '(why register link. format: http://[web address] [link text])') {
    $why_register_link = substr($why_register_link_details, 0, strpos($why_register_link_details, " "));
    $why_register_text = substr($why_register_link_details, strpos($why_register_link_details, " ") + 1);
    $why_register_html = "<a href=\"{$why_register_link}\">{$why_register_text}</a>";
}
?>
</pre></div>

<div id="IIRS_0">
  <div class="IIRS_0_no_javascript IIRS_0_message IIRS_0_message_level_warning">
    <?php 
IIRS_0_print_translated_HTML_text('Oops, Javascript failed to run, services unavailable, please go to');
?>
    &nbsp;<a href="http://transitionnetwork.org/">Transition Network</a>&nbsp;
    <?php 
        }
    }
}
?>
</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
    $message = IIRS_0_translation('you are now registered.') . " {$initiative_name} " . IIRS_0_translation('is go!');
    if ($IIRS_widget_mode) {
        $message .= "\n" . IIRS_0_translation('you will need to log in to') . ' TransitionNetwork.org ' . IIRS_0_translation('to manage your registration, NOT this website') . '.';
    }
    IIRS_0_set_message(IIRS_MESSAGE_SUCCESS_REGISTRATION, $message);
    ?>

    <form method="POST" id="IIRS_0_form_popup_domain_selection" action="summary_projects" class="IIRS_0_clear IIRS_0_formPopupNavigate"><div>
      <?php 
    IIRS_0_printEncodedPostParameters();
    ?>
      <input name="initiative_name_base" type="hidden" value="<?php 
    IIRS_0_print_HTML_form_value($initiative_name_base);
    ?>
" />
      <input name="native_user_ID" type="hidden" value="<?php 
    IIRS_0_print_HTML_form_value($native_user_ID);
    ?>
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;
}
}
?>
</p>
<ul>
  <?php 
$nice_domains = IIRS_0_get_nice_domains('{$domain_part}');
foreach ($nice_domains as $nice_domain) {
    print "<li>{$nice_domain}</li>";
}
?>
</ul>

<p>
  The Top-Level-Domains are also configurable by translating the "<i>nice_tlds</i>" string.
  It should look something like this:
  <pre>org,org.uk,com,net</pre>
  Below is the current list of domain name checks that will be run.
  <?php 
if (IIRS_0_translation('nice_tlds') == 'nice_tlds') {
    print 'It is currently the <b>English</b> default list with your domain added.';
}
?>
</p>
<ul>
  <?php 
foreach ($all_TLDs as $TLD) {
    print "<li>{$TLD}</li>";
}
?>
</ul>