Adds a contact to the user defined address book.
string
addAddress
(string $newAddress, string $newName)
-
string
$newAddress: The contact's email address.
-
string
$newName: The contact's name.
Add inline javascript to the output buffer.
void
addInlineScript
(mixed $script, [string $onload = false])
-
mixed
$script: The script text to add (can be stored in an array also).
-
string
$onload: Load the script after the page has loaded? Either 'dom' (on dom:loaded), 'load'.
Make sure a user-entered mailbox contains namespace information.
string
appendNamespace
(string $mbox)
-
string
$mbox: The user-entered mailbox string.
Returns the bare address.
mixed
bareAddress
(string $address, [boolean $multiple = false])
-
string
$address: The address string.
-
boolean
$multiple: Should we return multiple results?
Returns whether we can log in without a login screen for $server_key.
boolean
canAutoLogin
([string $server_key = null], [boolean $force = false])
-
string
$server_key: The server to check. Defaults to IMP::getCurrentServer().
-
boolean
$force: If true, check $server_key even if there is more than one server available.
Makes sure the user has been authenticated to view the page.
boolean
checkAuthentication
([boolean $return = false], [boolean $hordeauth = false])
-
boolean
$return: If this is true, return false instead of exiting/redirecting if authentication fails.
-
boolean
$hordeauth: Just check for Horde auth and don't bother the IMAP server.
Check if a token for a form is valid.
void
checkRequestToken
( $slug, $token)
Returns the appropriate link to call the message composition screen.
string
composeLink
([mixed $args = array()], [array $extra = array()])
-
mixed
$args: List of arguments to pass to compose.php. If this is passed in as a string, it will be parsed as a toaddress?subject=foo&cc=ccaddress (mailto-style) string.
-
array
$extra: Hash of extra, non-standard arguments to pass to compose.php.
Prepares the arguments to use for composeLink().
array
composeLinkArgs
([mixed $args = array()], [array $extra = array()])
-
mixed
$args: List of arguments to pass to compose.php. If this is passed in as a string, it will be parsed as a toaddress?subject=foo&cc=ccaddress (mailto-style) string.
-
array
$extra: Hash of extra, non-standard arguments to pass to compose.php.
Get the default personal namespace.
mixed
defaultNamespace
()
If there is information available to tell us about a prefix in front of mailbox names that shouldn't be displayed to the user, then use it to strip that prefix out.
string
displayFolder
(string $folder, [boolean $notranslate = false])
-
string
$folder: The folder name to display.
-
boolean
$notranslate: Do not translate the folder prefix.
Return a list of valid encrypt HTML option tags.
string
encryptList
([string $default = null], [boolean $returnList = false])
-
string
$default: The default encrypt option.
-
boolean
$returnList: Whether to return a hash with options instead of the options tag.
Wrapper to allow file_put_contents() use for PHP < 5.
TODO: Remove once PHP 5 is required.
void
filePutContents
( $file, $data)
Filters a string, if requested.
string
filterText
(string $text)
-
string
$text: The text to filter.
Wrapper around IMP_Folder::flist() which generates the body of a <select> form input from the generated folder list. The <select> and </select> tags are NOT included in the output of this function.
string
flistSelect
([string $heading = ''], [boolean $abbrev = true], [array $filter = array()], [string $selected = null], [boolean $new_folder = false], [boolean $inc_tasklists = false], [boolean $inc_vfolder = false], [ $inc_notepads = false])
-
string
$heading: The label for an empty-value option at the top of the list.
-
boolean
$abbrev: If true, abbreviate long mailbox names by replacing the middle of the name with '...'.
-
array
$filter: An array of mailboxes to ignore.
-
string
$selected: The mailbox to have selected by default.
-
boolean
$new_folder: If true, display an option to create a new folder.
-
boolean
$inc_tasklists: Should the user's editable notepads be included in the list?
-
boolean
$inc_vfolder: Should the user's virtual folders be included in the list?
-
$inc_notepads
Convert a preference value to/from the value stored in the preferences.
Preferences that need to call this function before storing/retrieving: trash_folder, spam_folder, drafts_folder, sent_mail_folder To allow folders from the personal namespace to be stored without this prefix for portability, we strip the personal namespace. To tell apart folders from the personal and any empty namespace, we prefix folders from the empty namespace with the delimiter.
string
folderPref
( $folder, boolean $append, string $mailbox)
-
string
$mailbox: The folder path.
-
boolean
$append: True - convert from preference value. False - convert to preference value.
-
$folder
Generates a URL with necessary mailbox/index information.
string
generateIMPUrl
(string $page, string $mailbox, [string $index = null], [string $tmailbox = null], [boolean $encode = true])
-
string
$page: Page name to link to.
-
string
$mailbox: The base mailbox to use on the linked page.
-
string
$index: The index to use on the linked page.
-
string
$tmailbox: The mailbox associated with $index.
-
boolean
$encode: Encode the argument separator? (since 4.2.1)
Returns the AutoLogin server key.
string
getAutoLoginServer
([boolean $first = false])
-
boolean
$first: Return the first value?
Creates a URL for cached DIMP data.
string
getCacheURL
(string $type, string $cid)
-
string
$type: The cache type.
-
string
$cid: The cache id.
Checks for To:, Subject:, Cc:, and other compose window arguments and pass back either a URI fragment or an associative array with any of them which are present.
string
getComposeArgs
(string $format)
-
string
$format: Either 'uri' or 'array'.
Process mailbox/index information for current page load.
array
getCurrentMailboxInfo
()
Returns a list of parameters necessary to indicate current mailbox status.
array
getIMPMboxParameters
(string $mailbox, [string $index = null], [string $tmailbox = null])
-
string
$mailbox: The mailbox to use on the linked page.
-
string
$index: The index to use on the linked page.
-
string
$tmailbox: The mailbox associated with $index to use on the linked page.
Returns the plain text label that is displayed for the current mailbox, replacing IMP_SEARCH_MBOX with an appropriate string and removing namespace and folder prefix information from what is shown to the user.
string
getLabel
(string $mbox)
-
string
$mbox: The mailbox to use for the label.
Returns the proper logout URL for logging out of IMP.
string
getLogoutUrl
()
Build IMP's list of menu items.
mixed
getMenu
([string $returnType = 'object'])
-
string
$returnType: Either 'object' or 'string'.
Get namespace info for a full folder path.
mixed
getNamespace
([string $mailbox = null], [boolean $empty = true])
-
string
$mailbox: The folder path. If empty, will return info on the default namespace (i.e. the first personal namespace).
-
boolean
$empty: If true and no matching namespace is found, return the empty namespace, if it exists.
Outputs the necessary javascript code to display the new mail notification message.
string
getNewMessagePopup
(mixed $var)
-
mixed
$var: Either an associative array with mailbox names as the keys and the message count as the values or an integer indicating the number of new messages in the current mailbox.
Utility function to obtain PATH_INFO information.
string
getPathInfo
()
Get a token for protecting a form.
void
getRequestToken
( $slug)
Return the sorting preference for the current mailbox.
array
getSort
([string $mbox = null])
-
string
$mbox: The mailbox to use (defaults to current mailbox in the session).
Return the list of base stylesheets to display.
TODO: Copied from Horde 3.2 for BC purposes.
array
getStylesheets
([ $apps = null], [mixed $theme = ''], [boolean $inherit = true], string|array $app)
-
string|array
$app: The Horde application(s).
-
mixed
$theme: The theme to use; specify an empty value to retrieve the theme from user preferences, and false for no theme.
-
boolean
$inherit: Inherit Horde-wide CSS?
-
$apps
Determines if the tidy extension is available and is the correct version. Returns the config array.
mixed
getTidyConfig
(integer $size)
-
integer
$size: Size of the HTML data, in bytes.
Returns the specified permission for the current user.
mixed
hasPermission
(string $permission, [boolean $value = false])
-
string
$permission: A permission.
-
boolean
$value: If true, the method returns the value of a scalar permission, otherwise whether the permission limit has been hit already.
Determine whether we're hiding deleted messages.
boolean
hideDeletedMsgs
([boolean $force = false])
-
boolean
$force: Force a redetermination of the return value (return value is normally cached after the first call).
Outputs the necessary script tags, honoring local configuration choices as to script caching.
void
includeScriptFiles
()
Outputs the necessary style tags, honoring local configuration choices as to stylesheet caching.
void
includeStylesheetFiles
([boolean $print = false], [string $app = 'imp'])
-
boolean
$print: Include print CSS?
-
string
$app: The application to load ('dimp' or 'imp').
Determines if the given mail server is the "preferred" mail server for
this web server. This decision is based on the global 'SERVER_NAME' and 'HTTP_HOST' server variables and the contents of the 'preferred' either field in the server's definition. The 'preferred' field may take a single value or an array of multiple values.
boolean
isPreferredServer
(string $server, [TODO $key = null])
-
string
$server: A complete server entry from the $servers hash.
-
TODO
$key: TODO
Is $mbox a 'special' folder (e.g. 'drafts' or 'sent-mail' folder)?
boolean
isSpecialFolder
(string $mbox)
-
string
$mbox: The mailbox to query.
Output login message to use for Horde log.
string
loginLogMessage
(string $status)
-
string
$status: Either 'login', 'logout', or 'failed'.
Either sets or checks the value of the logintasks flag.
integer
loginTasksFlag
([integer $set = null])
-
integer
$set: The value of the flag.
Generates an URL to the logout screen that includes any known information, such as username, server, etc., that can be filled in on the login form.
string
logoutUrl
()
Outputs IMP's menu to the current output stream.
void
menu
()
Replacement for number_format() which doesn't work with multibyte separators.
string
numberFormat
($number $number, [$decimals $decimals = 0])
-
$number
$number: The number to format.
-
$decimals
$decimals: The number of decimals.
Open a compose window.
void
openComposeWin
([ $options = array()])
Print pending inline javascript to the output buffer.
void
outputInlineScript
()
Parses an address or address list into the address components.
array
parseAddressList
(string $address, [boolean $validate = false], [boolean $domain = false])
-
string
$address: An address or address list.
-
boolean
$validate: Validate the addresses?
-
boolean
$domain: Use the local default domain?
Get message indices list.
mixed
parseIndicesList
(mixed $indices)
-
mixed
$indices: The following inputs are allowed:
1. An array of messages indices in the following format:
msg_id IMP_IDX_SEP msg_folder
msg_id = Message index of the message
IMP_IDX_SEP = IMP constant used to separate index/folder
msg_folder = The full folder name containing the message index
2. An array with the full folder name as keys and an array of message
indices as the values.
3. An IMP_Mailbox object, which will use the current index/folder
as determined by the object. If an IMP_Mailbox object is used, it
will be updated after the action is performed.
Output the javascript needed to call the popup_imp JS function.
string
popupIMPString
(string $url, [array $params = array()], [integer $width = 700], [integer $height = 650])
-
string
$url: The IMP page to load.
-
array
$params: An array of paramters to pass to the URL.
-
integer
$width: The width of the popup window.
-
integer
$height: The height of the popup window.
Generates the URL to the prefs page.
string
prefsURL
([boolean $full = false])
-
boolean
$full: Generate full URL?
Are we currently in "print" mode?
boolean
printMode
([boolean $mode = null])
-
boolean
$mode: True if in print mode, false if not.
Outputs IMP's quota information.
void
quota
()
Returns data needed to output quota.
array
quotaData
([boolean $long = true])
-
boolean
$long: Output long messages?
Returns true if we are doing a login for recomposition purposes.
boolean
recomposeLogin
()
Utility function to send redirect headers to browser, handling any browser quirks.
void
redirect
(string $url)
-
string
$url: The URL to redirect to.
Remove "bare newlines" from a string.
string
removeBareNewlines
(string $str)
-
string
$str: The original string.
Send response data to browser.
void
sendHTTPResponse
(mixed $data, string $ct)
-
mixed
$data: The data to serialize and send to the browser.
-
string
$ct: The content-type to send the data with. Either 'json', 'js-json', 'html', 'plain', and 'xml'.
Generates a full c-client server specification string.
string
serverString
([string $mbox = null], [ $protocol = null])
-
string
$mbox: The mailbox to append to end of the server string.
-
$protocol
Set the sorting preference for the current mailbox.
TODO: Purge non-existant search sorts (i.e. non VFolder entries).
void
setSort
([integer $by = null], [integer $dir = null], [string $mbox = null], [boolean $delete = false])
-
integer
$by: The sort type.
-
integer
$dir: The sort direction.
-
string
$mbox: The mailbox to use (defaults to current mailbox in the session).
-
boolean
$delete: Delete the entry?
Outputs IMP's status/notification bar.
void
status
()
Determines if thread sorting is available.
boolean
threadSortAvailable
(string $mbox)
-
string
$mbox: The mailbox to check.
Print inline javascript to output buffer after wrapping with necessary javascript tags.
string
wrapInlineScript
(array $script)
-
array
$script: The script to output.