Class IMP

Description

IMP Base Class.

$Horde: imp/lib/IMP.php,v 1.449.4.130 2010-10-01 07:13:02 slusarz Exp $

Copyright 1999-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.fsf.org/copyleft/gpl.html.

Located in /lib/IMP.php (line 143)


	
			
Method Summary
 string addAddress (string $newAddress, string $newName)
 void addInlineScript (mixed $script, [string $onload = false])
 string appendNamespace (string $mbox)
 mixed bareAddress (string $address, [boolean $multiple = false])
 boolean canAutoLogin ([string $server_key = null], [boolean $force = false])
 boolean checkAuthentication ([boolean $return = false], [boolean $hordeauth = false])
 void checkRequestToken ( $slug,  $token)
 string composeLink ([mixed $args = array()], [array $extra = array()])
 array composeLinkArgs ([mixed $args = array()], [array $extra = array()])
 mixed defaultNamespace ()
 string displayFolder (string $folder, [boolean $notranslate = false])
 string encryptList ([string $default = null], [boolean $returnList = false])
 void filePutContents ( $file,  $data)
 string filterText (string $text)
 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 folderPref ( $folder, boolean $append, string $mailbox)
 string generateIMPUrl (string $page, string $mailbox, [string $index = null], [string $tmailbox = null], [boolean $encode = true])
 string getAutoLoginServer ([boolean $first = false])
 string getCacheURL (string $type, string $cid)
 string getComposeArgs (string $format)
 array getIMPMboxParameters (string $mailbox, [string $index = null], [string $tmailbox = null])
 string getLabel (string $mbox)
 string getLogoutUrl ()
 mixed getMenu ([string $returnType = 'object'])
 mixed getNamespace ([string $mailbox = null], [boolean $empty = true])
 string getNewMessagePopup (mixed $var)
 string getPathInfo ()
 void getRequestToken ( $slug)
 array getSort ([string $mbox = null])
 array getStylesheets ([ $apps = null], [mixed $theme = ''], [boolean $inherit = true], string|array $app)
 mixed getTidyConfig (integer $size)
 mixed hasPermission (string $permission, [boolean $value = false])
 boolean hideDeletedMsgs ([boolean $force = false])
 void includeStylesheetFiles ([boolean $print = false], [string $app = 'imp'])
 boolean isPreferredServer (string $server, [TODO $key = null])
 boolean isSpecialFolder (string $mbox)
 string loginLogMessage (string $status)
 integer loginTasksFlag ([integer $set = null])
 string logoutUrl ()
 void menu ()
 string numberFormat ($number $number, [$decimals $decimals = 0])
 void openComposeWin ([ $options = array()])
 array parseAddressList (string $address, [boolean $validate = false], [boolean $domain = false])
 mixed parseIndicesList (mixed $indices)
 string popupIMPString (string $url, [array $params = array()], [integer $width = 700], [integer $height = 650])
 string prefsURL ([boolean $full = false])
 boolean printMode ([boolean $mode = null])
 void quota ()
 array quotaData ([boolean $long = true])
 boolean recomposeLogin ()
 void redirect (string $url)
 string removeBareNewlines (string $str)
 void sendHTTPResponse (mixed $data, string $ct)
 string serverString ([string $mbox = null], [ $protocol = null])
 void setSort ([integer $by = null], [integer $dir = null], [string $mbox = null], [boolean $delete = false])
 void status ()
 boolean threadSortAvailable (string $mbox)
 string wrapInlineScript (array $script)
Methods
addAddress (line 388)

Adds a contact to the user defined address book.

  • return: A link or message to show in the notification area.
string addAddress (string $newAddress, string $newName)
  • string $newAddress: The contact's email address.
  • string $newName: The contact's name.
addInlineScript (line 1643)

Add inline javascript to the output buffer.

  • since: IMP 4.2
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'.
appendNamespace (line 1361)

Make sure a user-entered mailbox contains namespace information.

  • return: The mailbox string with any necessary namespace info added.
  • since: IMP 4.1
string appendNamespace (string $mbox)
  • string $mbox: The user-entered mailbox string.
bareAddress (line 368)

Returns the bare address.

  • return: See MIME::bareAddress.
mixed bareAddress (string $address, [boolean $multiple = false])
  • string $address: The address string.
  • boolean $multiple: Should we return multiple results?
canAutoLogin (line 191)

Returns whether we can log in without a login screen for $server_key.

  • return: True or false.
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.
checkAuthentication (line 224)

Makes sure the user has been authenticated to view the page.

  • return: True on success, false on error.
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.
checkRequestToken (line 331)

Check if a token for a form is valid.

  • since: IMP 4.2
void checkRequestToken ( $slug,  $token)
  • $slug
  • $token
composeLink (line 661)

Returns the appropriate link to call the message composition screen.

  • return: The link to 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.
composeLinkArgs (line 628)

Prepares the arguments to use for composeLink().

  • return: The array of args to use for composeLink().
  • since: IMP 4.2
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.
defaultNamespace (line 1286)

Get the default personal namespace.

  • return: The default personal namespace info.
  • since: IMP 4.1
mixed defaultNamespace ()
displayFolder (line 724)

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.

  • return: The folder, with any prefix gone.
string displayFolder (string $folder, [boolean $notranslate = false])
  • string $folder: The folder name to display.
  • boolean $notranslate: Do not translate the folder prefix.
encryptList (line 1457)

Return a list of valid encrypt HTML option tags.

  • return: The list of option tags.
  • since: IMP 4.2
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.
filePutContents (line 2248)

Wrapper to allow file_put_contents() use for PHP < 5.

TODO: Remove once PHP 5 is required.

void filePutContents ( $file,  $data)
  • $file
  • $data
filterText (line 766)

Filters a string, if requested.

  • return: The filtered text (if requested).
string filterText (string $text)
  • string $text: The text to filter.
flistSelect (line 463)

Wrapper around IMP_Folder::flist() which generates the body of a &lt;select&gt; form input from the generated folder list. The &lt;select&gt; and &lt;/select&gt; tags are NOT included in the output of this function.

  • return: A string containing <option> elements for each mailbox in the list.
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
folderPref (line 1324)

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.

  • return: The folder name.
  • since: IMP 4.1
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
generateIMPUrl (line 1384)

Generates a URL with necessary mailbox/index information.

  • return: URL to $page with any necessary mailbox information added to the parameter list of the URL.
  • since: IMP 4.2
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)
getAutoLoginServer (line 152)

Returns the AutoLogin server key.

  • return: The server key.
string getAutoLoginServer ([boolean $first = false])
  • boolean $first: Return the first value?
getCacheURL (line 2023)

Creates a URL for cached DIMP data.

  • return: The URL to the cache page.
  • since: IMP 4.2
string getCacheURL (string $type, string $cid)
  • string $type: The cache type.
  • string $cid: The cache id.
getComposeArgs (line 566)

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.

  • return: A URI fragment or an associative array with any compose arguments present.
string getComposeArgs (string $format)
  • string $format: Either 'uri' or 'array'.
getCurrentMailboxInfo (line 1751)

Process mailbox/index information for current page load.

  • return: Array with the following elements:
     'mailbox' - The current active mailbox (may be search mailbox).
     'thismailbox' - The real IMAP mailbox of the current index.
     'index' - The IMAP message index.
  • since: IMP 4.2
array getCurrentMailboxInfo ()
getIMPMboxParameters (line 1404)

Returns a list of parameters necessary to indicate current mailbox status.

  • return: The list of parameters needed to indicate the current mailbox status.
  • since: IMP 4.2
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.
getLabel (line 353)

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.

  • return: The plain text label.
string getLabel (string $mbox)
  • string $mbox: The mailbox to use for the label.
getLogoutUrl (line 1767)

Returns the proper logout URL for logging out of IMP.

  • return: The logout URL.
  • since: IMP 4.2
string getLogoutUrl ()
getMenu (line 827)

Build IMP's list of menu items.

  • return: Either a Horde_Menu object or the rendered menu text.
mixed getMenu ([string $returnType = 'object'])
  • string $returnType: Either 'object' or 'string'.
getNamespace (line 1237)

Get namespace info for a full folder path.

  • return: The namespace info for the folder path or null if the path doesn't exist.
  • since: IMP 4.1
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.
getNewMessagePopup (line 1073)

Outputs the necessary javascript code to display the new mail notification message.

  • return: The javascript for the popup 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.
getPathInfo (line 2311)

Utility function to obtain PATH_INFO information.

  • return: The PATH_INFO string.
  • todo: Remove for Horde 4
  • since: IMP 4.2
string getPathInfo ()
getRequestToken (line 318)

Get a token for protecting a form.

  • since: IMP 4.2
void getRequestToken ( $slug)
  • $slug
getSort (line 1518)

Return the sorting preference for the current mailbox.

  • return: An array with the following keys: 'by' - Sort type 'dir' - Sort direction 'limit' - Was the sort limit reached?
  • since: IMP 4.2
array getSort ([string $mbox = null])
  • string $mbox: The mailbox to use (defaults to current mailbox in the session).
getStylesheets (line 2164)

Return the list of base stylesheets to display.

TODO: Copied from Horde 3.2 for BC purposes.

  • since: IMP 4.2
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
getTidyConfig (line 1842)

Determines if the tidy extension is available and is the correct version. Returns the config array.

  • return: The config array, or false if tidy is not available.
  • since: IMP 4.2
mixed getTidyConfig (integer $size)
  • integer $size: Size of the HTML data, in bytes.
hasPermission (line 790)

Returns the specified permission for the current user.

  • return: The value of the specified permission.
  • since: IMP 4.1
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.
hideDeletedMsgs (line 1427)

Determine whether we're hiding deleted messages.

  • return: True if deleted messages should be hidden.
  • since: IMP 4.2
boolean hideDeletedMsgs ([boolean $force = false])
  • boolean $force: Force a redetermination of the return value (return value is normally cached after the first call).
includeScriptFiles (line 1922)

Outputs the necessary script tags, honoring local configuration choices as to script caching.

  • since: IMP 4.2
void includeScriptFiles ()
includeStylesheetFiles (line 2043)

Outputs the necessary style tags, honoring local configuration choices as to stylesheet caching.

  • since: IMP 4.2
void includeStylesheetFiles ([boolean $print = false], [string $app = 'imp'])
  • boolean $print: Include print CSS?
  • string $app: The application to load ('dimp' or 'imp').
isPreferredServer (line 263)

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.

  • return: True if this entry is "preferred".
boolean isPreferredServer (string $server, [TODO $key = null])
  • string $server: A complete server entry from the $servers hash.
  • TODO $key: TODO
isSpecialFolder (line 1715)

Is $mbox a 'special' folder (e.g. 'drafts' or 'sent-mail' folder)?

  • return: Is $mbox a 'special' folder?
  • since: IMP 4.2
boolean isSpecialFolder (string $mbox)
  • string $mbox: The mailbox to query.
loginLogMessage (line 1803)

Output login message to use for Horde log.

  • return: The message string to use in the log.
  • since: IMP 4.2
string loginLogMessage (string $status)
  • string $status: Either 'login', 'logout', or 'failed'.
loginTasksFlag (line 1214)

Either sets or checks the value of the logintasks flag.

  • return: The value of the flag.
    1. = No login tasks pending
    2. = Login tasks pending
    3. = Login tasks pending, previous tasks interrupted
integer loginTasksFlag ([integer $set = null])
  • integer $set: The value of the flag.
logoutUrl (line 685)

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.

  • return: Logout URL with logout parameters added.
string logoutUrl ()
menu (line 924)

Outputs IMP's menu to the current output stream.

  • since: IMP 4.2
void menu ()
numberFormat (line 2358)

Replacement for number_format() which doesn't work with multibyte separators.

  • return: The number formatted for the current locale.
string numberFormat ($number $number, [$decimals $decimals = 0])
  • $number $number: The number to format.
  • $decimals $decimals: The number of decimals.
openComposeWin (line 599)

Open a compose window.

void openComposeWin ([ $options = array()])
  • $options
outputInlineScript (line 1681)

Print pending inline javascript to the output buffer.

  • since: IMP 4.2
void outputInlineScript ()
parseAddressList (line 421)

Parses an address or address list into the address components.

  • return: A list of address objects or a PEAR_Error object.
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?
parseIndicesList (line 1157)

Get message indices list.

  • return: Returns an array with the folder as key and an array of message indices as the value (See #2 above). Else, returns false.
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.
popupIMPString (line 1788)

Output the javascript needed to call the popup_imp JS function.

  • return: The javascript needed to call the popup code.
  • since: IMP 4.2
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.
prefsURL (line 1115)

Generates the URL to the prefs page.

  • return: The URL to the IMP prefs page.
string prefsURL ([boolean $full = false])
  • boolean $full: Generate full URL?
printMode (line 1127)

Are we currently in "print" mode?

  • return: Returns true if in "print" mode.
boolean printMode ([boolean $mode = null])
  • boolean $mode: True if in print mode, false if not.
quota (line 973)

Outputs IMP's quota information.

void quota ()
quotaData (line 994)

Returns data needed to output quota.

  • return: Array with these keys: class, message, percent.
  • since: IMP 4.2
array quotaData ([boolean $long = true])
  • boolean $long: Output long messages?
recomposeLogin (line 1500)

Returns true if we are doing a login for recomposition purposes.

  • return: True if current pageload is for purposes of logging in to resume composing a message.
  • since: IMP 4.2
boolean recomposeLogin ()
redirect (line 2338)

Utility function to send redirect headers to browser, handling any browser quirks.

  • todo: Move to framework (Browser::?) for Horde 4
  • since: IMP 4.2
void redirect (string $url)
  • string $url: The URL to redirect to.
removeBareNewlines (line 1733)

Remove "bare newlines" from a string.

  • return: The string with all bare newlines removed.
  • since: IMP 4.2
string removeBareNewlines (string $str)
  • string $str: The original string.
sendHTTPResponse (line 1871)

Send response data to browser.

  • since: IMP 4.2
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'.
serverString (line 297)

Generates a full c-client server specification string.

  • return: The full spec string.
string serverString ([string $mbox = null], [ $protocol = null])
  • string $mbox: The mailbox to append to end of the server string.
  • $protocol
setSort (line 1598)

Set the sorting preference for the current mailbox.

TODO: Purge non-existant search sorts (i.e. non VFolder entries).

  • since: IMP 4.2
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?
status (line 948)

Outputs IMP's status/notification bar.

void status ()
threadSortAvailable (line 1578)

Determines if thread sorting is available.

  • return: True if thread sort is available for this mailbox.
  • since: IMP 4.2.1
boolean threadSortAvailable (string $mbox)
  • string $mbox: The mailbox to check.
wrapInlineScript (line 1701)

Print inline javascript to output buffer after wrapping with necessary javascript tags.

  • return: The script with the necessary HTML javascript tags appended.
  • since: IMP 4.2
string wrapInlineScript (array $script)
  • array $script: The script to output.

Documentation generated on Sun, 30 Jan 2011 05:28:12 +0000 by phpDocumentor 1.4.3