$data = array();
$total_size = 0;
while (strpos($read, "\n") === false) {
- $read .= fgets($imap_stream, 9096);
+ if(!($read .= fgets($imap_stream, 9096))) {
+ break;
+ }
}
if (ereg("^\\* [0-9]+ FETCH.*\\{([0-9]+)\\}", $read, $regs)) {
}
while (1) {
while (strpos($read, "\n") === false) {
- $read .= fgets($imap_stream, 9096);
+ if(!($read .= fgets($imap_stream, 9096))) {
+ break;
+ }
}
// If we know the size, no need to look at the end parameters
if ($size > 0) {
* Luke Ehresman <lkehresman@yahoo.com>
* "Luke Ehresman" <lkehresman@yahoo.com>
* lkehresman@yahoo.com (Luke Ehresman)
- * become: Luke Ehresman
+ * becomes: Luke Ehresman
* <lkehresman@yahoo.com>
* becomes: lkehresman@yahoo.com
*/
function sqimap_find_displayable_name ($string) {
$string = trim($string);
-
+
if ( ereg('^(.+)<.*>', $string, $regs) ) {
- $string = ereg_replace ('"', '', $regs[1] );
+ $orig_string = $string;
+ $string = str_replace ('"', '', $regs[1] );
+ if (trim($string) == '') {
+ $string = sqimap_find_email($orig_string);
+ }
+ if( $string == '' || $string == ' ' ){
+ $string = ' ';
+ }
}
elseif ( ereg('\((.*)\)', $string, $regs) ) {
if( ( $regs[1] == '' ) || ( $regs[1] == ' ' ) ){
}
}
else {
- $string = sqimap_find_email($string);
+ $string = str_replace ('"', '', sqimap_find_email($string));
}
return trim($string);