'BYE' => _("ERROR : Imap server closed the connection.")
);
+// why can't this just use sqimap_error_box() ?
function sqimap_asearch_error_box($response, $query, $message)
{
global $imap_error_titles;
}
}
-/* This is to avoid the E_NOTICE warnings signaled by marc AT squirrelmail.org. Thanks Marc! */
+/**
+ * This is to avoid the E_NOTICE warnings signaled by marc AT squirrelmail.org. Thanks Marc!
+ */
function asearch_nz(&$var)
{
if (isset($var))
return '';
}
-/* This should give the same results as PHP 4 >= 4.3.0's html_entity_decode(), except it doesn't handle hex constructs */
+/**
+ * This should give the same results as PHP 4 >= 4.3.0's html_entity_decode(),
+ * except it doesn't handle hex constructs
+ */
function asearch_unhtmlentities($string) {
$trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES));
for ($i=127; $i<255; $i++) /* Add &#<dec>; entities */
return '"' . $what . '"'; // 4.3 quoted string form
}
-/*
- Parses a user date string into an rfc2060 date string (<day number>-<US month TLA>-<4 digit year>)
- Returns a preg_match-style array: [0]: fully formatted date, [1]: day, [2]: month, [3]: year
- Handles space, slash, backslash, dot and comma as separators (and dash of course ;=)
-*/
+/**
+ * Parses a user date string into an rfc2060 date string
+ * (<day number>-<US month TLA>-<4 digit year>).
+ * Returns a preg_match-style array: [0]: fully formatted date,
+ * [1]: day, [2]: month, [3]: year
+ * Handles space, slash, backslash, dot and comma as separators (and dash of course ;=)
+ */
function sqimap_asearch_parse_date($what)
{
global $imap_asearch_months;
global $sqimap_session_id;
$sqimap_session_id = 1;
-/* Sets an unique session id in order to avoid simultanous sessions crash. */
+/**
+ * Generates a new session ID by incrementing the last one used;
+ * this ensures that each command has a unique ID.
+ * @param bool unique_id
+ * @return string IMAP session id of the form 'A000'.
+ */
function sqimap_session_id($unique_id = false) {
global $data_dir, $username, $sqimap_session_id;
if (!$unique_id) {
}
}
-/*
+/**
* Both send a command and accept the result from the command.
* This is to allow proper session number handling.
*/
return false;
}
}
+
function sqimap_prepare_pipelined_query($new_query,&$tag,&$aQuery,$unique_id) {
$sid = sqimap_session_id($unique_id);
$tag_uid_a = explode(' ',trim($sid));
return $aResults;
}
-/*
- * custom fgets function. gets a line from IMAP
- * no matter how big it may be
+/**
+ * Custom fgets function: gets a line from the IMAP-server,
+ * no matter how big it may be.
+ * @param stream imap_stream the stream to read from
+ * @return string a line
*/
-
function sqimap_fgets($imap_stream) {
$read = '';
$buffer = 4096;
return $results;
}
-/* obsolete function, inform plugins that use it */
+/**
+ * Obsolete function, inform plugins that use it
+ * @deprecated use sqimap_run_command or sqimap_run_command_list instead
+ */
function sqimap_read_data_list($imap_stream, $tag, $handle_errors,
&$response, &$message, $query = '') {
global $color, $squirrelmail_language;
exit;
}
+/**
+ * Function to display an error related to an IMAP-query.
+ * @param string title the caption of the error box
+ * @param string query the query that went wrong
+ * @param string message_title
+ * @param string message the error message
+ * @return void
+ */
function sqimap_error_box($title, $query = '', $message_title = '', $message = '')
{
global $color, $squirrelmail_language;
error_box($string,$color);
}
-/*
+/**
* Reads the output from the IMAP stream. If handle_errors is set to true,
* this will also handle all errors that are received. If it is not set,
- * the errors will be sent back through $response and $message
+ * the errors will be sent back through $response and $message.
*/
-
function sqimap_retrieve_imap_response($imap_stream, $tag, $handle_errors,
&$response, &$message, $query = '',
$filter = false, $outputstream = false, $no_return = false) {
}
}
-/** sqimap_create_stream()
- * @return imap-stream resource identifier
+/**
* Connects to the IMAP server and returns a resource identifier for use with
* the other SquirrelMail IMAP functions. Does NOT login!
+ * @param string server hostname of IMAP server
+ * @param int port port number to connect to
+ * @param bool tls whether to use TLS when connecting.
+ * @return imap-stream resource identifier
*/
function sqimap_create_stream($server,$port,$tls=false) {
global $username, $use_imap_tls;
return $imap_stream;
}
-/*
+/**
* Logs the user into the imap server. If $hide is set, no error messages
* will be displayed. This function returns the imap connection handle.
*/
return $imap_stream;
}
-/* Simply logs out the IMAP session */
+/**
+ * Simply logs out the IMAP session
+ * @param stream imap_stream the IMAP connection to log out.
+ * @return void
+ */
function sqimap_logout ($imap_stream) {
/* Logout is not valid until the server returns 'BYE'
* If we don't have an imap_ stream we're already logged out */
sqimap_run_command($imap_stream, 'LOGOUT', false, $response, $message);
}
+/**
+ * Retreive the CAPABILITY string from the IMAP server.
+ * If capability is set, returns only that specific capability,
+ * else returns array of all capabilities.
+ */
function sqimap_capability($imap_stream, $capability='') {
global $sqimap_capabilities;
if (!is_array($sqimap_capabilities)) {
return $sqimap_capabilities;
}
-/* Returns the delimeter between mailboxes: INBOX/Test, or INBOX.Test */
+/**
+ * Returns the delimeter between mailboxes: INBOX/Test, or INBOX.Test
+ */
function sqimap_get_delimiter ($imap_stream = false) {
global $sqimap_delimiter, $optional_delimiter;
return $sqimap_delimiter;
}
-
+/**
+ * This encodes a mailbox name for use in IMAP commands.
+ * @param string what the mailbox to encode
+ * @return string the encoded mailbox string
+ */
function sqimap_encode_mailbox_name($what)
{
if (ereg("[\"\\\r\n]", $what))
}
-/* Gets the number of messages in the current mailbox. */
+/**
+ * Gets the number of messages in the current mailbox.
+ */
function sqimap_get_num_messages ($imap_stream, $mailbox) {
$read_ary = sqimap_run_command ($imap_stream, 'EXAMINE ' . sqimap_encode_mailbox_name($mailbox), false, $result, $message);
for ($i = 0; $i < count($read_ary); $i++) {
return false; //"BUG! Couldn't get number of messages in $mailbox!";
}
-
function parseAddress($address, $max=0) {
$aTokens = array();
$aAddress = array();
}
-
-/*
- * Returns the number of unseen messages in this folder
+/**
+ * Returns the number of unseen messages in this folder.
*/
function sqimap_unseen_messages ($imap_stream, $mailbox) {
$read_ary = sqimap_run_command ($imap_stream, 'STATUS ' . sqimap_encode_mailbox_name($mailbox) . ' (UNSEEN)', false, $result, $message);
return $regs[1];
}
-/*
+/**
* Returns the number of total/unseen/recent messages in this folder
*/
function sqimap_status_messages ($imap_stream, $mailbox) {
}
-/*
- * Saves a message to a given folder -- used for saving sent messages
+/**
+ * Saves a message to a given folder -- used for saving sent messages
*/
function sqimap_append ($imap_stream, $sent_folder, $length) {
fputs ($imap_stream, sqimap_session_id() . ' APPEND ' . sqimap_encode_mailbox_name($sent_folder) . " (\\Seen) \{$length}\r\n");
return $function($username);
}
-/* This is an example that gets imapservers from yellowpages (NIS).
+/**
+ * This is an example that gets imapservers from yellowpages (NIS).
* you can simple put map:map_yp_alias in your $imap_server_address
* in config.php use your own function instead map_yp_alias to map your
- * LDAP whatever way to find the users imapserver. */
-
+ * LDAP whatever way to find the users imapserver.
+ */
function map_yp_alias($username) {
$yp = `ypmatch $username aliases`;
return chop(substr($yp, strlen($username)+1));
} else {
$bcmp = '2' . $b->mailboxname_full;
}
- return user_strcasecmp($acmp, $bcmp);
+ return strnatcasecmp($acmp, $bcmp);
}
function compact_mailboxes_response($ary)
return array_values(array_unique($ary));
}
-/*
-function find_mailbox_name ($mailbox) {
- if (preg_match('/\*.+\"([^\r\n\"]*)\"[\s\r\n]*$/', $mailbox, $regs))
- return $regs[1];
- if (ereg(" *\"([^\r\n\"]*)\"[ \r\n]*$", $mailbox, $regs))
- return $regs[1];
- ereg(" *([^ \r\n\"]*)[ \r\n]*$",$mailbox,$regs);
- return $regs[1];
-}
-*/
-
-// Extract the mailbox name from an untagged LIST (7.2.2) or LSUB (7.2.3) answer
-// * (LIST|LSUB) (<Flags list>) (NIL|"<separator atom>") <mailbox name string>\r\n
-// mailbox name in quoted string MUST be unquoted and stripslashed (sm API)
+/**
+ * Extract the mailbox name from an untagged LIST (7.2.2) or LSUB (7.2.3) answer
+ * (LIST|LSUB) (<Flags list>) (NIL|"<separator atom>") <mailbox name string>\r\n
+ * mailbox name in quoted string MUST be unquoted and stripslashed (sm API)
+ */
function find_mailbox_name($line)
{
if (preg_match('/^\* (?:LIST|LSUB) \([^\)]*\) (?:NIL|\"[^\"]*\") ([^\r\n]*)[\r\n]*$/i', $line, $regs)) {
return '';
}
+/**
+ * @return bool whether this is a Noselect mailbox.
+ */
function check_is_noselect ($lsub_line) {
return preg_match("/^\* (LSUB|LIST) \([^\)]*\\\\Noselect[^\)]*\)/i", $lsub_line);
}
+/**
+ * @return bool whether this is a Noinferiors mailbox.
+ */
function check_is_noinferiors ($lsub_line) {
return preg_match("/^\* (LSUB|LIST) \([^\)]*\\\\Noinferiors[^\)]*\)/i", $lsub_line);
}
}
}
-/* Defines special mailboxes */
+/**
+ * Defines special mailboxes: given a mailbox name, it checks if this is a
+ * "special" one: INBOX, Trash, Sent or Draft.
+ */
function isSpecialMailbox( $box ) {
$ret = ( (strtolower($box) == 'inbox') ||
isTrashMailbox($box) || isSentMailbox($box) || isDraftMailbox($box) );
return $ret;
}
+/**
+ * @return bool whether this is a Trash folder
+ */
function isTrashMailbox ($box) {
global $trash_folder, $move_to_trash;
return $move_to_trash && $trash_folder &&
( $box == $trash_folder || isBoxBelow($box, $trash_folder) );
}
+/**
+ * @return bool whether this is a Sent folder
+ */
function isSentMailbox($box) {
global $sent_folder, $move_to_sent;
return $move_to_sent && $sent_folder &&
( $box == $sent_folder || isBoxBelow($box, $sent_folder) );
}
+/**
+ * @return bool whether this is a Draft folder
+ */
function isDraftMailbox($box) {
global $draft_folder, $save_as_draft;
return $save_as_draft &&
( $box == $draft_folder || isBoxBelow($box, $draft_folder) );
}
-/* Expunges a mailbox */
+/**
+ * Expunges a mailbox, ie. delete all contents.
+ */
function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true, $id='') {
global $uid_support;
if ($id) {
return $cnt;
}
-/* Checks whether or not the specified mailbox exists */
+/**
+ * Checks whether or not the specified mailbox exists
+ */
function sqimap_mailbox_exists ($imap_stream, $mailbox) {
if (!isset($mailbox) || empty($mailbox)) {
return false;
return isset($mbx[0]);
}
-/* Selects a mailbox */
+/**
+ * Selects a mailbox
+ */
function sqimap_mailbox_select ($imap_stream, $mailbox) {
global $auto_expunge;
return $result;
}
-/* Creates a folder */
+/**
+ * Creates a folder.
+ */
function sqimap_mailbox_create ($imap_stream, $mailbox, $type) {
global $delimiter;
if (strtolower($type) == 'noselect') {
$mailbox .= $delimiter;
}
- $read_ary = sqimap_run_command($imap_stream, 'CREATE ' . sqimap_encode_mailbox_name($mailbox),
+ $read_ary = sqimap_run_command($imap_stream, 'CREATE ' .
+ sqimap_encode_mailbox_name($mailbox),
true, $response, $message);
sqimap_subscribe ($imap_stream, $mailbox);
}
-/* Subscribes to an existing folder */
+/**
+ * Subscribes to an existing folder.
+ */
function sqimap_subscribe ($imap_stream, $mailbox) {
- $read_ary = sqimap_run_command($imap_stream, 'SUBSCRIBE ' . sqimap_encode_mailbox_name($mailbox),
+ $read_ary = sqimap_run_command($imap_stream, 'SUBSCRIBE ' .
+ sqimap_encode_mailbox_name($mailbox),
true, $response, $message);
}
-/* Unsubscribes to an existing folder */
+/**
+ * Unsubscribes from an existing folder
+ */
function sqimap_unsubscribe ($imap_stream, $mailbox) {
- $read_ary = sqimap_run_command($imap_stream, 'UNSUBSCRIBE ' . sqimap_encode_mailbox_name($mailbox),
+ $read_ary = sqimap_run_command($imap_stream, 'UNSUBSCRIBE ' .
+ sqimap_encode_mailbox_name($mailbox),
true, $response, $message);
}
-/* Deletes the given folder */
+/**
+ * Deletes the given folder
+ */
function sqimap_mailbox_delete ($imap_stream, $mailbox) {
global $data_dir, $username;
- $read_ary = sqimap_run_command($imap_stream, 'DELETE ' . sqimap_encode_mailbox_name($mailbox),
+ $read_ary = sqimap_run_command($imap_stream, 'DELETE ' .
+ sqimap_encode_mailbox_name($mailbox),
true, $response, $message);
sqimap_unsubscribe ($imap_stream, $mailbox);
do_hook_function('rename_or_delete_folder', $args = array($mailbox, 'delete', ''));
removePref($data_dir, $username, "thread_$mailbox");
}
-/* Determines if the user is subscribed to the folder or not */
+/**
+ * Determines if the user is subscribed to the folder or not
+ */
function sqimap_mailbox_is_subscribed($imap_stream, $folder) {
$boxesall = sqimap_mailbox_list ($imap_stream);
foreach ($boxesall as $ref) {
return false;
}
-/* Renames a mailbox */
+/**
+ * Renames a mailbox.
+ */
function sqimap_mailbox_rename( $imap_stream, $old_name, $new_name ) {
if ( $old_name != $new_name ) {
global $delimiter, $imap_server_type, $data_dir, $username;
}
$boxesall = sqimap_mailbox_list($imap_stream);
- $cmd = 'RENAME ' . sqimap_encode_mailbox_name($old_name) . ' ' . sqimap_encode_mailbox_name($new_name);
+ $cmd = 'RENAME ' . sqimap_encode_mailbox_name($old_name) .
+ ' ' . sqimap_encode_mailbox_name($new_name);
$data = sqimap_run_command($imap_stream, $cmd, true, $response, $message);
sqimap_unsubscribe($imap_stream, $old_name.$postfix);
$oldpref = getPref($data_dir, $username, 'thread_'.$old_name.$postfix);
}
}
-/*
+/**
* Formats a mailbox into parts for the $boxesall array
*
* The parts are:
return $boxesall;
}
-/*
- * Sorting function used to sort mailbox names.
- * + Original patch from dave_michmerhuizen@yahoo.com
- * + Allows case insensitivity when sorting folders
- * + Takes care of the delimiter being sorted to the end, causing
- * subfolders to be listed in below folders that are prefixed
- * with their parent folders name.
- *
- * For example: INBOX.foo, INBOX.foobar, and INBOX.foo.bar
- * Without special sort function: foobar between foo and foo.bar
- * With special sort function: foobar AFTER foo and foo.bar :)
- */
-function user_strcasecmp($a, $b) {
- return strnatcasecmp($a, $b);
-}
-
-/*
+/**
* Returns list of options (to be echoed into select statement
* based on available mailboxes and separators
* Caller should surround options with <SELECT..> </SELECT> and
return $mbox_options;
}
-/*
+/**
* Returns sorted mailbox lists in several different ways.
* See comment on sqimap_mailbox_parse() for info about the returned array.
*/
/* natural sort mailboxes */
if (isset($sorted_lsub_ary)) {
- usort($sorted_lsub_ary, 'user_strcasecmp');
+ usort($sorted_lsub_ary, 'strnatcasecmp');
}
/*
* The LSUB response doesn't provide us information about \Noselect
return $boxesnew;
}
-/*
+/**
* Returns a list of all folders, subscribed or not
*/
function sqimap_mailbox_list_all($imap_stream) {
}
}
-
-/* Define preferences for folder settings. */
-/* FIXME, we should load constants.php
-unseen_notify
-define('SMPREF_UNSEEN_NONE', 1);
-define('SMPREF_UNSEEN_INBOX', 2);
-define('SMPREF_UNSEEN_ALL', 3);
-
-define('SMPREF_UNSEEN_SPECIAL', 4); // Only special folders
-define('SMPREF_UNSEEN_NORMAL', 5); // Only normal folders
-
-unseen_type
-define('SMPREF_UNSEEN_ONLY', 1);
-define('SMPREF_UNSEEN_TOTAL', 2);
-*/
-
function sqimap_get_status_mbx_tree($imap_stream,&$mbx_tree) {
global $unseen_notify, $unseen_type, $trash_folder,$move_to_trash;
$aMbxs = $aQuery = $aTag = array();
$read = sqimap_run_command ($imap_stream, "STORE $start:$end +FLAGS (\\$flag)", $handle_errors, $response, $message, $uid_support);
}
-/* Remove specified flag from specified messages */
-function sqimap_messages_remove_flag ($imap_stream, $start, $end, $flag, $handle_errors) {
- global $uid_support;
- $read = sqimap_run_command ($imap_stream, "STORE $start:$end -FLAGS (\\$flag)", $handle_errors, $response, $message, $uid_support);
-}
-
function sqimap_toggle_flag($imap_stream, $id, $flag, $set, $handle_errors) {
global $uid_support;
$msgs_id = sqimap_message_list_squisher($id);
$read = sqimap_run_command ($imap_stream, "STORE $msgs_id ".$set_string."FLAGS ($flag)", $handle_errors, $response, $message, $uid_support);
}
-// obsolete?
+/** @deprecated */
function sqimap_get_small_header ($imap_stream, $id, $sent) {
$res = sqimap_get_small_header_list($imap_stream, $id, $sent);
return $res[0];
}
-/*
+/**
* Sort the message list and crunch to be as small as possible
* (overflow could happen, so make it small if possible)
*/
return $msgs_str;
}
-/* returns the references header lines */
-function get_reference_header ($imap_stream, $message) {
- global $uid_support;
- $responses = array ();
- $results = array();
- $references = "";
- $responses = sqimap_run_command_list ($imap_stream, "FETCH $message BODY[HEADER.FIELDS (References)]", true, $response, $message, $uid_support);
- if (!eregi("^\\* ([0-9]+) FETCH", $responses[0][0], $regs)) {
- $responses = array ();
- }
- return $responses;
-}
-
-
-/* get sort order from server and
- * return it as the $id array for
- * mailbox_display
+/**
+ * Get sort order from server and return it as the $id array for mailbox_display.
*/
-
function sqimap_get_sort_order ($imap_stream, $sort, $mbxresponse) {
global $default_charset, $thread_sort_messages,
$internal_date_sort, $server_sort_array,
}
-/* returns an indent array for printMessageinfo()
- this represents the amount of indent needed (value)
- for this message number (key)
-*/
-
+/**
+ * Returns an indent array for printMessageinfo()
+ * This represents the amount of indent needed (value),
+ * for this message number (key)
+ */
function get_parent_level ($imap_stream) {
global $sort_by_ref, $default_charset, $thread_new;
- $parent = "";
- $child = "";
- $cutoff = 0;
+ $parent = '';
+ $child = '';
+ $cutoff = 0;
/* loop through the threads and take unwanted characters out
of the thread string then chop it up
}
-/* returns an array with each element as a string
- representing one message thread as returned by
- the IMAP server
-*/
-
+/**
+ * Returns an array with each element as a string representing one
+ * message-thread as returned by the IMAP server.
+ */
function get_thread_sort ($imap_stream) {
global $thread_new, $sort_by_ref, $default_charset, $server_sort_array, $uid_support;
if (sqsession_is_registered('thread_new')) {
return $new_messages;
}
-// obsolete?
-function sqimap_get_headerfield($imap_stream, $field) {
- global $uid_support;
- $sid = sqimap_session_id(false);
-
- $results = array();
- $read_list = array();
-
- $query = "FETCH 1:* (UID BODY.PEEK[HEADER.FIELDS ($field)])";
- $readin_list = sqimap_run_command_list ($imap_stream, $query, true, $response, $message, $uid_support);
- $i = 0;
-
- foreach ($readin_list as $r) {
- $r = implode('',$r);
- /* first we unfold the header */
- $r = str_replace(array("\r\n\t","\r\n\s"),array('',''),$r);
- /*
- * now we can make a new header array with each element representing
- * a headerline
- */
- $r = explode("\r\n" , $r);
- if (!$uid_support) {
- if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH/iAU",$r[0], $regs)) {
- set_up_language($squirrelmail_language);
- echo '<br><b><font color=$color[2]>' .
- _("ERROR : Could not complete request.") .
- '</b><br>' .
- _("Unknown response from IMAP server: ") . ' 1.' .
- $r[0] . "</font><br>\n";
- } else {
- $id = $regs[1];
- }
- } else {
- if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH.*UID\s+([0-9]+)\s+/iAU",$r[0], $regs)) {
- set_up_language($squirrelmail_language);
- echo '<br><b><font color=$color[2]>' .
- _("ERROR : Could not complete request.") .
- '</b><br>' .
- _("Unknown response from IMAP server: ") . ' 1.' .
- $r[0] . "</font><br>\n";
- } else {
- $id = $regs[2];
- }
- }
- $field = $r[1];
- $field = substr($field,strlen($field)+2);
- $result[] = array($id,$field);
- }
- return $result;
-}
-
-
-
-
-
-/*
+/**
* Returns a message array with all the information about a message.
* See the documentation folder for more information about this array.
*/
return $msg;
}
-/* Wrapper function that reformats the header information. */
-// obsolete?
-function sqimap_get_message_header ($imap_stream, $id, $mailbox) {
- global $uid_support;
- $read = sqimap_run_command ($imap_stream, "FETCH $id BODY[HEADER]", true, $response, $message, $uid_support);
- $header = sqimap_get_header($imap_stream, $read);
- $header->id = $id;
- $header->mailbox = $mailbox;
- return $header;
-}
-
-/* Wrapper function that reformats the entity header information. */
-// obsolete?
-function sqimap_get_ent_header ($imap_stream, $id, $mailbox, $ent) {
- global $uid_support;
- $read = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent.HEADER]", true, $response, $message, $uid_support);
- $header = sqimap_get_header($imap_stream, $read);
- $header->id = $id;
- $header->mailbox = $mailbox;
- return $header;
-}
-
-/* function to get the mime headers */
-// obsolete?
-function sqimap_get_mime_ent_header ($imap_stream, $id, $mailbox, $ent) {
- global $uid_support;
- $read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[$ent.MIME]", true, $response, $message, $uid_support);
- $header = sqimap_get_header($imap_stream, $read);
- $header->id = $id;
- $header->mailbox = $mailbox;
- return $header;
-}
-
?>
define('SMOPT_GRP_MAILBOX', 1);
define('SMOPT_GRP_MESSAGE', 2);
-/* Define the optpage load function for the display options page. */
+/**
+ * This function builds an array with all the information about
+ * the options available to the user, and returns it. The options
+ * are grouped by the groups in which they are displayed.
+ * For each option, the following information is stored:
+ * - name: the internal (variable) name
+ * - caption: the description of the option in the UI
+ * - type: one of SMOPT_TYPE_*
+ * - refresh: one of SMOPT_REFRESH_*
+ * - size: one of SMOPT_SIZE_*
+ * - save: the name of a function to call when saving this option
+ * @return array all option information
+ */
function load_optpage_data_display() {
global $theme, $language, $languages, $js_autodetect_results,
$compose_new_win, $default_use_mdn, $squirrelmail_language, $allow_thread_sort,
/** Define any specialized save functions for this option page. ***/
/******************************************************************/
+/**
+ * This function saves a new theme setting.
+ * It updates the theme array.
+ */
function save_option_theme($option) {
global $theme;
save_option($option);
}
+/**
+ * This function saves the javascript detection option.
+ */
function save_option_javascript_autodetect($option) {
global $data_dir, $username, $new_javascript_setting;
define('SMOPT_GRP_FOLDERLIST', 1);
define('SMOPT_GRP_FOLDERSELECT', 2);
-/* Define the optpage load function for the folder options page. */
+/**
+ * This function builds an array with all the information about
+ * the options available to the user, and returns it. The options
+ * are grouped by the groups in which they are displayed.
+ * For each option, the following information is stored:
+ * - name: the internal (variable) name
+ * - caption: the description of the option in the UI
+ * - type: one of SMOPT_TYPE_*
+ * - refresh: one of SMOPT_REFRESH_*
+ * - size: one of SMOPT_SIZE_*
+ * - save: the name of a function to call when saving this option
+ * @return array all option information
+ */
function load_optpage_data_folder() {
global $username, $key, $imapServerAddress, $imapPort;
global $folder_prefix, $default_folder_prefix, $show_prefix_option;
/******************************************************************/
/** Define any specialized save functions for this option page. ***/
/******************************************************************/
+
+/**
+ * Saves the trash folder option.
+ */
function save_option_trash_folder($option) {
global $data_dir, $username;
save_option($option);
}
+/**
+ * Saves the sent folder option.
+ */
function save_option_sent_folder($option) {
global $data_dir, $username;
save_option($option);
}
+/**
+ * Saves the draft folder option.
+ */
function save_option_draft_folder($option) {
global $data_dir, $username;
define('SMOPT_GRP_SIG', 2);
define('SMOPT_GRP_TZ', 3);
-/* Define the optpage load function for the personal options page. */
+/**
+ * This function builds an array with all the information about
+ * the options available to the user, and returns it. The options
+ * are grouped by the groups in which they are displayed.
+ * For each option, the following information is stored:
+ * - name: the internal (variable) name
+ * - caption: the description of the option in the UI
+ * - type: one of SMOPT_TYPE_*
+ * - refresh: one of SMOPT_REFRESH_*
+ * - size: one of SMOPT_SIZE_*
+ * - save: the name of a function to call when saving this option
+ * @return array all option information
+ */
function load_optpage_data_personal() {
global $data_dir, $username, $edit_identity, $edit_name,
$full_name, $reply_to, $email_address, $signature, $tzChangeAllowed,
/** Define any specialized save functions for this option page. ***/
/******************************************************************/
+/**
+ * Saves the signature option.
+ */
function save_option_signature($option) {
global $data_dir, $username;
setSig($data_dir, $username, 'g', $option->new_value);