示例#1
0
$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>';
        }
    } 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>';
        }
示例#2
0
 /**
  * Test that we can't suspend an alert with a bad token
  */
 public function testSuspendInvalid()
 {
     $ALERT = new ALERT();
     $response = $ALERT->suspend('3::badtoken');
     $this->assertEquals(false, $response);
 }