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') { $success = $ALERT->resume($token); if ($success) { $message = '<p><strong>That alert has been resumed.</strong> You will now receive email alerts on any day when there are entries in Hansard that match your criteria.</p>';
// with the time the alert was created. // We check this exists in the database and if so we run the confirm // function of class ALERT to set the field confirmed in the table // alerts to true. // We then print a nice welcome message. // This depends on there being page definitions in metadata.php // FUNCTIONS // confirm_success() Displays a page with a success confirmation message // confirm_error() Displays a page with an error message // INITIALISATION include_once "../../../includes/easyparliament/init.php"; include_once "../../../includes/easyparliament/member.php"; include_once INCLUDESPATH . '../../../phplib/crosssell.php'; // Instantiate an instance of ALERT $ALERT = new ALERT(); $success = $ALERT->confirm(get_http_var('t')); if ($success) { confirm_success($ALERT); } else { confirm_error(); } // FUNCTION: confirm_success function confirm_success($ALERT) { global $PAGE, $this_page, $THEUSER; $this_page = 'alertconfirmsucceeded'; $criteria = $ALERT->criteria_pretty(true); $email = $ALERT->email(); $extra = null; $PAGE->page_start(); $PAGE->stripe_start();
/** * Test that confirming an alert with an invalid token succeeds */ public function testConfirmInvalid() { $ALERT = new ALERT(); $response = $ALERT->confirm('1::badtoken'); $this->assertEquals(false, $response); }