<?php /** * Identities IMAP * * This plugin allows fast switching between accounts. * * @version 1.0 * @author Boris Gulay * @url */ class ident_switch extends rcube_plugin { public $task='?(?!login|logout).*'; const TABLE = 'ident_switch'; const MY_POSTFIX = '_iswitch'; // Flags user in database const DB_ENABLED = 1; //const DB_SECURE_SSL = 2; // Not supported any more const DB_SECURE_IMAP_TLS = 4; private static function arr($array, $key, $default = null) { return $array[$key] ?? $default; } function init() { $this->add_hook('startup', array($this, 'on_startup')); $this->add_hook('render_page', array($this, 'on_render_page')); $this->add_hook('smtp_connect', array($this, 'on_smtp_connect')); $this->add_hook('identity_form', array($this, 'on_identity_form')); $this->add_hook('identity_update', array($this, 'on_identity_update')); $this->add_hook('identity_create', array($this, 'on_identity_create')); $this->add_hook('identity_create_after', array($this, 'on_identity_create_after')); $this->add_hook('identity_delete', array($this, 'on_identity_delete')); $this->add_hook('template_object_composeheaders', array($this, 'on_template_object_composeheaders')); $this->register_action('plugin.ident_switch.switch', array($this, 'on_switch')); } function on_startup($args) { $rc = rcmail::get_instance(); if (strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 0) { // We are impersonating $rc->config->set('imap_cache', null); $rc->config->set('messages_cache', false); if ($args['task'] == 'mail') { $this->add_texts('localization/'); $rc->config->set('create_default_folders', false); } } return $args; } function on_render_page($args) { $rc = rcmail::get_instance(); switch ($rc->task) { case 'mail': $this->render_switch($rc, $args); break; case 'settings': $this->include_script('ident_switch-form.js'); break; } return $args; }<?php /** * Identities IMAP * * This plugin allows fast switching between accounts. * * @version 1.0 * @author Boris Gulay * @url */ class ident_switch extends rcube_plugin { public $task='?(?!login|logout).*'; const TABLE = 'ident_switch'; const MY_POSTFIX = '_iswitch'; // Flags user in database const DB_ENABLED = 1; //const DB_SECURE_SSL = 2; // Not supported any more const DB_SECURE_IMAP_TLS = 4; private static function arr($array, $key, $default = null) { return $array[$key] ?? $default; } function init() { $this->add_hook('startup', array($this, 'on_startup')); $this->add_hook('render_page', array($this, 'on_render_page')); $this->add_hook('smtp_connect', array($this, 'on_smtp_connect')); $this->add_hook('identity_form', array($this, 'on_identity_form')); $this->add_hook('identity_update', array($this, 'on_identity_update')); $this->add_hook('identity_create', array($this, 'on_identity_create')); $this->add_hook('identity_create_after', array($this, 'on_identity_create_after')); $this->add_hook('identity_delete', array($this, 'on_identity_delete')); $this->add_hook('template_object_composeheaders', array($this, 'on_template_object_composeheaders')); $this->register_action('plugin.ident_switch.switch', array($this, 'on_switch')); } function on_startup($args) { $rc = rcmail::get_instance(); if (strcasecmp($rc->user->data['username'], $_SESSION['username']) !== 0) { // We are impersonating $rc->config->set('imap_cache', null); $rc->config->set('messages_cache', false); if ($args['task'] == 'mail') { $this->add_texts('localization/'); $rc->config->set('create_default_folders', false); } } return $args; } function on_render_page($args) { $rc = rcmail::get_instance(); switch ($rc->task) { case 'mail': $this->render_switch($rc, $args); break; case 'settings': $this->include_script('ident_switch-form.js'); break; } return $args; }
You have javascript disabled. You will not be able to edit any code.