rcube

Base class of the Roundcube Framework implemented as singleton

package

Framework

subpackage

Core

Methods

This implements the 'singleton' design pattern

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

Arguments

$mode

$env

Response

\rcube

The one and only instance

Private constructor

__construct($env = '') 

Arguments

$env

Initial startup function

init($mode) 

Arguments

$mode

Get the current database connection

get_dbh() : \rcube_db

Response

\rcube_db

Database object

Get global handle for memcache access

get_memcache() : object

Response

object

Memcache

Callback for memcache failure

memcache_failure($host, $port) 

Arguments

$host

$port

Initialize and get cache object

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

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

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) 

Arguments

$connect

Initialize and get storage object

get_storage() : \rcube_storage

Response

\rcube_storage

Storage object

Initialize storage object

storage_init() 

Set storage parameters.

set_storage_prop() 

This must be done AFTER connecting to the server!

Create session object and start the session.

session_init() 

Garbage collector - cache/temp cleaner

gc() 

Garbage collector function for temp files.

gc_temp() 

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() 

Get localized text in the desired language

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

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

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()) 

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

Arguments

$lang

Response

string

Valid language code

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

list_languages() : array

Response

array

List of available localizations

Encrypt using 3DES

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

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

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

Arguments

$size

Response

string

Vector string

Build a valid URL to this instance of Roundcube

url($p) : string

Arguments

$p

Response

string

Valid application URL

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

shutdown() 

Registers shutdown function to be executed on shutdown.

add_shutdown_function($function) 

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
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
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
static

Keywords {keyword} are replaced with arguments

Response

\output

of command. shell errors not detectable

Print or write debug messages

console() 
static

Append a line to a logfile in the logs directory.

write_log(mixed $name, $line) 
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) 
static

Arguments

$arg

$log

$terminate

Report error according to configured debug_level

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

Arguments

$arg_arr

Returns current time (with microseconds).

timer() : float
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') 
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

Response

mixed

User identifier

Getter for logged user name.

get_user_name() : string

Response

string

User name

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

get_user_email() : string

Response

string

User email address

Getter for logged user password.

get_user_password() : string

Response

string

User password

Get the per-user log directory

get_user_log_dir() 

Getter for logged user language code.

get_user_language() : string

Response

string

User language code

Unique Message-ID generator.

gen_message_id() : string

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

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

INIT_WITH_DB

INIT_WITH_DB

INIT_WITH_PLUGINS

INIT_WITH_PLUGINS

Properties

Singleton instace of rcube

instance : \rcube
static
var

Type(s)

\rcube

Stores instance of rcube_config.

config : \rcube_config
var

Type(s)

\rcube_config

Instace of database class.

db : \rcube_db
var

Type(s)

\rcube_db

Instace of Memcache class.

memcache : \Memcache
var

Type(s)

\Memcache

Instace of rcube_session class.

session : \rcube_session
var

Type(s)

\rcube_session

Instance of rcube_smtp class.

smtp : \rcube_smtp
var

Type(s)

\rcube_smtp

Instance of rcube_storage class.

storage : \rcube_storage
var

Type(s)

\rcube_storage

Instance of rcube_output class.

output : \rcube_output
var

Type(s)

\rcube_output

Instance of rcube_plugin_api.

plugins : \rcube_plugin_api
var

Type(s)

\rcube_plugin_api

texts

texts : 

caches

caches : 

shutdown_functions

shutdown_functions :