Пример #1
0
            $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('@', '&#64;', CONTACTEMAIL) . "'>email us</a> and let us\n        know, and we'll help out!</p>";
    }
}
$details = array();
if ($THEUSER->loggedin()) {
    $details['email'] = $THEUSER->email();
    $details['email_verified'] = true;
} elseif ($alert) {
    $details['email'] = $alert['email'];
    $details['email_verified'] = true;
Пример #2
0
// where the value of 't' is a form of their registration token.
// This token is a salted version of their email address concatenated
// with the time the alert was created.
// We check this exists in the database and if so we run the delete
// function of class ALERT to set the field deleted in the table
// alerts to true.
// We then print a confirmation message.
// This depends on there being page definitions in metadata.php
// FUNCTIONS
// delete_success()		Displays a page with a success confirmation message
// delete_error()		Displays a page with an error message
// INITIALISATION
include_once "../../../includes/easyparliament/init.php";
// Instantiate an instance of ALERT
$ALERT = new ALERT();
$success = $ALERT->delete(get_http_var('t'));
if ($success) {
    delete_success();
} else {
    delete_error();
}
// FUNCTION:  delete_success
function delete_success()
{
    global $PAGE, $this_page;
    $this_page = 'alertdeletesucceeded';
    $PAGE->page_start();
    $PAGE->stripe_start();
    ?>
	
	<p>Your alert has been unsubscribed.</p>
Пример #3
0
 /**
  * Test that we can't delete an alert with a bad token
  */
 public function testDeleteInvalid()
 {
     $ALERT = new ALERT();
     $response = $ALERT->delete('1::badtoken');
     $this->assertEquals(false, $response);
 }