diff options
| author | Carson Fleming <[email protected]> | 2024-11-21 04:08:05 -0500 |
|---|---|---|
| committer | Carson Fleming <[email protected]> | 2024-11-21 04:08:05 -0500 |
| commit | d0551f958e542a37ea19014b0394b0ca9b4f237e (patch) | |
| tree | a9b0f22ee289b8169168528781b6cc1fb9d588d9 | |
| parent | df6d5c1639067f0dbcba36c9c905ba5b00424fbc (diff) | |
| download | rc-identity-addresses-d0551f958e542a37ea19014b0394b0ca9b4f237e.tar.gz | |
actually that's basically it
| -rw-r--r-- | identity_addresses.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/identity_addresses.php b/identity_addresses.php index e2c1e98..5ddad7c 100644 --- a/identity_addresses.php +++ b/identity_addresses.php @@ -14,9 +14,8 @@ class identity_addresses extends rcube_plugin { } function fix_form($params) { - $record = $params['record']; - $options = array($record['email'] => $record['email']); - $permitted_addresses = $this->get_permitted_addresses($record); + $options = array($_SESSION['username'] => $_SESSION['username']); + $permitted_addresses = $this->get_permitted_addresses(); foreach ($permitted_addresses as $addr) { $options[$addr] = $addr; } @@ -31,16 +30,27 @@ class identity_addresses extends rcube_plugin { } function validate_create($params) { - return array('abort' => false, 'record' => $params['record']); + $record = $params['record']; + return array( + 'abort' => $this->validate_modification($record), + 'record' => $record + ); } function validate_update($params) { - return array('abort' => false, 'record' => $params['record']); + $record = $params['record']; + return array( + 'abort' => $this->validate_modification($record), + 'record' => $record + ); } - function validate_modification() {} + function validate_modification($record) { + return !in_array($record['email'], + $this->get_permitted_addresses($record)); + } - private function get_permitted_addresses($record) { + private function get_permitted_addresses() { if (!($sql = $this->rcmail->config->get('identity_addresses_query'))) { return []; } |
