file class.boaction.inc.php

File: class.boaction.inc.php

function delmov

Abstract: used to delete or move messages, single message or groups of messages
Author: Angles and previous authors

Discussion: after a message delete or move is handled, this function redirect the browser back to the appropiate page, and puts some data in the URI which the mail_msg class translates into a report to the user recapping what actions just took place. ALSO, note with multiple accounts or with filtering, it may be possible this function is processing a batch of messages that may be from or going to different folders, accounts, and servers. Both here and at the mail_msg move and delete functions, some grouping of message numbers is attempted, but this could be improved upon.

function get_attach

Abstract: browser requests a specific MIME part number, this function will get it from the mail server and send it to the browser.
Author: Angles and previous maintainers

Discussion: Uses the phpgw api browser class to generate the headers which preceed the actual attachment data. Note this is tricky because different browsers, especially the MSIE versions, require different headers to be present in order to handle the data effectively at the clients browser. Incorrect headers can cause things like the browser not getting the name of the attachment, or not starting the associated viewer for the attachment, or even several save_or_open dialogs in a row.

function view_html

Abstract: special handler to view certain types of html mail
Author: Angles

Discussion: Used in special cases when simply giving the client browser unprocessed html MIME part(s) is not a good idea or needs special attention. Not a good idea means that there is CSS in the html part which would totally b0rk the look of the clients browser, or certain unusual script. Special Handling means a MULTIPART RELATED message such as Outkrook stationary or Evolutions version of the same, where the html has IMG tags in it that are not real HREFs but rather a reference to another MIME part in the same message. To handle that this message display code swaps that IMG mime part reference with an actual URL used by "get_attach" function to retrieve that particular MIME part from the email server and send it to the browser, this the IMG appears in the HTML message as intended. In that case the processing is done before the message is dispayed, and the processed HTML part is stored as a form hiddenvar in base64 encoded format. The user sees a button saying "View HTML", if clicked this processed HTML part is submitted to this function which base64 decodes it and sends it to the browser as a simgle html page, not a part of a mail like is typical. In either case the user gets that button and the buttons associated form submits data to this function. If the part is not RELATED, i.e. did not require special IMG tag swapping, then this function gets submitted to is a reference to the particular HTML part of the message and it is sent to the browser as a page unto itself. In either case, the part is not displayed inline with other MIME parts, not displayed in the same browser window as the rest of the groupware template, instead this part will be viewed in its own page.

file class.boattach_file.inc.php

File: class.boattach_file.inc.php

function attach UNDER DEVELOPMENT

Abstract: conversion of attach_file.php into a bo class object for attaching files. UNDER DEVELOPMENT
Unknown: #authors Many, see file banner, credits to Joseph Engo, Squirrelmail, and Angles

Discussion: UNDER DEVELOPMENT

file class.bocompose.inc.php

File: class.bocompose.inc.php

class bocompose

Abstract: guts of compose logic is in here
Unknown: # discussion ?

class requires msg_bootstrap object

Discussion: bocompose needs GLOBALS[phpgw]->msg_bootstrap which has function "ensure_mail_msg_exists". Its safe to repeatedly use create_object on it because the api is smart enough not to re-create it if it already exists. And that function "ensure_mail_msg_exists". will not re-create or re-login, so this is "safe".

function get_compose_form_action_url

Abstract: ?
Param1: $menuaction_target (string)
Author: Angles

Discussion: Used by this class and also exposes some usefull functionality, mail.spell uses this function, for example.

Access: public

function compose

Abstract: The guts of the compose page logic is here.
Author: Angles

Discussion: ?

Access: public

file class.bofilters.inc.php

File: class.bofilters.inc.php

class filter_action_sequence

Abstract: private helper for filter matching function, will apply AND and OR logic and do an action

Discussion: This is how we apply the logic of the "AND" and "OR" that relate the match criteria rows SIMPLE LOGIC: each "and" "or" is compared with the item before it * example: ROW-0: subject contains "you got a raise" ROW-1: AND sender contains "boss" ROW-2: OR sender contains "your brother" * translates to: // (ROW-0 "AND" ROW-1) "OR" ROW-2 if both row 0 and row 1 are not satified, then this particular "logic chain" ends, BUT with row 2, the possible match would be if sender contains "your brother", and this match ALONE triggers the filter action. REMEMBER THIS: *ROW-2 itself can cause a match* because with "(X1 and X2) or X3", X3 alone causes a match. thus satisfying that particular filtes's match criteria and triggering action note: this means this we do *not* have this: // ROW-0 "AND" (ROW-1 "OR" ROW-2) if the above is really what you want: I suggest putting the "OR"s first, which puts the openening and closing Parentheses around the "OR" statement * example: ROW-0: sender contains "boss" ROW-1: OR sender contains "your brother" ROW-0: AND subject contains "you got a raise" * translates to: // (sender contains "boss" -OR- sender contains "your brother") -AND- subject contains "you got a raise" this is how you get the results you want. This example is designed to illustrate the a mail from "boss" about getting a "raise" may be more important to you than a mail from "your brother" with the same subject, because it is possible your brother does not control your compensation and he is just making a joke. You manage this logic by remembering that if you use 3 rows of match criteria, rows one and two have a parentheses around them. Why do it this way? The Sieve concept is to make filters EASY TO UNDERSTAND, studies show people actually use them in such cases therefor the simple rule that ANDs and ORs are paired together in the first and second row, is consistent and hopefully easy enough for "Jane / Joe User" to understand

Author: Angles
Access: Private

file class.boindex.inc.php

File: class.boindex.inc.php

function get_index_stats_block

Abstract: produce a ready to show folder stats data for use in a template, either email layout 1 or 2
Param1: $layout (int passed as string) either "1" or "2" for email layout 1 and 2, respectively
Author: Angles, design of layout 1 has roots in Aeromail.

Discussion: Different Layouts appear different but use mostly the same source data. Pass param $layout to specify a layout 1or layout 2 style stats appearance, default is "2" which means email layout 2 appearance.

Access: private, may be used publically if needed.

function index_data

Abstract: Depreciated foor in-house use, this could be used via XML-RPC to return all data necessary for an email "index" page.
Author: Angles
Result: associative array that holds all data necessary for an email "index" page.

Discussion: Not used anymore, if a remote clients wants processed email message list data, this would be the function to use. If necessary it can be updated to produce new data as required. but layout 1 is kinda lame looking, may be replaced.

function mlist_data

Abstract: DEPRECIATED - was used to display search results, NEEDS UPDATING

file class.bomessage.inc.php

File: class.bomessage.inc.php

class bomessage

Unknown: #abtract works with mail_msg class to produce data for displaying a message messages
Author: angles and others, some handling of "to" and "from" data are left over from previous maintainers.

Discussion: takes the complex mime data provided by php, turns it into a flat array with human understandable descriptions of what the parts do,

function bomessage

Unknown: #abtract ?

function message_data

Unknown: #abtract ?

file class.bopreferences.inc.php

File: class.bopreferences.inc.php

class bopreferences

Abstract: Much logic of email preference handling is here, especially submitting and multiple account preference handling.
Author: Angles, and skeeter helped on function "preferences"

Discussion: NOTE: if prefs are submitted that alter anything relative to a cached data item, the that cached item MUST BE EXPIRED, for example GLOBALS[phpgw]->msg->expire_session_cache_item("mailserver_callstr")

Access: public

capability initialize class mail_msg object but do not login

Abstract: we need functions in class mail_msg but we not want a login
Author: Angles

Discussion: we need mail_msg fully initialized to set prefs, but we do not need class_dcom, nor do we need to login, this is how to do it:

Example:
		$GLOBALS["phpgw"]->msg_bootstrap = CreateObject("email.msg_bootstrap");
			$GLOBALS["phpgw"]->msg_bootstrap->set_do_login(False);
			$GLOBALS["phpgw"]->msg_bootstrap->ensure_mail_msg_exists("name of this calling function", $this->debug_set_prefs);
		

function init_available_prefs

Abstract: Defines all available preferences for the email app and put in $this->std_prefs[] and $this->cust_prefs[]
Result: none, this is function directly manipulates the class vars ->std_prefs[] and ->cust_prefs[]
Param1: $this->std_prefs[] class array holds all Standard Preferences available for email,
Param2: $this->cust_prefs[] class array holds all Custom Preferences available for email
Author: Angles

Discussion: This function serves as a single place to establish and maintain all preferences available to the email class. Since the preferenced are stored in a dynamic database, the database schema is not present at the database level, so we define it here. Also, $this->std_prefs[] and $this->cust_prefs[] arrays can be used to build a UI for managing and showing these prefs, and those arrays can be looped through for the setting and storing of these preferences.

Access: public
Example:
		## sample usages of the "init_default" property 
			[init_default] comma seperated, first word is an instructional token
			--possible tokens are--
			string		[any_string]  ex. 'string,new_old'
			set_or_not	[set|not_set]  ex.  'set_or_not,not_set'
			function	[string_will_be_eval'd] ex. 'function,$this->sub_default_userid($accountid)'
			init_no_fill	we will not fill this item during initialization (ex. a password)
			varEVAL	[string_to_eval] ex. "$GLOBALS['phpgw_info']['server']['mail_server']"
		

capability Adding a preference option, HOWTO example.

Abstract: this example will help you understand how the email preferences work.
Author: Angles

Discussion: email preferences, like many other phpGW preference items, do not have a Database table devoted only to email preferences. If there were such a Database table, its fields would describe a schema similar to the one we are about to study. Email prefs are stored in the phpGW preferences table, which is shared by many apps and has the charactoristics of a dynamic data store, i.e. we can add, remove, or change email preference details without having to alter the Database table itself. This can make programming easier, but it also can present a chalange if your app has many preferences, which may have a complicted tree-like hierarchy. Low level preference functiond are handled by the pgpGW api. The data itself is stored in the database as a serialized array using the php functions serialize and unserialize. We can gain the flexibility of a rich preference data handling system by doing some work up front. The work in question here is an array based schema hard coded in this function, yet similar schema definitions could exist in an XML file, as the concept is very similar. We use an associaltive array (i,e. not a simple numbered array) to hold our schema data,

Example:
		This is a how-to  example for adding an email preference item, saving it to the prefs DB table, 
			retieving the pref, and using it in code. This DocSubTopic deals with adding an email preference item, 
			using pref item "icon theme" as an example. A Step-by-Step example is provided with explanation,
			(1) copy an  existing preference item to use as a template for your new preference item.
			(2) replace in the schema with your information, as such:
			*id*		The "Unique ID" of this pref item. The pref DB uses this like a UID. 
			*type*	[ exists| user_string | known_string ]
			*widget*	[ checkbox | textbox | textarea | combobox | passwordbox ]
			*accts_usage*	[ default, extra_accounts ]
			*write_props*	[ empty_string_ok | password, hidden, encrypted, empty_no_delete | no_db_defang ]
			*lang_blurb*	description displayed to the user on the preferences page.
			*init_default*	--possible tokens are--
						string		[any_string]  ex. 'string,new_old'
						set_or_not	[set|not_set]  ex.  'set_or_not,not_set'
						function		[string_will_be_eval'd] ex. "function,$this->sub_default_userid($accountid)"
						init_no_fill	we will not fill this item during initialization (ex. a password)
						varEVAL		[string_to_eval] ex. "$GLOBALS['phpgw_info']['server']['mail_server']"
			*values*		Array of values available to the user, "key" => "value" , used with combobox widgets.
			*long_desc*	Long help, detained description of the option displayed to the user as "long help".
			(3) Your are done. The preference is now part of email preferences. It will bedisplayed on the preferences 
			page, saved and read from the preferences DB, it will have the default value you specified unless the user 
			chooses otherwise. All this happens automatically, without the developer having to write any more code.
		

function grab_set_prefs_args

Abstract: calls either (a) grab_set_prefs_args_gpc or (b) grab_set_prefs_args_xmlrpc depending on if this class was called from within phogw or via external XMP-RPC. If neither, we should produce an error.
Param1: (none) However, function uses class var ->caller (string) with expected values being "phpgw" and "xmlrpc".
Author: Angles
Access: Public

function grab_set_prefs_args_gpc

Abstract: Called By "grab_set_prefs", only handles GPC vars that are involved in setting email preferences. Grabs data from $GLOBALS['HTTP_POST_VARS'] and $GLOBALS['HTTP_GET_VARS'] as necessaey, and fills various class arg variables with the available data. HOWEVER, does not attempt to grab data if the "submit_prefs" GPC submit_token variable is not present.
Param1: none
Result: none, this is an object call

Discussion: For abstraction from phpgw UI and from PHP's GPC data, put the submitted GPC data into a class var $this->args[] array. This array is then used to represent the submitted data, instead of $GLOBALS['HTTP_POST_VARS']. This serves to further seperate the mail functionality from php itself, this function will perform the variable handling of the traditional php page view Get Post Cookie (no cookie data used here though) The same data could be grabbed from any source, XML-RPC for example, insttead of php's GPC vars, so this function could (should) have an equivalent XML-RPC "to handle filling these class variables from an alternative source. These class vars are only relevant to setting email prefs.

Author: Angles
Access: Private

concept change in Default Accounts preferences may require Expiring Cached Data

Discussion: EXPIRE ANY CACHED ITEM THAT WAS DERIVED FROM A CHANGED PREF ITEM. We should be precise and only expire if necessary, but for now just expire any cached item that could be effected by a change in preferences. NOTE: default acctnum is always 0, the acctnum which these prefs apply to.

concept change in Extra Accounts preferences may require Expiring Cached Data

Discussion: EXPIRE ANY CACHED ITEM THAT WAS DERIVED FROM A CHANGED PREF ITEM. We should be precise and only expire if necessary, but for now just expire any cached item that could be effected by a change in preferences. NOTE: we locate this after we have obtained a reliable acctnum which these prefs apply to.

function grab_set_prefs_args_xmlrpc

Abstract: Called By "grab_set_prefs", Grabs data an XML-RPC call and fills various class arg variables with the available data relevant to setting email preferences.
Param1: none
Result: none, this is an object call

Discussion: functional relative to function "grab_set_prefs_args_gpc()", except this function grabs the data from an alternative, non-php-GPC, source NOT YET IMPLEMENTED

Author: Angles
Access: Private

function process_submitted_prefs

Abstract: Process incoming submitted prefs, process the data, and save to repository if needed. Currently used for processing email preferences, both standard and custom
Param1: $pref_set (array) structured pref data as defined and supplied in "this->init_available_prefs()"
Result: boolean False if no $pref_set was supplied, True otherwise

Discussion: Reusable function, any preference data structured as in "this->init_available_prefs()" can use this code to automate preference submissions.

Author: Angles
Access: Private

function preferences

Abstract: Call this function to process submitted prefs. It makes use of other class functions some of which should not be called directly.
Author: skeeter, Angles
Access: Public

function process_ex_account_submitted_prefs

Abstract: Extra Email Accounts Process incoming submitted prefs, process the data, and save to repository
Author: Angles
Access: Private

function ex_accounts_delete

Abstract: delete an extra email account
Param1: $acctnum(int) the account number of the account to delete
Author: Angles

Discussion: ?

Access: private

function ex_accounts_edit

Abstract: Extra Email Account Data process submitted prefs. It makes use of other class functions some of which should not be called directly, call this function in menuaction.
Author: Angles
Access: Public

function ex_accounts_list

Abstract: list Extra Email Accounts with links to edit and or delete them.
Author: Angles
Access: Public

function get_first_empty_ex_acctnum

Abstract: Used in adding a new extra account, obtains a free acctnum
Author: Angles
Access: Public

function obtain_ex_acctnum

Abstract: Preferences handlers pass around the acctnum as POST or GET var "ex_acctnum".
Author: Angles
Access: Public

file class.bosend.inc.php

File: class.bosend.inc.php

class bosend

Abstract:
Author: Angles, server side attachment storage technique borrowed from Squirrelmail,

function get_originating_ip

Abstract: the client IP for this phpgw user at the time the send button was clicked

Discussion: Gets the value for the "X-Originating-IP" header. That header is used by hotmail, for example, it looked like a "good thing" and was a feature request, so we use it here too. Even if the IP private (such as on a LAN), this can still be useful for the admin.

function copy_to_sent_folder

Abstract: Put a message in "Sent" Folder, if Applicable. This MUST be a message that has been sent already!
Result: Boolean
Author: Angles

Discussion: If a message has already been sent, and IF the user has set the pref enabling the use of the sent folder, only then should this function be used. If a message has not actually been sent, it should NOT be copied to the "Sent" folder because that misrepresents to the user the history of the message. Mostly this is an issue with automated messages sent from other apps. My .02 cents is that if a user did not send a message by pressing the "Send" button, then the message does not belong in the Sent messages folder. Other people may have a different opinion, so this function will not zap your keyboard if you think differently. Nonetheless, if the user has not enabled the preference "Sent mail copied to Sent Folder", then noting gets copied there no matter what. Note that we obtain these preference settings as shown in the example for this function. If the folder does not already exist, class mail_msg has code to make every reasonable attempt to create the folder automatically. Some servers just do things differently enough (unusual namespaces, sub folder trees) that the auto create may not work, but it is nost likly that it can be created, and even more likely that it already exists. NOTE: this particular class should be made availabllle to public use without the brain damage that is the current learning curve for this code. BUT for now, this is a private function unless you really know what you are doing. Even then, code in this class is subject to change.

Access: private - NEEDS TO BE MADE AVAILABLE FOR PUBLIC USE

capability (FUTURE CODE) append to sent folder without a pre-existing mailsvr_stream.

Discussion: FUTURE CODE what follows is untested but should work to accomplish that. While we do need to login to the mail server, we can just select the INBOX because the IMAP APPEND command does not require you have "selected" the folder that is the target of the append. We should be able to simply bootstrap the msg objext and call login, because during initialization the msg object gathers all the data it can find on what account number we are dealing with here, it handles that for us automatically. We do not want to append to the sent folder of the wrong account.

Example:
		## this should work if a stream does not already exist (UNTESTED)
			$this->msg_bootstrap = CreateObject("email.msg_bootstrap");
			$this->msg_bootstrap->ensure_mail_msg_exists('email.bosend.copy_to_sent_folder', $this->debug_send);
			## now run the rest of the function as usual.
		

function sendorspell

Abstract: detects whether the compose page was submitted as a send or spellcheck, and acts accordingly
Unknown: #params none, uses GET and POST vars
Author: Angles

Discussion: Compose form submit action target is bosend, naturally, however the spell check button submit is identical EXCEPT "btn_spellcheck" POST var will be set, which requires we handoff the handling to the spell class.

function spellcheck

Abstract: if the compose page was submitted as a pellcheck, this function is called, it then calls the emai.spell class
Unknown: #params none, uses GET and POST vars

Discussion: If needed, put the body through stripslashes_gpc() before handing it off to the mail_spell object. This function simply gathers the required information and hands it off to the mail_spell class,

function send

Abstract: if the compose page was submitted as a pellcheck, this function is called
Unknown: #params none, uses GET and POST vars, however this will be OOPd for API use

Discussion: advanced function to send mail with all the complexities of modern MIME usage. Currently handles forwarding as an "encapsulated" MIME part, thus prewserving the original messages structure, including any attachments the original message had. Of course the user can attach files, this includes attaching additional files to a forwarded message which itself alsready has attachments.

var msgtype

Abstract: obsoleted way phpgw apps used to inter-operate

Discussion: NOTE this is a vestigal way for phpgw apps to inter-operate, I *think* this is being obsoleted via n-tiering and xml-rpc / soap methods. RARELY USED, maybe NEVER used, most email code for this is now commented out "back in the day..." the "x-phpgw" header was specified by a phpgw app *other* than the email app which was used to include special phpgw related handling instructions in the message which to the message intentended to be noticed and processed by the phpgw email app when the user open the mail for viewing, at which time the phpgw email app would issue the special handling instructions contained in the "x-phpgw" header. even before n-tiering of the phpgw apps and api begain, I (angles) considered this a possible area of abuse and I commented out the code in the email app that would notice, process and issue those instructions.

property charset

Abstract: not user specified, not a user var, not an argument, not a paramater.

Discussion: charset could take up a lot of notes here, suffice to say that email began life as a US-ASCII thing and still us-ascii chars are strictly required for some headers, while other headers and the body have various alternative ways to deal with other charsets, ways that are well documented in email and other RFC's and other literature. In the rare event that the phpgw api is unable to provide us with a charset value, we use the RFC specified default value of "US-ASCII"

var from

Abstract: the mail's author, OPTIONAL, usually no need to specify this as an arg passed to the script.

Discussion: Generally this var does not need to be specified. When the mail is being sent from the user's default email account (or mail on behalf of the user, like automated email notifications), we generate the "from" header for the user, hence no custom "from" arg is necessary. This is the most common scenario, in which case we generate the "from" value as follows: (1) the user's "fullname" (a.k.a. the "personal" part of the address) is always picked up from the phpgw api's value that contains the users name, and (2) the user's email address is either (2a) the default value from the phpgw api which was passed into the user's preferences because the user specified no custom email address preference, or (2b) the user specified a custom email address in the email preferences in which case the aformentioned phpgw api default email address is not used in the user's preferences array, this user supplied value is used instead. Providing a "from" arg is usually for extra email accounts and/or alternative email profiles, where the user wants other than the "from" info otherwise defaultly associated with this email acccount. NOTE: from != sender from is who the mail came from assuming that person is also the mail's author. this is by far the most common scenario, "from" and "author" are usually one in the same (see below for info on when to *also* use "sender" - VERY rare)

var sender

Abstract: OPTIONAL only used in the rare event that the person sending the email is NOT that email's author.

Discussion: RFC2822 makes clear that the Sender header is ONLY used if some one NOT the author (ex. the author's secretary) is sending the author's email. RFC2822 considers that "From" = the author and the "Sender" = the person who clicked the send button. Generally they are one in the same and generally the Sender header (and hence this "sender" var) is NOT needed, not used, not included in the email's headers.

property date

Abstract: not user specified, not a user var, not an argument, not a paramater.

Discussion: According to RFC2822 the Date header *should* be the local time with the correct timezone offset relative to GMT, however this is problematic on many Linux boxen, and in general I have found that reliably extracting this data from the host OS can be tricky, so instead we use a fallback value which is simply GMT time, which is allowed under RFC2822 but not preferred. FUTURE: figure out a host independant way of getting the correct rfc time and TZ offset

property elho SMTP handshake domain value

Abstract: not user specified, not a user var, not an argument, not a paramater.

Discussion: when class.msg_send conducts the handshake with the SMTP server, this will be the required domain value that we supply to the SMTP server. Phpgw is considered the client to the SMTP server. RFC2821 sect 4.1.1.1 specifies this value is almost always the Fully Qualified Domain Name of the SMTP client machine, but rarely, when said client machine has dynamic FQDN or no reverse mapping is available, this value *should* be "address leteral" (see sect 4.1.3). Refer to the documentation for BIND for further reading on reverse lookup issues.

concept 7bit vs. 8bit encoding value in top level headers

Discussion: top level 7bit requires qprinting the body if the body has 8bit chars in it ISSUE 1: "it's unnecessary" nowdays, most all MTAs and IMAP/POP servers can handle 8bit by todays usage, 7bit is quite restrictive, when considering the variety of things that may be attached to or carried in a message (and growing) [begin digression] However, stuffing RFC822 email thru a X500 (?) gateway requires 7bit body, which we could do here, at the MUA level, and may possibly require other alterations of the message that occur at the gateway, some of which may actually drop portions of the message, indeed it's complicated, but rare in terms of total mail volume (?) [end digression] ISSUE 2: "risks violating RFCs and confusing MTAs" setting top level encoding to 7bit when the body actually has 8bit chars is "TOTALLY BAD" MTA's will be totally confused by that mis-match, and it violates RFCs **More Importantly** this is a coding and functionality issue involved in forwarding: in general, when you forward a message you should not alter that message if that forwarded message has 8bit chars, I don't think that can be altered even to quote-print that forwarded part (i.e. to convert it to 7bit) would be altering it I suppose you could base64 encode it, on the theory that it decodes exactly back into it's original form, but the practice of base64 encoding non-attachments (i.e. text parts) is EXTREMELY rare in my experience (Angles) and still problematic in coding for this. I suppose this assumes qprint is possible "lossy" in that the exact original may not be exactly the same as said pre-encoded forwarded part, and, after all, it's still altering the part. CONCLUSION: Set Top Level Header "Content-Transfer-Encoding" to "8bit" because it's easier to code for and less likely to violate RFCs. for now send out as 8bit and hope for the best.

file class.html_widgets.inc.php

File: class.html_widgets.inc.php

class html_option

Abstract: data structure used with class html_widgets
Param1: $value (class var) (string) this options value that will be submitted if selected
Param2: $text (class var) (string) the text the user sees, a description of this option
Param3: $selected (class var) (boolean) whether this option should be pre-selected in a combobox, default False
Author: Angles

Discussion: used in making select text, value items, such as in the combobox widget.

Access: private

class hiddenvar_option

Abstract: data structure used with hidden data in forms

Discussion: ?

Access: private

class html_widgets

Abstract: generate HTML widgets for use in web pages.
Author: Angles
Access: public

Discussion: OOP style class for producing common widgets in html pages, such as a combobox. Designed to reduce bain damage to the developer by hiding the details of the html tags and by treating these things as widgets which is what they are, more than just simple html markup.

class requires including spell_struct header file

Discussion: class html_widgets needs the special C-Style Include .h like file, class.spell_struct which holds data structure class correction_info used here for integration with the mail.spell spellchecking class.

capability HREF LINK WIDGET

Discussion: generate an a href item, includes link, target, text. CLEARS ITSELF after each "get_href"

Author: Angles
Example:
		$this->widgets->set_href_link('index.php');
		$this->widgets->set_href_target('top');
		$this->widgets->get_href_clickme(lang('click here for more info in a new window'));
		$my_href_tag = $this->widgets->get_href();
		

function clear_href_vars

Abstract: after every call to "->get_href" all internal vars are cleared automatically with this function.
Author: Angles

Discussion: href class vars for link, target, text. CLEARS ITSELF after each "get_href". This utilty function does that. It is RARE that you would ever need to call this directly.

Access: private

function set_href_link

Abstract: set the URL link of this this HREF widget
Param1: $href_link (string)
Author: Angles
Access: public

function get_href_link

Abstract: used check or verify the value if the "href_link" property
Author: Angles
Access: public

function set_href_target

Abstract: OPTIONAL set the "target", i.e. what browser window this HREF should apply to, default is not to specify any target in the HREF tag.
Param1: $href_target (string)
Author: Angles
Access: public

function get_href_target

Abstract: used check or verify the value if the "href_target" property
Author: Angles
Access: public

function set_href_clickme

Abstract: what the user needs to click on to activate the HREF link, can be text or a COMPLETE img tag.
Param1: $href_clickme (string) text or a COMPLETE img tag
Author: Angles
Access: public

function get_href_clickme

Abstract: used check or verify the value if the "href_clickme" property
Author: Angles
Access: public

function get_href

Abstract: generate and return an HREF tag using information you set in the OOP "set_href_" functions
Author: Angles
Result: (string) a complete HREF tag generated from data you set in the "set_href_" functions,

Discussion: After you set "href_target", "href_clickme" and other optional properties ("href_target") this function generates an HREF tag from that data and returns it. NOTE after generating the HREF tag, and before returning it, this function CLEARS ALL PROPERTIES that it used to make that href tag, so this "widget" automatically is ready to new usage without having to explicitly call any "new" or "clear" function.

Access: public

function href_maketag (not related to the HREF widget)

Abstract: QUICK way to generate a typical A HREF html item in a single function call. NOT PART OF THE HREF WIDGET, not OOP style, just a quick utilty function. ALL params must be passed in this function call.
Param1: $href_link (string) URL for this HREF tag
Param2: $href_text (string) what the user clicks on to activate this HREF tag, can be text OR a COMPLETE IMG tag.
Param3: $target (string) OPTIONAL target for the link, such as when using frames or opening a new browser window.
Author: Angles

Discussion: not really a widget, does not use OOP style, but it gets the job done quickly. Somewhat Depreciated, use the OOP style href widget instead.

Example:
		this->href_maketag("index.jsp", "click here for home page", "new");
		
Access: public

function img_maketag

Abstract: quick and dirty to make an IMG html tag in one function call.
Author: Angles
Param1: $location (string int) URL to the image, cal be releative or fully qualified
Param2: $alt (string) text displayed (a) in place of the image if not displayed, and (b) as a image tooltip on some browsers
Param3: $height (string int) int passed as a string, OPTIONAL, not included in img tag if not provided
Param4: $width (string int) int passed as a string OPTIONAL, not included in img tag if not provided
Param5: $border (string int) int passed as string OPTIONAL , not included in img tag if not provided , the size of the border around the image, often set to "0"

Discussion: not really a widget but it gets the job done. QUICK way to generate a typical A IMG html item in a single function call. Not OOP style, just a quick utilty function. ALL params must be passed in this function call.

Example:
		$my_img = widgets->img_maketag("poweredby.png", "powered by RedHat",  "", "", "0");
		
Access: public

capability COMBOBOX WIDGET

Discussion: generate a combo box html widget.

Author: Angles
Example:
		$this->widgets->new_combobox();
		$this->widgets->set_cbox_name("user_choice");
		$this->widgets->set_cbox_item("yes"', "Customer is Right");
		$this->widgets->set_cbox_item("no"', "Customer is Wrong");
		$my_combobox_wirget = $this->widgets->get_combobox();
		

function set_cbox_name

Abstract: ?

function get_cbox_name

Abstract: ?

function set_cbox_onChange

Abstract: ?

function get_cbox_onChange

Abstract: ?

function set_cbox_item

Abstract: ?

function set_cbox_item_spellcheck

Abstract: makes a special kind of combobox select item for use with spellcheck
Param1: $this_bad_word_element (class "correction_info" structued data from file class.spell_struct)
Param2: $suggestion_num (int OR empty string) see discussion below.
Author: Angles

Discussion: This function makes use of structure "correction_info" which we expose by including file class.spell_struct in the constructor for this class. The combobox select item this function makes embeds array data in the items "value" by setting it to a string that resembles a URL get request, which we then can recover this array by applying php function parse_str to the value when the user submits the form. The idea is to provide enough data in the value that the spellcheck replacement code can accurately find and replace the desired word, or not change the word at all if special suggestion string "K_E_E_P" is present. The first suggestion should be en empty string with special value "K_E_E_P" which means no change to the misspelled word, this is indicated by passing an empty string for param $suggestion_num. The value for the suggestion item is a URL type string that contains as much informaion as we can preserve from the $this_bad_word_element object param, but specifying the individual suggestion provieded by the $suggestion_num arg which is the index to this particular suggestion in the $this_bad_word_element->suggestions[] numbered array of suggestions. Upon submit, we can apply php function parse_str() to this uri to recover the desired array structure. Parse_str will even urldecode the items for us.

function get_cbox_item

Abstract: ?

function new_combobox

Abstract: ALWAYS start a new combobox widget by calling this function first. Clears all combobox properties.

function get_combobox

Abstract: generate and return a HTML select (combobo) widget using the values you set in the "set_cbox_" functions.
Author: Angles

Discussion: this function does not clear its properties, so if for some reason you want THE SAME comboboxes more then one time, calling "get_combobox" will return the same combobox until you clear it by calling "new_combobox", which you should ALWAYS do when starting a new combobox widget.

Access: public

capability FORM WIDGET

Discussion: generate a opening tag of a form including name, action, method, and hiddenvars

Author: Angles
Example:
		$this->widgets->new_form();
		$this->widgets->set_form_name('spell_review');
		$this->widgets->set_form_method('POST');
		$this->widgets->set_form_action('index.php?email.targets.move');
		$this->widgets->set_form_hiddenvar('subject', 'stock');
		$this->widgets->set_form_hiddenvar('symbol', 'GM');
		// OPTIONAL if you have set "preserve_vars" you can include them as hidden vars with this command
		$this->commit_preserve_vars_to_form();
		$my_form_tag = $this->widgets->get_form();
		

function set_form_name

Abstract: ?

function get_form_name

Abstract: ?

function set_form_action

Abstract: ?

function

Abstract: ? get_form_action

function set_form_method

Abstract: ?

function get_form_method

Abstract: ?

function set_form_hiddenvar

Abstract: put hidden vars in a form tag.
Param1: $name the "key" in the GPC key - value pair
Param2: $value the "value" in the GPC key - value pair
Param3: $do_urlencode (boolean) OPTIONAL default is True, whether or not to urlencode the name and value params.
Author: Angles
Access: public

function get_form_hiddenvar

Abstract: ?

function get_form

Abstract: generate and return an FORM tag using the data you set in the "set_form_" functions. Any hiddenvars will be urlencoded. NOTE YOU MUST PUT THE CLOSING <'form> somewhere after this form tag. This finctions generates the opening tag of the form, which is where all the complicated stuff is. The ending tag is a normal html markup closing tag you must supply.
Author: Angles
Access: prublic

function form_closetag

Abstract: SIMPLE - returns the closing tag for a form <'form>
Author: Angles

Discussion: This seems dumb at first, but take the folders combobox as an example, when the user selects a folder from the combbox the OnChange submits the form associated with that combobox, i.e. the form OnChange and the form name should be the same name and the form age should surround the combobox, I think, Anyway, IMAP servers have folders but POP servers do now, so we will not show said folder combobox if viewing a POP3 mail server. Therefor, in our template we put a non-breaking-space in the place of the combobox html. BUT what about that those form tage that surround this combobox, we should leave them out too. In typical templaying this is ease to replace the form opening tag with a non-breaking-space. BUT the closing tag is such a simple thing we often hard code it into the template, not a template var. SO we can not leave out the form open tag but have the form close tag still be in the template. This no-brainer function just makes it easy to remember to leave out or include, as the case may be, the form closeing tag.

Access: public

function make_button

Abstract: generate a button in a SINGLE FUNCTION CALL, all params must be passed.
Author: Angles
Param1: $type (string) usually "SUBMIT"
Param2: $name (string) they GPC "key" in the "key - value" pair
Param3: $value (string) they GPC "value" in the "key - value" pair AND THE TEXT on the button
Param4: $onClick (string) OPTIONAL usually some javascript for the onclick event of the button. Default is none

Discussion: Since a button is generally considered a "widget", I will call this a widget although it does not use "set_" property functions the other widgets do. All params must be passed in the function call.

Access: public
Example:
		$my_button = $this->widgets->make_button('submit', 'btn_send', lang('Send'));
		

capability TOOLBAR COMPOUND WIDGET

Discussion: generate a toolbar for use in email pages NOTE: usually only one toolbar made per page view so there is no "new_toolbar" function because we should not need it. set_toolbar_msg is the only value that you might want to check if you make more then one toolbar.

Author: Angles

function set_toolbar_msg

Abstract: the toolbar has a 3rd row which can display text to the user. This function sets that.
Param1: $msg (string)
Author: Angles

Discussion: Usually after deleting or moving messages or creating, renaming, or deleting folders, the mail_msg generates some kind of message to report to the user what actions were just taken. Note a blank string will clear a msg if needed. Currently only the uiindex page and the uifolder page might provide a msg.

Access: public

function get_toolbar_msg

Abstract: get whatever value the toolbar_msg property has.
Author: Angles
Access: public

function get_toolbar

Abstract: this function returns a complete html toolbar widget that is on top of many email pages.
Author: Angles

Discussion: generate a toolbar for use in email pages NOTE: WE NEED globals[phpge]->msg OBJECT and A LOGIN in order to make this toolbar, THEREFOR do not put this toolbar on a page where login may not be available.Currently, Preferencs pages DO NOT LOGIN, because if you are setting preferences you do not need a mailserver stream AND you may not even have enough data set to get a mailserver stream. Note: uses a private template object to assemple the toolbar, calling function is responsible for putting the result in the global template.

Access: public

function all_folders_combobox

Abstract: high level function, uses functions in mail_msg and this class html_widgets to make an acct switchbox UNDER DEVELOPMENT.
Param1: $form_reference (string) this bombobox sets an "onChange" event, which will submit the form you put here. Default value is "document.folders_cbox.submit()" where "" is the default value for the $form_reference param
Result: string representing an HTML listbox widget
Author: Angles

Discussion: The first item in this folder combo box tells the user to "pick a folder to change to", and has no "value", the value is an empty string, this is more like a label than a combobox item.

Access: private, maybe made public

function all_accounts_combobox

Abstract: UNDER DEVELOPMENT
Author: Angles

Discussion: the "values" are in the form of a URI request string, since a combobox can only submit a single string as its value. This way we put alot of information if the form of the URI request and use php function "parse_str" to "recover" all this data on the submit. Accounts have a "status" associated with them, can be "enabled", "disabled", or "empty". In this combobox we show "enabled" and "disabled" accounts, not "empty" accounts. NOTE "disabled" really has no use, and "empty" I am not sure if that is ever used anywhere at all. Also note that a "disabled" account should never be "pre-selected" in this combobox, which seems logical. Almost always there is an email account that can be considered "active" because the user is viewing its data (folders, messages, its preferences) or if the user is composing a message then the last "active" account is considered the account which this mail will be "from". Therefor, generally all mail activity have an account that it applies to. So when this combobox comes across the account that is currently "active", that account will be "pre-selected" in the combobox. This serves two purposes, ONE, the user can not swicth to an account that is currently the "active" account, the user can only switch do a different account, and TWO, this gives the user visual feedback about which account is currently "active", on some pages, such as the compose page, this remines the user who the mail will be "from", i.e. which account sent the mail. In making this thing we iterate thru the "extra_and_default_acounts list", which is an numbered array whose members are structured array data describing the account.

file class.mail_dcom.inc.php

File: class.mail_dcom.inc.php

class MAIL_DCOM

Abstract: implements communication with the mail server. (not related to anything else called "dcom")

Discussion: php may or may not have IMAP extension built in. This class will AUTO-DETECT that and load either (a) a class which mostly wraps the available builtin functions, or (b) a TOTAL REPLACEMENT to PHPs builtin imap extension. Currently, the POP3 socket class is fully implemented, basically a re-write of the UWash c-client, because all the logic contained in an imap server had to be emulated locally here, since a pop server provides only the most basic information, the rest must be deduced. NOTE: the imap socket class is NOT COMPLETE!

Author: Angles and others, each function has an authors list
Access: private, only mail_msg access this directly

file class.mail_dcom_base.inc.php

File: class.mail_dcom_base.inc.php

function utf7_encode

Abstract: ?
Author: Angles
Access: private

function utf7_encode_string

Abstract: ?
Author: Angles
Access: private

function utf7_decode

Abstract: ?
Author: Angles
Access: private

function utf7_decode_string

Abstract: ?
Author: Angles
Access: private

function get_flag

Abstract: ?

file class.mail_dcom_base_sock.inc.php

File: class.mail_dcom_base_sock.inc.php

class mailbox_status (sockets)

Abstract: part of mail Data Communications class

Discussion: see PHP function: IMAP_STATUS -- This function returns status information on a mailbox other than the current one SA_MESSAGES - set status->messages to the number of messages in the mailbox SA_RECENT - set status->recent to the number of recent messages in the mailbox SA_UNSEEN - set status->unseen to the number of unseen (new) messages in the mailbox SA_UIDNEXT - set status->uidnext to the next uid to be used in the mailbox SA_UIDVALIDITY - set status->uidvalidity to a constant that changes when uids for the mailbox may no longer be valid SA_ALL - set all of the above

class mailbox_msg_info (sockets)

Abstract: part of mail Data Communications class

Discussion: see PHP function: IMAP_MAILBOXMSGINFO -- Get information about the current mailbox

Syntax:
		structure returns this data
	Date		date of last change
	Driver		driver
	Mailbox	name of the mailbox
	Nmsgs	number of messages
	Recent		number of recent messages
	Unread	number of unread messages
	Deleted	number of deleted messages
	Size		mailbox size
		

class mailbox_status (sockets) discussion VS. class mailbox_msg_info (sockets)

Abstract: compare these two similar classes and their functions

Discussion: class mailbox_status is used by function IMAP_STATUS class mailbox_msg_info is used by function IMAP_MAILBOXMSGINFO These two functions / classes are similar, some notes on their usage is the example below

Example:
		Note 1)
	IMAP_MAILBOXMSGINFO is only used for the folder that the client is currently logged into,
	for pop3 this is always "INBOX", for imap this is the currently selected (opened) folder.
	Therefor, with imap the target folder must already be selected (via IMAP_OPEN or IMAP_REOPEN)
	Note 2)
	IMAP_STATUS is can be used to obtain data on a folder that is NOT currently selected (opened)
	by the client. For pop3 this difference means nothing, for imap this means the client
	need NOT select (i.e. open) the target folder before requesting status data.
	Still, IMAP_STATUS can be used on any folder wheter it is currently selected (opened) or not.
	Note 3)
	The main functional difference is that one function returns size data, and the other does not.
	imap_mailboxmsginfo returns size data, imap_status does NOT.
	This size data adds all the sizes of the messages in that folder together to get the total folder size.
	Some IMAP servers can take alot of time and CPU cycles to get this total,
	particularly with MAILDIR type imap servers such as Courier-imap, while other imap servers
	seem to return this size data with little difficulty.
		

class msg_structure (sockets)

Abstract: part of mail Data Communications class

Discussion: see PHP function: imap_fetchstructure -- Read the structure of a particular message

Syntax:
		structure of return data is this
	type			Primary body type
	encoding		Body transfer encoding
	ifsubtype		TRUE if there is a subtype string
	subtype		MIME subtype
	ifdescription		TRUE if there is a description string
	description		Content description string
	ifid			TRUE if there is an identification string
	id			Identification string
	lines			Number of lines
	bytes			Number of bytes
	ifdisposition		TRUE if there is a disposition string
	disposition		Disposition string
	ifdparameters		TRUE if the dparameters array exists
	dparameters		Disposition parameter array
	ifparameters		TRUE if the parameters array exists
	parameters		MIME parameters array
	parts			Array of objects describing each message part
		

class msg_overview (sockets)

Abstract: part of mail Data Communications class

Discussion: see PHP function: imap_fetch_overview -- Read an overview of the information in the headers of the given message. NOT CURRENTY IMPLEMENTED

class hdr_info_envelope (sockets)

Abstract: part of mail Data Communications class

Discussion: see PHP function: imap_headerinfo -- Read the header of the message see PHP function: imap_header which is simply an alias to imap_headerinfo

class mail_dcom_base (sockets)

Abstract: part of mail Data Communications class

Discussion: mail_dcom_base Extends phpgw api class network After mail_dcom_base is loaded, a top level class mail_dcom is created specifically for the necessary propocol, either POP3, IMAP, or NNTP

Syntax:
		CreateObject('email.mail_dcom');
		
Author: Angles, Skeeter, Itzchak Rehberg, Joseph Engo
Copyright: LGPL
Package: email (to be moved to phpgwapi when mature)
Access: public

function error

Abstract: none

function get_flag

Abstract: REDUNDANT FUNCTION FROM NON-SOCK CLASS

function distill_fq_folder

Abstract: break down a php fully qualified folder name into its seperate barts
Param1: $fq_folder : string : FOLDERNAME
Result: array structure as shown in the syntax
Syntax:
		this is the array return struture
		result['folder'] : string is the folder (a.k.a. mailbox) name WITHOUT the bracketed 
		result['svr_and_port'] string : for Internal Use
		result['server'] : string is the IP or NAME of the server
		result['port_with_junk'] string : for Internal Use
		result['port'] string is the port number
		

Discussion: $fq_folder name arrives as: FOLDERNAME OR some variation like this: FOLDERNAME FOLDERNAME this is how php passes around this data in its builtin IMAP extensions this function breaks down that string into it's parts

Author: Angles
Access: private

function read_port_glob

Abstract: used with POP3, reads data from port until we encounted param $end
Param1: $end (string) is the flag to look for that tells us when to stop reading the port's data
Result: raw string of data (glob) as received from the server

Discussion: POP3 servers data typically ends with special charactor(s), usually an empty line, i.e. a lone CRLF pair, or line that is a period "." followed br a CRLF pair thus we can direct this function to read the server's data until such special end flag is reached

Author: Angles, skeeter
Access: private

function glob_to_array

Abstract: used with POP3, converts raw string server data into an array
Param1: $data string
Param2: $keep_blank_lines boolean
Param3: $cut_from_here string
Param4: $keep_received_lines boolean
Param5: $idx_offset (integer) where to start the returned array at (if not zero)
Result: array

Discussion: ?

Author: Angles
Unknown: #access private

function show_crlf

Abstract: replace actual CRLF sequence with the string "CRLF"
Param1: $data (string)
Result: returns string "\r\n" CRFL pairs replaced with the string "CRLF"

Discussion: useful for debugging, CRLF pairs are CarrageReturn + LineFeed which is the standard way email client and servers end any line while communicating

Author: Angles
Access: public or private

function phpGW_quoted_printable_decode

Param1: $string string

Discussion: PHP `quoted_printable_decode` function does not work properly: it should convert '_' characters into ' '.

function phpGW_quoted_printable_decode2

Param1: $string (string)

Discussion: Remove '=' at the end of the lines. `quoted_printable_decode` doesn't do it.

function decode_base64

Param1: $string (string)

Discussion: uses ereg_replace and preg_replace in addition to php function base64_decode

function decode_qp

Param1: $string (string)

Discussion: ?

function decode_header

Param1: $string (string)

Discussion: ?

function decode_author

Discussion: ?

function get_mime_type

Discussion: useable but depreciated

function type_int_to_str

Discussion: ?

function get_mime_encoding

Discussion: ?

function encoding_int_to_str

Discussion: ?

function get_att_name

Discussion: usable but depreciated

function uudecode

Discussion: appears to implement UUDECODE without any special php functions.

file class.mail_dcom_imap_sock.inc.php

File: class.mail_dcom_imap_sock.inc.php

function str_begins_with

Abstract: determine if string $haystack begins with string $needle
Param1: $haystack : string : data to examine to determine if it starts with $needle
Param2: $needle : string : $needle should or should not start at position 0 (zero) of $haystack
Result: Boolean, True or False

Discussion: this is a NON-REGEX way to to so this, and is NOT case sensitive this *should* be faster then Regular expressions and *should* not be confused by regex special chars such as the period "." or the slashes "/" and "\" , etc...

Syntax:
		?
		
Author: Angles
Unknown: #access public or private

function imap_read_port

Abstract: reads data from an IMAP server until the line that begins with the specified param "cmd_tag"
Param1: $cmd_tag : string is the special string that indicates a server is done sending data this is generally the same "tag" identifier that the client sent when initiate the command, ex. "A001"
Result: array where each line of the server data exploded at every CRLF pair into an array

Discussion: IMAP servers send out data that is fairly well "typed", meaning RFC2060 is pretty strict about what the server may send out, allowing the client (us) to more easily interpet this data. The important indicator is the string at the beginning of each line of data from the server, it can be: "*" (astrisk) = "untagged" = means "this line contains server data and more data will follow" "+" (plus sign) means "you, the client, must now finish sending your data to the server" "tagged" is the command tag that the client used to initiate this command, such as "A001" IMAP server's final line of data for that command will contain that command's tag as sent from the client This tagged "command completion" signal is followed by either: "OK" = successful command completion "NO" = failure of some kind "BAD" = protocol error such as unrecognized command or syntax error, client should abort this command processing

Syntax:
		?
		
Author: Angles, skeeter
Unknown: #access private

function report_svr_data

Abstract: reports server data array for debugging purposes
Result: echos multiline data
Author: Angles
Unknown: #access private

function server_last_error

Abstract: implements IMAP_LAST_ERROR
Result: string

Discussion: ?

Syntax:
		?
		
Author: Angles
Unknown: #access public

function open

Abstract: implements php function IMAP_OPEN
Param1: $fq_folder : string : FOLDERNAME
Param2: $user : string : account name to log into on the server
Param3: $pass : string : password for this account on the mail server
Param4: $flags : NOT YET IMPLEMENTED

Discussion: implements the functionality of php function IMAP_OPEN note that php's IMAP_OPEN applies to IMAP, POP3 and NNTP servers

Syntax:
		?
		
Author: Angles, skeeter
Unknown: #access public

function reopen

Abstract: implements last part of IMAP_OPEN and all of IMAP_REOPEN
Param1: $stream_notused : socket class handles stream reference internally
Param2: $fq_folder : string : "fully qualified folder" FOLDERNAME
Param3: $flags : Not Used in helper function
Result: boolean True on success or False on error

Discussion: ?

Author: Angles
Unknown: #access public

function listmailbox

Abstract: implements IMAP_LISTMAILBOX
Param1: $stream_notused : socket class handles stream reference internally
Param2: $server_str : string :
Param3: $pattern : string : can be a namespace, or a mailbox name, or a namespace_delimiter, or a namespace_delimiter_mailboxname, AND/OR including either "%" or "*" (see discussion below)
Result: an array containing the names of the mailboxes
Unknown: #discussion: if param $pattern includes some form of mailbox reference, that tells the server where in the mailbox hierarchy to start searching. If neither wildcard "%" nor "*" follows said mailbox reference, then the server returns the delimiter and the namespace for said mailbox reference. More typically, either one of the wildcards "*" or "%" follows said mailbox reference, in which case the server behaves as such: _begin_PHP_MANUAL_quote: There are two special characters you can pass as part of the pattern: '*' and '%'. '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory. _end_quote_ See RFC 2060 Section 6.3.8 (client specific) and Section 7.2.2 (server specific) for more details. The imap LIST command takes 2 params , the first is either blank or a mailbox reference, the second is either blank or one of the wildcard tokens "*" or "%". PHP's param $pattern is a combination of the imap LIST command's 2 params, the difference between the imap and the php param(s) is that the php param $pattern will contain both mailbox reference AND/OR one of the wildcaed tokens in the same string, whereas the imap command seperates the wildcard token from the mailbox reference. I refer to IMAP_LISTMAILBOX's 2nd param as $server_str here while the php manual calls that same param "$ref", which is somewhat misnamed because the php manual states "ref should normally be just the server specification as described in imap_open()" which apparently means the server string with no namespace, no delimiter, nor any mailbox name.
Author: Angles, skeeter

function status

Abstract: implements php function IMAP_STATUS
Param1: $stream_notused : socket class handles stream reference internally
Param2: $fq_folder : string : FOLDERNAME
Param3: $flags : available options are: SA_MESSAGES - set status->messages to the number of messages in the mailbox SA_RECENT - set status->recent to the number of recent messages in the mailbox SA_UNSEEN - set status->unseen to the number of unseen (new) messages in the mailbox SA_UIDNEXT - set status->uidnext to the next uid to be used in the mailbox SA_UIDVALIDITY - set status->uidvalidity to a constant that changes when uids for the mailbox may no longer be valid SA_ALL - set all of the above

Discussion: implements the functionality of php function IMAP_STATUS

Syntax:
		?
		
Author: Angles, skeeter
Unknown: #access public

function get_body

Abstract: implements IMAP_BODY

file class.mail_dcom_pop3_sock.inc.php

File: class.mail_dcom_pop3_sock.inc.php

class mail_dcom (sockets)

Abstract: part of mail Data Communications class

Discussion: mail_dcom Extends mail_dcom_base which Extends phpgw api class network This is a top level class mail_dcom is designed specifically POP3

Syntax:
		CreateObject('email.mail_dcom');
		
Author: Angles, Skeeter, Itzchak Rehberg, Joseph Engo
Copyright: LGPL
Package: email (to be moved to phpgwapi when mature)
Access: public

function createmailbox

Abstract: unused function in pop3

function deletemailbox

Abstract: unused function in pop3

function expunge

Abstract: unused function in pop3

function listmailbox

Abstract: unused function in pop3

function mailcopy

Abstract: unused function in pop3

function mail_move

Abstract: unused function in pop3

function reopen

Abstract: unused function in pop3

function append

Abstract: unused function in pop3

function fetch_overview

Abstract: function NOT YET IMPLEMENTED in pop3 sockets

function noop_ping_test

Abstract: function NOT YET IMPLEMENTED in pop3 sockets

function server_last_error

Abstract: function NOT YET IMPLEMENTED in pop3 sockets

function open

Abstract: implements php function IMAP_OPEN
Param1: $fq_folder (string) FOLDERNAME (htmlized) {SERVER_NAME:PORT/OPTIONS}FOLDERNAME
Param2: $user (string) account name to log into on the server
Param3: $pass (string) password for this account on the mail server
Param4: $flags (defined int) NOT YET IMPLEMENTED

Discussion: implements the functionality of php function IMAP_OPEN note that php IMAP_OPEN applies to IMAP, POP3 and NNTP servers

Author: Angles, skeeter
Access: public

function close

Abstract: implements php function IMAP_CLOSE
Param1: $flags (defined int) NOT YET IMPLEMENTED

Discussion: implements the functionality of php function IMAP_CLOSE, note that with POP3, messages are marked "Deleted" and then automatically expunged on QUIT, aka IMAP_CLOSE.

Author: Angles, skeeter
Access: public

function mailboxmsginfo

Abstract: implements php function IMAP_MAILBOXMSGINFO
Param1: $stream_notused Not Used because api network class handles the stream

Discussion: implements php function IMAP_MAILBOXMSGINFO

Author: Angles, skeeter
Access: public

function status

Abstract: returns mailbox_status structure
Param1: $stream_notused Not Used because api network class handles the stream
Param2: $fq_folder Same server and folder string that the php function expects
Param3: $options defaults to SA_ALL, may not be completely implemented

Discussion: needed

Author: Angles, skeeter
Access: public

function num_msg

Abstract: returns number of messages in the mailbox
Param1: $stream_notused Not Used because api network class handles the stream

Discussion: actually usrs the function ->mailboxmsginfo to obtain the return data

Author: Angles, skeeter
Access: public

function sort

Abstract: implements IMAP_SORT
Param1: $stream_notused socket class handles stream reference internally
Param2: $criteria (integer) HOW to sort the messages, we prefer SORTARRIVAL, or "1" as default
Param3: $reverse (boolean) the ordering if the messages , low to high, or high to low, where FALSE 0 lowest to highest (default for php's builtin imap) TRUE 1 highest to lowest, a.k.a. Reverse Sorting
Param4: $options not implemented
Result: returns an array of integers which are messages numbers for the messages sorted as requested.

Discussion: using SORTDATE can cause some messages to be displayed in the wrong cronologicall order, because the sender's MUA can be innaccurate in date stamping

Author: Angles, Skeeter, Itzchak Rehberg, Joseph Engo
Access: public
Syntax:
		param criteria is used like this
		SORTDATE 0 This is the Date that the senders email client stamps the message with
		SORTARRIVAL 1  This is the date the email arrives at your email server (MTA)
		SORTFROM  2
		SORTSUBJECT 3
		SORTSIZE  6
		

function fetch_header_element

Abstract: ?

function fetchstructure

Abstract: implements IMAP_FETCHSTRUCTURE
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num (integer)
Param3: $flags (integer) - FT_UID (not implimented)
Result: returns an instance of Class "msg_structure" is sucessful, False if error

Discussion: basiclly a replacement for PHPs c-client logic which is missing if IMAP is not builtin

Author: Angles, calls functions with authors Skeeter, Itzchak Rehberg, Joseph Engo
Access: public

function fill_toplevel_fetchstructure

Abstract: HELPER function for fetchstructure / IMAP_FETCHSTRUCTURE
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num integer
Param3: $flags integer - FT_UID (not implimented)
Result: returns an instance of Class "msg_structure" is sucessful, False if error

Discussion: basiclly a replacement for PHP's c-client logic which is missing if IMAP is not builtin

Author: Angles, calls functions with authors Skeeter, Itzchak Rehberg, Joseph Engo
Access: private

function create_embeded_fetchstructure

Abstract: HELPER function for fetchstructure / IMAP_FETCHSTRUCTURE
Param1: $info **REFERENCE** to a class "msg_structure" object
Result: NONE this function DIRECTLY manipulates the referenced object

Discussion: as implemented, reference is to some part of class var $this->msg_structure

Author: Angles
Access: private

function sub_get_structure

Abstract: HELPER function for fetchstructure / IMAP_FETCHSTRUCTURE
Param1: $info **REFERENCE** to a class "msg_structure" object
Param2: $header_array array of headers to process
Result: NONE this function DIRECTLY manipulates the referenced object

Discussion: as implemented, reference is to some part of class var $this->msg_structure

Author: Angles, Itzchak Rehberg, Joseph Engo
Access: private

function unset_unfilled_fetchstructure

Abstract: HELPER function for fetchstructure / IMAP_FETCHSTRUCTURE
Param1: $info **REFERENCE** to a class "msg_structure" object
Result: NONE this function DIRECTLY manipulates the referenced object

Discussion: as implemented, reference is to some part of class var $this->msg_structure unsets any unfilled elements of the referenced part in the fetchstructure object to mimic PHPs return structure

Author: Angles
Access: private

function parse_type_subtype

Abstract: HELPER function for sub_get_structure / IMAP_FETCHSTRUCTURE
Param1: $info **REFERENCE** to a class "msg_structure" object
Param2: $content the text associated with the "content-type:" header
Result: NONE this function DIRECTLY manipulates the referenced object

Discussion: as implemented, reference is to some part of class var $this->msg_structure parses "content-type:" header into fetchstructure data ->type and ->subtype

Author: Angles, Itzchak Rehberg, Joseph Engo
Access: private

function parse_msg_params

Abstract: HELPER function for sub_get_structure / IMAP_FETCHSTRUCTURE
Param1: $info **REFERENCE** to a class "msg_structure" object
Param2: $content string from the "content-type:" or "content-disposition:" header
Param3: $is_disposition_param (boolean) true if parsing "content-disposition:" header string tells this function to fill info->dparameters instead of the more common info->parameters
Result: NONE this function DIRECTLY manipulates the referenced object

Discussion: as implemented, reference is to some part of class var $this->msg_structure parses "content-type:" header string into fetchstructure data info->parameters or "content-disposition:" header string into fetchstructure data info->dparameters

Author: Angles, Itzchak Rehberg, Joseph Engo
Access: private

function type_str_to_int

Abstract: ?

function default_type

Abstract: ?

function default_subtype

Abstract: ?

function default_encoding

Abstract: ?

function more_info

Abstract: may be obsoleted

function encoding_str_to_int

Abstract: ?

function size_msg

Abstract: ?

function header

Abstract: implements IMAP_HEADER (alias to IMAP_HEADERINFO)
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num intefer
Param3: $fromlength ?
Param4: $tolength ?
Param5: $defaulthost ?
Result: returns an instance of Class "hdr_info_envelope", or returns False on error

Discussion: none

Author: Angles, Skeeter, Itzchak Rehberg, Joseph Engo
Access: public

function get_addr_details

Abstract: HELPER function to header / IMAP_HEADER
Param1: $people
Param2: $address
Param3: $header
Param4: $count

Discussion: none

Author: Itzchak Rehberg, Joseph Engo
Unknown: #access private

function delete

Abstract: implements IMAP_DELETE
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num either an integer OR a comma seperated string of integers and/or ranges (21:23, 26, 69)
Param3: $flags (integer) - FT_UID (not implimented)
Result: returns True if able to mark a message for deletion, False if not

Discussion: Similar to an IMAP server, POP3 must be expunged to actually delete marked messages This is done (1) by immediately closing the connection after your done marking, this will cause POP3 to expunge or (2) by issuing PHPs buildin IMAP_EXPUNGE command which we DO NOT emulate here

Author: Angles
Access: public

function fetchheader

Abstract: implements IMAP_FETCHHEADER
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num integer
Param3: $flags integer - FT_UID; FT_INTERNAL; FT_PREFETCHTEXT
Result: returns string which is complete, unfiltered RFC2822 format header of the specified message

Discussion: This function implements the FT_PREFETCHTEXT text option This function uses the helper function "get_header_raw"

Author: Angles
Access: public

function get_header_array

Abstract: Custom Function - Similar to IMAP_FETCHHEADER - EXCEPT returns a string list array
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num integer
Param3: $flags integer - FT_UID; (FT_INTERNAL; FT_PREFETCHTEXT) none implemented
Result: returns headers exploded into a string list array, one array element per Un-Folded header line

Discussion: This function UN-FOLDS the headers as per RFC2822 "folding, so each element is in fact the intended complete header line, eliminates partial "folded" lines

Author: Angles
Access: public (custom function, also used privately)

function get_header_raw

Abstract: HELPER function for "fetchheader" / IMAP_FETCHHEADER
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num integer
Param3: $flags Not Used in helper function
Result: returns returns unprocessed glob header string of the specified message

Discussion: This function causes a fetch of the complete, unfiltered RFC2822 format header of the specified message as a text string and returns that text string (i.e. glob)

Author: Angles
Access: private

function fetchbody

Abstract: implements IMAP_FETCHBODY
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num integer
Param3: $part_num integer or a string of integers seperated by dots "2.4.1" references the MIME part number, or section, inside of the message
Param4: $flags Not Used in helper function
Result: returns string which is the desired message / part

Discussion: NOTE: as of Oct 17, 2001, the $part_num used here is not always the same as the part number used for official imap servers. But because this same class produced the fetchstructure, and provided it to the client, and that client will again use this class to get that part, the part number is consistant internally and is MUCH easier to implement in the fetchbody code. However, in the future, the part numbering logic in fetchbody will be coded to exactly match what an official imap server would expect. In the mail_msg class I refer to this "inexact" part number as "mime number dumb" as it is based only on the part's position in the fetchstructure array, before the processing to convert to official imap part number, which mail_msg class refers to as "mime number smart", which is used to access mime parts when using PHP's builtin IMAP module.

Author: Angles
Access: public

function get_body

Abstract: implements IMAP_BODY
Param1: $stream_notused socket class handles stream reference internally
Param2: $msg_num integer
Param3: $flags integer - FT_UID; FT_INTERNAL; FT_PEEK; FT_NOT
Unknown: #param$phpgw_include_header boolean (for custom use - not a PHP option)
Result: returns string which is a verbatim copy of the message body (i.e. glob)

Discussion: This function implements the IMAP_BODY and also includes a custom boolean param "phpgw_include_header" which also includes unfiltered headers in the return string NEEDED: code for flags: FT_UID; maybe FT_INTERNAL; FT_NOT; flag FT_PEEK has no effect on POP3

Author: Angles
Access: public

file class.mail_filters.inc.php

File: class.mail_filters.inc.php

capability extract multidimentional filter data embedded in this 1 dimentional array

Discussion: php3 limits POST arrays to one level of array key/value pairs thus complex filtering instructions are containded in special strings submitted as controls names action instructions willlook something like this: $filter_X ['action_1_judgement'] => 'fileinto' the "key" string "action_1_judgement" needs to be "decompressed" into an associative array the string means this: a: we are dealing with "action" instructions b: when this data is "decompressed" this would be action[1] data c: that this should be action[1] ["judgement"] where "judgement" is the key, and d: that value of this action[1] ["judgement"] = "fileinto"

Author: Angles

file class.mail_msg_base.inc.php

File: class.mail_msg_base.inc.php

class mail_dcom_holder

Abstract: This class has one purpose, PHP3 compatibility. It simply holds the DataCommunications Object.
Author: Angles

Discussion: In tests PHP3 could not handle having an object as a simple array item. Therefor we had to make this class to be the thing that holdes a class.dcom (DataCommunications) object. PHP4 had no problem with the previous code but it was changed to this for backwards compatibility with PHP3, otherwise the script exits with a parse error. Multiple account capability requires that any account can have a stream open to its server at any time, independant of any other DataCommunications object, simce one account may be IMAP while another account may be POP3. Using an array of these mail_dcom_holders, we can achieve this goal and still have PHP3 compatibility.

Example:
		$GLOBALS['phpgw_dcom_'.$acctnum] = new mail_dcom_holder;
		$GLOBALS['phpgw_dcom_'.$acctnum]->dcom = CreateObject("email.mail_dcom", $this_server_type);
	now we have an array based structure where each array key can have a DataCommunications object of its 
	own, thereby allowing for multiple mail accounts of any type to be open simultaneously.
		

class mail_msg_base

Abstract: One of three classes that combine to form the mail_msg object. The other classes are mail_msg_wrappers and filename mail_msg_display which is actually called mail_msg because it is the final class extension loaded and therefor bears the name we want the class as a whole to have, This class forms the common core of the email functionality,
Author: Angles, and with some small remnants of Aeromail present

Discussion: The three files and classes inter relate in the following way to end up with the mail_msg object FIRST, include class mail_msg_base, then SECONDLY incluse mail_msg_wrappers extending mail_msg_base, then THIRDLY include mail_msg which extends mail_msg_wrappers and, by inheritance, mail_msg_base All functions that are at the heart of email functionality are in this class. This class is in the process of being further OOPd so programmers can more easily use it without having to know abou the internal details. When multiple accounts are in use, each active account can be accessed and controlled through this class. Each active account with a stream open to its maiul server has its own DataCommunications object which used to be a part of this class but had to be moved elsewhere for PHP3 compatibility, but still each DataCommunications object is in an array and is accessed via an account number which is comtrolled in this class. This class handles organizing the preferences for each of the multiple accounts. In general, a simple class var array keeps the multiple account information organized as a numbered array based on integer account number. There are already many OOP methods that hide complexities from the programmer, such as the preference and arg access functions. Many of those functions can optionally take an account number and foilder name, but if none is supplies the functions uses logic to obtain valid account number and folder name for whatever account you are dealing with. There is extensice debug output available by setting the various debug flags between 1 to 3, or to 0 if no debug is wanted. More documentation is provided for each function in this class.

classvar known_external_args

Abstract: List of GET POST variables that the email class and app is supposed to be aware of.

Discussion: In a complex app such as email it becomes difficult to keep track of all the GET POST vars that the app is expected to know about. Therefor, all GPC vars this class is expected to be aware of are listed here with an explanation of what they do.

Param1: msgball (typed array) msgball "object" is a message-descriptive "object" or associative arrays that has all important message reference data as array data, passed via URI (real or embedded). With multiple accounts enabled most data such as a folder name or a message number, mean nothing by themselves because we do not know which account they are supposed to apply to. Msgball typed array combines all necessary data, the acctnum, folder, msgnum, and sometimes other data such as part_no, into one thing. Use msgball anytime you are dealing with messages, if you only you do not care about individual email messages, such as when switching from one folder to another, then you can use the fldball typed array, see below, which does not require such detailed information.
Param2: fldball (typed array) ldball "object" is an assiciative array of folder data passed via URI (real or embedded). Use fldball when instructing this class to do things that are not specific to any particular message number, such as when opening a stream to an account, or when switching from folder to folder. Generally the least amount of information necessary is fldball[acctnum] (int)and fldball[folder] (string). This class know to expect less information in a fldball, whereas a msgball is expected to contain very detailed information.
Param3: fldball_fake_uri (string in the form of a URI request) This is usually sourced from a folder combobox where HTML only allows a single value to be passed, thus we make a string in the syntax of a URI to contain multiple data values in that single HTML element, in this way we embed extra data in an otherwise very limiting HTML element. Note: even php's POST vars array handling can not do anything with a HTML combobox option value. See this example: POST data: folder_fake_uri="fldball['folder']=INBOX&fldball['acctnum']=0" Will be processed into this (using php function "parse_str()" to emulate URI GET behavior) fldball[folder] => INBOX fldball[acctnum] => 0
Param4: delmov_list (numbered array with each element being a msgball Fake URI string) Used with mail message moves, appends, and deletes, holds the "from" data, as in move this message "from" here to... and the "to" destimation data is contained in the to_fldball, see below. This comes from the checkbox form data in uiindex.index page, where multiple boxes may be checked but the POST data is limited to a simple string per checkbox, so additional information is embedded in delmov_list and converted to an associative array via php function "parse_str". This is typically used to move or delete a list of messages, but since this array are all msgball items, mail functions such as append and move are no longer limited to one account or one folder, the msgball array can instruct the class to move messages beween different mail accounts of different types and to and from any folder therein.
Param5: to_fldball_fake_uri (string in the form of a URI get request) Used to pass complex data deom a combo box which is limited to submitting only a single string. This is generally used to describe the destination acctnum and folder for message moves, appends, and deletes. Php function parse_str is used to make this string data into the typed array to_fldball, see below.
Param6: to_fldball (typed array with emements [acctnum] as int, and [folder] as string) Used to describe the destination in mail moves, or appends and it is formed by using php function parse_str on a POST submitted arg "to_fldball_fake_uri".
Param7: move_postmove_goto ? When moving a message while viewing it in the view message page, this var will be passed used to tell us what to show the user after we do the move, it will be a URI string that begins with "menuaction".
Param8: sort ?
Param9: order ?
Param10: start these three vars preserve the users current choice of sort and order between page views and message actions, and start is used to help the app in nextmatches behavior.
Param11: td (int) ?
Param12: tm (int) ?
Param13: tf (string) these three vars are used to === REPORT ON MOVES/DELETES === td = total deleted ; tm = total moved, tm used with tf, folder messages were moved to. usage: (outgoing) class.boaction: when action on a message is taken, report info is passed in these. (in) uiindex.index: here the report is diaplayed above the message list, used to give user feedback. Generally these are in the URI (GET var, not a form POST var)
Param14: what (string) === MOVE/DELETE MESSAGE INSTRUCTIONS === Possible Values: (outgoing) class.uiindex "move", "delall", used with delmov_list to move or delete messages. AND with "to_fldball" which is the destination acctnum and folder for the move. (outgoing) uimessage: "delete" used with a msgball to delete or move an individual message directly from the view message page. (in) class.boaction: instruction on what action to preform on 1 or more message(s) (move or delete) NOTE: the destination for the move is described in "delmov_list" which is a msgball list of msgball's which are message-descriptive "objects" or associative arrays that have all the necessary data on each message that is to be deleted or moved. The iuindex.index page uses the same form with different submit buttons (what) so the "delmov_list" is applicable to either deleting or moving messages depending on which submit button was clicked.
Param15: action (string) used for === INSTRUCTIONS FOR ACTION ON A MESSAGE OR FOLDER === (a) (out and in) uifolder: used with "target_folder" and (for renaming) "source_folder" and has instructions to add/delete/rename folders: create(_expert), delete(_expert), rename(_expert) where "X_expert" indicates do not modify the target_folder, the user know about of namespaces and delimiters. (b) uicompose: can be "reply" "replyall" "forward" which is passed on to bosend (c) bosend: when set to "forward" and used with "fwd_proc" instructs on how to construct the SMTP mail
Param16: msgball[part_no] (string) representing a specific MIME part number (example "2.1.2") within a multipart message. Used by (a) uicompose: used in combination with msgball, (b) boaction.get_attach: used in combination with msgball.
Param17: encoding (string) possible values "base64" "qprint" Used by (a) uicompose: if replying to, we get the body part to reply to, it may need to be un-qprint-ed, and (b) boaction.get_attach: appropriate decoding of the part to feed to the browser.
Param18: fwd_proc (string) Possible Values "encapsulation", "pushdown (not yet supported)" Used as (outgoing) uimessage much detail is known about the messge, there the forward proc method is determined. Used by: (a) uicompose: used with action = forward, (outgoing) passed on to bosend, (b) bosend: used with action = forward, instructs on how the SMTP message should be structured.
Param19: name (string) the name of an attachment
Param20: type (string) the mime type of an attachment
Param21: subtype (string) the mime subtype of an attachment. These 3 args comprise this info is passed to the browser to help the browser know what to do with the part a.k.a. attachment. (outgoing) uimessage: "name" is set in the link to the addressbook, it's the actual "personal" name part of the email address and boaction.get_attach: the name of the attachment. Note these params are NOT part of the msgball array, because with the other data already in msgball, it should be obvious what these items are supposed to apply to.
Param22: target_fldball (typed array) and
Param23: source_fldball_fake_uri (string of type URI Get) used to make the source_fldball param, see below.
Param24: source_fldball (typed array) used for === FOLDER ADD/DELETE/RENAME & DISPLAY === Note param source_fldball is used in renaming folders only. Used for: (outgoing) and (in) bofolder: used with "action" to add/delete/rename a mailbox folder, where "action" can be: create, delete, rename, create_expert, delete_expert, rename_expert.
Param25: show_long (string "true" if set) Used by uifolder it is set there and sent back to itself uifolder. If set: indicates to show 'long' folder names with namespace and delimiter NOT stripped off.
Param26: to (string) part of === COMPOSE VARS ===
Param27: cc (string) ?
Param28: bcc (string) ?
Param29: body (string) These compose vars, as most commonly NOT used with "mailto" have following usage (note if used with "mailto", less common, then see "mailto" below). Used as: (outgoing) uiindex, uimessage: any click on a clickable email address in these pages, will call uicompose passing "to" (possibly in rfc long form address), (outgoing) uimessage: when reading a message and you click reply, replyall, or forward calls uicompose with EITHER (1) a msgball so that compose gets all needed info, (more effecient than passing all those GPC args) OR (2) to,cc,subject,body may be passed. (outgoing) uicompose: ALL contents of input items to, cc, subject, body, etc... are passed as GPC args to bosend. (in) (a) compose.php: text that should go in to and cc (and maybe subject and body) text boxes are passed as incoming GPC args, and (in) (b) bosend: (fill me in - I got lazy)
Param30: sender (string) Less Common Usage RFC says use header "Sender" ONLY WHEN the sender of the email is NOT the author, this is somewhat rare.
Param31: attach_sig (boolean True is set, or not present or unset if False) USAGE (outgoing) uicompose: if checkbox attach sig is checked, this is passed as GPC var to bosent, and (in) bosend: indicate if message should have the user's "sig" added to the message.
Param32: msgtype (string) DEPRECIATED, flag to tell phpgw to invoke "special" custom processing of the message extremely rare, may be obsolete (not sure), most implementation code is commented out. Used as: (outgoing) currently NO page actually sets this var, and (a) bosend: will add the flag, if present, to the header of outgoing mail, and (b) bomessage identify the flag and call a custom proc.
Param33: personal (string) the name part of an email address,m used with the following param
Param34: mailto (string) === MAILTO URI SUPPORT === USAGE (in and out) bocompose: support for the standard mailto html document mail app call can be used with the typical compose vars (see above), indicates that to, cc, and subject should be treated as simple MAILTO args.
Param35: no_fmt (boolean) === MESSAGE VIEWING MOD === Usage (in and outgoing) uimessage: will display plain body parts without any html formatting added.
Param36: html_part (string) === VIEW HTML INSTRUCTIONS === actually a pre-processed HTML/RELATED MIME part with the image ID's swapped with msgball data for each "related" image, so the MUA may obtain the images from the email server using these msgball details.
Param37: force_showsize (boolean) === FOLDER STATISTICS - CALCULATE TOTAL FOLDER SIZE. As a speed up measure, and to reduce load on the IMAP server, there is an option to skip the calculating of the total folder size if certain conditions are met, such as more then 100 messages in a folder, the user may request an override of this for 1 page view.
Param38: mlist_set === SEARCH RESULT MESSAGE SET === DEPRECIATED - not yet fixed.
Param39: folder (string) most often a part of a msgball or fldball, the function begin_request will obtain the folder value from (1) args_array, the args passed directly to the begin_request function in the form of folder => Sent, if any, or (2) a fldball GPC or (3) a msgball GPC, or (4) default "INBOX". === THE FOLDER ARG discussion === Folder name is used in almost every procedure, IMAP can be logged into only one folder at a time and POP3 has only one folder anyway (INBOX), INBOX is the assumed default value for "folder".
Param40: ex_acctnum (int) all preference handling of extra accounts passes this as the account number "ex" = "extra".
Param41: COMPLETE_ME, are there more GPC args we use in the email app?

function begin_request

Abstract: initializes EVERYTHING, do not forget to call end_session before you leave this transaction.
Param1: $args_array May be phased out, but right now the most used param is "do_login" => True
Author: Angles
Description: the who enchalada happens here. Recently only class msg_bootstrap calls this directly.

function logout

Abstract: simply calls this->end_request with no args, so it closes all open streams.
Author: Angles

Discussion: Simplified way to logout. Closes all open streams for all accounts. Usually closing selected streams only is an internal only thing used in special circumstances, so this function SHOULD BE CALLED AT THE END of your page view, for example, just before the last template "pfp" (or whatever output function you use). NOTE: IF THERE IS A WAY TO "HOOK" THIS so it happens AUTOMATICALLY after the last parse of the api template, that would be a "good thing"

function end_request

Abstract: Closes open streams.
Author: Angles
Param1: $args_array OPTIONAL array of type fldball. If noy provided, all open streams are closed.

Discussion: Streams are left open during any particular mail operation and are not closed until this function is called. If this function is not called then the stream becomes a zombie and the mail server will close it after a certain amount of time. Mail streams before PHP 4,2 are not persistent, they last only as long as the page view or mail operation. This function should be called so the streams are properly closed with the logout command to the mail server.

function ensure_stream_and_folder

Abstract: make sure a stream is open and the desired folder is selected, can automatically do this for us
Author: Angles
Param1: $fldball descrfibes the acctnum and folder to open,
Param2: $called_from (string) name of the function that you called this from, used to aid in debugging.

Discussion: Typically used for moving mail between seperate accounts, use this function to make sure the source or destination mail server stream is open and the required folder is selected. If not, this function will open the connection and select the desired folder.

function login_error

Abstract: reports some details about a login failure, uses imap_last_error
Author: Angles
Param1: $called_from (string) name of the function that you called this from, used to aid in debugging.

Discussion: ?

function loginerr_tryagain_buggy_cert

Abstract: try to recover from a known php bug and reattempt login
Param1: $called_from
Param2: $error_report
Param3: $mail_server_type
Param4: $acctnum
Author: Angles

Discussion: as of RedHat 7.3 there us a bug in php and UWash requiring unusual mailscr_callstr containing "novalidate-cert" even for NON-SSL connections. If possible, this function adjusts the mailsvr_callstr and continues execution of the script. As long as we "return" from this function, instead of exiting, we can continue the script from where the error occured, assuming we have fixed the error. This is a cool thing, the option to fix and continue just by using "return", or to exit with "phpgw_exit", which ends execution of the script.

function prep_folder_in

Abstract: make sure the folder name has the correct namespace and delimiter, if not supplied they will be added.
Author: Angles
Param1: $feed_folder (string) the folder name to work on.
Param2: $acctnum (int) which account the folder belongs to, defaults to 0, the default account number.

Discussion: Mail servers ecpect the foldername to be in a particluar form. This function makes sure of this. If a foldername without a namespace is provided, this function will preform a lookup of all available folders for the given acount and get the closest match. The lookup may be nevessary because the namespace and delimiter can differ from server to server, although most typically the name space is "INBOX" and the delimiter is a period.

function prep_folder_out

Abstract: Used to prepare folder names for use in a GPC request, currently just urlencodes the foldername.
Author: Angles
Param1: $feed_folder (string) OPTIONAL the folder name to prepare.
Access: Private

Discussion: Folder if not passed will be obtained from the class which keeps track od the folder currently selected, this allows us to call this with no args and the current folder is "prep-ed". Foldnames with spaces and other URL unfriendly chars are encoded here must be decoded on the next input (script session) to undo what we do here.

function ensure_no_brackets

Abstract: used for removing the bracketed server call string from a full IMAP folder name string.
Author: Angles
Param1: $feed_str (string) the folder name to work on.
Access: Private
Syntax:
		** note this has chars that will not show up in the inline doc parser **
		ensure_no_brackets('INBOX') = 'INBOX'
		
Example:
		** same as syntax but can be viewed in the inline doc parser **
		ensure_no_brackets('{mail.yourserver.com:143}INBOX') results in 'INBOX'
		

function get_mailsvr_callstr

Abstract: will generate the appropriate string to access a mail server of type pop3, pop3s, imap, imaps
Result: the returned string is the server call string from beginning bracker "{" to ending bracket "}" the returned string is the server call string from beginning bracker "{" to ending bracket "}"

Discussion: After updating to RH73, a new bug popped up where PHP was checking the validity of the mail server certificate even for NON-SSL sessions, under certain circumstances. This has been handles in the login_error routine where this particular error is detected and fixes by adding "novalidate-cert" to the non-ssl imap or pop mailsvr_callstr, note this breaks good servers, so it's handled only after an error pops up and is determined to be a result of this bug. CACHE NOTE: this item is saved in the appsession cache, AND is bese64_encoded there, which encoding and decoding is handled in "save_session_cache_item" and "read_session_cache_item", respectively, where this dataname "mailsvr_namespace" has a special handler for this purpose. because this data has "database unfriendly" chars in it.

Syntax:
		
		
Example:
		{mail.yourserver.com:143}
		
Access: PRIVATE - public access is object->get_arg_value("mailsvr_namespace")

concept pref_mail_port

Discussion: The preferences for email were designed to *someday* let the user specify a non standard port to use for the mail server. This preference never came to be. The user still can not actually set a port number to use for the mail server. However, in the preferences api there is still code initializing a preference item called "mail_port", with a note that some day it would be user settable, but since it is not currently, the api preferences class has a function to determine the port number based on what kind of server we are connecting to. THIS DOES NOT REALLY BELONG IN PREFS, it never because a user preference, so the api preferences should not be concerned with mail_port. THEREFOR we will SET IT HERE. For backwards compatibility we still set a pref value for mail_port after we are done here, until we replace any code that asks prefs for a port number. Then, port number should be exclusively treated as an "arg" accessable through the OOP style ->get_arg_value('mail_port') function. We do not have a seperate functin for this, we do it here, because the "mail_port" and the "mail_server_type" and the "mailsvr_callstr" are inextricibly linked, they exist only as a related group if data. CONCLUSION: we determine "mail_port" in this function "get_mailsvr_callstr" which is a private function anyway.

function get_mailsvr_namespace

Abstract: will generate the appropriate namespace (aka filter) string to access an imap mail server
Param1: $acctnum of the server in question.
Syntax:
		INBOX    where INBOX is returned as the namespace
		
Example:
		get_mailsvr_namespace({mail.servyou.com:143}INBOX) returns INBOX
		

Discussion: for more info see: see http://www.rfc-editor.org/rfc/rfc2342.txt CACHE NOTE: this item is saved in the appsession cache.

Access: PRIVATE - public access is object->get_arg_value("mailsvr_namespace")

function get_mailsvr_delimiter

Abstract: will generate the appropriate token that goes between the namespace and the inferior folders (subfolders)
Example:
		(a) typical imap  "INBOX.Sent"  returns the "." as the delimiter, 
		(b) UWash imap (stock mbox)  "email/Sent"  returns the "/" as the delimiter
		
Access: PRIVATE - public access is object->get_arg_value("mailsvr_delimiter")

function get_mailsvr_supports_folders

Abstract: imap and nntp servers have folders, pop has only inbox, this is a utility function.
Result: boolean
Access: private

function get_folder_long

Abstract: will generate the long name of an imap folder name, contains NAMESPACE_DELIMITER_FOLDER string but NOT the part, (inline docparser repeat): ... but NOT the {serverName:port} part
Param1: $feed_folder (string) optional, defaults to inbox
Result: string the long name of an imap folder name, contains NAMESPACE_DELIMITER_FOLDER string

Discussion: Note that syntax "NAMESPACE_DELIMITER_FOLDER" is called a "fully qualified" folder name here. The param $feed_folder will be compared to the folder list supplied by the server to insure an accurate folder name is returned because a param $feed_folder LACKING a namespace or delimiter MUST have them added in order to become a "long" folder name, and just guessing is not good enough to ensure accuracy. Works with supported imap servers: UW-Maildir, Cyrus, Courier, UWash Example (Cyrus or Courier): INBOX.Templates Example (if subfolders a.k.a. "inferior folders" are enabled): INBOX.drafts.rfc ???? Example (UW-Maildir only): /home/James.Drafts ???? The above examle would suggext that UW-Maildir takes "~" as namespace and "/" as its pre-folder name delimiter, which as somewhat nonstandard because it appears the rest of the folder name uses "." as the delimiter.

Access: Public

function get_folder_short

Abstract: will generate the SHORT name of an imap folder name, i.e. strip off NAMESPACE_DELIMITER (inline docparser repeat): ... strip off {SERVER}NAMESPACE_DELIMITER
Param1: $feed_folder string
Result: string the "shortened" name of a given imap folder name

Discussion: Simply, this is the folder name without the nor the NAMESPACE nor the DELIMITER preceeding it. Inline docparser repeat: ... without the {serverName:port} nor the NAMESPACE nor the DELIMITER preceeding it. Works with supported imap servers UWash, UW-Maildir, Cyrus, Courier (old) Example (Cyrus or Courier): Templates (old) Example (Cyrus only): drafts.rfc

function get_folder_list

Abstract: list of folders in a numbered array, each element has 2 properties, "folder_long" and "folder_short"
Param1: $mailsvr_stream DEPRECIATED - do not use
Param2: $force_refresh boolean, will cause any cached folder data to expire, and "fresh" data is retrieved from the mailserver
Unknown: #return array numbered, with each numbered element having array keys "folder_long" and "folder_short"

Discussion: returns a numbered array, each element has 2 properties, "folder_long" and "folder_short" so every available folder is in the structure in both long form [namespace][delimiter][foldername] and short form (does not have the [namespace][delimiter] prefix to the folder name) This function can cache data in 2 ways (1) caching as server data in the prefs DB cache department, and (2) in the class var $this->get_arg_value("folder_list") Data will be grabbed from cache when available and when allowed. CACHE NOTE: this item is saved in the appsession cache.

Access: private - public access is object->get_arg_value("folder_list") but may be called directly if you need to manually force_refresh any cached data, although this is still for private use as well.

concept UWash IMAP Namespace

Discussion: uwash is file system based, so it requires a filesystem slash after the namespace. Note that with uwash the delimiter is in fact the file system slash. example: requesting list for "mail/*" (NOTE this request will NOT yield a list the INBOX folder included in the returned folder list). However, we have no choice since without the filesystem delimiter, requesting "email*" returns NOTHING. Example queries: (a) "~/" OR (b) if the user specifies specific mbox folder, then: "~/emails/*" OR (c) "emails/*" give the same result, much like a unix "ls" command. At this time we use "unqualified" a.k.a. "relative" directory names if the user provides a namespace. UWash will consider it relative to the mailuser's $HOME property as with "emails/*" (DOES THIS WORK ON ALL PLATFORMS??). BUT we use "~/" if no namespace is given.

Unknown: #returns UWASH IMAP returns information in this format (same as any other IMAP server format): FOLDERNAME (inline docparser repeat): {SERVER_NAME:PORT}FOLDERNAME For Example: Trash AND Archives/Letters (inline docparser repeat): {some.server.com:143}Trash AND {some.server.com:143}Archives/Letters

concept non-UWash IMAP Server Namespace

Discussion: when handling handle non-UWash IMAP servers, i.e. typical IMAP servers that do not use a filesystem slash as the "delimiter", the last arg is typically "INBOX*" (no dot) which DOES include the inbox in the list of folders. Wheres adding the delimiter "INBOX.*" (has dot) will NOT include the INBOX in the list of folders. So - it's theoretically safe to include the delimiter here, but the INBOX will not be included in the list, this is typically the ONLY TIME you would ever *not* use the delimiter between the namespace and what comes after it. HOWEVER to get *shared* folders included in the return, better NOT include the "." delimiter. For example: Cyrus does not like anything but a "*" as the pattern IF you want shared folders returned. Return data is a list suck as this: INBOX INBOX.Trash (inline docparser repeat): {some.server.com:143}INBOX AND {some.server.com:143}INBOX.Trash

function folder_lookup

Abstract: searches thru the list of available folders to determine if a given folder already exists
Param1: $mailsvr_stream - DEPRECIATED to not use, class provides this.
Param2: $folder_needle string ?
Param3: $acctnum int ?

Discussion: uses "folder_list[folder_long]" as the "haystack" because it is the most unaltered folder information returned from the server that we have if TRUE, then the "official" folder_long name is returned - the one supplied by the server itself during the get_folder_list routine - "folder_list[folder_long]" if False, an empty string is returned.

function is_imap_folder

Abstract: Used with UWash servers folder list to filter out names that are most like not folders.
Param1: $folder string ?
Result: boolean

Discussion: returns True if the given foldername is probable an IMAP folder. Uses some general criteria such as anything with a DOT_SLASH is probably not the name of an IMAP folder.

function care_about_unseen DEPRECIATED

Abstract: When reporting the number of unseen, or new, messages in a folder, we may skip folders such as Trash and Sent because we do not care what is unseen in those folders.
Param1: $folder string ?
Result: boolean

Discussion: DEPRECIATED function was used when the number of unseen messages in a folder was included in the dropdown folder list combobox HTML select widget.

function encrypt_email_passwd

Abstract: passes directly to crypto class
Param1: $data data string to be encrypted

Discussion: if mcrypt is not enabled, then the password data should be unmolested thru the crypto functions, i.e. do not alter the string if mcrypt will not be preformed on that string.

function decrypt_email_pass

Abstract: decrypt $data
Param1: $data data to be decrypted

Discussion: if mcrypt is not enabled, then the password data should be unmolested thru the crypto functions, i.e. do not alter the string if mcrypt will not be preformed on that string.

capability Upgrade Routine for 0.9.12 and earlier Custom Passwords DEPRECIATED

Discussion: the phpgw versions prior to and including 0.9.12 *may* have double or even tripple serialized passwd strings stored in their preferences table. SO: (1) check for this (2) unserialize to the real string (3) feed the unserialized / fixed passwd in the prefs class and save the "upgraded" passwd

function make_rfc2822_address

Abstract: Make Address accoring to RFC2822 Standards
Param1: $addy_data object from php email address structure from IMAP_HEADER
Param2: $html_encode boolean used to encode HTML offensive chars for display in a browser.
Result: string
Author: Angles

Discussion: will produce a string containing email addresses for (a) display a browser such as on the compose form, or (b) for use in an email mesage header, hence the standards compliance necessity, message headers must follow strict form.

function make_rfc_addy_array

Abstract: Make a typical string of "To " adresses into an array structure which easily manages all seperate elements of the addresses
Param1: $data (string) should be a comma seperated string of email addresses (or just one email address) such as

Discussion: To adress(es) in a string as we would get from a submitted compose form hold alot of useful information that can be extracted by sperating out the individual elements of the email address and, if many addresses are present, making an array of this data. This is especially useful during the send procedure, when we feed each individual address to the MTA, because the MTA expects a SIMPLE email address in the RCPT TO: command arg, not an address that contains any of the other things that an email address can contain, such as a users name (personal part) which itself can contain chars outside of the ASCII range (whether ISO encoded or not) that the MTA does not need and does not want to see in the RCPT TO: commands.

Example:
		* * using html special chars so the inline doc parser will show the brackets and stuff * *
		->make_rfc_addy_array('john@doe.com,"Php Group"<info@phpgroupware.org>,jerry@example.com,"joe john" <jj@example.com>')
		 which will be decomposed into an array of individual email addresses
		 where each numbered item will be like this this:
		 	array[x]['personal'] 
		 	array[x]['plain'] 
		 the above example would return this structure:
		 	array[0]['personal'] = ""
		 	array[0]['plain'] = "john@doe.com"
		 	array[1]['personal'] = "Php Group"
		 	array[1]['plain'] = "info@phpgroupware.org"
		 	array[2]['personal'] = ""
		 	array[2]['plain'] = "jerry@example.com"
		 	array[3]['personal'] = "joe john"
		 	array[3]['plain'] = "jj@example.com"
		
Syntax:
		ASCII example, inline docs will not show correctly  
		 john
		
Unknown: #doe.com,"Php Group" Author: Angles

function addy_array_to_str

Param1: $data array of email addresses from the function make_rfc_addy_array
Param2: $include_personal boolean whether to return simple email address or to also include the personal part
Result: string
Author: Angles

Discussion: this is the opposite of the function make_rfc_addy_array

function normalize_crlf

Abstract: Ensure CR and LF are always together, RFCs prefer the CRLF combo
Param1: $data string
Result: string
Author: Angles

Discussion: ?

function explode_linebreaks

Abstract: Explode by Linebreak, ANY kind of line break
Param1: $data string
Result: string
Author: Angles

Discussion: ?

function make_boundary

Abstract: Create a Unique Mime Boundary
Param1: $part_length int ?
Result: string
Author: Angles

Discussion: Users some randomization and RFC standards to make a MIME part seperator.

function make_message_id

Abstract: Create a Unique RFC2822 Message ID
Result: string
Author: Angles

Discussion: Users some randomization and some datetime elements to produce an RFC compliant MessageID header string.

function make_flags_str

Abstract: ConvertPHP type message header IMAP flag data into string data that the IMAP server understands.
Result: string
Author: Angles

Discussion: for use in an IMAP_APPEND command, and anytime you need to give the IMAP server Flag information ina format that it understands, as opposed to the PHP object which is not understandable to an IMAP server. ALSO can be used in string matching functions to verify if a message has a certain flag.

Example:
		example of verifing a message has been replied to
		if (strisr('Answered'), $flags_str) then (show replied flag)
		

function is_serialized

Abstract: find out if something is already serialized
Param1: $data could be almost anything

function is_serialized_str

Abstract: find out if a string is already serialized, speed increases since string is known type
Param1: $string_data SHOULD be a string, or else call "is_serialized()" instead

function substr_count_ex

Abstract: returns the number of times the "needle" substring occurs in the "haystack" string
Param1: $haystack string
Param2: $needle string

function is_bool_ex

Abstract: Find out whether a variable is boolean
Param1: $bool mixed

function href_maketag

Abstract: will generate a typical A HREF html item

function img_maketag

Abstract: will generate a typical IMG html item

file class.mail_msg_display.inc.php

File: class.mail_msg_display.inc.php

function all_folders_listbox

Abstract: gets a list of all folders available to the user, and makes an HTML listbox widget with that data
Param1: $feed_args[] array or args that you will "feed" into the function, contains the following members ['mailsvr_stream'] : integer : the stream where the data communications with the mailserver takes place ['pre_select_folder'] : string : if you want a particular folder already selected in the listbox, put that foldername here. Note you must know the name of the folder as it will aooear in the kistbox for this to work. ['skip_folder'] : string : if you want a particular folder to NOT appear in the listbox, put that foldername here. Note you must know the name of the folder as it will aooear in the kistbox for this to work. ['show_num_new'] : boolean : True = show number of unseen (new) message data with each folder in the listbox. There are some folders the code will not examine, such as "Trash" and "Sent" ['widget_name'] : string : name of the select widget : important for form post usage. Default "folder" ['embeded_extra_data'] : string : OPTIONAL, if this is specified, the value='' becomes "fake_uri_data" in order to contain the extra data. Mostly used to include the acctnum for the folder. In this case, the "widget_name" is appended with "_fake_uri" which tells the script to use "explode_fake_uri()" to get the data, which it then inserts back into the HTTP_POST_VARS as if the data had never been embeeded. NOTE: such data should be urlencode'd just as if this were a URI, however "prep_folder_out" takes care of this for the folder name automatically. ['on_change'] : string : the HTML select widget's "onChange" value. Default: "document.switchbox.submit()'" '[first_line_txt'] : string : the text that initially is displayed in the select widget, used for information only, like a descriptive label, it does not have any important data usage. Default: "lang('switch current folder to')"
Result: string representing an HTML listbox widget

Discussion: ?

Access: private

function folders_mega_listbox

Abstract: like "all_folders_listbox" except it really shows ALL folder from EVERY account
Param1: $feed_args[] array or args that you will "feed" into the function ??
Result: string representing an HTML listbox widget

Discussion: ?

Access: private

function fill_sort_order_start_msgnum

Abstract: alias to "fill_sort_order_start" because msgnum is NO LONGER handled here, function was renamed.
Author: Angles

Discussion: alias function for backward compatibility only, useful only until the rest of the code calls the real function "fill_sort_order_start"

function fill_sort_order_start

Abstract: handles determining what values sort, order, and start should have.
Author: Angles

Discussion: if sort, order, and start are available in the GPC vars and are valid (values work, not out of range) then those GPC vars are used as source data. If not, then data is generated accourding to the users prefs for sort and order, abd start is assumed 0 if not otherwise provided in the GPC vars. NOTE: MSGNUM IS NO LONGER HANDLED IN THIS FUNCTION so it was renamed from "fill_sort_order_start_msgnum" to "fill_sort_order_start".

Syntax:
		These are the PHP Sorting definitions and what they do and what their int value is.
	SORTDATE:  0	//This is the Date that the senders email client stanp the message with
	SORTARRIVAL: 1	 //This is the date your email server's MTA stamps the message with
			// using SORTDATE cause some messages to be displayed in the wrong cronologicall order
	SORTFROM:  2
	SORTSUBJECT: 3
	SORTTO:  4  // only used in the "Send" folder
	SORTSIZE:  6
		

function prev_next_navigation

Abstract:
Author: Angles and code from previous maintainer

function all_ex_accounts_listbox

Abstract:
Author: Angles

function format_byte_size

Abstract:
Author: mostly inherited from previous maintainer

function get_subject

Abstract:
Author: Angles and code from previous maintainer

function has_real_attachment

Abstract: a quick test to see if a message has an attachment, (NOT 100% accurate, but fast and mostly accurate)
Param1: $struct PHP structure obtained from the "fetchstructure" command
Result: boolean
Author: Angles

Discussion: for use when displaying a list of messages, a quick way to determine if visual information (paperclip) is necessary

function get_flat_pgw_struct

Abstract: Message Structure Analysis, make multilevel php message struct into a flat array
Param1: $struct (php structure from ?)
Author: Angles

concept ATTACHMENT DETECTION in get_flat_pgw_struct

Discussion: NOTE: initially I wanted to treat base64 attachments with more "respect", but many other attachments are NOT base64 encoded and are still attachments. If param_value NAME has a value, pretend it's an attachment, however, a base64 part IS an attachment even if it has no name, just make one up. BEGIN UPDATE: an exception to this is that some insane MUAs base64 encode the BODY, meaning a one part email body can be base64 encoded, BUT this is mostly spammers or malicious mail TRYING TO HIDE SOMETHING, such as the old IFRAME trick, or perhaps a more complicated message wrapped as one part, which may contain BAD files ending in bat, exe, or inf. END UPDATE. Also, if "disposition" header = "attachment", same thing, it is an attachment, and if no name is in the params, make one up. NOTE: we do not use "elseif" in the following logic because an attachment may be detected in *any* of the following code blocks in no particular, nor predictable, order.

concept MIME PART CATAGORIZATION in get_flat_pgw_struct

Abstract: Anglemail uses an custom flat mime analysis which gives human understandable names to MIME parts.
Example:
		POSSIBLE VALUES FOR [ " m_description " ] ARE 
			container
			packagelist
			presentable/image
			attachment
			presentable
		
Syntax:
		RULES for determining m_description are 
			a) if no subpart(s) then we have either "presentable" or "attachment"
			b) if subpart(s) and a boundary param, then we have a "packagelist" (HeadersOnly)
			c) else we have a container
		

function pgw_msg_struct

Abstract: Mime analysis, make multilevel php message structure into a flat array with human understandable information.
Author: Angles

function mime_number_smart

Abstract: Make a "dumb" mime part number (based only on array position) into a "Smart" mime number that a server understands.
Author: Angles

function make_part_clickable

Abstract: message text which could be an href or mail to can be made clickable.
Author: Inherited from previous maintainer, Angles refined only

function make_clickable

Abstract: message text which could be an href or mail to can be made clickable.
Author: See Discussion

Discussion: This code inherited from previous maintainer, who said this - function make_clickable taken from text_to_links() in the SourceForge Snipplet Library http://sourceforge.net/snippet/detail.php?type=snippet&id=100004 modified to make mailto: addresses compose in phpGW (not by Angles)

function has_this_param

Abstract: does a MIME param array contain a certain attribute.
Author: Angles

Discussion: can take as input either a php structure or an anglemail flat part array. For example, an attribute could be "filename" and its value could be "image.png", this function looks for the attribute, if it exists or not. If it does exist, you may be interested in its associated value, but that another issue.

function array_keys_str

Abstract: debug function, report all "keys" in an associative array of "key - value"
Author: Angles

function report_moved_or_deleted

Abstract: if mail was moved or deleted, we should report to the user what happened
Param1: none, it uses the class args described below in "discussion"
Result: string which has either (a) a langed report to show the user about the move/delete that just occured or (b) an empty string indicating no move or delete actions were taken, so none need to report anything

Discussion: uses the following class args ['args']['td'] "td" means "Total Deleted", if it's filled it contains the number of messages that were deleted ['args']['tm'] "tm" means "Total Moved", if it's filled it contains the number of messages that were moved ['args']['tf'] "tf" means "To Folder", if it's filled it contains the name of the folder that messages were moved to if the user requests a delete, then arg "td" SHOULD/MUST be filled with that information if the user requests a move, then BOTH args "tm" AND "tf" SHOULD/MUST be filled with that information "tm" is the number of messages moved, and it's most useful to know where they were moved to, hence "tf"

function report_total_foldersize

Abstract: get the total of all messges sizes in a folder added up to "folder size"
Param1: array, the single argument $report_args_array is an array with these 3 members $report_args_array['allow_stats_size_speed_skip'] boolean getting folder size *can* take long time if alot of mail is in the folder, and put unneeded load on the IMAP server set to True to skip getting the folder size if there are more messages in the folder than specified by "stats_size_threshold". Default: False $report_args_array['stats_size_threshold'] integer test to skip getting the folder size if there are more messages in the folder than this number Default: 100 (i.e. 100 messages is the test threshold) $report_args_array['number_all'] integer total number of messages in the folder if you know the total number of messages in the folder before calling this function, then fill this otherwise this function will obtain the data by itself if it needs it Default: not applicable
Result: string, either (a) folder size nicely formatted for human readability, or (b) an empty string if it was not OK to obtain the data according to the speed skip test

Discussion: total size of all emails in this folder added up, if its OK to get that data

function get_msg_list_display

Abstract: make an array containing all necessary data to display an "index.php" type list of mesasages
Param1: $folder_info array (OPTIONAL) array elements as defined in return from function $this->get_folder_status_info() . This is primarily a time saver, if you already have the data, then pass it, else this function will obtain the data for itself.
Param2: $folder_info array of integers (OPTIONAL) integers representing a list of message numbers we should display, pass this data if you have search results to show, for example. If this is not present, then this function get a numbered array list of all message numbers in that folder, sorted and ordered according to preferences and/or user submitted page view args.
Result: array first_item boolean, flag indicating this is the first item in the array, the first message to display, states the obvious, but the index tpl uses it to show a form tag only once back_color used in html UI's to alternate the color or each row of data has_attachment attachment dection code has determined that this message has attachment(s) which tells the UI to show the user something, like a paperclip image. $msgnum the number the mail server has assigned this message, used for fetching subject message subject text suitable for display, text only subject_link URL that will request this message from the server, use with "subject" to make an HREF size message size suitable for display is_unseen this message has NOT yet been viewed by the client from_name Part 1 of 2 of the From String to show the user. This part 1 is the "personal" data of the From person if it's available, if not we have no choice but to show the plain address of the from person. display_address_from Part 2 of 2 of the From String to show the user. This part 2 contains any additional info the user prefers to see in the From String, which can be either (a) the plain address of the From person, or (b) the plain address of the ReplyTo header address According to user's preferences and considering what data is available to fulfill those user prefs who_to Target address to send messages to when trying to "reply" to the author. Standard way to handle this is: (1) if ReplyTo is specified in the email header, then use it as the reply target (2) if no ReplyTo is specified, then we use the email address of the From person as the reply target. A seperate ReplyTo header address is optional when authoring a message, but it clearly states the intent of the "From person" that replying to the mail should NOT result in mail being sent to that "From person"'s address, so that intent SHOULD be honored. Another example: Quite often mailing lists use this header to make the "From" the person who sent the message to the list, and when you click "reply" the "ReplyTo" header indicates the mail should be sent to the list, NOT the person in the "From" header. Used to make the From String into a clickable HREF, which will produce a blank Compose Mail page with the To address filled targeted to this "who_to" value. This is different from a "reply to button" because no part of the original mail is included in the resulting Compose Mail page. from_link URL that will produce an empty Compose New Mail page with the To address already filled in, which address is the determination made in the "who_to" logic msg_date If the message arrived more than 1 day ago, this will be a date only. If the message arrived within one day, this will be the time of arrival with NO date.

Discussion: ?

Access: private

capability FROM DISPLAYABLE String

Abstract: display the "from" data according to user preferences
Result: string which is actually part 2 of 2 of the From String, with "from_name" being part 1 of 2.

Discussion: first some background on the terms used here * "plain address" means the "user

Unknown: #domain.com" part * "personal" means the name string that may be associated with that address in the headers that would look like this if present: "Joe Dough"

capabability "From String" is Personal data AND the "plain address" of the From person

Discussion: according to preferences, for the displayed "From" string the user wants to see the "personal" data AND the "plain address" data of the person who the message is from as the "From String" that is displated to the user. Additionally, we checked and made sure both those pieces of data are available.

capabability From String includes ReplyTo plain address

Discussion: according to preferences, for the displayed "From" string the user wants to see the "personal" data AND the plain address of the "ReplyTo" header, if available. To visually indicate this is reply to address, we surround in in < > instead of ( ) which we use to surround the "from" plain address, as used above. Note: even though we use the "personal" name from the From header, we show with it the plain address from the ReplyTo header. This is how this preference works :) Of course, if no ReplyTo address is present, we can not fulfill this user perference

capabability user sees ONLY the "plain address" of the From person

Discussion: The displayed "From String" the user will see is the "plain address" of the From person ONLY, no "personal" data is ahown. This happens as a fallback option when the user's assumed desire to see the "personal" data is unable to be fulfilled because that "personal" data for the From person was not available in the email headers.

file class.mail_msg_wrappers.inc.php

File: class.mail_msg_wrappers.inc.php

class mail_msg_wrappers

Abstract: Wrapper functions to be called as "public" functions

Discussion: Hides the implementation details from the calling process Provides most args to the dcom class from variables which class msg processed and set Sometimes returns processed data ready to be used for display or information MORE DISCUSSION - Why Wrap Here? Answer: because once the msg class opens a mailsvr_stream, that will be the only stream that instance of the class will have, so WHY keep supplying it as an arg EVERY time? Also, same for the "msgnum", unless you are looping thru a message list, you are most likely concerned with only ONE message, and the variable would be the MIME part therein

function phpgw_fetchstructure

Abstract: wrapper for IMAP_FETSCSTRUCTURE, phpgw supplies the nedessary stream arg
Param1: $msgnum integer
Result: returns the IMAP_FETSCSTRUCTURE data

Discussion: Wrapper supplies the needed mailsvr_stream arg to IMAP_FETSCSTRUCTURE The data communications object (class mail_dcom) is supplied by the class

function phpgw_header

Abstract: wrapper for IMAP_HEADER, phpgw supplies the nedessary stream arg and mail_dcom reference
Param1: $msgnum integer
Result: returns the php IMAP_HEADER data

Discussion: Wrapper supplies the needed mailsvr_stream arg to IMAP_HEADER The data communications object (class mail_dcom) is supplied by the class

function all_headers_in_folder

Abstract: wrapper for IMAP_HEADERS, phpgw supplies the nedessary stream arg and mail_dcom reference
Param1: $fldball array[folder] string ; array[acctnum] int
Result: returns the php IMAP_HEADERS data, php manual says function.imap-headers.php Returns headers for all messages in a mailbox Returns an array of string formatted with header info. One element per mail message

Discussion: = = = = USELESS FUNCTION = = = = returns array of strings, each string is extremely truncated partial contents of date, from, and subject, also includes the msg size in chars

function phpgw_get_flag

Abstract: ?

function phpgw_body

Abstract: ?

function phpgw_fetchbody

Abstract: ?

function get_msgball_list

Abstract: wrapper for IMAP_SORT, sorts a folder in the desired way, then get a list of all message, as integer message numbers
Param1: $acctnum int SPECIAL USE ONLY you may supply an acctnum to get info about a folder the is not the currently selected acct / folder
Param2: $folder string SPECIAL USE ONLY you may supply folder name to get info about a folder the is not the currently selected acct / folder
Author: Angles
Access: public
Result: returns an array of of type "msgball" , so it contains acctnum, foldername, message UID, and some other info, such as a pre-prepared "fake URI" a.k.a. a GET URI string of type magball. Important data is the message UID integers which are message numbers referring to messages in the current folder. Because multiple accounts may be in use, the msgball array structure is necessary so the correct acctnum and foldername accompanies each message UID. Therefor you have enough information to take all sorts of action on any particular message in the list, see discussion below.

Discussion: Folder and Account Number SHOULD be obtained from the class vars which were set during begin_request(), where folder and acctnum were determined from GET POST data or data supplied to begin_request() in its arg array. This way the desired folder is known to be correctly named (it exists, not a bogus foldername) and associated with the correct acctnum. However, some of the filter functions do use these params, but using them is discouraged. The return is an array of "msgball" data, which contains acctnum, foldername, message UID, and some other info, such as a pre-prepared "fake URI" a.k.a. a GET URI string of type magball. Use this data and specifically these message numbers to request more detailed information about a message (headers, subject), or the request message itself from the server. Sort and Order is applied by the class, so the calling process does not need to specify sorting here The data communications object (class mail_dcom) is supplied by the class

function get_folder_size

Abstract: uses IMAP_MAILBOXMSGINFO but returns only the size element
Result: integer returns the SIZE element of the php IMAP_MAILBOXMSGINFO data

Discussion: used only if the total size of a folder is desired, which takes time for the server to return The other data IMAP_MAILBOXMSGINFO returns (if size is NOT needed) is obtainable from "get_folder_status_info" more quickly and wth less load to the IMAP server The data communications object (class mail_dcom) and mailsvr_stream are supplied by the class

Author: Angles
Access: public

function get_folder_status_info

Abstract: wrapper for IMAP_STATUS, get status info for the current folder, with emphesis on reporting to user about new messages
Param1: $fldball typed array OPTIONAL as with many functions in this class, the folder you are interested in is usually the currently "selected" folder, in IMAP terms, which is selected during begin_request(), in which case it is not necessary to supply this information again in this param, instead this function will use the class vars about foldername and acctnum established during begin_request(). However, since there are multiple accounts, and since IMAP accounts themselves can contain many folders, it is understood that you may want information about a folder other than the currently selected folder, or about an account that you may want to move messges to. In these cases you may supply this param of type fldball, like this: parmarray[acctnum] = 1, parmarray[folder] = "INBOX", for example. The fldball array item is pretty flexible in that only the bare minumum of data is expected to be in it, as opposed to msgball which is supposed to contain quite detailed information.
Param2: $force_refresh boolean To speed email functionality, much data collected from the IMAP server is cached in some capacity, in fact the RFC on IMAP strongly encourages this. This function is used by many other functions and may be called sveral times during any single operation, so the return array data is cached in memory and will be returned if it is available. This is desirable in many occasions, but if for some reason you need to be sure the returned information is not from this cache, set this param to TRUE.
Result: returns an associative array with 5 named elements see the example
Example:
		this is the return structure
		result['is_imap'] boolean - pop3 server do not know what is "new" or not, IMAP servers do
		result['folder_checked'] string - the folder checked, as processed by the msg class, which may have done a lookup on the folder name
		result['alert_string'] string - lang'd string to show the user about status of new messages in this folder
		result['number_new'] integer - for IMAP: the number "recent" and/or "unseen"messages; for POP3: the total number of messages
		result['number_all'] integer - for IMAP and POP3: the total number messages in the folder
		

Discussion: gives user friendly "alert_string" element to show the user, info is for what ever folder the msg class is currently logged into, you may want to apply PHP function "number_format()" to the integers after you have done any math code and befor eyou display them to the user, it adds the thousands comma

Author: Angles
Access: public

function phpgw_status

Abstract: ?
Author: Angles
Access: public

function phpgw_server_last_error

Abstract: ?
Author: Angles
Access: public

function phpgw_ping

Abstract: ?
Author: Angles
Access: public

function phpgw_search

Abstract: ?
Author: Angles
Access: public

function phpgw_createmailbox

Abstract: ?
Param1: $target_fldball (array or type "fldball") NOTE: folder element SHOULD HAVE SERVER CALLSTR.
Author: Angles
Access: public

function phpgw_deletemailbox

Abstract: ?
Author: Angles
Access: public

function phpgw_renamemailbox

Abstract: ?
Author: Angles
Access: public

function phpgw_listmailbox

Abstract: ?
Author: Angles
Access: public

function phpgw_append

Abstract: ?
Author: Angles
Access: public

function phpgw_mail_move

Abstract: ?
Author: Angles
Access: public

function interacct_mail_move

Abstract: ?
Author: Angles
Access: public

function industrial_interacct_mail_move

Abstract: ?
Author: Angles
Access: public

function phpgw_expunge

Abstract: ?
Author: Angles
Access: public

function phpgw_delete

Abstract: ?
Author: Angles
Access: public

function decode_fake_uri

Abstract: decodes a URI type "query string" into an associative array
Param1: $uri_type_string string in the style of a URI such as "&item=phone&action=dial"
Result: associative array where the $key and $value are exploded from the uri like [item] => "phone"

Discussion: HTML select "combobox"s can only return 1 "value" per item, to break that limitation you can use that 1 item like a "fake URI", meaning you make a single string store structured data by using the standard syntax of a HTTP GET URI, see the example

Example:
		HTTP GET URI, example
		< select name="fake_uri_data" > < option value="&item=phone&action=dial&touchtone=1" > ( ... etc ... )
		In an HTTP POST event, this would appear as in the example
		$GLOBALS['HTTP_POST_VARS']['fake_uri_data'] => "&item=phone&action=dial&touchtone=1"
		Then you feed that string into this function and you get back an associave array like this
		return["item"] => "phone"
		return["action"] => "dial"
		return["touchtone"] => "1"
		NOTE: this differs from PHP's parse_str() because this function  will NOT attempt to decode the urlencoded values.
		In this way you may store many data elements in a single HTML "option" value=" " tag.
		
Author: Angles
Access: Public

function grab_class_args_gpc

Abstract: grab data from $GLOBALS['HTTP_POST_VARS'] and $GLOBALS['HTTP_GET_VARS'] as necessaey, and fill various class arg variables with the available data
Result: none, this is an object call

Discussion: to further seperate the mail functionality from php itself, this function will perform the variable handling of the traditional php page view Get Post Cookie (no cookie data used here though) The same data could be grabbed from any source, XML-RPC for example, insttead of php's GPC vars, so this function could (should) have an equivalent XML-RPC "to handle filling these class variables from an alternative source.

Author: Angles
Access: Public

function grab_class_args_xmlrpc

Abstract: grab data an XML-RPC call and fill various class arg variables with the available data
Result: none, this is an object call

Discussion: functional relative to function "grab_class_args_gpc()", except this function grabs the data from an alternative, non-php-GPC, source NOT YET IMPLEMENTED

Author: Angles
Access: Public

function get_best_acctnum

Abstract: search a variety of vars to find a legitimate account number, fallsback to $this->get_acctnum
Param1: $args_array ARRAY that was passed to ->begin_request, pass that into here if possible, it is a primary source
Param2: $got_args ARRAY of the *External* params / args fed to this script via GPC or other methods Note: these are NOT the "internal args"
Param3: $force_feed_acctnum INTEGER if for some reason you want to force an account number (DEPRECIATED)
Result: integer, most legitimate account number that was obtained

Discussion: ?

Author: Angles
Access: Private

function init_internal_args_and_set_them

Abstract: initialize Internally controlled params (args). MUST already have an acctnum
Param1: $acctnum integer the current account number whose array we will fill with these initialized args
Result: none, this is an object call

Discussion: ?

Author: Angles
Access: Public

function get_best_folder_arg

Abstract: search a variety of vars to find a legitimate folder value to open on the mail server number,
Param1: $args_array ARRAY that was passed to ->begin_request, pass that into here if possible, it is a primary source
Param2: $got_args ARRAY of the *External* params / args fed to this script via GPC or other methods Note: these are NOT the "internal args"
Param3: $acctnum INTEGER used to querey various already-set args
Result: string, mostt legitimate folder value that was obtained

Discussion: ?

Author: Angles
Access: Private

cabability appsession TEMPORARY DATA CACHING - data we generate

Abstract: Caching via the the api appsession cache occurs in 2 basic forms. (ONE) information we are responsible for generating in this mail_msg class, and (TWO) data that the mail server sends us. This discussion is about ONE.

Discussion: Data this class must generate includes preferences, mail server callstring, namespace, delimiter, (not a complete list). The first time a data element is generated, for example ->get_arg_value("mailsvr_namespace"), which is needed before we can login to the mailserver, the private function "get_mailsvr_namespace" determines this string, then places that value in what I refer to as the "Level1 cache" (L1 cache) which is simply a class variable that is filled with that value. Additionally, that data is saved in the appsession cache. The L1 cache only exists as long as the script is run, usually one pageview. The appsession cache exists as long as the user is logged in. When the user requests another page view, private function ""get_mailsvr_namespace" checks (always) the L1 cache for this value, if this is the first time this function has been called for this pageview, that L1 cache does not yet exist. Then the functions checks the appsession cache for this value. In this example, it will find it there, put that value in the L1 cache, then return the value and exit. For the rest of the pageview, any call to this function will return the L1 cache value, no logic in that function is actually encountered.

cabability appsession TEMPORARY DATA CACHING - data from the mailserver

Abstract: Caching via the the api appsession cache occurs in 2 basic forms. (ONE) information we are responsible for generating in this mail_msg class, and (TWO) data that the mail server sends us. This discussion is about TWO

Discussion: CACHE FORM TWO is anything the mail server sends us that we want to cache. The IMAP rfc requires we cache as much as we can so we do not ask the server for the same information unnecessarily. Take function "get_msgball_list" as an example. This is a list of messages in a folder, the list we save is in the form of typed array "msgball" which means the list included message number, full folder name, and account number. BEGIN DIGRESSION Why is all this data cached? Traditionally, a mail message has a "ball and chain" association with a particular mail server, a particular account on that mail server, and a particular folder within that account. This is the traditional way to think of email. HOWEVER, this email app desires to completely seperate an individual mail message from any of those traditional associations. So what does a "msgball" list allow us to so? This way we can move messages between accounts without caring where that account is located, what type of server its on, or what folder its in. We can have exotic search results where the "msgball" list contains references to messages from different accounts on different servers of different types in different folders therein. Because every peice of data about the message we need is stored in the typed array "msgball", we have complete freedom of movement and manipulation of those messages. END DIGRESSION. So the function "get_msgball_list", the first time it is called for any particular folder, asks the mail server for a list of message UIDs (Unique Message ID good for as long as that message is in that folder), and assembles the "msgball" list by adding the associated account number and folder name to that message number. This list is then stored in the appsession cache. Being in the appsession cache means this data will persist for as long as the user is logged in. The data becomes STALE if 1. new mail arrives in the folder, or 2. messages are moved out of the folder. So the next pageview the user requests for that folder calls "get_msgball_list" which attempts to find the data stored in the appsession cache. If it is found cached there, the data is checked for VALIDITY during function "read_session_cache_item" which calls function "get_folder_status_info" and checks for 2 things, 1. that this "msgball" is in fact referring to the same server, account, and folder as the newly requested data, and (CRUCIAL ITEM) 2. checks for staleness using the data returned from "get_folder_status_info", especially "uidnext", "uidvalidity", and "number_all" to determine if the data is stale or not. MORE ON THIS LATER. If the data is not stale and correctly refers to the right account, the "msgball" list stored in the appsession cache is used as the return value of "get_msgball_list" and THE SERVER IS NOT ASKED FOR THE MESSAGE LIST UNNECESSARILY. This allows for folders with thousands of messages to reduce client - server xfers dramatically. HOWEVER - this is an area where additional speed could be achieved by NOT VALIDIATING EVERY TIME, meaning we could set X minutes where the "msgball" list is considered NOT STALE. This eliminates a server login just to get validity information via "get_folder_status_info". HOWEVER, even though we have the message list for that folder in cache, we still must request the envelope info (from, to, subject, date) in order to show the index page. THIS DATA COULD BE CACHED TOO. Conclusion - you have seen how a massage list is cached, validated, and reused. Additionally, we have discussed ways to gain further speed with X minutes of assumed "freshness" and by caching envelope data.

function expire_session_cache_item

Abstract: ?

Discussion: used with appsession TEMPORARY DATA CACHING server-side caching of limited, ephermal data, such as a list of messages from an imap search, via appsession

Author: Angles
Access: private

function save_session_cache_item

Abstract: ?

Discussion: used with appsession TEMPORARY DATA CACHING server-side caching of limited, ephermal data, such as a list of messages from an imap search, via appsession. NOTE: to cache an item you must add it to list of data items that has a handler here, otherwise we skip it.

Author: Angles
Access: private

function read_session_cache_item

Abstract: ?

Discussion: used with appsession TEMPORARY DATA CACHING server-side caching of limited, ephermal data, such as a list of messages from an imap search, via appsession

Author: Angles
Access: private

cabability Pref-Based SEMI-PERMENANT DATA CACHING (DEPRECIATED) (NOT USED ANYMORE)

Abstract: Folder List server-side caching, for data intended to survive and span individual sessions.

Discussion: Folder List data does not change that often, as opposed to the data cached in appsession, which often changes with each page view. Refer to class var array $this->cachable_server_items[] to see supported cachable items. Currently the longer-term data we cache with this Perf-Based methodology are: (1) 'get_mailsvr_namespace', and (2) 'get_folder_list' Those items go hand-in-hand. The data cached is that data which is produced (returned) by the function of the same name (easier to remember this way :), i.e. function "get_mailsvr_namespace()" data is saved to an array item with base element called "get_mailsvr_namespace". Ditto for function "get_folder_list()". Both cached items are necessary to achieve a longer-lived caching of a list of folders available to the user for a particular emil account. This folder list does not change often, thus deserving of a longer-lived caching than the appsession caching methodology. Namespace is also cached because it is used to analyse the folder_list data (generating "folder_short" from cached "folder_long" names, so those data items need each other. SO: The Storage Object for this data is currently (Dec 26, 2001) the Email Preferences database, for this reason: it's the only data store available to the email class for which the data survives and spans sessions. Perhaps a dedicated table in the DB may be used in the future,

function get_cached_data

Abstract: NOT USED, part of semi-permanent, session-spanning caching of data

Discussion: DORMANT CODE, used with server-side session-spanning caching. currently not used but may be implemented again.

Author: Angles
Access: private

function set_cached_data

Abstract: NOT USED, part of semi-permanent, session-spanning caching of data

Discussion: DORMANT CODE, used with server-side session-spanning caching. currently not used but may be implemented again.

Author: Angles
Access: private

function remove_cached_data

Abstract: NOT USED, part of semi-permanent, session-spanning caching of data

Discussion: DORMANT CODE, used with server-side session-spanning caching. currently not used but may be implemented again.

Author: Angles
Access: private

capability OOP-Style Access Methods to Private Object Properties

Abstract: simple access methods to read and set data, with transparent account number handling

Discussion: When multiple email accounts are enables, they may even be active at the same time, thus the properties and preferences for any individual email account must be distinctly accessable for each email account with as little brain damage to the developer as possible. These access methods server two purposes: (1) centralize access to all params and oprefs into a common, standardized methodology, and (2) these access functions also transparently handly the dirty work of tracking which email account the data applies to, takes care of any special handling a param may require, and it's classic OOP style. With the exception of a few paramaters/arguments that are not specific to any individual email acount, such as for private, internal object core properties, the developer need only use these functions to access object params, arguments, and preferences.

Author: Angles

function get_acctnum

Abstract: read which account number the object is currently activated on
Param1: $unset_returns_default boolean default True. If no acctnum is currently set, should this function return a boolean False or a hardcoded "fallback default" account number, typically integer 0. Default is to return a fallback default account number.
Unknown: #returns (most typically) the internal account number of the currently active email account, but can be set, via the $unset_returns_default param,

Discussion: When multiple email accounts are enabled, all arg/param and preference access functions "pivot" off of this "object->acctnum" property, it serves essentially as the array key which maps the various access functions to the data of the intended account number. DEVELOPERS NOTE: The integer zero returned by this function can sometimes be mistaken as "empty" of "false", when using conditionals such as if ($my_acctnum) { then do this }; may incorrectly interper integer 0 as a "false" and this example conditional would not behave as expected, since there is infact a valid acount number of 0 in the variable. The preferred test for that type of condition is: if ((string)$my_acctnum != '') { then do this }; which produces a more desirable result.

Author: Angles

function set_acctnum

Abstract: instruct the object which email account is the desired active account for all params, args, and preferences should refer to.
Param1: $acctnum integer
Result: True if a valid param $acctnum is given and the object->acctnum value is set, False if invalid data is passed in the param.
Author: Angles

Discussion: ?

Access: public

function get_pref_value

Abstract: ?
Param1: $pref_name (string)
Param2: $acctnum (int) OPTIONAL
Result: none
Author: Angles

Discussion: ?

Access: public

function set_pref_value

Abstract: ?
Param1: $pref_name (string)
Param2: $this_value (string, int, or array)
Param3: $acctnum (int) OPTIONAL
Result: True if pref value was set, False on failure to set the item, such as invalid data is passed in the param.
Author: Angles

Discussion: ?

Access: public

function get_isset_pref

Abstract: Check if a given preference is set
Param1: $pref_name (string)
Param2: $acctnum (int) OPTIONAL
Result: True if preference $pref_name value exists, False if not
Author: Angles

Discussion: It is common the boolean preference items are simply not set if their value is supposed to be false. This function can be used for this discovery. Note that some string preferences items, such as the email sig, can be set yet have a value of an empty string, in this case this function follows strict logic and returns True because the preference exists. Similarly, uwash mail location is another example of a preference item where an empty string is a valid value.

Access: public

function unset_pref

Abstract: unset a preference item.
Param1: $pref_name (string)
Param2: $acctnum (int) OPTIONAL
Result: True if $pref_name existed and was made unset, False on failure, such as $pref_name not being set in the first place. This function can not unset something that does not exist to begin with.
Author: Angles

Discussion: ?

Access: public

function get_all_prefs

Abstract: get the entire preference data array FOR ONE ACCOUNT
Param1: $acctnum (int) OPTIONAL
Result: none
Author: Angles

Discussion: The result are not the raw preferences directly from the database, this function returns the preference array for an email account as explosed to the email app, that is these are preferences that have passed through some logic to process and normalize them,

Access: public

function set_pref_array

Abstract: set the entire preference data array FOR ONE ACCOUNT
Param1: $pref_array_data (array) either (a) correctly formed emai pref array data, or (b) an empty array
Param2: $acctnum (int) OPTIONAL
Result: boolean True is successfully sets $pref_array_data, False to indicate all we did was clear the args, no data was fed
Author: Angles

Discussion: NOTE the first thing this function does is clear the existing preference array for the emal account. This happens no matter what. This effectively is a way to clear an accounts email preference array by passing an empty array, which can be useful in certain situations. More commonly this function is used to set the entire preference array for an account in one operation. In that case you better know what youre doing, $pref_array_data must be correctly formed emai pref array data. By clearing the existing preference array no matter what, this is why a return value of False indicates that, while no new preference data was set, still something did occur and that was the clearing of any pre-existing preference array.

Access: private

function _get_arg_is_known

Abstract: utility function for private use, tests if a given $arg_name is in the $this->known_external_args[] array.
Param1: $arg_name (string)
Param2: $calling_function_name (string) used for debug output
Result: boolean
Author: Angles

Discussion: ?

Access: private

function get_isset_arg

Abstract: Check if a given variable is set
Param1: $arg_name (string)
Param2: $acctnum (int) OPTIONAL
Result: boolean
Author: Angles

Discussion: ?

Access: public

function unset_arg

Abstract: unset a class variable
Param1: $arg_name (string)
Param2: $acctnum (int) OPTIONAL
Result: boolean True if $arg_name existed and was made unset, False on failure, such as $arg_name not being set in the first place. This function can not unset something that does not exist to begin with.
Author: Angles

Discussion: ?

Access: public

function get_arg_value

Abstract: Obtain the value of a given class variable, will handoff to helper functions if necessary.
Param1: $arg_name (string)
Param2: $acctnum (int) OPTIONAL
Result: (string, int, or array)
Author: Angles

Discussion: Some class variables, such as "mailsvr_namespace", have functions dedicated only to determining their value. In these cases this function will hand off the request directly to that specialized function. In other cases the class variable desired is a simple variable and its value is returned.

Access: public

function _direct_access_arg_value

Abstract: utility function for private use, used to bypass any special handlers, to directly access the "args" array.
Param1: $arg_name (string)
Param2: $acctnum (int) optional
Result: (mixed)
Author: Angles

Discussion: Esoteric utility function for specialized private use.

Access: private

function set_arg_value

Abstract: Sets a variable in the "args" array. Should only be used for args that do not require specialized functions.
Param1: $arg_name (string)
Param2: $this_value (mixed)
Param3: $acctnum (int) optional
Result: (mixed)
Author: Angles

Discussion: ?

Access: public

function set_arg_array

Abstract: ?
Param1: $arg_array_data (array)
Param2: $acctnum (int) optional
Result: boolean
Author: Angles

Discussion: ?

Access: private

function get_all_args

Abstract: ?
Param1: $acctnum (int) optional
Result: (mixed)
Author: Angles

Discussion: ?

Access: private

function unset_all_args

Abstract: ?
Param1: $acctnum (int) optional
Result: none
Author: Angles

Discussion: ?

Access: private

file class.mail_send.inc.php

File: class.mail_send.inc.php

class mail_send

Abstract: sockets based SMTP class, will communicate with an MTA to send mail
Result: returns True on success (mail was sent), returns False on error (no mail sent)

Discussion: class provides for complex SMTP transactions, bypassing need for php's builtin mail sending functions. Currently part of the email class group, when mature will be moved to standard phpgroupware api.

Author: (a) Itzchak Rehberg - initial implementation, SMTP communication and control flow, excellent work! and (b) Angelo Puglisi (Angles) - convert to multi-dimentional array driven architecture, expanded debugging, RFC2822 and 2821 compliance, retain a copy for archiving option, fake send debug, handshake retention, other stuff...

file class.msg_bootstrap.inc.php

File: class.msg_bootstrap.inc.php

class msg_bootstrap

Abstract: Utility class shared throught out the email app which ensures the GLOBALS->msg exists and is logged in
Param1: $do_login (boolean) defaults to True, most often you do not need to change this.
Author: Angles

Discussion: only has one function which bootstraps the GLOBALS->msg (if necessary). It should be safe to call CreateObject on this class at any time for object $GLOBALS[phpgw]->msg_bootstrap because api is smart enough to not re-create it and theres nothing in the constructor, so this bootstrap capability should be available at any time to any code file. If there is a problem logging in, function GLOBALS["phpgw"]->msg->login_error() is called, giving an error message, and the script exits.

Example:
		$GLOBALS["phpgw"]->msg_bootstrap = CreateObject("email.msg_bootstrap");
	$GLOBALS['phpgw']->msg_bootstrap->login();
	## OR, if you care about debug info, an alternative is to use this, does the same thing but gives debug info.
	$GLOBALS['phpgw']->msg_bootstrap->ensure_mail_msg_exists('name of my function');
		
Access: public

function set_do_login

Abstract: whether to try to login to the mail server or not during a call to "ensure_mail_msg_exists". OPTIONAL, default is True.
Param1: $do_login (boolean)
Author: Angles
Result: (boolean) whatever the value var $this->do_login has on exiting the function.

Discussion: OPTONAL, most often it is desirable to establish a mail server stream, so the default assumed value for "do_login" is True for any call to "ensure_mail_msg_exists". However, set to False for situations where you want to set or get email preference data when a login is not required or when there may be no preference data set yet, such as the first time a user sets the preferences.

Access: public

function get_do_login

Abstract: get the value of var $this->do_login
Param1: $do_login (boolean)
Result: (boolean) the value var $this->do_login
Author: Angles

Discussion: ?

Access: public

function login

Abstract: If you do not care to do complicated things with email, create this object and call this login function.
Author: Angles

Discussion: Alias to "ensure_mail_msg_exists", if you want debugging output capability then use that function. If you just want to get email working quickly, use this function.

Example:
		## email quickstart:
			$GLOBALS["phpgw"]->msg_bootstrap = CreateObject("email.msg_bootstrap");
			$GLOBALS['phpgw']->msg_bootstrap->login();
		

function ensure_mail_msg_exists

Abstract: standard function to make sure a mail_msg object exists and is logged into the mailserver
Param1: $called_by (string) used for debug output
Param2: $debug_level (int) value 0 to 3, the prevailing debug level for the calling function.
Author: Angles

Discussion: This process os the same for any email related code that needs the mail_msg object and an open stream. This function calls msg->begin_request and thus all the complicated logic associated with multiple accounts is handled there.

function ensure_utility_classes

Abstract: utility function for bootstraping, makes sure ancillary global objects are in existance.
Param1: $debug_level (int) the bootstrap code adopts the debug level of the calling object, it is passed as a param.
Author: Angles

Discussion: This is a utility function called by this-> ensure_mail_msg_exists. Email uses utility c lasses from both email and api utility objects, such as html_widgets, this function makes sure the most commonly used of these are available for global access throughout the email code. Right now this is private, used only by this class itself.

Access: private

file class.spell.inc.php

File: class.spell.inc.php

class spell

Abstract: Handles spell checking for email messages. Give it all necessary data and it handles the rest. All class params are private unless an OOP style access function is provided.
Param1: $max_suggest (int) maximum number is suggestions to show in a combobox
Param2: $spell_svc (object) the spell service access class, a dummy module if pspell is not compiled in
Param3: $can_spell (boolean) This is picked up from the spell service module, a dummy module will report False. Read Only, Access with ->get_can_spell()
Param4: $sp_feed_type (defined integer) SP_FEED_UNKNOWN or SP_FEED_WORDS or SP_FEED_LINES, defined in file class.spell_struct
Param5: $pspell_link (int) a pointer kind of thing you get when you create a new pspell dictionary link.
Param6: $my_validator (object of type phpgwapi.validator) used to help decide what words to not bother spellchecking, like URLs.
Param7: $widgets (object of type html_widgets)
Param8: $user_lang (string) obtained from "phpgw_info", used when creating the pspell disctionary link. Read Only, Access with ->get_user_lang()
Param9: $reject_reason (string) when this class decides a word is not worth checking, it fills this with the reason, ex. "do not check URLs"
Param10: $subject (string) use OOP access functions ->set_subject and ->get_subject.
Param11: $preserve_tokens (array) Scheduled For Depreciation, but still used. A list of GPC vars we typically want to preserve thru the spellchecking process. However, it is too limiting to had a hard-coded list, need to allow more flexibility.
Param12: $preserve_vars (array) use OOP access functions ->set_preserve_var and ->get_preserve_vars. Currently, you can set any vars you want, but only those in the $preserve_tokens will be preserved as hiddenvars. NEEDS FIXING.
Param13: $body_orig string use OOP access functions ->set_body_orig and ->get_body_orig. This is record of the original message before any spell check changes.
Param14: $body_display (PRIVATE) string ACCESS ONLY use OOP access functions ->get_body_display. Scheduled for depreciation because the function "prep_body_display" directly returns this data and there us no readon to keep it stored in this param. "prep_body_display" is quite useful, do not limit it by bounding it to this param.
Param15: THERE ARE MORE...

Discussion: Provide this class with any of the above vars that you have. Subject and Body will be spellchecked, but the other data is needed because this class handles the rest of the logic from spell checking, to user review of spellcheck, to applying the users choices to the body, only then is the message handed off to another object, either class send for sending, or class compose if the user wants to edit the text some more. Calling process MUST set any vars it wants preserved through the spellcheck process, they will be put in the spellcheck page form.

class requires including header utility file spell_struct

Discussion: class spell needs the public shared C-Style Include .h file, which holds public data structure classes for class email spell

function set_can_spell (PRIVATE)

Abstract: This class must discover if its spell service module is real or dummy, uses this to set that access to a working spell service backend.
Author: Angles

Discussion: This class must discover if its spell service module is real or dummy, and use this function to set that information and make it available publicly via "get_can_spell". Should be discovered and set in the constructor.

Access: private

function get_can_spell

Abstract: check is this spelling class has access to a working spell service backend.
Result: Boolean

Discussion: If a real, working spell service is abailable, such as pspell support compiled into php, this will return True, if a dummy placeholder service is loaded, such as when the pspell extension is NOT compiled into php, this returns False. This class picks up this value in its constructor, when it loads a spell service backend, that the service object will report if it can do anything or not. Dummy placeholder class is loaded only so certain function names exists, so php will not complain anout undefined functions.

Access: public

function set_sp_feed_type (PRIVATE)

Abstract: This class must discover if its spell service module takes single words or lines (strings) of text.
Author: Angles

Discussion: This class must discover if its spell service module takes single words or lines (strings) of text, and use this function to set that information and make it available publicly via "get_sp_feed_type". Should be discovered and set in the constructor. Can be one of SP_FEED_UNKNOWN, SP_FEED_WORDS, or SP_FEED_LINES, as defined in file class.spell_struct

Access: private

function get_sp_feed_type

Abstract: public access to how the spell service backend wants its input, as single words or lines of text.
Result: Boolean

Discussion: Supporting more than one backend service means this class must report how the backend wants the input, single words or lines of text. Can be one of SP_FEED_UNKNOWN, SP_FEED_WORDS, or SP_FEED_LINES, as defined in file class.spell_struct.

Access: public

function set_preserve_var

Abstract: spell form needs to preserve, or carry forward, any send related vars that were sent to class.bosend.
Param1: $name (string)
Param2: $value (string)

Discussion: Spell check is called from class.bosend, where the compose form gets submitted. If the spellcheck button was pressed, then class.bosend creates an object of this class to handle the spell checking. When the user submits the spellcheck form, the desired misspelled words will be replaced and then this class invokes class.bocompose to take the user back to the compose form with the corrected body text. From there the user may click send which submits the form to class.bosend. Therefor any send related GPC vars that the compose form had when it was submitted for spellchecking must be put back in the compose form after spellchecking so that class.bosend gets the information it needs, the same information it would have gotten had a spell check not occurred. Certain vars will be passed in the URL, these are sort, order, start, the msgball or fldball, and fwd_proc are all passed in the URL that is the form "action". Other vars have their own special requirements, these are body and subject vars, because they will be spellchecked. All other vars that need to be preserved use this function to set their data. These var names are enumerated in $this->preserve_tokens[] array, so that one code loop thru these tokens can handle all the necessary vars to be preserved, such as in function "commit_preserve_vars_to_form". Note that when class.bosend gets the submitted compose form and determines it needs to be directed to this class for spellchecking, class.bosend MUST USE THE SET_* CODE in this class to set any vars that class.bosend thinks should be saved. Class spell does not grab these vars, the calling process must use the OOP style access methods to set them. Only then will this class be able to preserve them, this class can only preserve what it is told to preserve.

function commit_preserve_vars_to_form

Abstract: Any valid items in $this->preserve_vars will be turned into widget form hiddenvars for preservation.

Discussion: Uses a loop of vars we need to preserve (that are not preserved elsewhere) that tells the widget class to make them hiddenvars in the form we will use in the spell check page.

function set_subject

Abstract: Set this to the subject of the message to be spell checked.
Param1: $str (string)
Author: Angles

Discussion: This class needs all the information that is available about a message, which it will preserve and pass back to the compose (or send) code when the spell check is done. This is for the subject of the message to be spell checked. NOTE: in the future the subject *should* be spell checked too, currently the subject is *NOT* spellchecked,

Access: Public

function get_subject

Abstract: Returns the value set with "set_subject"
Author: Angles

Discussion: ?

Access: Public

function set_body_orig

Abstract: Set this to the body of the message to be spell checked.
Param1: $str (string)
Author: Angles

Discussion: An this original, unmodified copy of the body is stored and available after the spell check if you wish to compare to the spell fixed text. This explains why this is "body_orig" instead of just "body". NOTE this is the text that gets spell checked, so it is REQUIRED to set this or else there is nothing to spellcheck. NOTE: if it is necessary, STRIP SLASHES BEFORE SETTING THIS. This class has no way of knowing if the body has the "magic" GPC slashes or not. It is recommended to pass the text thru function "stripslashes_gpc" (in the mail_msg class) before setting this value.

Access: Public

function get_body_orig

Abstract: Returns the original, unmodified message text which was spell checked, without any corrections.
Param1: $str (string)
Author: Angles

Discussion: An this original, unmodified copy of the body is stored and available after the spell check if you wish to compare to the spell fixed text, or for any reason, if you want it use this function.

Access: Public

function prep_body_in

Abstract: prepare bodt yexy for the spellchecker by normalizing CRLFs and decoding html specialchars.
Param1: none, this is an OOP class function, operates directly on $this->body_orig.
Result: none, this is an object call, works directly on the objects vars.

Discussion: YOU MUST STRIPSLASHES BEFORE calling ->set_body_orig(), which in turn calls this function, because this function has no way of knowing if it should stripslashes on submitted data or not, but YOU do because you are writting the code that uses this object, so YOU must strip slashes (if necessary) before calling ->set_body_orig(), which in turn calls this function.

Access: Private

function prep_body_display (somewhat DEPRECIATED)

Abstract: prepare text into something we can display in an HTML page. This particular function is supposed to be private but is may be useful for other things too.
Param1: $feed_text (string) this is the text that you want prepared for showing in an HTML page.
Result: string
Author: Angles

Discussion: In order to show text in an html browser this functions does a few things to it, such as convery CRLF chars into BR tags, and to encode HTML offensive chars into their htlp specialchar equivalents. Returns the prepared string and also directly fills class var $this->body_display with this prepared text, but that is a private class param.

Access: Private

function care_about_word

Abstract: spell checker is stupid, so we only give it text we believe to be words.
Param1: $str (string) a string to test
Result: boolean
Author: Angles

Discussion: returns True if we should spell check the text, False if we should ignore this text. Uses a variety of tests to determine what is probably not a "real word" so these words can be skipped during the spell checking. This is because the spell checker will often report these type of words to be misspelled, mostly because of strange punctuation of ASCII "art". Here is a list of the kind of strings what will cause a return of False : empty strings, CR or LF chars, single letter words, numbers, email addresses, URLs, internet host names, anything surrounded by typical markup brackets < >, words with a dot in the middle of it. Not every check is perfect, but this function will return it best assumption about the given string, whether it should be considered a "real word" or not.

Access: Private

function strip_punctuation

Abstract: this utility function will strip punctuation from text
Param1: $str (string) ?
Result: string

Discussion: spell checker is stupid, this utility function will strip punctuation from text so that the spell checker can look at the word itself, and not be confused by any punctuation.

Access: Private

function html_mark_bad_word

Abstract: DEPRECIATED

function html_mark_entire_line

Abstract: DEPRECIATED

Discussion: This Depreciated function was used during developement of this class, before comboboxes were used, it uses HTML tags to make the misspelled word bold and red, then puts up to $this->max_suggest suggestions after the word in brackets, with each suggestion seperated by the pipe character. Although this is no loner used at this moment, it may be of some use in the future. In theory, the user would get back the text as described, then have to hand edit the corrections. Not very user friendly so it is DEPRECIATED.

Unknown: #example ## User gets spell corrections like this: Could you pleeze [ please | sneeze | freeze ] send it to me. ## note: this example is fictional, not actual spell suggestions.
Access: Private

function add_option_boxes

Abstract: takes one line of text and inserts suggestion comboboxes after each misspelled word.
Param1: $line_of_text (string) a single line of text from the body of the message, whicj message is exploded by linebreaks.
Param2: $line_num (int) the line number in relation to the entire body of text when exploded by linebreaks.

Discussion: Uses class.html_widgets to simplify the HTML of the select boxes. Must operate on an entire line of text because the suggesion data targets the mispelled word by storing its line number and word number within that line, where the line is exploded by space. Thus, in adding the comboboxes there will be additional spaces and words added to the line, but this is not a problem is an entire line of text is processed in one pass. The function simply stores an unmodified version of the line and uses that to target words in any location in the line of text. Additonally, this function directly access the class var $this->bad_words which contains an object of type "correction_info" (as defined in file class.spell_struct) to obtain the suggestion data.

Access: Private

function get_form_action_url

Abstract: generate the URL which is the target, or action, of the spell review form
Result: string

Discussion: This function uses the code in class.bocompose to generate the return value. It does this by creating a class.bocompose object and calling its function get_compose_form_action_url(). The only difference is we pass a $menuaction_target var unique to this forms needs, whereas the compose form uses a different $menuaction_target specific to the compose form.

function make_correction_struct_from_array

Abstract: recover badwords "correction_info" structure data from the GPC vars of the spell_review form.
Param1: $submitted_correction_data (array) numbered array where each element is an associative array of badwords data.
Author: Angles

Discussion: the spell review form submits correction data in the form of URI string which is made into an array with parse_str. This data originated as "correction_info" structure data generated during spell_review, designed to be very similar to the "correction_info" structure, so it is possible to match the submitted badword data array to the "correction_info" structure it was modeled after.

function replace_badwords_this_line

Abstract: takes one line of text and replace each misspelled word the user has specified a replacement for
Param1: $line_of_text (string) a single line of text from the body of the message, whicj message is exploded by linebreaks.
Param2: $line_num (int) the line number in relation to the entire body of text when exploded by linebreaks.

Discussion: Must operate on an entire line of text because the suggesion data targets the mispelled word by line number and word number within that line, where the line is exploded by space. Thus, if a corrected word has a space there will be additional spaces and words added to the line, but this is not a problem is an entire line of text is processed in one pass. The function simply stores an unmodified version of the line and uses that to target words in any location in the line of text. Additonally, this function directly access the class var $this->bad_words which contains an object of type "correction_info" (as defined in file class.spell_struct) to obtain the suggestion data. That data was recovered from the user submitted form, made into an array, then made into the "correction_info" data. IMPORTANT: $this->bad_words->suggestions[0] IS THE USERS CHOICE of replacement word. During the initial spell checking it holds the suggestions from the spell checker backend, BUT after user submits the form with corrections, ->suggestions[0] is the bombobox value which was the users choice of a replacement word for that particular misspelled word, unless ->suggestions[0] is the special token "K_E_E_P" in which case the user desires no change for this word.

Access: Private

function spell_review

Abstract: The guts of the spellcheck logic is here, where the body is examined and corrections suggested.
Author: Angles

Discussion: ?

function spell_finished

Abstract: User reviewed spell check data is submitted to this function, which replaces words and calls compose.
Author: Angles

Discussion: Spell check form is submitted to this funcion, which replaces any misspelled words the user wants replaced, then invokes class.bocompose and takes the user back to the compose page with the corrected message text. Note this function must pass any GPC vars preserved when the compose form eas submitted for spellcheck, and put those bars back in the compose form where they are needed for when the compose form is submitted to class.bosend.

file class.spell_struct.inc.php

File: class.spell_struct.inc.php

class spell_struct

Abstract: A simple C-Style Include .h file, holds public data structure classes for class email spell

Discussion: Class Email Spell can be used with other classess such as the html widget class, however the html widget class, in this example, must be made aware of any data structures that the spell class may pass to it. Use this file like an include file for such purposes. I suggest require_once.

constant SP_FEED_

Abstract: does dpell checker want single words or lines of text, SP_FEED_UNKNOWN or SP_FEED_WORDS or SP_FEED_LINES
Author: Angles

Discussion: there should be different ways to spell check depending on what your system has installed. The php builtin pspell extension appears to take one word at a time, the command line version of aspell takes a string, a line of text, at one time. class.spell constructor should determine this and fill $this->sp_feed_type.

class correction_info

Abstract: coherently combine spelling suggextions with the original text
Param1: $orig_word string $line_num int $word_num int $suggestions array of strings

Discussion: holds information about a misspelled word including where it appears in the original text and up to MAX_SUGGEST suggestions

file class.spell_svc_none.inc.php

File: class.spell_svc_none.inc.php

class spell_svc_none

Abstract: dummy placeholder for spell-less installations
Param1: can_spell (boolean) PRIVATE - flag if this is a working module or a dummy one Only the calling spell class should access this, from there it is made public.
Param2: $sp_feed_type (defined int) PRIVATE , if tis services takes single words or strings, values are defined in spell class, which gets the value from here and makes it public.
Author: Angles

Discussion: If PHP psspell support is not compiled in, this dummy module spell_ svc_none is loaded so there are no errors related to undefined pspell functions.

Access: public

function get_can_spell

Abstract: Read Only, report if this spell service is capable of spell check or not.
Author: Angles

Discussion: The calling spell class will ask if this spell service is capable of spell check or not. This function is exposed to the calling spell class for this purpose. The calling spell class then maked that information public. This is a dummy placeholder module so it returns False.

Access: private

function get_sp_feed_type

Abstract: Read Only, report if this spell service takes single words or strings.
Author: Angles

Discussion: The calling spell class will ask if this spell service takes single words or strings. This function is exposed to the calling spell class for this purpose. The calling spell class then maked that information public.

Access: private

function pgw_pspell_new

Abstract: dummy placeholder for spell-less installations
Param1: string language, string [spelling], string [jargon], string [encoding], int [mode]

Discussion: returns False so ignorant calling code will sense something is wrong with spelling code.

Access: public

function pgw_pspell_check

Abstract: dummy placeholder for spell-less installations
Param1: int dictionary_link, string word

Discussion: Returns True to imitate a word is spelled correctly, then ignorant calling code will not ask for suggestions, hopefully.

Access: public

function pgw_pspell_suggest

Abstract: dummy placeholder for spell-less installations
Param1: int dictionary_link, string word

Discussion: Returns empty array to imitate pspell hafving no suggestions, since this is a dummy module there are indeed no suggestions, and ignorant calling code will not act on any suggestions if it gets an empty array back.

Access: public

file class.spell_svc_php.inc.php

File: class.spell_svc_php.inc.php

class spell_svc_php

Abstract: Wraps calls to the spell checking backend psspell buildin tp PHP
Param1: can_spell (boolean) PRIVATE - flag if this is a working module or a dummy one Only the calling spell class should access this, from there it is made public.
Param2: $sp_feed_type (defined int) PRIVATE , if tis services takes single words or strings, values are defined in spell class, which gets the value from here and makes it public.
Author: Angles

Discussion: This is loaded if PHP has psspell support compiled in. If it is not compiled in, a dummy module spell_ svc_none is loaded so there are no errors related to undefined pspell functions.

function get_can_spell

Abstract: Read Only, report if this spell service is capable of spell check or not.
Author: Angles

Discussion: The calling spell class will ask if this spell service is capable of spell check or not. This function is exposed to the calling spell class for this purpose. The calling spell class then maked that information public.

Access: private

function get_sp_feed_type

Abstract: Read Only, report if this spell service takes single words or strings.
Author: Angles

Discussion: The calling spell class will ask if this spell service takes single words or strings. This function is exposed to the calling spell class for this purpose. The calling spell class then maked that information public.

Access: private

function pgw_pspell_new

Abstract: wraps calls to "pspell_new"
Param1: string language, string [spelling], string [jargon], string [encoding], int [mode]

Discussion: Php manual shows params to be: pspell_new (string language, string [spelling], string [jargon], string [encoding], int [mode])

Access: public

function pgw_pspell_check

Abstract: wraps calls to "pspell_check"
Param1: int dictionary_link, string word

Discussion: Php manual shows params to be: pspell_check (int dictionary_link, string word)

Access: public

function pgw_pspell_suggest

Abstract: wraps calls to "pspell_suggest"
Param1: int dictionary_link, string word

Discussion: Php manual shows params to be: pspell_suggest (int dictionary_link, string word)

Access: public

file class.svc_nextmatches.inc.php

File: class.svc_nextmatches.inc.php

class svc_nextmatches

Abstract: service class for email, implements nextmatches that ONLY EMAIL needs

function page

Abstract: ?

function show_sort_order_mail

Abstract: ?
Param1: $old_sort : the current sort value
Param2: $new_sort : the sort value you want if you click on this
Param3: $default_order : users preference for ordering list items (force this when a new [different] sorting is requested)
Param4: $order : the current order (will be flipped if old_sort = new_sort)
Param5: $program : script file name
Param6: $text : Text the link will show
Param7: $extra : any extra stuff you want to pass, url style

function nav_left_right_mail

Abstract: same code as left and right (as of Dec 07, 2001) except all combined into one function
Param1: feed_vars : array with these elements:
start total cmd_prefix cmd_suffix
Unknown: #return array, combination of functions left and right above, with these elements: first_page prev_page next_page last_page

function set_link_mail

Abstract: ?
Param1: $img_src ?
Param2: $label ?
Param3: $link ?
Param4: $extravars ?

function set_icon_mail

Abstract: ?
Param1: $align ?
Param2: $img ?
Param3: $alt_text ?

file class.ui_mail_debug.inc.php

File: class.ui_mail_debug.inc.php

class ui_mail_debug

Abstract: Useful debug and inline docs access page.

Discussion: Uncomment the "public_functions" line to enable the Email Debug Page. Should be disabled by default, this is a developers tool.

Author: Angles

capability Debug Page

Discussion: Uncomment the next line of code to enable the Email Debug Page. This is file email / class.ui_mail_debug.inc.php

function index

Abstract: This page is displayed by exposing this as a public function then calling it .

Discussion: Uncomment the "public_functions" line to enable the Email Debug Page. Should be disabled by default, this is a developers tool. If enabled, call this function to display the page.

Example:
		/index.php?menuaction=email.ui_mail_debug.index
		
Author: Angles

file class.uicompose.inc.php

File: class.uicompose.inc.php

function compose

Abstract: calls bocompose and makes the compose page
Author: Angles
Description: ?
Access: public

file class.uiindex.inc.php

File: class.uiindex.inc.php

function index

Abstract: assembles data used for the index page, the list of messages in a folder
Param1: $reuse_feed_args (array) DEPRECIATED
Author: Angles
Description: ?

function mlist DEPRECIATED

Abstract: display a pre-defined message set array
Author: Angles
Description: This code is depreciated, was used for message searches using an old technique.

file class.uimessage.inc.php

File: class.uimessage.inc.php

class uimessage

Abstract: ?

function message

Abstract: ?

file class.uipreferences.inc.php

File: class.uipreferences.inc.php

function create_prefs_block

Abstract: create 2 columns TR's (TableRows) from preference data as standardized in email bopreferences class vars ->std_prefs[] and ->cust_prefs[], various HTML widgets supported
Param1: $feed_prefs : array : preference data as standardized in email bopreferences class vars ->std_prefs[] and ->cust_prefs[]
Result: : string : HTML data accumulated for parsed prefernce widget TR's

Discussion: email bopreferences class vars ->std_prefs[] and ->cust_prefs[], as filled by email bopreferences->init_available_prefs(), represent a standardized preferences schema, this function generates TR's from that data, using elements "id", "widget", "other_props", "lang_blurb", and "values" from that array structure. This function uses that data to fill a template block that contatains the requested widget and the appropriate data. Available HTML widgets are: * textarea * textbox * passwordbox * combobox * checkbox If prefs data "other_props" contains "hidden", as with password data, then the actual preference value is not shown and the "text blurb" is appended with "(hidden)". Array can contain any number of preference "records", all generated TR's are cumulative.

Unknown: #author Angles

function preferences

Abstract: call this function to display the typical UI html page for email preferences

Discussion: should obtain the desired account number the user wants to see prefs for, if possible

Unknown: #author Angles

function preferences_default_acct_zero

Abstract: call this function to display the UI html page for email preferences for the Default Account

Discussion: This is ONLY FOR THE DEFAULT ACCOUNT for 2 reasons 1) the defaut account has slightly different prefs then the extra account, and 2) author too lazy to combine this function with ex_accounts_edit() like it should be

Unknown: #author Angles, skeeter

function ex_accounts_edit

Abstract: call this function to display the typical UI html page Extra Email Accounts Preferences
Unknown: #author Angles, skeeter

file functions.inc.php

File: functions.inc.php

concept Turn Off Magic Quotes Runtime

Discussion: magic_quotes_runtime essentially handles slashes when communicating with databases. PHP MANUAL says: If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash. this is undesirable - turn it off.