require_once('../functions/page_header.php');
require_once('../functions/display_messages.php');
-/**
- * Unique SessionId
- *
- * Sets an unique session id in order to avoid simultanous sessions crash.
- *
- * @return string a 4 chars unique string
- */
-
global $sqimap_session_id;
$sqimap_session_id = 1;
-function sqimap_session_id() {
+/* Sets an unique session id in order to avoid simultanous sessions crash. */
+function sqimap_session_id() {
global $data_dir, $username, $sqimap_session_id;
-
return( sprintf("A%03d", $sqimap_session_id++) );
}
-/******************************************************************************
-** Both send a command and accept the result from the command. This is
-** to allow proper session number handling.
-******************************************************************************/
-
+/*
+ * Both send a command and accept the result from the command.
+ * This is to allow proper session number handling.
+ */
function sqimap_run_command_list ($imap_stream, $query, $handle_errors, &$response, &$message) {
$sid = sqimap_session_id();
fputs ($imap_stream, $sid . ' ' . $query . "\r\n");
/*
- * 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
+ * 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
*/
-
-function sqimap_read_data_list ($imap_stream, $pre, $handle_errors,
- &$response, &$message, $query = '') {
+function sqimap_read_data_list ($imap_stream, $pre, $handle_errors, &$response, &$message, $query = '') {
global $color, $squirrelmail_language;
$read = '';
}
}
- // if (ereg("^\\* [0-9]+ FETCH.*\\{([0-9]+)\\}", $read, $regs)) {
+ /* if (ereg("^\\* [0-9]+ FETCH.*\\{([0-9]+)\\}", $read, $regs)) { */
if (preg_match('/^\* [0-9]+ FETCH.*\{([0-9]+)\}/', $read, $regs)) {
- $size = $regs[1];
- //} else if (ereg("^\\* [0-9]+ FETCH", $read, $regs)) {
+ $size = $regs[1];
+ /* } else if (ereg("^\\* [0-9]+ FETCH", $read, $regs)) { */
} else if (preg_match('/^\* [0-9]+ FETCH/', $read, $regs)) {
- // Sizeless response, probably single-line
+ /* Sizeless response, probably single-line */
$size = -1;
$data[] = $read;
$read = fgets($imap_stream, $bufsize);
break;
}
}
- // If we know the size, no need to look at the end parameters
+ /* If we know the size, no need to look at the end parameters */
if ($size > 0) {
if ($total_size == $size) {
- // We've reached the end of this 'message', switch to the next one.
+ /* We've reached the end of this 'message', switch to the next one. */
$data[] = $read;
break;
} else if ($total_size > $size) {
}
$total_size += strlen($read);
} else {
+ /* if (ereg("^$pre (OK|BAD|NO)(.*)", $read, $regs) || */
if (preg_match("/^$pre (OK|BAD|NO)(.*)/", $read, $regs) ||
- // if (ereg("^$pre (OK|BAD|NO)(.*)", $read, $regs) ||
- (($size == -1) && preg_match('/^\* [0-9]+ FETCH.*/', $read, $regs))) {
+ /* (($size == -1) && ereg("^\\* [0-9]+ FETCH.*", $read, $regs))) { */
+ (($size == -1) && preg_match('/^\* [0-9]+ FETCH.*/', $read, $regs))) {
break;
} else if ( preg_match('/^\* OK \[PARSE.*/', $read, $regs ) ) {
+ /*
+ * This block has been added in order to avoid the problem
+ * caused by the * OK [PARSE] Missing parameter answer
+ * Please, replace it with a better parsing if you know how.
+ * This block has been updated by
+ * Seth E. Randall <sethr@missoulafcu.org>. Once we see
+ * one OK [PARSE line, we just go through and keep
+ * tossing them out until we get something different.
+ */
while ( preg_match('/^\* OK \[PARSE.*/', $read, $regs ) ) {
$read = fgets($imap_stream, $bufsize);
}
- /*
- This block has been added in order to avoid the problem
- caused by the * OK [PARSE] Missing parameter answer
- Please, replace it with a better parsing if you know how.
- This block has been updated by
- Seth E. Randall <sethr@missoulafcu.org>. Once we see
- one OK [PARSE line, we just go through and keep
- tossing them out until we get something different.
- */
$data[] = $read;
$read = fgets ($imap_stream, $bufsize);
} else if (preg_match('/^\* BYE \[ALERT\](.*)/', $read, $regs)) {
/*
- It seems that the IMAP server has coughed a lung up
- and hung up the connection. Print any info we have
- and abort.
+ * It seems that the IMAP server has coughed up a lung
+ * and hung up the connection. Print any info we have
+ * and abort.
*/
echo _("Please contact your system administrator and report the following error:") . "<br>\n";
- echo "$regs[1]";
- exit(0);
+ echo $regs[1];
+ exit;
} else {
$data[] = $read;
$read = fgets ($imap_stream, $bufsize);
}
}
- // while (($more_msgs = !ereg("^$pre (OK|BAD|NO)(.*)$", $read, $regs)) &&
- // !ereg("^\\* [0-9]+ FETCH.*", $read, $regs)) {
+ /*
+ * while (($more_msgs = !ereg("^$pre (OK|BAD|NO)(.*)$", $read, $regs)) &&
+ * !ereg("^\\* [0-9]+ FETCH.*", $read, $regs)) {
+ */
while (($more_msgs = !preg_match("/^$pre (OK|BAD|NO)(.*)$/", $read, $regs)) &&
!preg_match('/^\* [0-9]+ FETCH.*/', $read, $regs)) {
$read = fgets($imap_stream, $bufsize);
if ($handle_errors == false) {
return( $resultlist );
} else if ($response == 'NO') {
- // ignore this error from m$ exchange, it is not fatal (aka bug)
+ /* ignore this error from M$ exchange, it is not fatal (aka bug) */
if (strstr($message, 'command resulted in') === false) {
set_up_language($squirrelmail_language);
echo "<br><b><font color=$color[2]>\n" .
$message . "</font><br>\n";
exit;
} else {
- return( $resultlist );
+ return $resultlist;
}
}
function sqimap_read_data ($imap_stream, $pre, $handle_errors, &$response, &$message, $query = '') {
-
$res = sqimap_read_data_list($imap_stream, $pre, $handle_errors, $response, $message, $query);
return $res[0];
-
}
-/******************************************************************************
-** Logs the user into the imap server. If $hide is set, no error messages
-** will be displayed. This function returns the imap connection handle.
-******************************************************************************/
+/*
+ * Logs the user into the imap server. If $hide is set, no error messages
+ * will be displayed. This function returns the imap connection handle.
+ */
function sqimap_login ($username, $password, $imap_server_address, $imap_port, $hide) {
-
global $color, $squirrelmail_language, $HTTP_ACCEPT_LANGUAGE, $onetimepad;
- $imap_stream = fsockopen ( $imap_server_address, $imap_port,
- $error_number, $error_string, 15);
+ $imap_stream = fsockopen ( $imap_server_address, $imap_port, $error_number, $error_string, 15);
if ( !$imap_stream ) {
- return FALSE;
+ return false;
}
$server_info = fgets ($imap_stream, 1024);
- // Decrypt the password
+ /* Decrypt the password */
$password = OneTimePadDecrypt($password, $onetimepad);
- /** Do some error correction **/
+ /* Do some error correction */
if (!$imap_stream) {
if (!$hide) {
set_up_language($squirrelmail_language, true);
$query = 'LOGIN "' . quoteIMAP($username) . '" "' . quoteIMAP($password) . '"';
$read = sqimap_run_command ($imap_stream, $query, false, $response, $message);
- /** If the connection was not successful, lets see why **/
+ /* If the connection was not successful, lets see why */
if ($response != 'OK') {
if (!$hide) {
if ($response != 'NO') {
- // "BAD" and anything else gets reported here.
+ /* "BAD" and anything else gets reported here. */
set_up_language($squirrelmail_language, true);
if ($response == 'BAD') {
printf (_("Bad request: %s")."<br>\r\n", $message);
}
exit;
} else {
- /* If the user does not log in with the correct
+ /*
+ * If the user does not log in with the correct
* username and password it is not possible to get the
* correct locale from the user's preferences.
* Therefore, apply the same hack as on the login
* screen.
- */
-
- /* $squirrelmail_language is set by a cookie when
+ *
+ * $squirrelmail_language is set by a cookie when
* the user selects language and logs out
*/
exit;
}
}
-
return $imap_stream;
}
-/*
- * Simply logs out the imap session
- */
+/* Simply logs out the IMAP session */
function sqimap_logout ($imap_stream) {
/* Logout is not valid until the server returns 'BYE' */
sqimap_run_command($imap_stream, 'LOGOUT', false, $response, $message);
$c = explode(' ', $read[0]);
for ($i=2; $i < count($c); $i++) {
$cap_list = explode('=', $c[$i]);
- if (isset($cap_list[1]))
+ if (isset($cap_list[1])) {
$sqimap_capabilities[$cap_list[0]] = $cap_list[1];
- else
+ } else {
$sqimap_capabilities[$cap_list[0]] = TRUE;
+ }
}
}
- if (! isset($sqimap_capabilities[$capability])) {
- return false;
- } else {
+ if (isset($sqimap_capabilities[$capability])) {
return $sqimap_capabilities[$capability];
+ } else {
+ return false;
}
}
-/******************************************************************************
-** 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;
- global $optional_delimiter;
+ global $sqimap_delimiter, $optional_delimiter;
/* Use configured delimiter if set */
if((!empty($optional_delimiter)) && $optional_delimiter != 'detect') {
/* Do some caching here */
if (!$sqimap_delimiter) {
if (sqimap_capability($imap_stream, 'NAMESPACE')) {
- /* According to something that I can't find, this is supposed to work on all systems
- OS: This won't work in Courier IMAP.
- OS: According to rfc2342 response from NAMESPACE command is:
- OS: * NAMESPACE (PERSONAL NAMESPACES) (OTHER_USERS NAMESPACE) (SHARED NAMESPACES)
- OS: We want to lookup all personal NAMESPACES...
- */
+ /*
+ * According to something that I can't find, this is supposed to work on all systems
+ * OS: This won't work in Courier IMAP.
+ * OS: According to rfc2342 response from NAMESPACE command is:
+ * OS: * NAMESPACE (PERSONAL NAMESPACES) (OTHER_USERS NAMESPACE) (SHARED NAMESPACES)
+ * OS: We want to lookup all personal NAMESPACES...
+ */
$read = sqimap_run_command($imap_stream, 'NAMESPACE', true, $a, $b);
if (eregi('\\* NAMESPACE +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL)', $read[0], $data)) {
if (eregi('^\\( *\\((.*)\\) *\\)', $data[1], $data2)) {
}
-/*
- * 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 \"$mailbox\"", true, $result, $message);
for ($i = 0; $i < count($read_ary); $i++) {
if (ereg("[^ ]+ +([^ ]+) +EXISTS", $read_ary[$i], $regs)) {
return $regs[1];
}
}
- return sprintf( "BUG! Couldn't get number of messages in %s!", $mailbox );
-
+ return "BUG! Couldn't get number of messages in $mailbox!";
}
-/*
-* Returns a displayable email address
-*/
+/* Returns a displayable email address.
+ * Luke Ehresman <lehresma@css.tayloru.edu>
+ * "Luke Ehresman" <lehresma@css.tayloru.edu>
+ * <lehresma@css.tayloru.edu>
+ * lehresma@css.tayloru.edu (Luke Ehresman)
+ * lehresma@css.tayloru.edu
+ * becomes: lehresma@css.tayloru.edu
+ */
function sqimap_find_email ($string) {
- /** Luke Ehresman <lehresma@css.tayloru.edu>
- ** <lehresma@css.tayloru.edu>
- ** lehresma@css.tayloru.edu
- **
- ** What about
- ** lehresma@css.tayloru.edu (Luke Ehresman)
- **/
-
if (ereg("<([^>]+)>", $string, $regs)) {
$string = $regs[1];
+ } else if (ereg("([^ ]+@[^ ]+)", $string, $regs)) {
+ $string = $regs[1];
}
return trim($string);
}
/*
- * Takes the From: field, and creates a displayable name.
- * Luke Ehresman <lkehresman@yahoo.com>
- * "Luke Ehresman" <lkehresman@yahoo.com>
- * lkehresman@yahoo.com (Luke Ehresman)
- * becomes: Luke Ehresman
- * <lkehresman@yahoo.com>
- * becomes: lkehresman@yahoo.com
+ * Takes the From: field and creates a displayable name.
+ * Luke Ehresman <lkehresman@yahoo.com>
+ * "Luke Ehresman" <lkehresman@yahoo.com>
+ * lkehresman@yahoo.com (Luke Ehresman)
+ * becomes: Luke Ehresman
+ * <lkehresman@yahoo.com>
+ * becomes: lkehresman@yahoo.com
*/
function sqimap_find_displayable_name ($string) {
$string = trim($string);
}
/*
-* 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) {
- //fputs ($imap_stream, sqimap_session_id() . " SEARCH UNSEEN NOT DELETED\r\n");
$read_ary = sqimap_run_command ($imap_stream, "STATUS \"$mailbox\" (UNSEEN)", true, $result, $message);
$i = 0;
while (isset($read_ary[$i])) {
/*
-* 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 \"$sent_folder\" (\\Seen) \{$length}\r\n");
$tmp = fgets ($imap_stream, 1024);
* $Id$
*/
-GLOBAL $boxesnew;
+global $boxesnew;
function isBoxBelow( $box2, $box1 ) {
-
global $delimiter, $folder_prefix, $imap_server_type;
if ( $imap_server_type == 'uw' ) {
$boxs = $box2;
$i = strpos( $box1, $delimiter, strlen( $folder_prefix ) );
- if ( $i === FALSE ) {
+ if ( $i === false ) {
$i = strlen( $box2 );
}
} else {
$boxs = $box2 . $delimiter;
- // Skip next second delimiter
+ /* Skip next second delimiter */
$i = strpos( $box1, $delimiter );
$i = strpos( $box1, $delimiter, $i + 1 );
- if ( $i === FALSE ) {
+ if ( $i === false ) {
$i = strlen( $box2 );
} else {
$i++;
}
}
- return( substr( $box1, 0, $i ) == substr( $boxs, 0, $i ) );
-
+ return ( substr( $box1, 0, $i ) == substr( $boxs, 0, $i ) );
}
-/*
- Defines Special Mail Boxes
-*/
+/* Defines special mailboxes */
function isSpecialMailbox( $box ) {
-
global $trash_folder, $sent_folder, $draft_folder,
$move_to_trash, $move_to_sent, $save_as_draft;
$ret = do_hook_function( 'special_mailbox', $box );
}
- return( $ret );
-
+ return $ret;
}
-/*************************
- ** Expunges a mailbox **
- *************************/
-function sqimap_mailbox_expunge ($imap_stream, $mailbox,$handle_errors = TRUE) {
- $read = sqimap_run_command($imap_stream, 'EXPUNGE',
- $handle_errors, $response, $message);
+/* Expunges a mailbox */
+function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true) {
+ $read = sqimap_run_command($imap_stream, 'EXPUNGE', $handle_errors,
+ $response, $message);
}
-
-/******************************************************************************
- ** 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)) {
return false;
}
$mbx = sqimap_run_command($imap_stream, "LIST \"\" \"$mailbox\"",
- TRUE, $response, $message);
+ true, $response, $message);
return isset($mbx[0]);
}
-/******************************************************************************
- ** Selects a mailbox
- ******************************************************************************/
+/* Selects a mailbox */
function sqimap_mailbox_select ($imap_stream, $mailbox,
- $hide=TRUE, $recent=false, $extrainfo=false) {
+ $hide = true, $recent = false, $extrainfo = false) {
global $auto_expunge;
if ( $mailbox == 'None' ) {
}
$read = sqimap_run_command($imap_stream, "SELECT \"$mailbox\"",
- TRUE, $response, $message);
+ true, $response, $message);
if ($recent) {
for ($i=0; $i<count($read); $i++) {
if (strpos(strtolower($read[$i]), 'recent')) {
return $r[1];
} else {
if ($auto_expunge) {
- $tmp = sqimap_run_command($imap_stream, 'EXPUNGE',
- false, $a, $b);
+ $tmp = sqimap_run_command($imap_stream, 'EXPUNGE', false, $a, $b);
}
if (isset( $extrainfo ) && $extrainfo) {
$result = array();
}
}
-
-
-/******************************************************************************
- ** Creates a folder
- ******************************************************************************/
-function sqimap_mailbox_create ($imap_stream, $mailbox, $type)
-{
+/* Creates a folder */
+function sqimap_mailbox_create ($imap_stream, $mailbox, $type) {
global $delimiter;
if (strtolower($type) == 'noselect') {
- $mailbox = $mailbox.$delimiter;
+ $mailbox .= $delimiter;
}
$read_ary = sqimap_run_command($imap_stream, "CREATE \"$mailbox\"",
- TRUE, $response, $message);
-
+ true, $response, $message);
sqimap_subscribe ($imap_stream, $mailbox);
}
-
-
-/******************************************************************************
- ** Subscribes to an existing folder
- ******************************************************************************/
-function sqimap_subscribe ($imap_stream, $mailbox)
-{
+/* Subscribes to an existing folder */
+function sqimap_subscribe ($imap_stream, $mailbox) {
$read_ary = sqimap_run_command($imap_stream, "SUBSCRIBE \"$mailbox\"",
- TRUE, $response, $message);
+ true, $response, $message);
}
-
-
-/******************************************************************************
- ** Unsubscribes to an existing folder
- ******************************************************************************/
-function sqimap_unsubscribe ($imap_stream, $mailbox)
-{
+/* Unsubscribes to an existing folder */
+function sqimap_unsubscribe ($imap_stream, $mailbox) {
global $imap_server_type;
-
$read_ary = sqimap_run_command($imap_stream, "UNSUBSCRIBE \"$mailbox\"",
- TRUE, $response, $message);
+ true, $response, $message);
}
-
-
-/******************************************************************************
- ** This function simply deletes the given folder
- ******************************************************************************/
-function sqimap_mailbox_delete ($imap_stream, $mailbox)
-{
+/* Deletes the given folder */
+function sqimap_mailbox_delete ($imap_stream, $mailbox) {
$read_ary = sqimap_run_command($imap_stream, "DELETE \"$mailbox\"",
- TRUE, $response, $message);
+ true, $response, $message);
sqimap_unsubscribe ($imap_stream, $mailbox);
- do_hook_function("rename_or_delete_folder",$args = array($mailbox, 'delete', ''));
+ do_hook_function("rename_or_delete_folder", $args = array($mailbox, 'delete', ''));
}
-/***********************************************************************
- ** 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) {
if ($ref['unformatted'] == $folder) {
- return TRUE;
+ return true;
}
}
return false;
}
-
-/*
- Renames a mailbox
-*/
+/* Renames a mailbox */
function sqimap_mailbox_rename( $imap_stream, $old_name, $new_name ) {
-
- if ( $old_name <> $new_name ) {
+ if ( $old_name != $new_name ) {
global $delimiter, $imap_server_type;
if ( substr( $old_name, -1 ) == $delimiter ) {
$old_name = substr( $old_name, 0, strlen( $old_name ) - 1 );
}
$boxesall = sqimap_mailbox_list($imap_stream);
$cmd = 'RENAME "' . quoteIMAP($old_name) . '" "' . quoteIMAP($new_name) . '"';
- $data = sqimap_run_command($imap_stream, $cmd,
- TRUE, $response, $message);
+ $data = sqimap_run_command($imap_stream, $cmd, true, $response, $message);
sqimap_unsubscribe($imap_stream, $old_name.$postfix);
sqimap_subscribe($imap_stream, $new_name.$postfix);
do_hook_function("rename_or_delete_folder",$args = array($old_name, 'rename', $new_name));
$new_sub = $new_name . $delimiter . substr($box[$p], $l);
if ($imap_server_type == 'cyrus') {
$cmd = 'RENAME "' . quoteIMAP($box[$p]) . '" "' . quoteIMAP($new_sub) . '"';
- $data = sqimap_run_command($imap_stream, $cmd, TRUE,
+ $data = sqimap_run_command($imap_stream, $cmd, true,
$response, $message);
}
sqimap_unsubscribe($imap_stream, $box[$p]);
sqimap_subscribe($imap_stream, $new_sub);
- do_hook_function("rename_or_delete_folder",$args = array($box[$p], 'rename', $new_sub));
+ do_hook_function("rename_or_delete_folder",
+ $args = array($box[$p], 'rename', $new_sub));
}
}
}
-
}
-/******************************************************************************
- ** Formats a mailbox into 4 parts for the $boxesall array
- **
- ** The four parts are:
- **
- ** raw - Raw LIST/LSUB response from the IMAP server
- ** formatted - nicely formatted folder name
- ** unformatted - unformatted, but with delimiter at end removed
- ** unformatted-dm - folder name as it appears in raw response
- ** unformatted-disp - unformatted without $folder_prefix
- **
- ******************************************************************************/
-function sqimap_mailbox_parse ($line, $line_lsub)
-{
+/*
+ * Formats a mailbox into 4 parts for the $boxesall array
+ *
+ * The four parts are:
+ *
+ * raw - Raw LIST/LSUB response from the IMAP server
+ * formatted - nicely formatted folder name
+ * unformatted - unformatted, but with delimiter at end removed
+ * unformatted-dm - folder name as it appears in raw response
+ * unformatted-disp - unformatted without $folder_prefix
+ */
+function sqimap_mailbox_parse ($line, $line_lsub) {
global $folder_prefix, $delimiter;
-
+
/* Process each folder line */
for ($g=0; $g < count($line); $g++) {
-
+
/* Store the raw IMAP reply */
if (isset($line[$g])) {
$boxesall[$g]["raw"] = $line[$g];
}
else {
- $boxesall[$g]["raw"] = "";
+ $boxesall[$g]["raw"] = '';
}
-
-
+
+
/* Count number of delimiters ($delimiter) in folder name */
$mailbox = trim($line_lsub[$g]);
$dm_count = substr_count($mailbox, $delimiter);
if (substr($mailbox, -1) == $delimiter) {
- /* If name ends in delimiter - decrement count by one */
- $dm_count--;
+ /* If name ends in delimiter, decrement count by one */
+ $dm_count--;
}
-
- /* Format folder name, but only if it's a INBOX.* or have */
- /* a parent. */
+
+ /* Format folder name, but only if it's a INBOX.* or has a parent. */
$boxesallbyname[$mailbox] = $g;
$parentfolder = readMailboxParent($mailbox, $delimiter);
if ( (strtolower(substr($mailbox, 0, 5)) == "inbox") ||
(strlen($parentfolder) > 0) ) ) {
$indent = $dm_count - ( substr_count($folder_prefix, $delimiter));
if ($indent > 0) {
- $boxesall[$g]['formatted'] = str_repeat(" ", $indent);
+ $boxesall[$g]['formatted'] = str_repeat(' ', $indent);
}
else {
$boxesall[$g]['formatted'] = '';
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 :)
+ * + 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) {
global $delimiter;
}
}
- return ($result);
+ return $result;
}
-/******************************************************************************
- ** Returns sorted mailbox lists in several different ways.
- ** See comment on sqimap_mailbox_parse() for info about the returned array.
- ******************************************************************************/
+/*
+ * Returns sorted mailbox lists in several different ways.
+ * See comment on sqimap_mailbox_parse() for info about the returned array.
+ */
function sqimap_mailbox_list($imap_stream) {
-
- GLOBAL $boxesnew;
+ global $boxesnew;
if ( !isset( $boxesnew ) ) {
- GLOBAL $data_dir, $username, $list_special_folders_first,
+ global $data_dir, $username, $list_special_folders_first,
$folder_prefix, $trash_folder, $sent_folder, $draft_folder,
$move_to_trash, $move_to_sent, $save_as_draft,
$delimiter;
- $inbox_in_list = $inbox_subscribed = FALSE;
+ $inbox_in_list = false;
+ $inbox_subscribed = false;
require_once('../src/load_prefs.php');
require_once('../functions/array.php');
- /** LSUB array **/
+ /* LSUB array */
$lsub_ary = sqimap_run_command ($imap_stream, "LSUB \"$folder_prefix\" \"*%\"",
- TRUE, $response, $message);
+ true, $response, $message);
- /* Section about removing the last element was removed */
- /* We don't return "* OK" anymore from sqimap_read_data */
+ /*
+ * Section about removing the last element was removed
+ * We don't return "* OK" anymore from sqimap_read_data
+ */
$sorted_lsub_ary = array();
for ($i=0;$i < count($lsub_ary); $i++) {
- /* Workaround for EIMS */
- /* Doesn't work if the mailbox name is multiple lines */
+ /*
+ * Workaround for EIMS
+ * Doesn't work if the mailbox name is multiple lines
+ */
if (isset($lsub_ary[$i + 1]) &&
ereg("^(\\* [A-Z]+.*)\\{[0-9]+\\}([ \n\r\t]*)$",
$lsub_ary[$i], $regs)) {
$i ++;
- $lsub_ary[$i] = $regs[1] . '"' . addslashes(trim($lsub_ary[$i])) .
- '"' . $regs[2];
+ $lsub_ary[$i] = $regs[1] . '"' . addslashes(trim($lsub_ary[$i])) . '"' . $regs[2];
}
$temp_mailbox_name = find_mailbox_name($lsub_ary[$i]);
$sorted_lsub_ary[] = $temp_mailbox_name;
if (strtoupper($temp_mailbox_name) == 'INBOX') {
- $inbox_subscribed = TRUE;
+ $inbox_subscribed = true;
}
}
$new_ary = array();
usort($sorted_lsub_ary, 'user_strcasecmp');
}
- /** LIST array **/
+ /* LIST array */
$sorted_list_ary = array();
for ($i=0; $i < count($sorted_lsub_ary); $i++) {
if (substr($sorted_lsub_ary[$i], -1) == $delimiter) {
}
$read = sqimap_run_command ($imap_stream, "LIST \"\" \"$mbx\"",
- TRUE, $response, $message);
+ true, $response, $message);
/* Another workaround for EIMS */
if (isset($read[1]) &&
ereg("^(\\* [A-Z]+.*)\\{[0-9]+\\}([ \n\r\t]*)$",
$read[0], $regs)) {
- $read[0] = $regs[1] . '"' . addslashes(trim($read[1])) .
- '"' . $regs[2];
+ $read[0] = $regs[1] . '"' . addslashes(trim($read[1])) . '"' . $regs[2];
}
if (isset($sorted_list_ary[$i])) {
if (isset($sorted_list_ary[$i]) &&
strtoupper(find_mailbox_name($sorted_list_ary[$i])) == 'INBOX') {
- $inbox_in_list = TRUE;
+ $inbox_in_list = true;
}
}
- /**
+ /*
* Just in case they're not subscribed to their inbox,
* we'll get it for them anyway
*/
- if ($inbox_subscribed == false || $inbox_in_list == false) {
+ if (!$inbox_subscribed || !$inbox_in_list) {
$inbox_ary = sqimap_run_command ($imap_stream, "LIST \"\" \"INBOX\"",
- TRUE, $response, $message);
+ true, $response, $message);
/* Another workaround for EIMS */
if (isset($inbox_ary[1]) &&
ereg("^(\\* [A-Z]+.*)\\{[0-9]+\\}([ \n\r\t]*)$",
$boxesall = sqimap_mailbox_parse ($sorted_list_ary, $sorted_lsub_ary);
- /** Now, lets sort for special folders **/
+ /* Now, lets sort for special folders */
$boxesnew = $used = array();
/* Find INBOX */
foreach ( $boxesall as $k => $box ) {
if ( strtolower($box['unformatted']) == 'inbox') {
$boxesnew[] = $box;
- $used[$k] = TRUE;
+ $used[$k] = true;
} else {
- $used[$k] = FALSE;
+ $used[$k] = false;
}
}
/* List special folders and their subfolders, if requested. */
- if ($list_special_folders_first == TRUE) {
-
+ if ($list_special_folders_first) {
foreach ( $boxesall as $k => $box ) {
- if ( !$used[$k] &&
- isSpecialMailbox( $box['unformatted'] ) ) {
+ if ( !$used[$k] && isSpecialMailbox( $box['unformatted'] ) ) {
$boxesnew[] = $box;
- $used[$k] = TRUE;
+ $used[$k] = true;
}
}
}
}
- return( $boxesnew );
-
+ return $boxesnew;
}
/*
* Returns a list of all folders, subscribed or not
*/
function sqimap_mailbox_list_all($imap_stream) {
-
-
- GLOBAL $list_special_folders_first, $folder_prefix,
- $delimiter;
+ global $list_special_folders_first, $folder_prefix, $delimiter;
require_once('../functions/array.php');
$ssid = sqimap_session_id();
$lsid = strlen( $ssid );
fputs ($imap_stream, $ssid . " LIST \"$folder_prefix\" *\r\n");
- $read_ary = sqimap_read_data ($imap_stream, $ssid, TRUE, $response, $message);
+ $read_ary = sqimap_read_data ($imap_stream, $ssid, true, $response, $message);
$g = 0;
$phase = 'inbox';
ereg("^(\\* [A-Z]+.*)\\{[0-9]+\\}([ \n\r\t]*)$",
$read_ary[$i], $regs)) {
$i ++;
- $read_ary[$i] = $regs[1] . '"' .
- addslashes(trim($read_ary[$i])) .
- '"' . $regs[2];
+ $read_ary[$i] = $regs[1] . '"' . addslashes(trim($read_ary[$i])) . '"' . $regs[2];
}
if (substr($read_ary[$i], 0, $lsid) != $ssid ) {
$dm_count--;
}
- /* Format folder name, but only if it's a INBOX.* or have */
- /* a parent. */
+ /* Format folder name, but only if it's a INBOX.* or has a parent. */
$boxesallbyname[$mailbox] = $g;
$parentfolder = readMailboxParent($mailbox, $delimiter);
if((eregi('^inbox'.quotemeta($delimiter), $mailbox)) ||
$mailbox = substr($mailbox, 0, strlen($mailbox) - 1);
}
$boxes[$g]['unformatted'] = $mailbox;
- $boxes[$g]['unformatted-disp'] =
- ereg_replace('^' . $folder_prefix, '', $mailbox);
+ $boxes[$g]['unformatted-disp'] = ereg_replace('^' . $folder_prefix, '', $mailbox);
$boxes[$g]['id'] = $g;
- /** Now lets get the flags for this mailbox **/
+ /* Now lets get the flags for this mailbox */
$read_mlbx = sqimap_run_command ($imap_stream, "LIST \"\" \"$mailbox\"",
- TRUE, $response, $message);
+ true, $response, $message);
/* Another workaround for EIMS */
if (isset($read_mlbx[1]) &&
- ereg("^(\\* [A-Z]+.*)\\{[0-9]+\\}([ \n\r\t]*)$",
- $read_mlbx[0], $regs)) {
- $read_mlbx[0] = $regs[1] . '"' .
- addslashes(trim($read_mlbx[1])) .
- '"' . $regs[2];
+ ereg("^(\\* [A-Z]+.*)\\{[0-9]+\\}([ \n\r\t]*)$", $read_mlbx[0], $regs)) {
+ $read_mlbx[0] = $regs[1] . '"' . addslashes(trim($read_mlbx[1])) . '"' . $regs[2];
}
$flags = substr($read_mlbx[0], strpos($read_mlbx[0], '(')+1);
* $Id$
*/
-/****************************************************************************
- ** Copies specified messages to specified folder
- ****************************************************************************/
+/* Copies specified messages to specified folder */
function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) {
$read = sqimap_run_command ($imap_stream, "COPY $start:$end \"$mailbox\"", true, $response, $message);
}
-/****************************************************************************
- ** Deletes specified messages and moves them to trash if possible
- ****************************************************************************/
+/* Deletes specified messages and moves them to trash if possible */
function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) {
global $move_to_trash, $trash_folder, $auto_expunge;
if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
sqimap_messages_copy ($imap_stream, $start, $end, $trash_folder);
- sqimap_messages_flag ($imap_stream, $start, $end, "Deleted");
- } else {
- sqimap_messages_flag ($imap_stream, $start, $end, "Deleted");
}
+ sqimap_messages_flag ($imap_stream, $start, $end, "Deleted");
}
-/****************************************************************************
- ** Sets the specified messages with specified flag
- ****************************************************************************/
+/* Sets the specified messages with specified flag */
function sqimap_messages_flag ($imap_stream, $start, $end, $flag) {
$read = sqimap_run_command ($imap_stream, "STORE $start:$end +FLAGS (\\$flag)", true, $response, $message);
}
-
-/****************************************************************************
- ** Remove specified flag from specified messages
- ****************************************************************************/
+/* Remove specified flag from specified messages */
function sqimap_messages_remove_flag ($imap_stream, $start, $end, $flag) {
$read = sqimap_run_command ($imap_stream, "STORE $start:$end -FLAGS (\\$flag)", true, $response, $message);
}
-
-/****************************************************************************
- ** Returns some general header information -- FROM, DATE, and SUBJECT
- ****************************************************************************/
+/* Returns some general header information -- FROM, DATE, and SUBJECT */
class small_header {
var $from = '', $subject = '', $date = '', $to = '',
$priority = 0, $message_id = 0, $cc = '';
$res = sqimap_get_small_header_list($imap_stream, array($id), $sent);
return $res[0];
}
-
-/* Sort the message list and crunch to be as small as possible
+
+/*
+ * Sort the message list and crunch to be as small as possible
* (overflow could happen, so make it small if possible)
*/
function sqimap_message_list_squisher($messages_array) {
$msgs_str .= ':' . $end;
}
}
-
+
return $msgs_str;
-}
+}
function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
global $squirrelmail_language, $color, $data_dir, $username;
$read_list = array();
$sizes_list = array();
- /**
+ /*
* We need to return the data in the same order as the caller supplied
* in $msg_list, but IMAP servers are free to return responses in
* whatever order they wish... So we need to re-sort manually
'</b><br>' .
_("Unknown response from IMAP server: ") . ' 1.' .
$r[0] . "</font><br>\n";
- /* exit; */
} else if (! isset($id2index[$regs[1]]) || !count($id2index[$regs[1]])) {
set_up_language($squirrelmail_language);
echo '<br><b><font color=$color[2]>' .
'</b><br>' .
_("Unknown message number in reply from server: ") .
$regs[1] . "</font><br>\n";
- /* exit */
} else {
$read_list[$id2index[$regs[1]]] = $r;
}
}
arsort($read_list);
-
+
$query = "$sid FETCH $msgs_str RFC822.SIZE\r\n";
fputs ($imap_stream, $query);
$sizesin_list = sqimap_read_data_list($imap_stream, $sid, true, $response, $message);
-
+
foreach ($sizesin_list as $r) {
if (!eregi("^\\* ([0-9]+) FETCH", $r[0], $regs)) {
set_up_language($squirrelmail_language);
$sizes_list[$id2index[$regs[1]]] = $r;
}
arsort($sizes_list);
-
+
for ($msgi = 0; $msgi < $maxmsg; $msgi++) {
$subject = _("(no subject)");
$from = _("Unknown Sender");
$type[1] = "";
$read = $read_list[$msgi];
- for ($i = 0; $i < count($read); $i++) {
- if (eregi ("^to:(.*)$", $read[$i], $regs)) {
- /*$to = sqimap_find_displayable_name(substr($read[$i], 3));*/
+ foreach ($read as $read_part) {
+ if (eregi ("^to:(.*)$", $read_part, $regs)) {
$to = $regs[1];
- } else if (eregi ("^from:(.*)$", $read[$i], $regs)) {
- /*$from = sqimap_find_displayable_name(substr($read[$i], 5));*/
+ } else if (eregi ("^from:(.*)$", $read_part, $regs)) {
$from = $regs[1];
- } else if (eregi ("^x-priority:(.*)$", $read[$i], $regs)) {
+ } else if (eregi ("^x-priority:(.*)$", $read_part, $regs)) {
$priority = trim($regs[1]);
- } else if (eregi ("^message-id:(.*)$", $read[$i], $regs)) {
+ } else if (eregi ("^message-id:(.*)$", $read_part, $regs)) {
$messageid = trim($regs[1]);
- } else if (eregi ("^cc:(.*)$", $read[$i], $regs)) {
+ } else if (eregi ("^cc:(.*)$", $read_part, $regs)) {
$cc = $regs[1];
- } else if (eregi ("^date:(.*)$", $read[$i], $regs)) {
+ } else if (eregi ("^date:(.*)$", $read_part, $regs)) {
$date = $regs[1];
- } else if (eregi ("^subject:(.*)$", $read[$i], $regs)) {
+ } else if (eregi ("^subject:(.*)$", $read_part, $regs)) {
$subject = htmlspecialchars(trim($regs[1]));
if ($subject == "") {
$subject = _("(no subject)");
}
- } else if (eregi ("^content-type:(.*)$", $read[$i], $regs)) {
+ } else if (eregi ("^content-type:(.*)$", $read_part, $regs)) {
$type = strtolower(trim($regs[1]));
if ($pos = strpos($type, ";")) {
$type = substr($type, 0, $pos);
}
$type = explode("/", $type);
- if (! isset($type[1])) {
+ if (!isset($type[1])) {
$type[1] = '';
}
}
}
- $internaldate = getPref($data_dir, $username, 'internal_date_sort');
+ $internaldate = getPref($data_dir, $username, 'internal_date_sort');
if (trim($date) == "" || $internaldate) {
fputs($imap_stream, "$sid FETCH $msg_list[$msgi] INTERNALDATE\r\n");
$readdate = sqimap_read_data($imap_stream, $sid, true, $response, $message);
if (eregi(".*INTERNALDATE \"(.*)\".*", $readdate[0], $regs)) {
- $date_list = explode(" ", trim($regs[1]));
- $date_list[0] = str_replace("-", " ", $date_list[0]);
- $date = implode(" ", $date_list);
+ $date_list = explode(' ', trim($regs[1]));
+ $date_list[0] = str_replace("-", ' ', $date_list[0]);
+ $date = implode(' ', $date_list);
}
}
eregi("([0-9]+)[^0-9]*$", $sizes_list[$msgi][0], $regs);
$size = $regs[1];
-
+
$header = new small_header;
- if ($issent == true) {
+ if ($issent) {
$header->from = (trim($to) != '' ? $to : '(' ._("No To Address") . ')');
} else {
$header->from = $from;
return $result;
}
-/****************************************************************************
- ** Returns the flags for the specified messages
- ****************************************************************************/
+/* Returns the flags for the specified messages */
function sqimap_get_flags ($imap_stream, $i) {
$read = sqimap_run_command ($imap_stream, "FETCH $i:$i FLAGS", true, $response, $message);
- if (ereg("FLAGS(.*)", $read[0], $regs)) {
+ if (ereg('FLAGS(.*)', $read[0], $regs)) {
return explode(' ', trim(ereg_replace('[\\(\\)\\\\]', '', $regs[1])));
}
- return Array('None');
+ return array('None');
}
function sqimap_get_flags_list ($imap_stream, $msg_list) {
$result_flags = array();
for ($i = 0; $i < sizeof($result_list); $i++) {
- if (eregi("^\\* ([0-9]+).*FETCH.*FLAGS(.*)", $result_list[$i][0], $regs)
+ if (eregi('^\* ([0-9]+).*FETCH.*FLAGS(.*)', $result_list[$i][0], $regs)
&& isset($id2index[$regs[1]]) && count($id2index[$regs[1]])) {
$result_flags[$id2index[$regs[1]]] = explode(" ", trim(ereg_replace('[\\(\\)\\\\]', '', $regs[2])));
} else {
return $result_flags;
}
-/****************************************************************************
- ** Returns a message array with all the information about a message. See
- ** the documentation folder for more information about this array.
- ****************************************************************************/
+/*
+ * Returns a message array with all the information about a message.
+ * See the documentation folder for more information about this array.
+ */
function sqimap_get_message ($imap_stream, $id, $mailbox) {
$header = sqimap_get_message_header($imap_stream, $id, $mailbox);
return sqimap_get_message_body($imap_stream, $header);
}
-/****************************************************************************
- ** Wrapper function that reformats the header information.
- ****************************************************************************/
+/* Wrapper function that reformats the header information. */
function sqimap_get_message_header ($imap_stream, $id, $mailbox) {
$read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[HEADER]", true, $response, $message);
-
$header = sqimap_get_header($imap_stream, $read);
$header->id = $id;
$header->mailbox = $mailbox;
-
return $header;
}
-/****************************************************************************
- ** Wrapper function that reformats the entity header information.
- ****************************************************************************/
+/* Wrapper function that reformats the entity header information. */
function sqimap_get_ent_header ($imap_stream, $id, $mailbox, $ent) {
$read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[$ent.HEADER]", true, $response, $message);
$header = sqimap_get_header($imap_stream, $read);
}
-/****************************************************************************
- ** Wrapper function that returns entity headers for use by decodeMime
- ****************************************************************************/
+/* Wrapper function that returns entity headers for use by decodeMime */
/*
function sqimap_get_entity_header ($imap_stream, &$read, &$type0, &$type1, &$bound, &$encoding, &$charset, &$filename) {
$header = sqimap_get_header($imap_stream, $read);
$filename = $header["FILENAME"];
}
*/
-
-/****************************************************************************
- ** Queries the IMAP server and gets all header information.
- ****************************************************************************/
+/* Queries the IMAP server and gets all header information. */
function sqimap_get_header ($imap_stream, $read) {
global $where, $what;
$hdr = new msg_header();
$i = 0;
+
/* Set up some defaults */
$hdr->type0 = "text";
$hdr->type1 = "plain";
$hdr->mime = true;
$i++;
}
-
- /** ENCODING TYPE **/
+ /* ENCODING TYPE */
else if (substr(strtolower($read[$i]), 0, 26) == "content-transfer-encoding:") {
$hdr->encoding = strtolower(trim(substr($read[$i], 26)));
$i++;
}
-
- /** CONTENT-TYPE **/
- else if (strtolower(substr($read[$i], 0, 13)) == "content-type:") {
+ /* CONTENT-TYPE */
+ else if (strtolower(substr($read[$i], 0, 13)) == "content-type:") {
$cont = strtolower(trim(substr($read[$i], 13)));
if (strpos($cont, ";")) {
$cont = substr($cont, 0, strpos($cont, ";"));
}
-
if (strpos($cont, "/")) {
$hdr->type0 = substr($cont, 0, strpos($cont, "/"));
$hdr->type1 = substr($cont, strpos($cont, "/")+1);
$hdr->type0 = $cont;
}
-
$line = $read[$i];
$i++;
while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) {
$i++;
}
- /** Detect the boundary of a multipart message **/
+ /* Detect the boundary of a multipart message */
if (eregi('boundary="([^"]+)"', $line, $regs)) {
$hdr->boundary = $regs[1];
}
- /** Detect the charset **/
+ /* Detect the charset */
if (strpos(strtolower(trim($line)), "charset=")) {
$pos = strpos($line, "charset=") + 8;
$charset = trim($line);
$hdr->charset = "us-ascii";
}
}
-
else if (strtolower(substr($read[$i], 0, 20)) == "content-disposition:") {
- /** Add better dontent-disposition support **/
-
+ /* Add better content-disposition support */
$line = $read[$i];
$i++;
while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) {
$i++;
}
- /** Detects filename if any **/
+ /* Detects filename if any */
if (strpos(strtolower(trim($line)), "filename=")) {
$pos = strpos($line, "filename=") + 9;
$name = trim($line);
if (strpos($line, " ", $pos) > 0) {
- $name = substr($name, $pos, strpos($line, " ", $pos));
+ $name = substr($name, $pos, strpos($line, " ", $pos));
} else {
- $name = substr($name, $pos);
+ $name = substr($name, $pos);
}
$name = str_replace("\"", "", $name);
$hdr->filename = $name;
}
}
-
- /** REPLY-TO **/
+ /* REPLY-TO */
else if (strtolower(substr($read[$i], 0, 9)) == "reply-to:") {
$hdr->replyto = trim(substr($read[$i], 9, strlen($read[$i])));
$i++;
}
-
- /** FROM **/
+ /* FROM */
else if (strtolower(substr($read[$i], 0, 5)) == "from:") {
$hdr->from = trim(substr($read[$i], 5, strlen($read[$i]) - 6));
if (! isset($hdr->replyto) || $hdr->replyto == "") {
}
$i++;
}
- /** DATE **/
+ /* DATE */
else if (strtolower(substr($read[$i], 0, 5)) == "date:") {
$d = substr($read[$i], 5);
$d = trim($d);
$hdr->date = getTimeStamp($d);
$i++;
}
- /** SUBJECT **/
+ /* SUBJECT */
else if (strtolower(substr($read[$i], 0, 8)) == "subject:") {
$hdr->subject = trim(substr($read[$i], 8, strlen($read[$i]) - 9));
if (strlen(Chop($hdr->subject)) == 0) {
$hdr->subject = _("(no subject)");
}
-
- /*
+ /*
if ($where == 'SUBJECT') {
$hdr->subject = $what;
// $hdr->subject = eregi_replace($what, "<b>\\0</b>", $hdr->subject);
}
*/
-
$i++;
}
- /** CC **/
+ /* CC */
else if (strtolower(substr($read[$i], 0, 3)) == "cc:") {
$pos = 0;
$hdr->cc[$pos] = trim(substr($read[$i], 4));
$i++;
}
}
- /** BCC **/
+ /* BCC */
else if (strtolower(substr($read[$i], 0, 4)) == "bcc:") {
$pos = 0;
$hdr->bcc[$pos] = trim(substr($read[$i], 5));
$i++;
}
}
- /** TO **/
+ /* TO */
else if (strtolower(substr($read[$i], 0, 3)) == "to:") {
$pos = 0;
$hdr->to[$pos] = trim(substr($read[$i], 4));
$i++;
}
}
- /** MESSAGE ID **/
+ /* MESSAGE ID */
else if (strtolower(substr($read[$i], 0, 11)) == "message-id:") {
$hdr->message_id = trim(substr($read[$i], 11));
$i++;
}
-
-
- /** ERROR CORRECTION **/
+ /* ERROR CORRECTION */
else if (substr($read[$i], 0, 1) == ")") {
if (strlen(trim($hdr->subject)) == 0) {
$hdr->subject = _("(no subject)");
}
$i++;
}
- /** X-PRIORITY **/
+ /* X-PRIORITY */
else if (strtolower(substr($read[$i], 0, 11)) == "x-priority:") {
$hdr->priority = trim(substr($read[$i], 11));
$i++;
return $hdr;
}
-
-/****************************************************************************
- ** Returns the body of a message.
- ****************************************************************************/
+/* Returns the body of a message. */
function sqimap_get_message_body ($imap_stream, &$header) {
$id = $header->id;
return decodeMime($imap_stream, $header);
}
-
-/****************************************************************************
- ** Returns an array with the body structure
- ****************************************************************************/
?>