summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--config.inc.php.dist26
-rw-r--r--identity_addresses.php42
3 files changed, 73 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a9e8e02
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+composer.phar
+/vendor/
+
+# Config
+config.inc.php
diff --git a/config.inc.php.dist b/config.inc.php.dist
new file mode 100644
index 0000000..2759a34
--- /dev/null
+++ b/config.inc.php.dist
@@ -0,0 +1,26 @@
+<?php
+$config = [];
+
+// PEAR database DSN for performing the query. By default
+// Roundcube DB settings are used.
+// Supported replacement variables:
+// %h - user's IMAP hostname
+// %n - hostname ($_SERVER['SERVER_NAME'])
+// %t - hostname without the first part
+// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
+// %z - IMAP domain (IMAP hostname without the first part)
+$config['identity_addresses_db_dsn'] = '';
+
+// The SQL query used to select a user's supported identity addresses.
+// Supported replacement variables:
+// %h - user's IMAP hostname
+// %n - hostname ($_SERVER['SERVER_NAME'])
+// %t - hostname without the first part
+// %z - IMAP domain (IMAP hostname without the first part)
+// %u - the username (from the session info)
+// %l - the local part of the username
+// (in case the username is an email address)
+// %d - the domain part of the username
+// (in case the username is an email address)
+$config['identity_addresses_query'] = 'SELECT address FROM users WHERE owner = %u';
+?>
diff --git a/identity_addresses.php b/identity_addresses.php
new file mode 100644
index 0000000..600c450
--- /dev/null
+++ b/identity_addresses.php
@@ -0,0 +1,42 @@
+<?php
+class identity_addresses extends rcube_plugin {
+ public $task = 'settings';
+ private $rc;
+
+ function init() {
+ $this->rc = rcmail::get_instance();
+
+ $this->load_config();
+
+ $this->add_hook('identity_form', array($this, 'fix_form'));
+ $this->add_hook('identity_create', array($this, 'validate_create'));
+ $this->add_hook('identity_update', array($this, 'validate_update'));
+ }
+
+ function fix_form($form, $record) {
+ echo 'Form: ';
+ var_dump($form);
+ echo PHP_EOL . 'Record: ';
+ var_dump($record);
+ die(PHP_EOL);
+ }
+
+ function validate_create($login, $record) {
+ echo 'Login: ';
+ var_dump($login);
+ echo PHP_EOL . 'Record: ';
+ var_dump($record);
+ die(PHP_EOL);
+ }
+
+ function validate_update($id, $record) {
+ echo 'ID: ';
+ var_dump($id);
+ echo PHP_EOL . 'Record: ';
+ var_dump($record);
+ die(PHP_EOL);
+ }
+
+ function validate_modification() {}
+}
+?>