diff --git a/www/docs/postcode/address_list.php b/www/docs/postcode/address_list.php deleted file mode 100644 index f84593d9ed..0000000000 --- a/www/docs/postcode/address_list.php +++ /dev/null @@ -1,18 +0,0 @@ -
- - -

Please pick your address from the list below: - -

- '; - print ucwords(strtolower($address->address)); - print ''; -} -?> - -

- - -

diff --git a/www/docs/postcode/index.php b/www/docs/postcode/index.php index fdecaab71b..5ebce37d46 100644 --- a/www/docs/postcode/index.php +++ b/www/docs/postcode/index.php @@ -24,31 +24,11 @@ # 2024 ELECTION EXTRA -$data['address'] = $address = get_http_var('address'); -if ($address) { - $dc_data = democracy_club_address($address); - $constituencies = mapit_address($address, $pc); -} else { - $dc_data = democracy_club_postcode($pc); - if (!isset($dc_data->error) && $dc_data->address_picker) { - show_address_list($pc, $dc_data->addresses); - exit; - } - $constituencies = mapit_postcode($pc); -} -if (!$constituencies || isset($dc_data->error) || !$dc_data->dates) { +$constituencies = mapit_postcode($pc); +if (!$constituencies) { postcode_error("Sorry, " . _htmlentities($pc) . " isn't a known postcode"); } -$data['ballot'] = null; -foreach ($dc_data->dates as $date) { - if ($date->date != '2024-07-04') continue; - foreach ($date->ballots as $b) { - if ($b->election_id != 'parl.2024-07-04') continue; - $data['ballot'] = $b; - } -} - if (isset($constituencies['SPE']) || isset($constituencies['SPC'])) { $data['multi'] = "scotland"; $MEMBER = fetch_mp($pc, $constituencies); @@ -201,35 +181,11 @@ function member_redirect(&$MEMBER) { } } -function democracy_club_postcode($pc) { - $pc = urlencode($pc); - $data = web_lookup("https://developers.democracyclub.org.uk/api/v1/postcode/$pc/?include_current=1&auth_token=" . OPTION_DEMOCRACYCLUB_TOKEN); - $data = json_decode($data); - return $data; -} - -function democracy_club_address($address) { - $address = urlencode($address); - $data = web_lookup("https://developers.democracyclub.org.uk/api/v1/address/$address/?include_current=1&auth_token=" . OPTION_DEMOCRACYCLUB_TOKEN); - $data = json_decode($data); - return $data; -} - function mapit_postcode($postcode) { $filename = 'postcode/' . rawurlencode($postcode); return mapit_lookup('postcode', $filename); } -function mapit_address($address, $pc) { - $address = urlencode($address); - $url = str_replace('{s}', $address, OPTION_MAPIT_UPRN_LOOKUP); - $file = web_lookup($url); - $r = json_decode($file); - if (isset($r->error)) return mapit_postcode($pc); - $filename = 'point/4326/' . $r->wgs84_lon . ',' . $r->wgs84_lat; - return mapit_lookup('point', $filename); -} - function mapit_lookup($type, $filename) { global $mapit_ids; $file = web_lookup(OPTION_MAPIT_URL . $filename); @@ -255,14 +211,6 @@ function mapit_lookup($type, $filename) { return $areas; } -function show_address_list($pc, $addresses) { - global $PAGE; - $PAGE->page_start(); - $PAGE->stripe_start(); - include("address_list.php"); - $PAGE->page_end(); -} - function web_lookup($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);