Fix/prepare plugins to use out of Roundcube (where rcmail object doesn't exist)
This commit is contained in:
parent
5be0b06fcb
commit
2d08c58e56
22 changed files with 62 additions and 62 deletions
|
@ -75,7 +75,7 @@ class calendar extends rcube_plugin
|
|||
{
|
||||
$this->require_plugin('libcalendaring');
|
||||
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
$this->lib = libcalendaring::get_instance();
|
||||
|
||||
$this->register_task('calendar', 'calendar');
|
||||
|
@ -1094,7 +1094,7 @@ class calendar extends rcube_plugin
|
|||
}
|
||||
|
||||
foreach ((array)$event['attachments'] as $k => $attachment) {
|
||||
$event['attachments'][$k]['classname'] = rcmail_filetype2classname($attachment['mimetype'], $attachment['name']);
|
||||
$event['attachments'][$k]['classname'] = rcube_utils::file2class($attachment['mimetype'], $attachment['name']);
|
||||
}
|
||||
|
||||
return array(
|
||||
|
@ -1936,13 +1936,13 @@ class calendar extends rcube_plugin
|
|||
|
||||
if ($attachment['status'] && !$attachment['abort']) {
|
||||
$id = $attachment['id'];
|
||||
$attachment['classname'] = rcmail_filetype2classname($attachment['mimetype'], $attachment['name']);
|
||||
$attachment['classname'] = rcube_utils::file2class($attachment['mimetype'], $attachment['name']);
|
||||
|
||||
// store new attachment in session
|
||||
unset($attachment['status'], $attachment['abort'], $attachment['data']);
|
||||
$_SESSION[self::SESSION_KEY]['attachments'][$id] = $attachment;
|
||||
|
||||
$attachment['id'] = 'rcmfile' . $attachment['id']; # add prefix to consider it 'new'
|
||||
$attachment['id'] = 'rcmfile' . $attachment['id']; // add prefix to consider it 'new'
|
||||
$event['attachments'][] = $attachment;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ abstract class calendar_driver
|
|||
*/
|
||||
public function list_categories()
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
return $rcmail->config->get('calendar_categories', array());
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class calendar_itip
|
|||
|
||||
// finally send the message
|
||||
$this->itip_send = true;
|
||||
$sent = rcmail_deliver_message($message, $headers['X-Sender'], $mailto, $smtp_error);
|
||||
$sent = $this->rc->deliver_message($message, $headers['X-Sender'], $mailto, $smtp_error);
|
||||
$this->itip_send = false;
|
||||
|
||||
return $sent;
|
||||
|
@ -147,8 +147,8 @@ class calendar_itip
|
|||
// compose common headers array
|
||||
$headers = array(
|
||||
'From' => $sender,
|
||||
'Date' => rcmail_user_date(),
|
||||
'Message-ID' => rcmail_gen_message_id(),
|
||||
'Date' => $this->rc->user_date(),
|
||||
'Message-ID' => $this->rc->gen_message_id(),
|
||||
'X-Sender' => $from,
|
||||
);
|
||||
if ($agent = $this->rc->config->get('useragent'))
|
||||
|
|
|
@ -44,7 +44,7 @@ class kolab_activesync extends rcube_plugin
|
|||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
|
||||
$this->require_plugin('jqueryui');
|
||||
$this->require_plugin('libkolab');
|
||||
|
|
|
@ -32,7 +32,7 @@ class kolab_activesync_ui
|
|||
public function __construct($plugin)
|
||||
{
|
||||
$this->plugin = $plugin;
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
$skin_path = $this->plugin->local_skin_path() . '/';
|
||||
$this->skin_path = 'plugins/kolab_activesync/' . $skin_path;
|
||||
|
||||
|
@ -170,8 +170,8 @@ class kolab_activesync_ui
|
|||
$names[] = $origname;
|
||||
$classes = array('mailbox');
|
||||
|
||||
if ($folder_class = rcmail_folder_classname($folder)) {
|
||||
$foldername = html::quote(rcube_label($folder_class));
|
||||
if ($folder_class = $this->rc->folder_classname($folder)) {
|
||||
$foldername = html::quote($this->rc->gettext($folder_class));
|
||||
$classes[] = $folder_class;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class kolab_addressbook extends rcube_plugin
|
|||
{
|
||||
require_once(dirname(__FILE__) . '/lib/rcube_kolab_contacts.php');
|
||||
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
|
||||
// load required plugin
|
||||
$this->require_plugin('libkolab');
|
||||
|
|
|
@ -32,7 +32,7 @@ class kolab_addressbook_ui
|
|||
*/
|
||||
public function __construct($plugin)
|
||||
{
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
$this->plugin = $plugin;
|
||||
|
||||
$this->init_ui();
|
||||
|
|
|
@ -132,7 +132,7 @@ class rcube_kolab_contacts extends rcube_addressbook
|
|||
}
|
||||
}
|
||||
|
||||
$this->action = rcmail::get_instance()->action;
|
||||
$this->action = rcube::get_instance()->action;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class kolab_auth extends rcube_plugin
|
|||
|
||||
public function init()
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$this->add_hook('authenticate', array($this, 'authenticate'));
|
||||
$this->add_hook('startup', array($this, 'startup'));
|
||||
|
@ -76,7 +76,7 @@ class kolab_auth extends rcube_plugin
|
|||
}
|
||||
|
||||
public function load_user_role_plugins_and_settings($role_dns) {
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
$this->load_config();
|
||||
|
||||
// Check role dependent plugins to enable and settings to modify
|
||||
|
@ -152,7 +152,7 @@ class kolab_auth extends rcube_plugin
|
|||
}
|
||||
|
||||
public function write_log($args) {
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
if (!$rcmail->config->get('kolab_auth_auditlog', false)) {
|
||||
return $args;
|
||||
|
@ -230,7 +230,7 @@ class kolab_auth extends rcube_plugin
|
|||
$this->load_config();
|
||||
$this->add_texts('localization/');
|
||||
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
$admin_login = $rcmail->config->get('kolab_auth_admin_login');
|
||||
$group = $rcmail->config->get('kolab_auth_group');
|
||||
$role_attr = $rcmail->config->get('kolab_auth_role');
|
||||
|
@ -263,7 +263,7 @@ class kolab_auth extends rcube_plugin
|
|||
return $args;
|
||||
}
|
||||
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
$admin_login = $rcmail->config->get('kolab_auth_admin_login');
|
||||
$admin_pass = $rcmail->config->get('kolab_auth_admin_password');
|
||||
$login_attr = $rcmail->config->get('kolab_auth_login');
|
||||
|
@ -391,8 +391,8 @@ class kolab_auth extends rcube_plugin
|
|||
|
||||
// Log "Login As" usage
|
||||
if (!empty($origname)) {
|
||||
write_log('userlogins', sprintf('Admin login for %s by %s from %s',
|
||||
$args['user'], $origname, rcmail_remote_ip()));
|
||||
rcube::write_log('userlogins', sprintf('Admin login for %s by %s from %s',
|
||||
$args['user'], $origname, rcube_utils::remote_ip()));
|
||||
}
|
||||
|
||||
return $args;
|
||||
|
@ -404,7 +404,7 @@ class kolab_auth extends rcube_plugin
|
|||
public function imap_connect($args)
|
||||
{
|
||||
if (!empty($_SESSION['kolab_auth_admin'])) {
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
$admin_login = $rcmail->decrypt($_SESSION['kolab_auth_login']);
|
||||
$admin_pass = $rcmail->decrypt($_SESSION['kolab_auth_password']);
|
||||
|
||||
|
@ -421,7 +421,7 @@ class kolab_auth extends rcube_plugin
|
|||
public function smtp_connect($args)
|
||||
{
|
||||
if (!empty($_SESSION['kolab_auth_admin'])) {
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
$admin_login = $rcmail->decrypt($_SESSION['kolab_auth_login']);
|
||||
$admin_pass = $rcmail->decrypt($_SESSION['kolab_auth_password']);
|
||||
|
||||
|
@ -441,7 +441,7 @@ class kolab_auth extends rcube_plugin
|
|||
return $this->ldap->ready;
|
||||
}
|
||||
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$addressbook = $rcmail->config->get('kolab_auth_addressbook');
|
||||
|
||||
|
@ -468,7 +468,7 @@ class kolab_auth extends rcube_plugin
|
|||
*/
|
||||
private function get_user_record($user, $host)
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
$filter = $rcmail->config->get('kolab_auth_filter');
|
||||
|
||||
$filter = $this->parse_vars($filter, $user, $host);
|
||||
|
@ -490,15 +490,15 @@ class kolab_auth extends rcube_plugin
|
|||
*/
|
||||
private function parse_vars($str, $user, $host)
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
$domain = $rcmail->config->get('username_domain');
|
||||
|
||||
if (!empty($domain) && strpos($user, '@') === false) {
|
||||
if (is_array($domain) && isset($domain[$host])) {
|
||||
$user .= '@'.rcube_parse_host($domain[$host], $host);
|
||||
$user .= '@'.rcube_utils::parse_host($domain[$host], $host);
|
||||
}
|
||||
else if (is_string($domain)) {
|
||||
$user .= '@'.rcube_parse_host($domain, $host);
|
||||
$user .= '@'.rcube_utils::parse_host($domain, $host);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class kolab_config extends rcube_plugin
|
|||
*/
|
||||
public function init()
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
// Register spellchecker dictionary handlers
|
||||
if (strtolower($rcmail->config->get('spellcheck_dictionary')) != 'shared') {
|
||||
|
|
|
@ -39,7 +39,7 @@ class kolab_folders extends rcube_plugin
|
|||
function init()
|
||||
{
|
||||
self::$instance = $this;
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
|
||||
// load required plugin
|
||||
$this->require_plugin('libkolab');
|
||||
|
|
|
@ -44,7 +44,7 @@ class kolab_zpush extends rcube_plugin
|
|||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
|
||||
$this->require_plugin('jqueryui');
|
||||
$this->add_texts('localization/', true);
|
||||
|
|
|
@ -30,7 +30,7 @@ class kolab_zpush_ui
|
|||
public function __construct($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
|
||||
$skin = $this->rc->config->get('skin');
|
||||
$this->config->include_stylesheet('skins/' . $skin . '/config.css');
|
||||
|
@ -146,8 +146,8 @@ class kolab_zpush_ui
|
|||
|
||||
$classes = array('mailbox');
|
||||
|
||||
if ($folder_class = rcmail_folder_classname($folder)) {
|
||||
$foldername = rcube_label($folder_class);
|
||||
if ($folder_class = $this->rc->folder_classname($folder)) {
|
||||
$foldername = $this->rc->gettext($folder_class);
|
||||
$classes[] = $folder_class;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,19 +51,19 @@ class ldap_authentication extends rcube_plugin
|
|||
function authenticate($args)
|
||||
{
|
||||
if ($this->init_ldap()) {
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
$filter = $rcmail->config->get('ldap_authentication_filter');
|
||||
$domain = $rcmail->config->get('username_domain');
|
||||
|
||||
// get username and host
|
||||
$user = $args['user'];
|
||||
$host = rcube_parse_host($args['host']);
|
||||
$host = rcube_utils::parse_host($args['host']);
|
||||
|
||||
if (!empty($domain) && strpos($user, '@') === false) {
|
||||
if (is_array($domain) && isset($domain[$args['host']]))
|
||||
$user .= '@'.rcube_parse_host($domain[$host], $host);
|
||||
$user .= '@'.rcube_utils::parse_host($domain[$host], $host);
|
||||
else if (is_string($domain))
|
||||
$user .= '@'.rcube_parse_host($domain, $host);
|
||||
$user .= '@'.rcube_utils::parse_host($domain, $host);
|
||||
}
|
||||
|
||||
// replace variables in filter
|
||||
|
@ -102,7 +102,7 @@ class ldap_authentication extends rcube_plugin
|
|||
return $this->ldap->ready;
|
||||
|
||||
$this->load_config();
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$addressbook = $rcmail->config->get('ldap_authentication_addressbook');
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class libcalendaring extends rcube_plugin
|
|||
{
|
||||
self::$instance = $this;
|
||||
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
|
||||
// set user's timezone
|
||||
$this->timezone = new DateTimeZone($this->rc->config->get('timezone', 'GMT'));
|
||||
|
@ -529,7 +529,7 @@ class libcalendaring extends rcube_plugin
|
|||
'html' => $content,
|
||||
'name' => $attachment['name'],
|
||||
'mimetype' => $attachment['mimetype'],
|
||||
'classname' => rcmail_filetype2classname($attachment['mimetype'], $attachment['name']),
|
||||
'classname' => rcube_utils::file2class($attachment['mimetype'], $attachment['name']),
|
||||
'complete' => true), $uploadid);
|
||||
}
|
||||
else { // upload failed
|
||||
|
|
|
@ -56,7 +56,7 @@ $opts = get_opt(array(
|
|||
$opts['username'] = !empty($opts[1]) ? $opts[1] : $opts['user'];
|
||||
$action = $opts[0];
|
||||
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -57,7 +57,7 @@ class odfviewer extends rcube_plugin
|
|||
if ($ua->ie && $ua->ver < 9)
|
||||
return;
|
||||
// extend list of mimetypes that should open in preview
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
if ($rcmail->action == 'preview' || $rcmail->action == 'show' || $rcmail->task == 'calendar' || $rcmail->task == 'tasks') {
|
||||
$mimetypes = $rcmail->config->get('client_mimetypes', 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/x-javascript,application/pdf,application/x-shockwave-flash');
|
||||
if (!is_array($mimetypes))
|
||||
|
@ -87,7 +87,7 @@ class odfviewer extends rcube_plugin
|
|||
}
|
||||
else {
|
||||
$fp = fopen($tempfn, 'w');
|
||||
$imap = rcmail::get_instance()->get_storage();
|
||||
$imap = rcube::get_instance()->get_storage();
|
||||
$imap->get_message_part($args['uid'], $args['id'], $args['part'], false, $fp);
|
||||
fclose($fp);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ class odfviewer extends rcube_plugin
|
|||
*/
|
||||
function gc_cleanup()
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$tmp = unslashify($this->tempdir);
|
||||
$expire = mktime() - 172800; // expire in 48 hours
|
||||
|
|
|
@ -21,7 +21,7 @@ class owncloud extends rcube_plugin
|
|||
|
||||
function init()
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
// requires kolab_auth plugin
|
||||
if (empty($_SESSION['kolab_uid'])) {
|
||||
|
@ -39,20 +39,20 @@ class owncloud extends rcube_plugin
|
|||
|
||||
// add taskbar button
|
||||
$this->add_button(array(
|
||||
'command' => 'owncloud',
|
||||
'class' => 'button-owncloud',
|
||||
'classsel' => 'button-owncloud button-selected',
|
||||
'innerclass' => 'button-inner',
|
||||
'label' => 'owncloud.owncloud',
|
||||
'command' => 'owncloud',
|
||||
'class' => 'button-owncloud',
|
||||
'classsel' => 'button-owncloud button-selected',
|
||||
'innerclass' => 'button-inner',
|
||||
'label' => 'owncloud.owncloud',
|
||||
), 'taskbar');
|
||||
|
||||
// add style for taskbar button (must be here) and Help UI
|
||||
// add style for taskbar button (must be here) and Help UI
|
||||
$this->include_stylesheet($this->local_skin_path()."/owncloud.css");
|
||||
}
|
||||
|
||||
function action()
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$rcmail->output->add_handlers(array('owncloudframe' => array($this, 'frame')));
|
||||
$rcmail->output->set_pagetitle($this->gettext('owncloud'));
|
||||
|
@ -61,7 +61,7 @@ class owncloud extends rcube_plugin
|
|||
|
||||
function frame()
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$this->load_config();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class piwik_analytics extends rcube_plugin
|
|||
}
|
||||
|
||||
function add_script($args) {
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$exclude = $rcmail->config->get('piwik_analytics_exclude');
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ abstract class tasklist_driver
|
|||
*/
|
||||
public function list_categories()
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
return $rcmail->config->get('tasklist_categories', array());
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class tasklist extends rcube_plugin
|
|||
{
|
||||
$this->require_plugin('libcalendaring');
|
||||
|
||||
$this->rc = rcmail::get_instance();
|
||||
$this->rc = rcube::get_instance();
|
||||
$this->lib = libcalendaring::get_instance();
|
||||
|
||||
$this->register_task('tasks', 'tasklist');
|
||||
|
@ -601,7 +601,7 @@ class tasklist extends rcube_plugin
|
|||
$rec['alarms_text'] = libcalendaring::alarms_text($rec['alarms']);
|
||||
|
||||
foreach ((array)$rec['attachments'] as $k => $attachment) {
|
||||
$rec['attachments'][$k]['classname'] = rcmail_filetype2classname($attachment['mimetype'], $attachment['name']);
|
||||
$rec['attachments'][$k]['classname'] = rcube_utils::file2class($attachment['mimetype'], $attachment['name']);
|
||||
}
|
||||
|
||||
if (in_array($rec['id'], $this->collapsed_tasks))
|
||||
|
@ -844,13 +844,13 @@ class tasklist extends rcube_plugin
|
|||
|
||||
if ($attachment['status'] && !$attachment['abort']) {
|
||||
$id = $attachment['id'];
|
||||
$attachment['classname'] = rcmail_filetype2classname($attachment['mimetype'], $attachment['name']);
|
||||
$attachment['classname'] = rcube_utils::file2class($attachment['mimetype'], $attachment['name']);
|
||||
|
||||
// store new attachment in session
|
||||
unset($attachment['status'], $attachment['abort'], $attachment['data']);
|
||||
$_SESSION[self::SESSION_KEY]['attachments'][$id] = $attachment;
|
||||
|
||||
$attachment['id'] = 'rcmfile' . $attachment['id']; # add prefix to consider it 'new'
|
||||
$attachment['id'] = 'rcmfile' . $attachment['id']; // add prefix to consider it 'new'
|
||||
$task['attachments'][] = $attachment;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class tinymce_config extends rcube_plugin
|
|||
|
||||
function config($args)
|
||||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
$rcmail = rcube::get_instance();
|
||||
|
||||
$config = array(
|
||||
'forced_root_block' => '',
|
||||
|
|
Loading…
Add table
Reference in a new issue