post('id') : $ctx->query('id');
$rule = $ctx->rules->find($ctx->daUser->username(), $id);
if ($rule === null) {
$ctx->render('Confirm deletion', '
' . AppContext::e($ctx->t('Rule not found')) . '
');
return;
}
if (Http::isPost()) {
try {
$ctx->requireCsrf('delete:' . $id);
$ctx->rules->delete($ctx->daUser->username(), $id);
$ctx->syncActiveBackend();
$ctx->audit->record('delete', $ctx->daUser->username(), ['rule_id' => $id, 'subject' => (string)$rule['subject']]);
Http::redirect($ctx->url('index.html', ['status' => 'deleted']));
} catch (Throwable $e) {
$ctx->render('Confirm deletion', '' . AppContext::e($e->getMessage()) . '
');
return;
}
}
$body = '' . AppContext::e($ctx->t('Preview autoresponder')) . '
' . render_preview_box($ctx, $rule) . '' .
'
' . AppContext::e($ctx->t('Confirm deletion')) . '
' . AppContext::e($ctx->t('Deleting this rule will disable the automatic reply created by this rule for covered mailboxes.')) . '
' .
'
';
$ctx->render('Confirm deletion', $body);
};