Esempio n. 1
0
        $postcode_areas = mapit_call('postcode', $fyr_values['pc']);
        mapit_check_error($postcode_areas);
        $area_ids = array_keys($postcode_areas['areas']);
        if (!in_array($fyr_representative['voting_area'], $area_ids)) {
            mismatch_error();
        }
        $eb_type = $va_inside[$fyr_voting_area['type']];
        foreach ($postcode_areas['areas'] as $id => $arr) {
            if ($arr['type'] == $eb_type) {
                $eb_area = $arr;
                break;
            }
        }
    }
    // Data bad due to election etc?
    check_area_status($eb_area, $fyr_voting_area);
    //Check the contact method exists
    $success = msg_recipient_test($fyr_values['who']);
    if (rabx_is_error($success)) {
        list($error_type, $error_msg) = recipient_test_error($success, $eb_area, $fyr_voting_area, $fyr_representative);
        $values = array('error_message' => $error_msg);
        if ($error_type == 'shame') {
            $values['title'] = 'Oh no! What a shame!';
        }
        template_draw("error-general", $values);
        exit(1);
    }
    //Assemble the name string
    $stash['rep_text'] = $fyr_voting_area['rep_prefix'] . " " . $fyr_representative['name'] . " " . $fyr_voting_area['rep_suffix'];
}
generate_signature($fyr_values);
Esempio n. 2
0
    $eb_area = elected_body_area($voting_areas, $va_types);
    list($representatives, $rep_counts) = get_rep_counts($va_areas, $area_representatives);
    $rep_count = array_sum($rep_counts);
    $col_blurb = col_blurb($va_types, $va_areas[0], $eb_area, $rep_count, $rep_counts[0]);
    if ($has_list_reps) {
        list($text, $col_after) = display_reps_two_types($va_types, $va_areas, $representatives, $rep_count, $rep_counts);
    } else {
        list($text, $col_after) = display_reps_one_type($va_types[0], $va_areas[0], $representatives[0], $rep_count, $meps_hidden);
    }
    if ($rep_count > 1) {
        $heading = "Your {$va_areas[0]['rep_name_plural']}";
    } else {
        $heading = "Your {$va_areas[0]['rep_name']}";
    }
    // Data bad due to election etc?
    if ($disabled = check_area_status($va_areas[0])) {
        $text = $disabled;
        $heading = "<strike>{$heading}</strike>";
    }
    array_push($fyr_rep_descs, $col_blurb);
    array_push($fyr_rep_lists, $text);
    array_push($fyr_representatives, $text);
    array_push($fyr_blurbs, $col_blurb);
    array_push($fyr_more, $col_after);
    array_push($fyr_headings, $heading);
    debug_timestamp();
}
// A/B Testing Hack!
if (isset($_GET['t'])) {
    $template = $_GET['t'];
} else {