$status = dadem_get_area_status($fyr_representative['voting_area']); dadem_check_error($status); if ($parent_status != 'none' || $status != 'none'){ $election_error = cobrand_election_error_message($cobrand); if (!$election_error) { $election_error = 'Sorry, an election is forthcoming or has recently happened here.'; } template_show_error($election_error); } //Check the contact method exists $success = msg_recipient_test($fyr_values['who']); if (rabx_is_error($success)) { if ($success->code == FYR_QUEUE_MESSAGE_BAD_ADDRESS_DATA) { $error_msg = cobrand_bad_contact_error_msg($cobrand, $eb_area_info); if (!$error_msg) { $error_msg = bad_contact_error_msg($eb_area_info); } template_show_error($error_msg); } elseif ($success->code == FYR_QUEUE_MESSAGE_SHAME) { $error_msg = cobrand_shame_error_msg($cobrand, $fyr_voting_area, $fyr_representative); if (!$error_msg) { $error_msg = shame_error_msg($fyr_voting_area, $fyr_representative); } template_draw("error-shame", array("error_message" => $error_msg)); exit(1); } else { template_show_error($success->text); } }
function recipient_test_error($error, $eb_area, $fyr_voting_area, $fyr_representative) { global $cobrand; if ($error->code == FYR_QUEUE_MESSAGE_BAD_ADDRESS_DATA) { $error_msg = cobrand_bad_contact_error_msg($cobrand, $eb_area); if (!$error_msg) { $error_msg = bad_contact_error_msg($eb_area); } return array('bad', $error_msg); } elseif ($error->code == FYR_QUEUE_MESSAGE_SHAME) { $error_msg = cobrand_shame_error_msg($cobrand, $fyr_voting_area, $fyr_representative); if (!$error_msg) { $error_msg = shame_error_msg($fyr_voting_area, $fyr_representative); } return array('shame', $error_msg); } else { return array('unknown', $error->text); } }