X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_general.php;h=0d8839665a01734c226206f9f35c85014d547098;hb=4f313fcfab8ae75f0edb04c73d7257a93dbeda1e;hp=133e9851b402dedd028ba781bb09a31898f4297d;hpb=e9f8ea4ecb40efdb6f19631f8359ebd1fbf588be;p=squirrelmail.git diff --git a/functions/imap_general.php b/functions/imap_general.php index 133e9851..0d883966 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -13,18 +13,21 @@ function sqimap_read_data ($imap_stream, $pre, $handle_errors, $response, $message) { global $color; + //$imap_general_debug = true; + $imap_general_debug = false; + $read = fgets ($imap_stream, 1024); -// echo "$read
"; + if ($imap_general_debug) echo "$read
"; $counter = 0; while ((substr($read, 0, strlen("$pre OK")) != "$pre OK") && (substr($read, 0, strlen("$pre BAD")) != "$pre BAD") && (substr($read, 0, strlen("$pre NO")) != "$pre NO")) { $data[$counter] = $read; $read = fgets ($imap_stream, 1024); -// echo "$read
"; + if ($imap_general_debug) echo "$read
"; $counter++; } -// echo "--
"; + if ($imap_general_debug) echo "--
"; if (substr($read, 0, strlen("$pre OK")) == "$pre OK") { $response = "OK"; $message = trim(substr($read, strlen("$pre OK"), strlen($read))); @@ -40,18 +43,18 @@ if ($handle_errors == true) { if ($response == "NO") { - echo "
"; + echo "
\n"; echo _("ERROR : Could not complete request."); - echo "
"; + echo "

\n"; echo _("Reason Given: "); - echo "$message

"; + echo "$message

\n"; exit; } else if ($response == "BAD") { - echo "
"; + echo "
\n"; echo _("ERROR : Bad or malformed request."); - echo "
"; + echo "

\n"; echo _("Server responded: "); - echo "$message

"; + echo "$message

\n"; exit; } } @@ -67,11 +70,14 @@ ** 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; + global $color, $squirrelmail_language, $HTTP_ACCEPT_LANGUAGE, $onetimepad; $imap_stream = fsockopen ($imap_server_address, $imap_port, &$error_number, &$error_string); $server_info = fgets ($imap_stream, 1024); + // Decrypt the password + $password = OneTimePadDecrypt($password, $onetimepad); + // This function can sometimes be called before the check for // gettext is done. if (!function_exists("_")) { @@ -114,7 +120,7 @@ $squirrelmail_language = substr($HTTP_ACCEPT_LANGUAGE, 0, 2); } - if (isset($squirrelmail_language)) { + if (isset($squirrelmail_language) && function_exists("bindtextdomain")) { if ($squirrelmail_language != "en" && $squirrelmail_language != "") { putenv("LC_ALL=".$squirrelmail_language); bindtextdomain("squirrelmail", "../locale/"); @@ -234,6 +240,7 @@ ******************************************************************************/ function sqimap_find_displayable_name ($string) { $string = " ".trim($string); + $orig_string = $string; if (strpos($string, "<") && strpos($string, ">")) { if (strpos($string, "<") == 1) { $string = sqimap_find_email($string); @@ -242,12 +249,15 @@ $string = substr($string, 0, strpos($string, "<")); $string = ereg_replace ("\"", "", $string); } + + if (trim($string) == "") { + $string = sqimap_find_email($orig_string); + } } return $string; } - /****************************************************************************** ** Returns the number of unseen messages in this folder ******************************************************************************/