File/main.inc

Description

Roundcube Webmail common functions

Classes
Class Description
 class rcube_base_replacer Helper class to turn relative urls into absolute ones
Includes
 require_once (INSTALL_PATH.'program/include/rcube_shared.inc') (line 32)
Constants
RCUBE_INPUT_GET = 0x0101 (line 35)
RCUBE_INPUT_GPC = 0x0103 (line 37)
RCUBE_INPUT_POST = 0x0102 (line 36)
Functions
asciiwords (line 413)

Remove all non-ascii and non-word chars

except ., -, _

void asciiwords ( $str, [ $css_id = false], [ $replace_with = ''])
  • $str
  • $css_id
  • $replace_with
check_email (line 1698)

E-mail address validation

boolean check_email (string $email, [boolean $dns_check = true])
  • string $email: Email address
  • boolean $dns_check: True to check dns
console (line 1891)

Print or write debug messages

void console ([mixed 0 = Debug message or data])
  • mixed 0: Debug message or data
create_attrib_string (line 659)

Compose a valid attribute string for HTML tags

  • return: HTML formatted attribute string
string create_attrib_string (array $attrib, [array $allowed_attribs = array('id', 'class', 'style')])
  • array $attrib: Named tag attributes
  • array $allowed_attribs: List of allowed attributes
format_date (line 734)

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

  • return: Formatted date string
string format_date (mixed $date, [string $format = NULL], [bool $convert = true])
  • mixed $date: Date representation (string, timestamp or DateTime object)
  • string $format: Date format to use
  • bool $convert: Enables date convertion according to user timezone
format_email_recipient (line 852)

Compose a valid representation of name and e-mail address

  • return: Formatted string
string format_email_recipient (string $email, [string $name = ''])
  • string $email: E-mail address
  • string $name: Person name
get_input_value (line 319)

Read input value and convert it for internal use Performs stripslashes() and charset conversion if necessary

  • return: Field value or NULL if not available
string get_input_value (string $fname, int $source, [boolean $allow_html = FALSE], [string $charset = NULL])
  • string $fname: Field name to read
  • int $source: Source to get value from (GPC)
  • boolean $allow_html: Allow HTML tags in field value
  • string $charset: Charset to convert into
get_sequence_name (line 68)

Return correct name for a specific database sequence (used for Postgres only)

  • return: Translated sequence name
string get_sequence_name (string $sequence)
  • string $sequence: Secuence name
get_table_name (line 47)

Return correct name for a specific database table

  • return: Translated table name
string get_table_name (string $table)
  • string $table: Table name
html_identifier (line 423)

Convert the given string into a valid HTML identifier

Same functionality as done in app.js with rcube_webmail.html_identifier()

void html_identifier ( $str, [ $encode = false])
  • $str
  • $encode
JQ (line 303)

Quote a given string for javascript output.

Shortcut function for rep_specialchars_output

string JQ ( $str)
  • $str
json_serialize (line 188)

Convert a variable into a javascript object notation

  • return: Serialized JSON string
string json_serialize (mixed $input)
  • mixed $input: Input value
parse_attrib_string (line 677)

Convert a HTML attribute string attributes to an associative array (name => value)

  • return: Key-value pairs of parsed attributes
array parse_attrib_string (string $str)
  • string $str: Input string
parse_input_value (line 352)

Parse/validate input value. See get_input_value() Performs stripslashes() and charset conversion if necessary

  • return: Parsed value
string parse_input_value (string $value, [boolean $allow_html = FALSE], [string $charset = NULL])
  • string $value: Input value
  • boolean $allow_html: Allow HTML tags in field value
  • string $charset: Charset to convert into
Q (line 291)

Quote a given string.

Shortcut function for rep_specialchars_output

string Q ( $str, [ $mode = 'strict'], [ $newlines = TRUE])
  • $str
  • $mode
  • $newlines
raise_error (line 2069)

Throw system error and show error page

void raise_error ([array $arg = array()], [boolean $log = false], [boolean $terminate = false])
  • array $arg: Named parameters
    • code: Error code (required)
    • type: Error type [php|db|imap|javascript] (required)
    • message: Error message
    • file: File where error occured
    • line: Line where error occured
  • boolean $log: True to log the error
  • boolean $terminate: Terminate script execution
rcmail_deliver_message (line 1434)

Send the given message using the configured method

  • return: Send status.
boolean rcmail_deliver_message ( &$message, string $from, array $mailto,  &$smtp_error, [ &$body_file = null], [array $smtp_opts = null], object $message, array $smtp_error, string $body_file)
  • object $message: Reference to Mail_MIME object
  • string $from: Sender address string
  • array $mailto: Array of recipient address strings
  • array $smtp_error: SMTP error array (reference)
  • string $body_file: Location of file with saved message body (reference), used when delay_file_io is enabled
  • array $smtp_opts: SMTP options (e.g. DSN request)
  • &$message
  • &$smtp_error
  • &$body_file
rcmail_display_server_error (line 1292)

Outputs error message according to server error/response codes

void rcmail_display_server_error ([string $fallback = null], [string $fallback_args = null])
  • string $fallback: Fallback message label
  • string $fallback_args: Fallback message label arguments
rcmail_filetype2classname (line 1330)

Generate CSS classes from mimetype and filename extension

  • return: CSS classes separated by space
string rcmail_filetype2classname (string $mimetype, string $filename)
  • string $mimetype: Mimetype
  • string $filename: The filename
rcmail_gen_message_id (line 1567)
void rcmail_gen_message_id ()
rcmail_get_edit_field (line 518)

Create an edit field for inclusion on a form

  • return: HTML field definition
string rcmail_get_edit_field (string $col, string $value, array $attrib, [string $type = 'text'])
  • string $col: col field name
  • string $value: value field value
  • array $attrib: attrib HTML element attributes for field
  • string $type: type HTML element type (default 'text')
rcmail_localize_foldername (line 1193)

Try to localize the given IMAP folder name.

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

  • return: Localized folder name in UTF-8 encoding
string rcmail_localize_foldername (string $name)
  • string $name: Folder name
rcmail_localize_folderpath (line 1202)
void rcmail_localize_folderpath ( $path)
  • $path
rcmail_log_login (line 1976)

Write login data (name, ID, IP address) to the 'userlogins' log file.

void rcmail_log_login ()
rcmail_mailbox_list (line 869)

Return the mailboxlist in HTML

  • return: HTML code for the gui object
string rcmail_mailbox_list (array $attrib)
  • array $attrib: Named parameters
rcmail_mailbox_select (line 943)

Return the mailboxlist as html_select object

  • return: HTML drop-down object
html_select rcmail_mailbox_select ([array $p = array()])
  • array $p: Named parameters
rcmail_mem_check (line 1614)

Check if we can process not exceeding memory_limit

boolean rcmail_mem_check (integer $need)
  • integer $need: Required amount of memory
rcmail_mod_css_styles (line 568)

Replace all css definitions with #container [def] and remove css-inlined scripting

  • return: Modified CSS source
string rcmail_mod_css_styles (string $source, string $container_id, [ $allow_remote = false])
  • string $source: CSS source code
  • string $container_id: Container ID to use as prefix
  • $allow_remote
rcmail_overwrite_action (line 113)

Overwrite action variable

void rcmail_overwrite_action (string $action)
  • string $action: New action value
rcmail_quota_content (line 1246)
void rcmail_quota_content ([ $attrib = NULL])
  • $attrib
rcmail_quota_display (line 1227)
void rcmail_quota_display ( $attrib)
  • $attrib
rcmail_remote_ip (line 1993)

Returns remote IP address and forwarded addresses if found

  • return: Remote IP address(es)
string rcmail_remote_ip ()
rcmail_replace_emoticons (line 1390)

Replaces TinyMCE's emoticon images with plain-text representation

  • return: HTML content
string rcmail_replace_emoticons (string $html)
  • string $html: HTML content
rcmail_temp_gc (line 140)

Garbage collector function for temp files.

Remove temp files older than two days

void rcmail_temp_gc ()
rcmail_url (line 129)

Compose an URL for a specific action

  • return: application URL
The rcmail_url (string $action, [array $p = array()], [string $task = null])
  • string $action: Request action
  • array $p: More URL parameters
  • string $task: Request task (omit if the same)
rcmail_user_date (line 1591)
void rcmail_user_date ()
rcmail_xss_entity_decode (line 632)

Decode escaped entities used by known XSS exploits.

See http://downloads.securityfocus.com/vulnerabilities/exploits/26800.eml for examples

  • return: Decoded string
string rcmail_xss_entity_decode (string $content)
  • string $content: CSS content to decode
rcmail_xss_entity_decode_callback (line 647)

preg_replace_callback callback for rcmail_xss_entity_decode_callback

  • return: decoded entity
string rcmail_xss_entity_decode_callback (array $matches)
  • array $matches: matches result from preg_replace_callback
rcube_autocomplete_init (line 2201)

Initializes client-side autocompletion

void rcube_autocomplete_init ()
rcube_charset_convert (line 162)
void rcube_charset_convert ( $str,  $from, [ $to = NULL])
  • $str
  • $from
  • $to
rcube_check_referer (line 2018)

Check whether the HTTP referer matches the current request

  • return: True if referer is the same host+path, false if not
boolean rcube_check_referer ()
rcube_fontdefs (line 2224)
void rcube_fontdefs ([ $font = null])
  • $font
rcube_html_editor (line 1351)

Output HTML editor scripts

void rcube_html_editor ([string $mode = ''])
  • string $mode: Editor mode
rcube_https_check (line 1630)

Check if working in SSL mode

boolean rcube_https_check ([integer $port = null], [boolean $use_https = true])
  • integer $port: HTTPS port number
  • boolean $use_https: Enables 'use_https' option checking
rcube_idn_convert (line 1782)
void rcube_idn_convert ( $input, [ $is_utf = false])
  • $input
  • $is_utf
rcube_idn_to_ascii (line 1768)
void rcube_idn_to_ascii ( $str)
  • $str
rcube_idn_to_utf8 (line 1777)
void rcube_idn_to_utf8 ( $str)
  • $str
rcube_label (line 90)

Get localized text in the desired language It's a global wrapper for rcmail::gettext()

string rcube_label (mixed $p, [string $domain = null])
  • mixed $p: Named parameters array or label name
  • string $domain: Domain to search in (e.g. plugin name)
rcube_label_exists (line 102)

Global wrapper of rcmail::text_exists() to check whether a text label is defined

void rcube_label_exists ( $name, [ $domain = null], [ &$ref_domain = null])
  • $name
  • $domain
  • &$ref_domain
rcube_log_bug (line 2095)

Report error according to configured debug_level

void rcube_log_bug (array $arg_arr)
  • array $arg_arr: Named parameters
rcube_parse_host (line 1669)

Replaces hostname variables

string rcube_parse_host (string $name, [string $host = ''])
  • string $name: Hostname
  • string $host: Optional IMAP hostname
rcube_sess_unset (line 1654)

For backward compatibility.

void rcube_sess_unset ([string $var_name = null])
  • string $var_name: Variable name.
rcube_strtotime (line 699)

Improved equivalent to strtotime()

int rcube_strtotime (string $date)
  • string $date: Date string
rcube_table_output (line 464)

Create a HTML table based on the given data

  • return: HTML table code
string rcube_table_output (array $attrib, mixed $table_data, array $a_show_cols, string $id_col)
  • array $attrib: Named table attributes
  • mixed $table_data: Table row data. Either a two-dimensional array or a valid SQL result set
  • array $a_show_cols: List of cols to show
  • string $id_col: Name of the identifier col
rcube_upload_init (line 2172)
void rcube_upload_init ()
rcube_upload_progress (line 2142)
void rcube_upload_progress ()
rc_detect_encoding (line 169)
void rc_detect_encoding ( $string, [ $failover = ''])
  • $string
  • $failover
rc_utf8_clean (line 176)
void rc_utf8_clean ( $input)
  • $input
rep_specialchars_output (line 207)

Replacing specials characters to a specific encoding type

  • return: The quoted string
string rep_specialchars_output (string $str, [string $enctype = ''], [string $mode = ''], [boolean $newlines = TRUE])
  • string $str: Input string
  • string $enctype: Encoding type: text|html|xml|js|url
  • string $mode: Replace mode for tags: show|replace|remove
  • boolean $newlines: Convert newlines
request2param (line 396)

Convert array of request parameters (prefixed with _) to a regular array with non-prefixed keys.

  • return: Hash array with all request parameters
array request2param ([int $mode = RCUBE_INPUT_GPC], [ $ignore = 'task|action'])
  • int $mode: Source to get value from (GPC)
  • $ignore
strip_newlines (line 449)

Remove new lines characters from given string

  • return: Stripped string
string strip_newlines (string $str)
  • string $str: Input value
strip_quotes (line 437)

Remove single and double quotes from given string

  • return: Dequoted string
string strip_quotes (string $str)
  • string $str: Input value
write_log (line 1921)

Append a line to a logfile in the logs directory.

Date will be added automatically to the line.

void write_log ($name $name, line $line)
  • $name $name: name of log file
  • line $line: Line to append

Documentation generated on Wed, 23 May 2012 16:40:47 +0200 by phpDocumentor 1.4.4