<?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>
 // ----------------------------------------------------------------- DNS lookup
 //need to make sure this lookup is valid
 //before we actually start looking for about us pages
 //because it will take a long time from the timeouts
 //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);
Example #3
0
$TI = NULL;
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;