check_input() Validates the edited or added alert data and creates error messages. add_alert() Adds alert to database depending on success. display_search_form() Shows the new form to enter alert data. set_criteria() Sets search criteria from information in MP and Keyword fields. */ include_once '../../includes/easyparliament/init.php'; include_once INCLUDESPATH . "easyparliament/people.php"; include_once INCLUDESPATH . "easyparliament/member.php"; include_once INCLUDESPATH . "easyparliament/searchengine.php"; include_once INCLUDESPATH . '../../commonlib/phplib/auth.php'; include_once INCLUDESPATH . '../../commonlib/phplib/crosssell.php'; $this_page = "alert"; $extra = null; $ALERT = new ALERT(); $token = get_http_var('t'); $alert = $ALERT->check_token($token); $message = ''; if ($action = get_http_var('action')) { $success = true; if ($action == 'Confirm') { $success = $ALERT->confirm($token); if ($success) { $criteria = $ALERT->criteria_pretty(true); $message = "<p>Your alert has been confirmed. You will now\n receive email alerts for the following criteria:</p>\n <ul>{$criteria}</ul> <p>This is normally the day after, but could\n conceivably be later due to issues at our or parliament.uk's\n end.</p>"; } } elseif ($action == 'Suspend') { $success = $ALERT->suspend($token); if ($success) { $message = '<p><strong>That alert has been suspended.</strong> You will no longer receive this alert.</p>'; } } elseif ($action == 'Resume') {
/** * Test that an incorrect token (non-numeric alert ID) will fail */ public function testCheckTokenNonNumericId() { $ALERT = new ALERT(); $response = $ALERT->check_token('one:token1'); $this->assertEquals(false, $response); }