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 30)
 require_once ('utf7.inc') (line 29)
Constants
RCUBE_INPUT_GET = 0x0101 (line 33)
RCUBE_INPUT_GPC = 0x0103 (line 35)
RCUBE_INPUT_POST = 0x0102 (line 34)
Functions
asciiwords (line 725)

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

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

Print or write debug messages

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

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

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])
  • mixed $date: Date representation (string or timestamp)
  • string $format: Date format to use
format_email_recipient (line 1124)

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

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

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

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

Convert the given string into a valid HTML identifier

Same functionality as done in app.js with this.identifier_expr

void html_identifier ( $str)
  • $str
JQ (line 624)

Quote a given string for javascript output.

Shortcut function for rep_specialchars_output

string JQ ( $str)
  • $str
parse_attrib_string (line 974)

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

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

Quote a given string.

Shortcut function for rep_specialchars_output

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

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_cache_gc (line 164)

Garbage collector for cache entries.

Remove all expired message cache records

void rcmail_cache_gc ()
rcmail_deliver_message (line 1678)

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

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_gen_message_id (line 1811)
void rcmail_gen_message_id ()
rcmail_get_edit_field (line 832)

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

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 1473)
void rcmail_localize_folderpath ( $path)
  • $path
rcmail_log_login (line 2143)

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

void rcmail_log_login ()
rcmail_mailbox_list (line 1141)

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

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_mod_css_styles (line 879)

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)
  • string $source: CSS source code
  • string $container_id: Container ID to use as prefix
rcmail_overwrite_action (line 111)

Overwrite action variable

void rcmail_overwrite_action (string $action)
  • string $action: New action value
rcmail_quota_content (line 1518)
void rcmail_quota_content ([ $attrib = NULL])
  • $attrib
rcmail_quota_display (line 1498)
void rcmail_quota_display ( $attrib)
  • $attrib
rcmail_remote_ip (line 2160)

Returns remote IP address and forwarded addresses if found

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

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

Garbage collector function for temp files.

Remove temp files older than two days

void rcmail_temp_gc ()
rcmail_url (line 127)

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 1835)
void rcmail_user_date ()
rcmail_xss_entity_decode (line 929)

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

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

Initializes client-side autocompletion

void rcube_autocomplete_init ()
rcube_charset_convert (line 207)

Convert a string from one charset to another.

Uses mbstring and iconv functions if possible

  • return: Converted string
string rcube_charset_convert (string $str, string $from, [string $to = NULL])
  • string $str: Input string
  • string $from: Suspected charset of the input string
  • string $to: Target charset to convert to; defaults to RCMAIL_CHARSET
rcube_check_referer (line 2185)

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_error_handler (line 192)

Catch an error and throw an exception.

void rcube_error_handler (int $errno, string $errstr)
  • int $errno: Level of the error
  • string $errstr: Error message
rcube_html_editor (line 1598)

Output HTML editor scripts

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

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 2010)
void rcube_idn_convert ( $input, [ $is_utf = false])
  • $input
  • $is_utf
rcube_idn_to_ascii (line 1996)
void rcube_idn_to_ascii ( $str)
  • $str
rcube_idn_to_utf8 (line 2005)
void rcube_idn_to_utf8 ( $str)
  • $str
rcube_label (line 88)

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

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

Report error according to configured debug_level

void rcube_log_bug (array $arg_arr)
  • array $arg_arr: Named parameters
rcube_parse_charset (line 329)

Parse and validate charset name string (see #1485758).

Sometimes charset string is malformed, there are also charset aliases but we need strict names for charset conversion (specially utf8 class)

  • return: The validated charset name
string rcube_parse_charset (string $input)
  • string $input: Input charset name
rcube_parse_host (line 1897)

Replaces hostname variables

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

For backward compatibility.

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

Improved equivalent to strtotime()

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

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 2339)
void rcube_upload_init ()
rcube_upload_progress (line 2309)
void rcube_upload_progress ()
rcube_utf7_to_utf8 (line 438)

Converts string from standard UTF-7 (RFC 2152) to UTF-8.

  • return: The converted string
string rcube_utf7_to_utf8 (string $str)
  • string $str: Input string
rcube_utf16_to_utf8 (line 497)

Converts string from UTF-16 to UTF-8 (helper for utf-7 to utf-8 conversion)

  • return: The converted string
string rcube_utf16_to_utf8 (string $str)
  • string $str: Input string
rep_specialchars_output (line 528)

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

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

Remove new lines characters from given string

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

Remove single and double quotes from given string

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

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 Tue, 04 Oct 2011 22:55:23 +0200 by phpDocumentor 1.4.3