Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(5) |
Jun
(73) |
Jul
(155) |
Aug
(142) |
Sep
(50) |
Oct
(89) |
Nov
(39) |
Dec
(59) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(239) |
Feb
(293) |
Mar
(90) |
Apr
(149) |
May
(117) |
Jun
(52) |
Jul
(67) |
Aug
(15) |
Sep
(97) |
Oct
(304) |
Nov
(295) |
Dec
(372) |
2002 |
Jan
(357) |
Feb
(272) |
Mar
(153) |
Apr
(158) |
May
(170) |
Jun
(139) |
Jul
(226) |
Aug
(401) |
Sep
(314) |
Oct
(343) |
Nov
(270) |
Dec
(231) |
2003 |
Jan
(201) |
Feb
(112) |
Mar
(146) |
Apr
(103) |
May
(148) |
Jun
(287) |
Jul
(302) |
Aug
(139) |
Sep
(206) |
Oct
(281) |
Nov
(116) |
Dec
(191) |
2004 |
Jan
(82) |
Feb
(223) |
Mar
(175) |
Apr
(280) |
May
(260) |
Jun
(206) |
Jul
(107) |
Aug
(207) |
Sep
(108) |
Oct
(171) |
Nov
(186) |
Dec
(180) |
2005 |
Jan
(144) |
Feb
(226) |
Mar
(200) |
Apr
(286) |
May
(120) |
Jun
(144) |
Jul
(125) |
Aug
(111) |
Sep
(221) |
Oct
(51) |
Nov
(275) |
Dec
(73) |
2006 |
Jan
(178) |
Feb
(313) |
Mar
(87) |
Apr
(104) |
May
(145) |
Jun
(74) |
Jul
(197) |
Aug
(229) |
Sep
(118) |
Oct
(298) |
Nov
(39) |
Dec
(170) |
2007 |
Jan
(251) |
Feb
(109) |
Mar
(82) |
Apr
(5) |
May
(80) |
Jun
(63) |
Jul
(98) |
Aug
(103) |
Sep
(61) |
Oct
(41) |
Nov
(50) |
Dec
(47) |
2008 |
Jan
(74) |
Feb
(71) |
Mar
(102) |
Apr
(31) |
May
(117) |
Jun
(33) |
Jul
(61) |
Aug
(12) |
Sep
(22) |
Oct
(25) |
Nov
(21) |
Dec
(52) |
2009 |
Jan
(13) |
Feb
(16) |
Mar
(79) |
Apr
(181) |
May
(164) |
Jun
(10) |
Jul
(23) |
Aug
(30) |
Sep
(19) |
Oct
(18) |
Nov
(7) |
Dec
(5) |
2010 |
Jan
(23) |
Feb
(17) |
Mar
(15) |
Apr
(2) |
May
(4) |
Jun
(23) |
Jul
(89) |
Aug
(8) |
Sep
(13) |
Oct
(6) |
Nov
(4) |
Dec
(6) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(5) |
Apr
(13) |
May
(9) |
Jun
|
Jul
(23) |
Aug
(1) |
Sep
(9) |
Oct
(1) |
Nov
(11) |
Dec
(89) |
2012 |
Jan
(19) |
Feb
(16) |
Mar
(17) |
Apr
(24) |
May
(2) |
Jun
(2) |
Jul
(8) |
Aug
(5) |
Sep
(4) |
Oct
|
Nov
|
Dec
(2) |
2013 |
Jan
(2) |
Feb
|
Mar
(9) |
Apr
|
May
(4) |
Jun
(24) |
Jul
(4) |
Aug
|
Sep
(2) |
Oct
(5) |
Nov
(10) |
Dec
(9) |
2014 |
Jan
(25) |
Feb
(3) |
Mar
(14) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
(4) |
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2015 |
Jan
(23) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
(16) |
Jul
|
Aug
(10) |
Sep
(2) |
Oct
|
Nov
(10) |
Dec
(2) |
2016 |
Jan
(9) |
Feb
(3) |
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(17) |
Oct
(30) |
Nov
(2) |
Dec
(31) |
2017 |
Jan
(11) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
(42) |
Jul
(16) |
Aug
(8) |
Sep
(5) |
Oct
(2) |
Nov
(23) |
Dec
(3) |
2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
(15) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
1
(10) |
2
(9) |
3
(7) |
4
(2) |
5
(3) |
6
(4) |
7
(2) |
8
(11) |
9
(2) |
10
(1) |
11
(5) |
12
(6) |
13
(6) |
14
(4) |
15
(5) |
16
(4) |
17
(8) |
18
(4) |
19
(10) |
20
(4) |
21
(6) |
22
|
23
(5) |
24
(8) |
25
(7) |
26
|
27
(1) |
28
(6) |
29
(4) |
30
(8) |
31
(1) |
|
|
|
|
|
|
From: Seth E. Randall <indiri69@us...> - 2002-03-16 19:44:55
|
Update of /cvsroot/squirrelmail/squirrelmail/functions In directory usw-pr-cvs1:/tmp/cvs-serv19264 Modified Files: imap_general.php imap_mailbox.php imap_messages.php Log Message: Tons of formatting changes by Jon Tai. Didn't merge changes to imap_search.php, as I wanted to take a closer look at it. Jon Tai said: I cleaned up the four imap_*.php files - fixed comments so they use the /* */ style, fixed spacings, added { } around logic blocks that didn't have them, etc. I also hacked sqimap_find_email() in imap_general.php to support strings in the form of "lehresma@... (Luke Ehresman)". Index: imap_general.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/imap_general.php,v retrieving revision 1.105 retrieving revision 1.106 diff -u -w -r1.105 -r1.106 --- imap_general.php 16 Mar 2002 04:23:22 -0000 1.105 +++ imap_general.php 16 Mar 2002 19:44:50 -0000 1.106 @@ -14,28 +14,19 @@ 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"); @@ -56,9 +47,7 @@ * 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 = ''; @@ -76,12 +65,12 @@ } } - // 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)) { + /* } 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); @@ -94,10 +83,10 @@ 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) { @@ -115,34 +104,35 @@ } $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) && 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@...>. 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@...>. 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); @@ -150,8 +140,10 @@ } } - // 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); @@ -165,7 +157,7 @@ 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" . @@ -188,36 +180,32 @@ $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); @@ -230,11 +218,11 @@ $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); @@ -249,14 +237,14 @@ } 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 */ @@ -272,13 +260,10 @@ 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); @@ -293,26 +278,23 @@ $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') { @@ -322,11 +304,12 @@ /* 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)) { @@ -355,43 +338,38 @@ } -/* - * 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@...> + * "Luke Ehresman" <lehresma@...> + * <lehresma@...> + * lehresma@... (Luke Ehresman) + * lehresma@... + * becomes: lehresma@... */ function sqimap_find_email ($string) { - /** Luke Ehresman <lehresma@...> - ** <lehresma@...> - ** lehresma@... - ** - ** What about - ** lehresma@... (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. + * Takes the From: field and creates a displayable name. * Luke Ehresman <lkehresman@...> * "Luke Ehresman" <lkehresman@...> * lkehresman@... (Luke Ehresman) @@ -434,7 +412,6 @@ * 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])) { Index: imap_mailbox.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/imap_mailbox.php,v retrieving revision 1.129 retrieving revision 1.130 diff -u -w -r1.129 -r1.130 --- imap_mailbox.php 12 Mar 2002 20:40:03 -0000 1.129 +++ imap_mailbox.php 16 Mar 2002 19:44:50 -0000 1.130 @@ -11,24 +11,23 @@ * $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++; @@ -36,14 +35,10 @@ } 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; @@ -56,36 +51,28 @@ $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' ) { @@ -93,7 +80,7 @@ } $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')) { @@ -103,8 +90,7 @@ 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(); @@ -133,81 +119,52 @@ } } - - -/****************************************************************************** - ** 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', '')); } -/*********************************************************************** - ** 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 ); @@ -218,8 +175,7 @@ } $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)); @@ -230,32 +186,30 @@ $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 */ @@ -266,7 +220,7 @@ $boxesall[$g]["raw"] = $line[$g]; } else { - $boxesall[$g]["raw"] = ""; + $boxesall[$g]["raw"] = ''; } @@ -274,12 +228,11 @@ $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 */ + /* 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") || @@ -288,7 +241,7 @@ (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'] = ''; @@ -323,13 +276,14 @@ return $boxesall; } -/** +/* * Sorting function used to sort mailbox names. * + Original patch from dave_michmerhuizen@... * + 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 :) @@ -375,52 +329,55 @@ } } - 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(); @@ -434,7 +391,7 @@ 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) { @@ -445,13 +402,12 @@ } $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])) { @@ -467,17 +423,17 @@ 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]*)$", @@ -492,27 +448,25 @@ $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; } } @@ -526,25 +480,21 @@ } } - 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'; @@ -554,9 +504,7 @@ 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 ) { @@ -571,8 +519,7 @@ $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)) || @@ -595,21 +542,17 @@ $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); Index: imap_messages.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/imap_messages.php,v retrieving revision 1.79 retrieving revision 1.80 diff -u -w -r1.79 -r1.80 --- imap_messages.php 15 Mar 2002 11:55:57 -0000 1.79 +++ imap_messages.php 16 Mar 2002 19:44:50 -0000 1.80 @@ -11,46 +11,32 @@ * $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 = ''; @@ -61,7 +47,8 @@ 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) { @@ -99,7 +86,7 @@ $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 @@ -120,7 +107,6 @@ '</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]>' . @@ -128,7 +114,6 @@ '</b><br>' . _("Unknown message number in reply from server: ") . $regs[1] . "</font><br>\n"; - /* exit */ } else { $read_list[$id2index[$regs[1]]] = $r; } @@ -174,27 +159,25 @@ $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); @@ -210,16 +193,16 @@ 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; @@ -240,15 +223,13 @@ 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) { @@ -260,7 +241,7 @@ $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 { @@ -277,31 +258,25 @@ 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); @@ -311,9 +286,7 @@ } -/**************************************************************************** - ** 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); @@ -325,15 +298,13 @@ $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"; @@ -344,21 +315,18 @@ $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 **/ + /* 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); @@ -366,7 +334,6 @@ $hdr->type0 = $cont; } - $line = $read[$i]; $i++; while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) { @@ -376,12 +343,12 @@ $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); @@ -396,10 +363,8 @@ $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]) != ")")) { @@ -409,7 +374,7 @@ $i++; } - /** Detects filename if any **/ + /* Detects filename if any */ if (strpos(strtolower(trim($line)), "filename=")) { $pos = strpos($line, "filename=") + 9; $name = trim($line); @@ -422,14 +387,12 @@ $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 == "") { @@ -437,7 +400,7 @@ } $i++; } - /** DATE **/ + /* DATE */ else if (strtolower(substr($read[$i], 0, 5)) == "date:") { $d = substr($read[$i], 5); $d = trim($d); @@ -446,23 +409,21 @@ $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)); @@ -473,7 +434,7 @@ $i++; } } - /** BCC **/ + /* BCC */ else if (strtolower(substr($read[$i], 0, 4)) == "bcc:") { $pos = 0; $hdr->bcc[$pos] = trim(substr($read[$i], 5)); @@ -484,7 +445,7 @@ $i++; } } - /** TO **/ + /* TO */ else if (strtolower(substr($read[$i], 0, 3)) == "to:") { $pos = 0; $hdr->to[$pos] = trim(substr($read[$i], 4)); @@ -495,14 +456,12 @@ $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)"); @@ -515,7 +474,7 @@ } $i++; } - /** X-PRIORITY **/ + /* X-PRIORITY */ else if (strtolower(substr($read[$i], 0, 11)) == "x-priority:") { $hdr->priority = trim(substr($read[$i], 11)); $i++; @@ -527,17 +486,10 @@ 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 - ****************************************************************************/ ?> |
From: Simon Dick <simond@us...> - 2002-03-16 12:46:13
|
Update of /cvsroot/squirrelmail/squirrelmail/plugins/administrator In directory usw-pr-cvs1:/tmp/cvs-serv3836 Modified Files: defines.php Log Message: Add org logo width/height to the admin plugin Index: defines.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/plugins/administrator/defines.php,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -r1.21 -r1.22 --- defines.php 1 Mar 2002 10:41:37 -0000 1.21 +++ defines.php 16 Mar 2002 12:46:09 -0000 1.22 @@ -63,6 +63,14 @@ '$org_logo' => array( 'name' => _("Organization Logo"), 'type' => SMOPT_TYPE_STRING, 'size' => 40 ), + '$org_logo_width' => array( 'name' => _("Organization Logo Width"), + 'type' => SMOPT_TYPE_INTEGER, + 'size' => 5, + 'default' => 0), + '$org_logo_height' => array( 'name' => _("Organization Logo Height"), + 'type' => SMOPT_TYPE_INTEGER, + 'size' => 5, + 'default' => 0), '$org_title' => array( 'name' => _("Organization Title"), 'type' => SMOPT_TYPE_STRING, 'size' => 40 ), |
From: Seth E. Randall <indiri69@us...> - 2002-03-16 04:23:25
|
Update of /cvsroot/squirrelmail/squirrelmail/functions In directory usw-pr-cvs1:/tmp/cvs-serv12724 Modified Files: imap_general.php Log Message: Fix IMAP PARSE reponse matching. This should get rid of retrival errors with Missing parameters and those stupid <Undisclosed-Recipient:;> To: lines that UW IMAP chokes on from Outlook Express. Also changed some ereg to preg and removed some useless spacing. Index: imap_general.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/imap_general.php,v retrieving revision 1.104 retrieving revision 1.105 diff -u -w -r1.104 -r1.105 --- imap_general.php 8 Mar 2002 21:07:49 -0000 1.104 +++ imap_general.php 16 Mar 2002 04:23:22 -0000 1.105 @@ -79,7 +79,8 @@ // 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)) { + //} else if (ereg("^\\* [0-9]+ FETCH", $read, $regs)) { + } else if (preg_match('/^\* [0-9]+ FETCH/', $read, $regs)) { // Sizeless response, probably single-line $size = -1; $data[] = $read; @@ -116,18 +117,24 @@ } else { if (preg_match("/^$pre (OK|BAD|NO)(.*)/", $read, $regs) || // if (ereg("^$pre (OK|BAD|NO)(.*)", $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 ) ) { + } else if ( preg_match('/^\* OK \[PARSE.*/', $read, $regs ) ) { + 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@...>. Once we see + one OK [PARSE line, we just go through and keep + tossing them out until we get something different. */ - $read = fgets ($imap_stream, $bufsize); $data[] = $read; $read = fgets ($imap_stream, $bufsize); - } else if (preg_match("/^\* BYE \[ALERT\](.*)/", $read, $regs)) { + } 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 |
From: Seth E. Randall <indiri69@us...> - 2002-03-16 04:19:27
|
Update of /cvsroot/squirrelmail/squirrelmail/functions In directory usw-pr-cvs1:/tmp/cvs-serv11831 Modified Files: mime.php Log Message: Fix IMAP parsing to properly match Non-FETCH reponses. Index: mime.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/mime.php,v retrieving revision 1.174 retrieving revision 1.175 diff -u -w -r1.174 -r1.175 --- mime.php 13 Mar 2002 09:16:17 -0000 1.174 +++ mime.php 16 Mar 2002 04:19:20 -0000 1.175 @@ -382,8 +382,8 @@ $data = sqimap_run_command ($imap_stream, $cmd, true, $response, $message); do { - $topline = array_shift( $data ); - } while( $topline && $topline == '*' && !preg_match( '/\\* [0-9] FETCH.*/i', $topline )) ; + $topline = trim(array_shift( $data )); + } while( $topline && $topline[0] == '*' && !preg_match( '/\* [0-9]+ FETCH.*/i', $topline )) ; $wholemessage = implode('', $data); if (ereg('\\{([^\\}]*)\\}', $topline, $regs)) { |