summaryrefslogtreecommitdiff
path: root/inbox_settings.php
diff options
context:
space:
mode:
Diffstat (limited to 'inbox_settings.php')
-rw-r--r--inbox_settings.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/inbox_settings.php b/inbox_settings.php
index 2a720d1..a0b36b5 100644
--- a/inbox_settings.php
+++ b/inbox_settings.php
@@ -17,6 +17,7 @@ class inbox_settings extends rcube_plugin {
$this->register_action('plugin.inbox_settings', [$this, 'render_settings_ui']);
$this->register_action('plugin.inbox_keys', [$this, 'render_keys_ui']);
+ $this->register_action('plugin.inbox_keys_delete', [$this, 'delete_selected_keys']);
}
function scrub_encryption_preference($params) {
@@ -90,6 +91,9 @@ class inbox_settings extends rcube_plugin {
// info the js needs access to
$this->rcmail->output->add_gui_object('keyslist', $attrib['id']);
+ $this->rcmail->output->add_label(
+ 'inbox_settings.confirm_delete_key', 'inbox_settings.deleting_key');
+ // the js in question
$this->rcmail->output->include_script('list.js');
$this->include_script('keys.js');
@@ -175,6 +179,12 @@ class inbox_settings extends rcube_plugin {
return $page_content;
}
+ function delete_selected_keys() {
+ run_query('delete_keys', $_POST['keys']);
+ $this->rcmail->output->set_pagetitle($this->gettext('deleting_key'));
+ $this->rcmail->output->send('plugin');
+ }
+
private static function label_assoc_2d($data) {
$labeled_data = [];
foreach ($data as $row) {
@@ -242,7 +252,7 @@ class inbox_settings extends rcube_plugin {
$sql = str_replace('%h', $db->quote($host, 'text'), $sql);
foreach ($substitutions as $key => $value) {
- $sql = str_replace($key, $db->quote($value, 'text'), $sql);
+ $sql = str_replace($key, self::quote_replacement($db, $value), $sql);
}
$result = $db->query($sql);
@@ -259,6 +269,13 @@ class inbox_settings extends rcube_plugin {
return $ndresult;
}
+ private static function quote_replacement($db, $value) {
+ if (!is_array($value)) return $db->quote($value, 'text');
+ return '(' . implode(', ', array_map(function ($inner) {
+ return self::quote_replacement($db, $inner);
+ }, $value)) . ')';
+ }
+
private static function parse_dsn($dsn) {
if (strpos($dsn, '%')) {
// parse DSN and replace variables in hostname