Example #1
0
    if ($options['extra_space']) {
        $form .= ' ';
    }
    $form .= '<a href="/about-constituency" class="help-text">What postcode should I use?</a>';
    // End the form
    if ($options['inner_div']) {
        $form .= '</div>';
    }
    $form .= '</form>';
    return $form;
}
if ($cobrand) {
    $cocode = cobrand_force_default_cocode($cobrand, $cocode);
}
$pc = canonicalise_postcode(get_http_var('pc'));
fyr_rate_limit(array("postcode" => array($pc, "Postcode that's been typed in")));
if ($new_pc = validate_easily_mistyped_postcode($pc)) {
    header('Location: ' . url_new('', true, 'pc', $new_pc));
    exit;
}
// Redirect from parlparse person identifier
$person = get_http_var("person");
if ($person) {
    $ids = dadem_get_same_person($person);
    dadem_check_error($ids);
    // TODO: Fix up case when a person is a representative multiple times
    // (for now we just take the most recent made one, i.e. last in list)
    $id = $ids[count($ids) - 1];
    header('Location: ' . url_new('write', false, 'fyr_extref', fyr_external_referrer(), 'cocode', get_http_var('cocode'), 'who', $id));
    exit;
}
Example #2
0
}

# Determine if this is a message to be sent to a group of representatives
$fyr_group_msg = false;
if ($fyr_who == 'all')
    $fyr_group_msg = true;

// Rate limiter
$limit_values = array('postcode' => array($fyr_postcode, "Postcode that's been typed in"));
if ($fyr_who != 'all') {
    $limit_values['who'] = array($fyr_who, "Representative id from DaDem");
}
if (array_key_exists('body', $fyr_values) and strlen($fyr_values['body']) > 0) {
    $limit_values['body'] = array($fyr_values['body'], "Body text of message");
}
fyr_rate_limit($limit_values);

// For a group mail, get a group_id for transaction with the fax queue now
// and generate message ids later
if ($fyr_group_msg) {
    
    if (array_key_exists('fyr_grpid', $fyr_values))
        $grpid = $fyr_values['fyr_grpid'];
    else {
        $grpid = msg_create_group();
        msg_check_error($grpid);
        $fyr_values['fyr_grpid'] = $grpid;
    }

} else {
Example #3
0
function rate_limit($fyr_values)
{
    $limit_values = array('postcode' => array($fyr_values['pc'], "Postcode that's been typed in"));
    if ($fyr_values['who'] != 'all') {
        $limit_values['who'] = array($fyr_values['who'], "Representative id from DaDem");
    }
    if (array_key_exists('body', $fyr_values) and strlen($fyr_values['body']) > 0) {
        $limit_values['body'] = array($fyr_values['body'], "Body text of message");
    }
    fyr_rate_limit($limit_values);
}
Example #4
0
$fyr_postcode = canonicalise_postcode(get_http_var('pc'));
if ($fyr_postcode == '') {
    header('Location: /');
    exit();
}

$a_forward = get_http_var('a');
if ($cobrand) {
    $a_forward = cobrand_force_representative_type($cobrand, $cocode, $a_forward);
}

$area_types = fyr_parse_area_type_list($a_forward);

debug("FRONTEND", "postcode is $fyr_postcode");
debug_timestamp();
fyr_rate_limit(array('postcode' => array($fyr_postcode, "Postcode that's been typed in ")));

// Find all the districts/constituencies and so on (we call them "voting
// areas") for the postcode
$voting_areas = mapit_get_voting_areas($fyr_postcode);
if (rabx_is_error($voting_areas)) {
    header('Location: ' . url_new('/', true, 'pc', $fyr_postcode));
    exit;
}
debug_timestamp();

// Limit to specific types of representatives
$fyr_all_url = null;
if ($area_types) {
    $a = array();
    foreach (array_keys($area_types) as $t) {
Example #5
0
function get_postcode()
{
    $postcode = canonicalise_postcode(get_http_var('pc'));
    if (!$postcode) {
        header('Location: /');
        exit;
    }
    debug("FRONTEND", "postcode is {$postcode}");
    fyr_rate_limit(array('postcode' => array($postcode, "Postcode that's been typed in ")));
    return $postcode;
}
Example #6
0
$messages = array(
    array(name => "Sammy Streetwise", body => "I'm writing to complain
    about litter not being collected.  Every week I put out more and
    more rubbish, but the council does not come.  It's a disgrace that I
    pay my council tax but a simple thing like litter collection doesn't
    happen.  Can you please sort it out?", id => 0),
    array(name => "Freddy Frantic", body => "I'm writing to say that I
    think MPs aren't paid enough expenses to do their job properly.  I
    am sick and tired of newspapers claiming that MPs expenses are just
    to line their pockets.  They are not, they are to help them do their
    job.  Just thought I'd let you know how I felt.", id
    => 1),);
$fyr_postcode = "zz99zz";
debug("FRONTEND", "who is $fyr_who");
debug("FRONTEND", "postcode is $fyr_postcode");
fyr_rate_limit(array('postcode' => array($fyr_postcode, "Postcode that's been typed in"), 
                     'who' => array($fyr_who, "Representative id from DaDem")));

// What to do
$action = get_http_var('action');
if ($action == "") $action = "index";

// Look up info about the representative who is using the interface
$representative = dadem_get_representative_info($fyr_who);
$voting_area = mapit_get_voting_area_info($representative['voting_area']);

// Add extra fields
$newmessages = array();
foreach ($messages as $message) {
    $message['short_body'] = trim_characters($message['body'], 0, 200);
    $message['url'] = "reps?action=forward&id=" . $message['id'];
    $newmessages[] = $message;
Example #7
0
<?php

/*
 * Record answer to questionnaire to find out whether the representative
 * replied to their constituent.
 * 
 * Copyright (c) 2004 UK Citizens Online Democracy. All rights reserved.
 * Email: francis@mysociety.org. WWW: http://www.mysociety.org
 *
 * $Id: response.php,v 1.11 2009-11-19 11:38:18 matthew Exp $
 * 
 */
require_once "../phplib/fyr.php";
require_once "../phplib/queue.php";
require_once "../commonlib/phplib/utility.php";
fyr_rate_limit(array());
$token = get_http_var('token');
if (!$token) {
    $missing_token_message = cobrand_missing_token_message($cobrand);
    if (!$missing_token_message) {
        $missing_token_message = "Please make sure you copy the URL from your email properly. The token was missing.";
    }
    template_show_error($missing_token_message);
}
$answer = get_http_var('answer');
if ($answer != "yes" && $answer != "no") {
    $missing_answer_message = cobrand_missing_answer_message($cobrand);
    if (!$missing_answer_message) {
        $missing_answer_message = "Please make sure you copy the URL from your email properly. The answer type was missing.";
    }
    template_show_error($missing_answer_message);