summaryrefslogtreecommitdiff
path: root/plugins/virtuser_query
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-04-23 09:25:22 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-04-23 09:25:22 +0000
commita7f183495283c0b60fb5dcb304e82c046c860167 (patch)
tree8542bb6b8e0611e900a67ebb1e1e471e6a054894 /plugins/virtuser_query
parent53422d0d46dae5de1a62411e4508c0b2dddd6aed (diff)
- code formatting
git-svn-id: https://svn.roundcube.net/trunk@3548 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/virtuser_query')
-rw-r--r--plugins/virtuser_query/virtuser_query.php59
1 files changed, 29 insertions, 30 deletions
diff --git a/plugins/virtuser_query/virtuser_query.php b/plugins/virtuser_query/virtuser_query.php
index 94defc5de..6b025d0ea 100644
--- a/plugins/virtuser_query/virtuser_query.php
+++ b/plugins/virtuser_query/virtuser_query.php
@@ -22,13 +22,13 @@ class virtuser_query extends rcube_plugin
function init()
{
- $this->app = rcmail::get_instance();
- $this->query = $this->app->config->get('virtuser_query');
+ $this->app = rcmail::get_instance();
+ $this->query = $this->app->config->get('virtuser_query');
- if ($this->query) {
- $this->add_hook('user2email', array($this, 'user2email'));
-// $this->add_hook('email2user', array($this, 'email2user'));
- }
+ if ($this->query) {
+ $this->add_hook('user2email', array($this, 'user2email'));
+// $this->add_hook('email2user', array($this, 'email2user'));
+ }
}
/**
@@ -36,36 +36,35 @@ class virtuser_query extends rcube_plugin
*/
function user2email($p)
{
- $rcmail = rcmail::get_instance();
- $dbh = $rcmail->get_dbh();
+ $dbh = $this->app->get_dbh();
- $sql_result = $dbh->query(preg_replace('/%u/', $dbh->escapeSimple($p['user']), $this->query));
+ $sql_result = $dbh->query(preg_replace('/%u/', $dbh->escapeSimple($p['user']), $this->query));
- while ($sql_arr = $dbh->fetch_array($sql_result)) {
- if (strpos($sql_arr[0], '@')) {
- if ($p['extended'] && count($sql_arr) > 1) {
- $result[] = array(
- 'email' => $sql_arr[0],
- 'name' => $sql_arr[1],
- 'organization' => $sql_arr[2],
- 'reply-to' => $sql_arr[3],
- 'bcc' => $sql_arr[4],
- 'signature' => $sql_arr[5],
- 'html_signature' => (int)$sql_arr[6],
- );
- }
- else {
- $result[] = $sql_arr[0];
- }
+ while ($sql_arr = $dbh->fetch_array($sql_result)) {
+ if (strpos($sql_arr[0], '@')) {
+ if ($p['extended'] && count($sql_arr) > 1) {
+ $result[] = array(
+ 'email' => $sql_arr[0],
+ 'name' => $sql_arr[1],
+ 'organization' => $sql_arr[2],
+ 'reply-to' => $sql_arr[3],
+ 'bcc' => $sql_arr[4],
+ 'signature' => $sql_arr[5],
+ 'html_signature' => (int)$sql_arr[6],
+ );
+ }
+ else {
+ $result[] = $sql_arr[0];
+ }
- if ($p['first'])
- break;
+ if ($p['first'])
+ break;
+ }
}
- }
- $p['email'] = $result;
+ $p['email'] = $result;
- return $p;
+ return $p;
}
}