rcmail

Extends \rcube

Application class of Roundcube Webmail implemented as singleton

package

Webmail

Methods

This implements the 'singleton' design pattern

get_instance($mode, $env = '') : \rcube
inherited static

Arguments

$mode

$env

Response

\rcube

The one and only instance

Initial startup function to register session, create database and imap connections

startup() 

Setter for application task

set_task($task) 

Arguments

$task

Setter for system user object

set_user($user) 

Arguments

$user

Return instance of the internal address book class

get_address_book($id, $writeable = false) : \rcube_contacts

Arguments

$id

$writeable

Response

\rcube_contacts

Address book object

Return identifier of the address book object

get_address_book_id($object) : string

Arguments

$object

Response

string

Source identifier

Return address books list

get_address_sources($writeable = false, $skip_hidden = false) : array

Arguments

$writeable

$skip_hidden

Response

array

Address books array

Getter for compose responses.

get_compose_responses($sorted = false, $user_only = false) : array

These are stored in local config and user preferences.

Arguments

$sorted

$user_only

Response

array

List of the current user's stored responses

Init output object for GUI and add common scripts.

load_gui($framed = false) : \rcube_output

This will instantiate a rcmail_output_html object and set environment vars according to the current session and configuration

Arguments

$framed

Response

\rcube_output

Reference to HTML output object

Create an output object for JSON responses

json_init() : \rcube_output

Response

\rcube_output

Reference to JSON output object

Create session object and start the session.

session_init() 
inherited

Auto-select IMAP host based on the posted login information

autoselect_host() : string

Response

string

Selected IMAP host

Destroy session data and remove cookie

kill_session() 

Do server side actions on logout

logout_actions() 

Generate a unique token to be used in a form request

get_request_token() : string

Response

string

The request token

Check if the current request contains a valid token

check_request($mode = \rcube_utils::INPUT_POST) : boolean

Arguments

$mode

Response

boolean

True if request token is valid false if not

Build a valid URL to this instance of Roundcube

url($p) : string
inherited

Arguments

$p

Response

string

Valid application URL

Function to be executed in script shutdown Registered with register_shutdown_function()

shutdown() 
inherited

Registers action aliases for current task

register_action_map(array $map) 

Arguments

$map

array

Alias-to-filename hash array

Returns current action filename

get_action_file() 

Fixes some user preferences according to namespace handling change.

fix_namespace_settings(\rcube_user $user) 

Old Roundcube versions were using folder names with removed namespace prefix. Now we need to add the prefix on servers where personal namespace has prefix.

Arguments

$user

\rcube_user

User object

Overwrite action variable

overwrite_action($action) 

Arguments

$action

Set environment variables for specified config options

set_env_config($options) 

Arguments

$options

Returns RFC2822 formatted current date in user's timezone

user_date() : string

Response

string

Date

Create a HTML table based on the given data

table_output($attrib, $table_data, $a_show_cols, $id_col) : string

Arguments

$attrib

$table_data

$a_show_cols

$id_col

Response

string

HTML table code

Convert the given date to a human readable form This uses the date formatting properties from config

format_date($date, $format = null, $convert = true) : string

Arguments

$date

$format

$convert

Response

string

Formatted date string

Return folders list in HTML

folder_list(array $attrib) : string

Arguments

$attrib

array

Named parameters

Response

string

HTML code for the gui object

Return folders list as html_select object

folder_selector(array $p = array()) : \html_select

Arguments

$p

array

Named parameters

Response

\html_select

HTML drop-down object

Create a hierarchical array of the mailbox list

build_folder_tree(&$arrFolders, $folder, $delm = '/', $path = '') 

Arguments

$arrFolders

$folder

$delm

$path

Return html for a structured list <ul> for the mailbox tree

render_folder_tree_html(&$arrFolders, &$mbox_name, &$jslist, $attrib, $nestLevel) 

Arguments

$arrFolders

$mbox_name

$jslist

$attrib

$nestLevel

Return html for a flat list <select> for the mailbox tree

render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames = false, $nestLevel, $opts = array()) 

Arguments

$arrFolders

$mbox_name

$maxlength

$select

$realnames

$nestLevel

$opts

Return internal name for the given folder if it matches the configured special folders

folder_classname($folder_id) 

Arguments

$folder_id

Try to localize the given IMAP folder name.

localize_foldername(string $name, bool $with_path = true) : string

UTF-7 decode it in case no localized text was found

Arguments

$name

string

Folder name

$with_path

bool

Enable path localization

Response

string

Localized folder name in UTF-8 encoding

localize_folderpath

localize_folderpath($path) 

Arguments

$path

quota_display

quota_display($attrib) 
static

Arguments

$attrib

quota_content

quota_content($attrib = null) 

Arguments

$attrib

Outputs error message according to server error/response codes

display_server_error(string $fallback = null, array $fallback_args = null, string $suffix = '') 

Arguments

$fallback

string

Fallback message label

$fallback_args

array

Fallback message label arguments

$suffix

string

Message label suffix

Output HTML editor scripts

html_editor(string $mode = '') 

Arguments

$mode

string

Editor mode

Replaces TinyMCE's emoticon images with plain-text representation

replace_emoticons(string $html) : string
static

Arguments

$html

string

HTML content

Response

string

HTML content

File upload progress handler.

upload_progress() 

Initializes file uploading interface.

upload_init() 

Initializes client-side autocompletion.

autocomplete_init() 

Returns supported font-family specifications

font_defs(string $font = null) 
static

Arguments

$font

string

Font name

Create a human readable string for a number of bytes

show_bytes($bytes) : string

Arguments

$bytes

Response

string

Byte string

Returns real size (calculated) of the message part

message_part_size($part) : string

Arguments

$part

Response

string

Part size (and unit)

setcookie

setcookie($name, $value, $exp) 
static

Arguments

$name

$value

$exp

imap_connect

imap_connect() 

imap_init

imap_init() 

Connect to the mail storage server with stored session data

storage_connect() : bool

Response

bool

True on success, False on error

Private constructor

__construct($env = '') 
inherited

Arguments

$env

Initial startup function

init($mode) 
inherited

Arguments

$mode

Get the current database connection

get_dbh() : \rcube_db
inherited

Response

\rcube_db

Database object

Get global handle for memcache access

get_memcache() : object
inherited

Response

object

Memcache

Callback for memcache failure

memcache_failure($host, $port) 
inherited

Arguments

$host

$port

Initialize and get cache object

get_cache(string $name, string $type = 'db', string $ttl, bool $packed = true) : \rcube_cache
inherited

Arguments

$name

string

Cache identifier

$type

string

Cache type ('db', 'apc' or 'memcache')

$ttl

string

Expiration time for cache items

$packed

bool

Enables/disables data serialization

Response

\rcube_cache

Cache object

Initialize and get shared cache object

get_cache_shared(string $name, bool $packed = true) : \rcube_cache_shared
inherited

Arguments

$name

string

Cache identifier

$packed

bool

Enables/disables data serialization

Response

\rcube_cache_shared

Cache object

Create SMTP object and connect to server

smtp_init($connect = false) 
inherited

Arguments

$connect

Initialize and get storage object

get_storage() : \rcube_storage
inherited

Response

\rcube_storage

Storage object

Initialize storage object

storage_init() 
inherited

Set storage parameters.

set_storage_prop() 
inherited

This must be done AFTER connecting to the server!

Garbage collector - cache/temp cleaner

gc() 
inherited

Garbage collector function for temp files.

gc_temp() 
inherited

Remove temp files older than two days

Runs garbage collector with probability based on session settings. This is intended for environments without a session.

gc_run() 
inherited

Get localized text in the desired language

gettext(mixed $attrib, string $domain = null) : string
inherited

Arguments

$attrib

mixed

Named parameters array or label name

$domain

string

Label domain (plugin) name

Response

string

Localized text

Check if the given text label exists

text_exists(string $name, string $domain = null, string &$ref_domain = null) : boolean
inherited

Arguments

$name

string

Label name

$domain

string

Label domain (plugin) name or '*' for all domains

$ref_domain

string

Sets domain name if label is found

Response

boolean

True if text exists (either in the current language or in en_US)

Load a localization package

load_language(string $lang = null, array $add = array(), array $merge = array()) 
inherited

Arguments

$lang

string

Language ID

$add

array

Additional text labels/messages

$merge

array

Additional text labels/messages to merge

Check the given string and return a valid language code

language_prop($lang) : string
inherited

Arguments

$lang

Response

string

Valid language code

Read directory program/localization and return a list of available languages

list_languages() : array
inherited

Response

array

List of available localizations

Encrypt using 3DES

encrypt(string $clear, string $key = 'des_key', boolean $base64 = true) : string
inherited

Arguments

$clear

string

clear text input

$key

string

encryption key to retrieve from the configuration, defaults to 'des_key'

$base64

boolean

whether or not to base64_encode() the result before returning

Response

string

encrypted text

Decrypt 3DES-encrypted string

decrypt(string $cipher, string $key = 'des_key', boolean $base64 = true) : string
inherited

Arguments

$cipher

string

encrypted text

$key

string

encryption key to retrieve from the configuration, defaults to 'des_key'

$base64

boolean

whether or not input is base64-encoded

Response

string

decrypted text

Generates encryption initialization vector (IV)

create_iv($size) : string
inherited

Arguments

$size

Response

string

Vector string

Registers shutdown function to be executed on shutdown.

add_shutdown_function($function) 
inherited

The functions will be executed before destroying any objects like smtp, imap, session, etc.

Arguments

$function

Quote a given string.

Q($str, $mode = 'strict', $newlines = true) : string
inherited static

Shortcut function for rcube_utils::rep_specialchars_output()

Arguments

$str

$mode

$newlines

Response

string

HTML-quoted string

Quote a given string for javascript output.

JQ($str) : string
inherited static

Shortcut function for rcube_utils::rep_specialchars_output()

Arguments

$str

Response

string

JS-quoted string

Construct shell command, execute it and return output as string.

exec() : \output
inherited static

Keywords {keyword} are replaced with arguments

Response

\output

of command. shell errors not detectable

Print or write debug messages

console() 
inherited static

Append a line to a logfile in the logs directory.

write_log(mixed $name, $line) 
inherited static

Date will be added automatically to the line.

Arguments

$name

mixed

name of log file

$line

Throw system error (and show error page).

raise_error($arg = array(), $log = false, $terminate = false) 
inherited static

Arguments

$arg

$log

$terminate

Report error according to configured debug_level

log_bug($arg_arr) 
inherited static
see self::raise_error()

Arguments

$arg_arr

Returns current time (with microseconds).

timer() : float
inherited static

Response

float

Current time in seconds since the Unix

Logs time difference according to provided timer

print_timer(float $timer, string $label = 'Timer', string $dest = 'console') 
inherited static
see self::timer()

Arguments

$timer

float

Timer (self::timer() result)

$label

string

Log line prefix

$dest

string

Log file name

Getter for logged user ID.

get_user_id() : mixed
inherited

Response

mixed

User identifier

Getter for logged user name.

get_user_name() : string
inherited

Response

string

User name

Getter for logged user email (derived from user name not identity).

get_user_email() : string
inherited

Response

string

User email address

Getter for logged user password.

get_user_password() : string
inherited

Response

string

User password

Get the per-user log directory

get_user_log_dir() 
inherited

Getter for logged user language code.

get_user_language() : string
inherited

Response

string

User language code

Unique Message-ID generator.

gen_message_id() : string
inherited

Response

string

Message-ID

Send the given message using the configured method.

deliver_message(object &$message, string $from, array $mailto, array &$error, string &$body_file = null, array $options = null) : boolean
inherited

Arguments

$message

object

Reference to Mail_MIME object

$from

string

Sender address string

$mailto

array

Array of recipient address strings

$error

array

SMTP error array (reference)

$body_file

string

Location of file with saved message body (reference),

                      used when delay_file_io is enabled

$options

array

SMTP options (e.g. DSN request)

Response

boolean

Send status.

Constants

ERROR_STORAGE

ERROR_STORAGE

ERROR_INVALID_REQUEST

ERROR_INVALID_REQUEST

ERROR_INVALID_HOST

ERROR_INVALID_HOST

ERROR_COOKIES_DISABLED

ERROR_COOKIES_DISABLED

INIT_WITH_DB

INIT_WITH_DB
inherited

INIT_WITH_PLUGINS

INIT_WITH_PLUGINS
inherited

Properties

Main tasks.

main_tasks : array
static
var

Type(s)

array

Current task.

task : string
var

Type(s)

string

Current action.

action : string
var

Type(s)

string

comm_path

comm_path : 

filename

filename : 

address_books

address_books : 

action_map

action_map : 

Singleton instace of rcube

instance : \rcube
inherited static
var

Type(s)

\rcube

Stores instance of rcube_config.

config : \rcube_config
inherited
var

Type(s)

\rcube_config

Instace of database class.

db : \rcube_db
inherited
var

Type(s)

\rcube_db

Instace of Memcache class.

memcache : \Memcache
inherited
var

Type(s)

\Memcache

Instace of rcube_session class.

session : \rcube_session
inherited
var

Type(s)

\rcube_session

Instance of rcube_smtp class.

smtp : \rcube_smtp
inherited
var

Type(s)

\rcube_smtp

Instance of rcube_storage class.

storage : \rcube_storage
inherited
var

Type(s)

\rcube_storage

Instance of rcube_output class.

output : \rcube_output
inherited
var

Type(s)

\rcube_output

Instance of rcube_plugin_api.

plugins : \rcube_plugin_api
inherited
var

Type(s)

\rcube_plugin_api

texts

texts : 
inherited

caches

caches : 
inherited

shutdown_functions

shutdown_functions : 
inherited