function init() { $this->add_texts('localization/'); $this->register_action('plugin.archive', array($this, 'request_action')); $rcmail = rcube::get_instance(); if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') && ($archive_folder = $rcmail->config->get('archive_mbox'))) { $this->add_hook('render_mailboxlist', array($this, 'render_mailboxlist')); if ($rcmail->config->get('archive_show_button', true)) { $this->add_button(array('type' => 'link', 'label' => 'buttontitle', 'command' => 'plugin.archive', 'class' => 'button buttonPas archive disabled', 'classact' => 'button archive', 'width' => 32, 'height' => 32, 'title' => 'buttontitle', 'domain' => $this->ID), 'toolbar'); } $rcmail->output->set_env('archive_folder', $archive_folder); if ($rcmail->config->get('skin', 'larry') == 'classic') { $this->include_stylesheet('skins/classic/archivefolder.css'); } } else { if ($rcmail->task == 'settings') { $dont_override = $rcmail->config->get('dont_override', array()); if (!in_array('archive_mbox', $dont_override)) { $this->add_hook('preferences_sections_list', array($this, 'archivefoldersection')); $this->add_hook('preferences_list', array($this, 'prefs_table')); $this->add_hook('preferences_save', array($this, 'save_prefs')); } } } }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new help($rcube->api); $this->assertInstanceOf('help', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new database_attachments($rcube->api); $this->assertInstanceOf('database_attachments', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new identity_select($rcube->api); $this->assertInstanceOf('identity_select', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Constructor * * @param string $lang Language code */ function __construct($lang = 'en') { $this->rc = rcube::get_instance(); $this->engine = $this->rc->config->get('spellcheck_engine', 'googie'); $this->lang = $lang ? $lang : 'en'; $this->options = array('ignore_syms' => $this->rc->config->get('spellcheck_ignore_syms'), 'ignore_nums' => $this->rc->config->get('spellcheck_ignore_nums'), 'ignore_caps' => $this->rc->config->get('spellcheck_ignore_caps'), 'dictionary' => $this->rc->config->get('spellcheck_dictionary')); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new additional_message_headers($rcube->api); $this->assertInstanceOf('additional_message_headers', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new new_user_dialog($rcube->api); $this->assertInstanceOf('new_user_dialog', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new example_addressbook($rcube->api); $this->assertInstanceOf('example_addressbook', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
public function ham(&$uids, $mbox) { $rcmail = rcube::get_instance(); $storage = $rcmail->storage; $new_uids = array(); foreach ($uids as $uid) { $saved = false; $message = new rcube_message($uid); if (sizeof($message->attachments) > 0) { foreach ($message->attachments as $part) { if ($part->ctype_primary == 'message' && $part->ctype_secondary == 'rfc822' && $part->ctype_parameters['x-spam-type'] == 'original') { $orig_message_raw = $message->get_part_body($part->mime_id); $saved = $storage->save_message($mbox, $orig_message_raw); if ($saved !== false) { $rcmail->output->command('rcmail_markasjunk2_move', null, $uid); array_push($new_uids, $saved); } } } } } if (sizeof($new_uids) > 0) { $uids = $new_uids; } }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new newmail_notifier($rcube->api); $this->assertInstanceOf('newmail_notifier', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new debug_logger($rcube->api); $this->assertInstanceOf('debug_logger', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * */ public function import($csv) { // convert to UTF-8 $head = substr($csv, 0, 4096); $fallback = rcube::get_instance()->config->get('default_charset', 'ISO-8859-1'); // fallback to Latin-1? $charset = rcube_charset::detect($head, RCUBE_CHARSET); $csv = rcube_charset::convert($csv, $charset); $head = ''; $this->map = array(); // Parse file foreach (preg_split("/[\r\n]+/", $csv) as $i => $line) { $elements = $this->parse_line($line); if (empty($elements)) { continue; } // Parse header if (empty($this->map)) { $this->parse_header($elements); if (empty($this->map)) { break; } } else { $this->csv_to_vcard($elements); } } }
function init() { $this->rc = rcube::get_instance(); $this->add_hook('authenticate', array($this, 'authentication')); $this->add_hook('storage_connect', array($this, 'storage_connection')); $this->add_hook('smtp_connect', array($this, 'smtp_connection')); }
function init() { $this->rc = rcube::get_instance(); // register actions $this->register_action('plugin.managesieve', array($this, 'managesieve_actions')); $this->register_action('plugin.managesieve-action', array($this, 'managesieve_actions')); $this->register_action('plugin.managesieve-vacation', array($this, 'managesieve_actions')); $this->register_action('plugin.managesieve-save', array($this, 'managesieve_save')); $this->register_action('plugin.managesieve-saveraw', array($this, 'managesieve_saveraw')); if ($this->rc->task == 'settings') { $this->add_hook('settings_actions', array($this, 'settings_actions')); $this->init_ui(); } else { if ($this->rc->task == 'mail') { // register message hook if ($this->rc->action == 'show') { $this->add_hook('message_headers_output', array($this, 'mail_headers')); } // inject Create Filter popup stuff if (empty($this->rc->action) || $this->rc->action == 'show' || strpos($this->rc->action, 'plugin.managesieve') === 0) { $this->mail_task_handler(); } } } }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new virtuser_file($rcube->api); $this->assertInstanceOf('virtuser_file', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new squirrelmail_usercopy($rcube->api); $this->assertInstanceOf('squirrelmail_usercopy', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Default constructor */ public function __construct($db, $config) { $this->db = $db; $this->start = microtime(true); $this->ip = rcube_utils::remote_addr(); $this->logging = $config->get('log_session', false); $lifetime = $config->get('session_lifetime', 1) * 60; $this->set_lifetime($lifetime); // use memcache backend $this->storage = $config->get('session_storage', 'db'); if ($this->storage == 'memcache') { $this->memcache = rcube::get_instance()->get_memcache(); // set custom functions for PHP session management if memcache is available if ($this->memcache) { ini_set('session.serialize_handler', 'php'); session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'mc_read'), array($this, 'mc_write'), array($this, 'mc_destroy'), array($this, 'gc')); } else { rcube::raise_error(array('code' => 604, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, 'message' => "Failed to connect to memcached. Please check configuration"), true, true); } } else { if ($this->storage != 'php') { ini_set('session.serialize_handler', 'php'); // set custom functions for PHP session management session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'db_read'), array($this, 'db_write'), array($this, 'db_destroy'), array($this, 'gc')); $this->table_name = $this->db->table_name('session', true); } } }
/** * Default constructor for CalDAV client. * * @param string Caldav URI to appropriate calendar. * @param string Username for HTTP basic auth. * @param string Password for HTTP basic auth. * @param boolean Verify SSL cert. // Mod by Rosali (https://gitlab.awesome-it.de/kolab/roundcube-plugins/issues/1) */ public function __construct($uri, $user = null, $pass = null, $authtype = 'detect', $verifySSL = array(true, true)) { $this->user_agent = 'MyRoundcube-SabreDAV/' . Sabre\DAV\Version::VERSION; // Include libvcalendar on demand ... if (!class_exists("libvcalendar")) { require_once INSTALL_PATH . 'plugins/libgpl/libcalendaring/libvcalendar.php'; } $this->libvcal = new libvcalendar(); $this->rc = rcube::get_instance(); $tokens = parse_url($uri); $this->base_uri = $tokens['scheme'] . "://" . $tokens['host'] . ($tokens['port'] ? ":" . $tokens['port'] : null); $this->path = $tokens['path'] . ($tokens['query'] ? "?" . $tokens['query'] : null); switch ($authtype) { case 'digest': $auth = Sabre\DAV\Client::AUTH_DIGEST; break; case 'basic': $auth = Sabre\DAV\Client::AUTH_BASIC; break; default: $auth = Sabre\DAV\Client::AUTH_BASIC | Sabre\DAV\Client::AUTH_DIGEST; } $settings = array('baseUri' => $this->base_uri, 'authType' => $auth); if ($user) { $settings['userName'] = $user; } if ($pass) { $settings['password'] = $pass; } parent::__construct($settings); $this->verifyPeer = $verifySSL[0]; $this->verifyHost = $verifySSL[1]; }
/** * __construct * * Provide a uid, and parse message structure. * * @param string $uid The message UID. * @param string $folder Folder name * * @see self::$app, self::$storage, self::$opt, self::$parts */ function __construct($uid, $folder = null) { $this->uid = $uid; $this->app = rcube::get_instance(); $this->storage = $this->app->get_storage(); $this->folder = strlen($folder) ? $folder : $this->storage->get_folder(); $this->storage->set_options(array('all_headers' => true)); // Set current folder $this->storage->set_folder($this->folder); $this->headers = $this->storage->get_message($uid); if (!$this->headers) { return; } $this->mime = new rcube_mime($this->headers->charset); $this->subject = $this->mime->decode_mime_string($this->headers->subject); list(, $this->sender) = each($this->mime->decode_address_list($this->headers->from, 1)); $this->set_safe(intval($_GET['_safe']) || $_SESSION['safe_messages'][$uid]); $this->opt = array('safe' => $this->is_safe, 'prefer_html' => $this->app->config->get('prefer_html'), 'get_url' => $this->app->url(array('action' => 'get', 'mbox' => $this->storage->get_folder(), 'uid' => $uid))); if (!empty($this->headers->structure)) { $this->get_mime_numbers($this->headers->structure); $this->parse_structure($this->headers->structure); } else { $this->body = $this->storage->get_body($uid); } // notify plugins and let them analyze this structured message object $this->app->plugins->exec_hook('message_load', array('object' => $this)); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new hide_blockquote($rcube->api); $this->assertInstanceOf('hide_blockquote', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new markasjunk($rcube->api); $this->assertInstanceOf('markasjunk', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Replace emoticon icons <img> 'src' attribute, so it can * be replaced with real file by Mail_Mime. * * @param string &$html HTML content * * @return array List of image files */ public static function replace(&$html) { // Replace this: // <img src="http[s]://.../tinymce/plugins/emoticons/img/smiley-cool.gif" ... /> // with this: // <img src="/path/on/server/.../tinymce/plugins/emoticons/img/smiley-cool.gif" ... /> $rcube = rcube::get_instance(); $assets_dir = $rcube->config->get('assets_dir'); $path = unslashify($assets_dir ?: INSTALL_PATH) . '/' . self::IMG_PATH; $offset = 0; $images = array(); // remove any null-byte characters before parsing $html = preg_replace('/\\x00/', '', $html); if (preg_match_all('# src=[\'"]([^\'"]+)#', $html, $matches, PREG_OFFSET_CAPTURE)) { foreach ($matches[1] as $m) { // find emoticon image tags if (preg_match('#' . self::IMG_PATH . '(.*)$#', $m[0], $imatches)) { $image_name = $imatches[1]; // sanitize image name so resulting attachment doesn't leave images dir $image_name = preg_replace('/[^a-zA-Z0-9_\\.\\-]/i', '', $image_name); $image_file = $path . $image_name; // Add the same image only once $images[$image_name] = $image_file; $html = substr_replace($html, $image_file, $m[1] + $offset, strlen($m[0])); $offset += strlen($image_file) - strlen($m[0]); } } } return $images; }
/** * Plugin initialization. */ function init() { $this->require_plugin('libcalendaring'); $this->rc = rcube::get_instance(); $this->lib = libcalendaring::get_instance(); $this->register_task('calendar', 'calendar'); // load calendar configuration $this->load_config(); // load localizations $this->add_texts('localization/', $this->rc->task == 'calendar' && (!$this->rc->action || $this->rc->action == 'print')); $this->timezone = $this->lib->timezone; $this->gmt_offset = $this->lib->gmt_offset; $this->dst_active = $this->lib->dst_active; $this->timezone_offset = $this->gmt_offset / 3600 - $this->dst_active; require $this->home . '/lib/calendar_ui.php'; $this->ui = new calendar_ui($this); // catch iTIP confirmation requests that don're require a valid session if ($this->rc->action == 'attend' && !empty($_REQUEST['_t'])) { $this->add_hook('startup', array($this, 'itip_attend_response')); } else { if ($this->rc->action == 'feed' && !empty($_REQUEST['_cal'])) { $this->add_hook('startup', array($this, 'ical_feed_export')); } else { // default startup routine $this->add_hook('startup', array($this, 'startup')); } } $this->add_hook('user_delete', array($this, 'user_delete')); }
/** * Object constructor. * * @param string $type Engine type ('db' or 'memcache' or 'apc') * @param int $userid User identifier * @param string $prefix Key name prefix * @param string $ttl Expiration time of memcache/apc items * @param bool $packed Enables/disabled data serialization. * It's possible to disable data serialization if you're sure * stored data will be always a safe string */ function __construct($type, $userid, $prefix = '', $ttl = 0, $packed = true) { $rcube = rcube::get_instance(); $type = strtolower($type); if ($type == 'memcache') { $this->type = 'memcache'; $this->db = $rcube->get_memcache(); } else { if ($type == 'apc') { $this->type = 'apc'; $this->db = function_exists('apc_exists'); // APC 3.1.4 required } else { $this->type = 'db'; $this->db = $rcube->get_dbh(); } } // convert ttl string to seconds $ttl = get_offset_sec($ttl); if ($ttl > 2592000) { $ttl = 2592000; } $this->userid = (int) $userid; $this->ttl = $ttl; $this->packed = $packed; $this->prefix = $prefix; }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new zipdownload($rcube->api); $this->assertInstanceOf('zipdownload', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
public function ham(&$uids) { $rcmail = rcube::get_instance(); $storage = $rcmail->storage; $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); $new_uids = array(); foreach (explode(",", $uids) as $uid) { $saved = false; $message = new rcube_message($uid); if (sizeof($message->attachments) > 0) { foreach ($message->attachments as $part) { if ($part->ctype_primary == 'message' && $part->ctype_secondary == 'rfc822') { $orig_message_raw = $storage->get_message_part($message->uid, $part->mime_id, $part); $saved = $storage->save_message($mbox, $orig_message_raw); if ($saved !== false) { $rcmail->output->command('rcmail_markasjunk2_move', null, $uid); array_push($new_uids, $saved); } } } } } if (sizeof($new_uids) > 0) { $uids = implode(',', $new_uids); } }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new http_authentication($rcube->api); $this->assertInstanceOf('http_authentication', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new subscriptions_option($rcube->api); $this->assertInstanceOf('subscriptions_option', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
/** * Plugin object construction test */ function test_constructor() { $rcube = rcube::get_instance(); $plugin = new legacy_browser($rcube->api); $this->assertInstanceOf('legacy_browser', $plugin); $this->assertInstanceOf('rcube_plugin', $plugin); }
private function _do_filterlearn($uids, $spam) { $rcmail = rcube::get_instance(); $user = $rcmail->user; foreach ($uids as $uid) { $MESSAGE = new rcube_message($uid); $from = $MESSAGE->sender['mailto']; if ($from == "") { $rcmail->output->command('display_message', 'email address not found ' . $from, 'error'); } else { $new_arr['whatfilter'] = 'from'; $new_arr['searchstring'] = htmlspecialchars(addslashes($from)); $new_arr['destfolder'] = addslashes("Junk"); $new_arr['messages'] = 'all'; $new_arr['filterpriority'] = ''; $new_arr['markread'] = 'markread'; $arr_prefs = $user->get_prefs(); $arr_prefs['filters'][] = $new_arr; if ($user->save_prefs($arr_prefs)) { $rcmail->output->command('display_message', 'I learned that messages from ' . $from . ' are SPAM', 'confirmation'); } else { $rcmail->output->command('display_message', 'I learned nothing', 'error'); } } } }