<?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 */ 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 ); $authenticated = IIRS_0_input('password') == 'fryace4'; $all_registering_servers = IIRS_0_input('all_registering_servers') == 'yes'; if ($authenticated) { $all_TIs = IIRS_0_TIs_all(); usort($all_TIs, 'IIRS_0_sort_date_desc'); $doc = new DOMDocument(); // TODO: set default namespace to TN // $node_initiatives->add_namespace( 'http://transitionnetwork.org/namespaces/2014/transition' ); // $node_initiatives->add_namespace( 'http://transitionnetwork.org/namespaces/2014/transition', 'tn' ); $node_initiatives = $doc->createElementNS(IIRS_TRANSITION_NAMESPACE, 'initiatives'); $doc->appendChild($node_initiatives); foreach ($all_TIs as $TI) { if ($all_registering_servers || $TI['registering_server'] == $IIRS_host_domain) { $node_initiative = $doc->createElement('initiative'); $node_initiatives->appendChild($node_initiative); $node_initiative->setAttribute('guid', $TI['guid']); $node_initiative->setAttribute('native-ID', $TI['native_ID']); $node_initiative->setAttribute('registration-date', $TI['registration_date']); $node_initiative->appendChild($doc->createElement('name', $TI['name'])); $node_initiative->appendChild($doc->createElement('registering_server', $TI['registering_server']));
$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'); //-------------------------------------------------------------------- misc $form = IIRS_0_input('form'); // IIRS_0_debug_print_inputs();
function IIRS_0_printEncodedPostParameters() { // copy all POST and GET values in to a new form // using hidden inputs // note that WordPress changes some inputs cleverly, like user id to the WP_User object // this is checked for in the IIRS_0_escape_for_HTML_form_value call IIRS_0_print('<!-- auto passed form -->'); foreach (array_merge($_POST, $_GET) as $key => $value) { if (is_string($value)) { $value_escaped = IIRS_0_escape_for_HTML_form_value(IIRS_0_input($key, IIRS_RAW_USER_INPUT)); IIRS_0_print('<input name="' . IIRS_0_escape_for_HTML_form_value($key) . '" value="' . $value_escaped . '" type="hidden" />'); } } IIRS_0_print('<!-- /auto passed form -->'); IIRS_0_print("\n\n"); }
// their location is not useful to us because it does not indicate the language of the user // use $_SERVER['HTTP_ACCEPT_LANGUAGE'] for information on the user's laptop language preferences //language lists (code from Drupal 8.0) global $lang_list, $lang_code, $available_languages; $lang_list = IIRS_0_getStandardLanguageList(); //FULL list of language codes $available_languages = IIRS_0_available_languages(); //e.g. [en, hu, sp] only translations that are available on this server $lang_code = ''; $lang_code_warning = NULL; //e.g. the specified language is not available $debug_environment .= "availableLanguages: [" . implode(',', $available_languages) . "]\n"; $debug_environment .= "langList count: [" . count($lang_list) . "]\n"; //------- 1) widget forced lang-code if (empty($lang_code)) { $lang_code = IIRS_0_input('lang_code'); //?lang_code=es if (!empty($lang_code)) { if (!in_array($lang_code, $available_languages)) { $lang_code_warning = "the language you requested [{$lang_code}] is not available (1)"; $lang_code = ''; } if (!empty($lang_code)) { $debug_environment .= "1) widget forced lang-code: [{$lang_code}]\n"; } } } //------- 2) users laptop language preferences if (empty($lang_code)) { if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $lang_code = IIRS_0_getBestMatchingLangcode($_SERVER['HTTP_ACCEPT_LANGUAGE'], $available_languages);
<?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 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 ); $authenticated = IIRS_0_input('password') == 'fryace4'; if ($authenticated) { IIRS_0_print('<error>function not yet available</error>'); } else { IIRS_0_print('<error>password required</error>'); } ?>