- $query[] = "UPDATE msgrcpt SET rs = 'R' WHERE mail_id = '$mail_id'";
- } else if ($request == 'delete') {
- $query[] = "UPDATE msgrcpt SET rs = 'D' WHERE mail_id = '$mail_id'";
- } else {
- error("Unknown operation [$request]");
- exit;
- }
- $success = $DB->update($query);
- if (! $success) {
- error("Message not released, contact administrator [$query]");
- exit;
- }
- header('Location: index.php');
+ $util = new Utils;
+ $loggedIn = $util->isLoggedIn();
+ $request = isset($_GET['op']) ? $_GET['op'] : '';
+ if ($loggedIn && isset($_GET['id'])) {
+ $ids = explode(',', $_GET['id']);
+ if ($request == 'block') {
+ // /add/(whitelist|blacklist)/(.+)
+ $query = handleRequest($util, $request, $ids);
+ $data = json_encode($query);
+ if ($util->isAdmin()) {
+ $method = '/add/blacklist';
+ } else {
+ $method = '/add/blacklist/' . $util->getUser();
+ }
+ $success = $util->makeRestCall($method, $data);
+ } else {
+ $query = handleRequest($util, $request, $ids);
+ $success = $DB->update($query);
+ }
+ if (! $success) {
+ if ($request == 'block') {
+ error("Could not blacklist sender");
+ } else {
+ error("Message not released, contact administrator [$query]");
+ }
+ exit;
+ }
+ header('Location: qtadmin.php');