$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>'; } } elseif ($action == 'Delete') { $success = $ALERT->delete($token); if ($success) { $message = '<p><strong>That alert has been deleted.</strong> You will no longer receive this alert.</p>'; } } if (!$success) { $message = "<p>The link you followed to reach this page appears to be\n incomplete.</p> <p>If you clicked a link in your alert email you may\n need to manually copy and paste the entire link to the 'Location' bar\n of the web browser and try again.</p> <p>If you still get this message,\n please do <a href='mailto:" . str_replace('@', '@', CONTACTEMAIL) . "'>email us</a> and let us\n know, and we'll help out!</p>"; } }
/** * Test that we can't delete an alert with a bad token */ public function testResumeInvalid() { $ALERT = new ALERT(); $response = $ALERT->resume('6::badtoken'); $this->assertEquals(false, $response); }