From 7ce342dcef2291f6e57eb53892e09a80d2f63dc9 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sat, 18 Dec 1999 16:08:29 +0000 Subject: [PATCH] Redid the way folders are listed git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@84 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/array.php | 12 ++-- functions/imap.php | 89 +++++++++++++++++++++---- functions/mailbox.php | 9 ++- functions/mailbox_display.php | 49 +++++++------- functions/smtp.php | 3 + functions/strings.php | 4 ++ src/compose.php | 6 ++ src/compose_send.php | 3 +- src/empty_trash.php | 11 ++-- src/folders.php | 69 +++++++++++-------- src/folders_create.php | 14 ++++ src/folders_delete.php | 39 +++++------ src/folders_rename_getname.php | 1 - src/left_main.php | 117 ++++++++++++--------------------- src/login.php | 1 + src/move_messages.php | 3 +- src/webmail.php | 5 +- 17 files changed, 257 insertions(+), 178 deletions(-) diff --git a/functions/array.php b/functions/array.php index 99dd1264..65498fc1 100644 --- a/functions/array.php +++ b/functions/array.php @@ -16,8 +16,12 @@ } $GLOBALS["col"] = $col; // Column or Columns as an array $GLOBALS["dir"] = $dir; // Direction, a positive number for ascending a negative for descending - - function comp2($a,$b,$i = 0) { + + usort($ary,comp2); + return $ary; + } + + function comp2($a,$b,$i = 0) { global $col; global $dir; $c = count($col) -1; @@ -34,8 +38,4 @@ } return $r; } - - usort($ary,comp2); - return $ary; - } ?> diff --git a/functions/imap.php b/functions/imap.php index 62bfe30b..0362e32c 100644 --- a/functions/imap.php +++ b/functions/imap.php @@ -32,10 +32,10 @@ if ($handle_errors == true) { if ($response == "NO") { - echo "ERROR: Could not complete request.
  Reason given: $message

"; + echo "
ERROR: Could not complete request.
  Reason given: $message

"; exit; } else if ($response == "BAD") { - echo "ERROR: Bad or malformed request.
  Server responded: $message

"; + echo "
ERROR: Bad or malformed request.
  Server responded: $message

"; exit; } } @@ -151,11 +151,12 @@ $data = imapReadData($imapConnection, "1", false, $response, $message); if ($response == "NO") { - echo "ERROR: Could not complete request.
  Reason given: $message

"; - echo "Possible solutions:
  • You may need to specify that the folder is a subfolder of INBOX
  • "; + echo "
    ERROR: Could not complete request.
      Reason given: $message

    "; + echo "Possible solutions:
  • You may need to specify that the folder is a subfolder of INBOX
  • "; + echo "
  • Try renaming the folder to something different.
  • "; exit; } else if ($response == "BAD") { - echo "ERROR: Bad or malformed request.
      Server responded: $message

    "; + echo "ERROR: Bad or malformed request.
      Server responded: $message

    "; exit; } } @@ -175,25 +176,85 @@ } /** Sends back two arrays, boxesFormatted and boxesUnformatted **/ - function getFolderList($imapConnection, &$boxesFormatted, &$boxesUnformatted, &$boxesRaw) { + function getFolderList($imapConnection, &$boxes) { + require ("../config/config.php"); + fputs($imapConnection, "1 list \"\" *\n"); $str = imapReadData($imapConnection, "1", true, $response, $message); $dm = findMailboxDelimeter($imapConnection); + $g = 0; for ($i = 0;$i < count($str); $i++) { $mailbox = chop($str[$i]); - $boxesRaw[$i] = $mailbox; + if (substr(findMailboxName($mailbox), 0, 1) != ".") { + $boxes[$g]["RAW"] = $mailbox; - $mailbox = findMailboxName($mailbox); - $periodCount = countCharInString($mailbox, $dm); + $mailbox = findMailboxName($mailbox); + $periodCount = countCharInString($mailbox, $dm); - // indent the correct number of spaces. - for ($j = 0;$j < $periodCount;$j++) - $boxesFormatted[$i] = "$boxesFormatted[$i]  "; + // indent the correct number of spaces. + for ($j = 0;$j < $periodCount;$j++) + $boxes[$g]["FORMATTED"] = $boxes[$g]["FORMATTED"] . "  "; - $boxesFormatted[$i] = $boxesFormatted[$i] . readShortMailboxName($mailbox, $dm); - $boxesUnformatted[$i] = $mailbox; + $boxes[$g]["FORMATTED"] = $boxes[$g]["FORMATTED"] . readShortMailboxName($mailbox, $dm); + $boxes[$g]["UNFORMATTED"] = $mailbox; + $boxes[$g]["ID"] = $g; + $g++; + } } + + $original = $boxes; + + for ($i = 0; $i < count($original); $i++) { + $boxes[$i]["UNFORMATTED"] = strtolower($boxes[$i]["UNFORMATTED"]); + } + + $boxes = ary_sort($boxes, "UNFORMATTED", 1); + + for ($i = 0; $i < count($original); $i++) { + for ($j = 0; $j < count($original); $j++) { + if ($boxes[$i]["ID"] == $original[$j]["ID"]) { + $boxes[$i]["UNFORMATTED"] = $original[$j]["UNFORMATTED"]; + $boxes[$i]["FORMATTED"] = $original[$j]["FORMATTED"]; + $boxes[$i]["RAW"] = $original[$j]["RAW"]; + } + } + } + + for ($i = 0; $i < count($boxes); $i++) { + if ($boxes[$i]["UNFORMATTED"] == $special_folders[0]) { + $boxesnew[0]["FORMATTED"] = $boxes[$i]["FORMATTED"]; + $boxesnew[0]["UNFORMATTED"] = trim($boxes[$i]["UNFORMATTED"]); + $boxesnew[0]["RAW"] = trim($boxes[$i]["RAW"]); + $boxes[$i]["USED"] = true; + } + } + if ($list_special_folders_first == true) { + for ($i = 0; $i < count($boxes); $i++) { + for ($j = 1; $j < count($special_folders); $j++) { + if (substr($boxes[$i]["UNFORMATTED"], 0, strlen($special_folders[$j])) == $special_folders[$j]) { + $pos = count($boxesnew); + $boxesnew[$pos]["FORMATTED"] = $boxes[$i]["FORMATTED"]; + $boxesnew[$pos]["RAW"] = trim($boxes[$i]["RAW"]); + $boxesnew[$pos]["UNFORMATTED"] = trim($boxes[$i]["UNFORMATTED"]); + $boxes[$i]["USED"] = true; + } + } + } + } + for ($i = 0; $i < count($boxes); $i++) { + if (($boxes[$i]["UNFORMATTED"] != $special_folders[0]) && + ($boxes[$i]["UNFORMATTED"] != ".mailboxlist") && + ($boxes[$i]["USED"] == false)) { + $pos = count($boxesnew); + $boxesnew[$pos]["FORMATTED"] = $boxes[$i]["FORMATTED"]; + $boxesnew[$pos]["RAW"] = trim($boxes[$i]["RAW"]); + $boxesnew[$pos]["UNFORMATTED"] = trim($boxes[$i]["UNFORMATTED"]); + $boxes[$i]["USED"] = true; + } + } + + $boxes = $boxesnew; } function deleteMessages($imapConnection, $a, $b, $numMessages, $trash_folder, $move_to_trash, $auto_expunge, $mailbox) { diff --git a/functions/mailbox.php b/functions/mailbox.php index 8babee25..9febb941 100644 --- a/functions/mailbox.php +++ b/functions/mailbox.php @@ -66,8 +66,7 @@ while ((substr($read, 0, 15) != "messageFetch OK") && (substr($read, 0, 16) != "messageFetch BAD")) { if (substr($read, 0, 5) == "From:") { - $read = ereg_replace("<", "EMAILSTART--", $read); - $read = ereg_replace(">", "--EMAILEND", $read); + $read = encodeEmailAddr("$read"); $from[$pos] = substr($read, 5, strlen($read) - 6); } else if (substr($read, 0, 5) == "Date:") { @@ -99,6 +98,12 @@ } } + function encodeEmailAddr($string) { + $string = ereg_replace("<", "EMAILSTART--", $string); + $string = ereg_replace(">", "--EMAILEND", $string); + return $string; + } + function setMessageFlag($imapConnection, $i, $q, $flag) { fputs($imapConnection, "messageStore STORE $i:$q +FLAGS (\\$flag)\n"); } diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 98007b04..435facc0 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -33,7 +33,7 @@ ** This function loops through a group of messages in the mailbox and shows them **/ function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort) { - require ("../config/config.php"); + include ("../config/config.php"); if (1 <= $numMessages) { getMessageHeaders($imapConnection, 1, $numMessages, $from, $subject, $date); @@ -139,15 +139,6 @@ } } -// $j = 0; -// while ($j < $numMessages) { -// $sub = $msgs[$j]["SUBJECT"]; -// $id = $msgs[$j]["ID"]; -// echo "$id -- $sub
    "; -// $j++; -// } -//exit; - if ($startMessage + 24 < $numMessages) { $endMessage = $startMessage + 24; } else { @@ -191,30 +182,36 @@ echo ""; echo "\n\n\n
    "; - echo "\n"; + echo "
    \n"; echo " \n"; - echo " \n"; - echo " "; echo " \n"; @@ -224,7 +221,7 @@ echo "
    \n"; - echo " \n"; - echo " \n"; + echo " Move selected to: "; + echo " \n"; + echo " "; + echo " \n"; echo " \n"; - echo "  checked messages\n"; + echo " \n"; + echo "  checked messages\n"; echo "
    "; echo ""; echo ""; - echo " "; + echo " "; /** FROM HEADER **/ echo " \n"; + echo " \n"; else if ($sort == 5) echo " \n"; else diff --git a/functions/smtp.php b/functions/smtp.php index 066fca59..c733470d 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -58,6 +58,9 @@ fputs($smtpConnection, "Cc: <$cc_list>\n"); // Who the CCs are } fputs($smtpConnection, "X-Mailer: SquirrelMail (version $version)\n"); // Identify SquirrelMail + fputs($smtpConnection, "Reply-To: $from\n"); + fputs($smtpConnection, "MIME-Version: 1.0\n"); + fputs($smtpConnection, "Content-Type: text/plain; charset=us-ascii\n"); fputs($smtpConnection, "$body\n"); // send the body of the message fputs($smtpConnection, ".\n"); // end the DATA part diff --git a/functions/strings.php b/functions/strings.php index c3cdc3a3..142d13a5 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -1,4 +1,5 @@ diff --git a/src/compose.php b/src/compose.php index ac450160..cfa8136c 100644 --- a/src/compose.php +++ b/src/compose.php @@ -38,6 +38,12 @@ } } + // Add some decoding information + $send_to = encodeEmailAddr($send_to); + // parses the field and returns only the email address + $send_to = decodeEmailAddr($send_to); + + $send_to = strtolower($send_to); $send_to = ereg_replace("\"", "", $send_to); $send_to = stripslashes($send_to); diff --git a/src/compose_send.php b/src/compose_send.php index 57dc4dad..a0cdabde 100644 --- a/src/compose_send.php +++ b/src/compose_send.php @@ -45,7 +45,8 @@ sendMessage($smtpServerAddress, $smtpPort, $username, $domain, $passed_to, $passed_cc, $passed_bcc, $passed_subject, $passed_body, $version); - echo ""; + if ($auto_forwarding == true) + echo ""; echo "\n"; displayPageHeader($color, "None"); diff --git a/src/empty_trash.php b/src/empty_trash.php index 1d177b55..3de63073 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -5,19 +5,20 @@ include("../functions/page_header.php"); include("../functions/display_messages.php"); include("../functions/imap.php"); + include("../functions/array.php"); $imapConnection = loginToImapServer($username, $key, $imapServerAddress); - getFolderList($imapConnection, $boxesFormatted, $boxesUnformatted, $boxesRaw); + getFolderList($imapConnection, $boxes); $mailbox = $trash_folder; fputs($imapConnection, "1 LIST \"$mailbox\" *\n"); $data = imapReadData($imapConnection , "1", false, $response, $message); while (substr($data[0], strpos($data[0], " ")+1, 4) == "LIST") { - for ($i = 0; $i < count($boxesUnformatted); $i++) { - if (($boxesUnformatted[$i] == $mailbox) || - (substr($boxesUnformatted[$i], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) { - removeFolder($imapConnection, "$boxesUnformatted[$i]"); + for ($i = 0; $i < count($boxes); $i++) { + if (($boxes[$i]["UNFORMATTED"] == $mailbox) || + (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) { + removeFolder($imapConnection, $boxes[$i]["UNFORMATTED"]); } } fputs($imapConnection, "1 LIST \"$mailbox\" *\n"); diff --git a/src/folders.php b/src/folders.php index f25c2c42..e67e73fe 100644 --- a/src/folders.php +++ b/src/folders.php @@ -4,6 +4,7 @@ include("../functions/page_header.php"); include("../functions/imap.php"); include("../functions/mailbox.php"); + include("../functions/array.php"); echo "\n"; @@ -16,29 +17,32 @@ echo "
    Num From"; if ($sort == 2) @@ -244,7 +241,7 @@ /** SUBJECT HEADER **/ echo " Subject\n"; if ($sort == 4) - echo "
    \n"; $imapConnection = loginToImapServer($username, $key, $imapServerAddress); - getFolderList($imapConnection, $boxesFormatted, $boxesUnformatted, $boxesRaw); + getFolderList($imapConnection, $boxes); /** DELETING FOLDERS **/ echo "\n"; echo ""; echo "
    \n"; /** CREATING FOLDERS **/ @@ -46,40 +50,53 @@ echo "
    \n"; /** RENAMING FOLDERS **/ echo ""; echo "
    Delete Folder
    "; echo "\n"; - echo "\n"; + for ($i = 0; $i < count($boxes); $i++) { $use_folder = true; for ($p = 0; $p < count($special_folders); $p++) { - if ($boxesUnformatted[$i] == $special_folders[$p]) { + if ($boxes[$i]["UNFORMATTED"] == $special_folders[$p]) { $use_folder = false; - } else if (substr($boxesUnformatted[$i], 0, strlen($trash_folder)) == $trash_folder) { + } else if (substr($boxes[$i]["UNFORMATTED"], 0, strlen($trash_folder)) == $trash_folder) { $use_folder = false; } } - - if ($use_folder == true) - echo "
    "; echo "
    \n"; echo "
    \n"; - echo "  as a subfolder of
    "; - echo "\n"; if ($default_sub_of_inbox == false) echo "
    Rename a Folder
    "; echo "
    \n"; - echo "\n"; + for ($i = 0; $i < count($boxes); $i++) { $use_folder = true; for ($p = 0; $p < count($special_folders); $p++) { - if ($boxesUnformatted[$i] == $special_folders[$p]) { + if ($boxes[$i]["UNFORMATTED"] == $special_folders[$p]) { + $use_folder = false; + } else if (substr($boxes[$i]["UNFORMATTED"], 0, strlen($trash_folder)) == $trash_folder) { $use_folder = false; } } - if ($use_folder == true) - echo "

    \n"; ?> diff --git a/src/folders_create.php b/src/folders_create.php index 171fbad9..b34a5332 100644 --- a/src/folders_create.php +++ b/src/folders_create.php @@ -4,10 +4,24 @@ include("../functions/strings.php"); include("../functions/page_header.php"); include("../functions/imap.php"); + include("../functions/display_messages.php"); echo "\n"; + displayPageHeader($color, "None"); + $imapConnection = loginToImapServer($username, $key, $imapServerAddress); $dm = findMailboxDelimeter($imapConnection); + + if (strpos($folder_name, "\"") || strpos($folder_name, ".") || + strpos($folder_name, "/") || strpos($folder_name, "\\") || + strpos($folder_name, "'") || strpos($folder_name, "$dm")) { + plain_error_message("Illegal folder name. Please select a different name.
    Click here to go back.", $color); + exit; + } + + if ($contain_subs == true) + $folder_name = "$folder_name$dm"; + if (trim($subfolder) == "[ None ]") { createFolder($imapConnection, "$folder_name"); } else { diff --git a/src/folders_delete.php b/src/folders_delete.php index 6e214ecd..7b635a35 100644 --- a/src/folders_delete.php +++ b/src/folders_delete.php @@ -4,16 +4,17 @@ include("../functions/page_header.php"); include("../functions/imap.php"); include("../functions/mailbox.php"); + include("../functions/array.php"); echo "\n"; $imapConnection = loginToImapServer($username, $key, $imapServerAddress); - getFolderList($imapConnection, $boxesFormatted, $boxesUnformatted, $boxesRaw); + getFolderList($imapConnection, $boxes); $dm = findMailboxDelimeter($imapConnection); /** lets see if we CAN move folders to the trash.. otherwise, just delete them **/ - for ($i = 0; $i < count($boxesUnformatted); $i++) { - if ($boxesUnformatted[$i] == $trash_folder) - $tmp_trash_folder = $boxesRaw[$i]; + for ($i = 0; $i < count($boxes[$i]["UNFORMATTED"]); $i++) { + if ($boxes[$i]["UNFORMATTED"] == $trash_folder) + $tmp_trash_folder = $boxes[$i]["RAW"]; } $tmpflags = getMailboxFlags($tmp_trash_folder); @@ -26,22 +27,22 @@ /** Lets start removing the folders and messages **/ if (($move_to_trash == true) && ($can_move_to_trash == true)) { /** if they wish to move messages to the trash **/ /** Creates the subfolders under $trash_folder **/ - for ($i = 0; $i < count($boxesUnformatted); $i++) { - if (($boxesUnformatted[$i] == $mailbox) || - (substr($boxesUnformatted[$i], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) { - $folderWithoutINBOX = getFolderNameMinusINBOX($boxesUnformatted[$i], $dm); - $flags = getMailboxFlags($boxesRaw[$i]); + for ($i = 0; $i < count($boxes); $i++) { + if (($boxes[$i]["UNFORMATTED"] == $mailbox) || + (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) { + $folderWithoutINBOX = getFolderNameMinusINBOX($boxes[$i]["UNFORMATTED"], $dm); + $flags = getMailboxFlags($boxes[$i]["RAW"]); for ($b = 0; $b < count($flags); $b++) { $type = $flags[$b]; } createFolder($imapConnection, "$trash_folder" . $dm . "$folderWithoutINBOX", $type); } } - for ($i = 0; $i < count($boxesUnformatted); $i++) { - if (($boxesUnformatted[$i] == $mailbox) || - (substr($boxesUnformatted[$i], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) { - selectMailbox($imapConnection, $boxesUnformatted[$i], $numMessages); - $folder = getFolderNameMinusINBOX($boxesUnformatted[$i]); + for ($i = 0; $i < count($boxes); $i++) { + if (($boxes[$i]["UNFORMATTED"] == $mailbox) || + (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) { + selectMailbox($imapConnection, $boxes[$i]["UNFORMATTED"], $numMessages); + $folder = getFolderNameMinusINBOX($boxes[$i]["UNFORMATTED"]); if ($numMessages > 0) $success = copyMessages($imapConnection, 1, $numMessages, "$trash_folder" . $dm . "$folder"); @@ -49,17 +50,17 @@ $success = true; if ($success == true) - removeFolder($imapConnection, "$boxesUnformatted[$i]"); + removeFolder($imapConnection, $boxes[$i]["UNFORMATTED"]); } } } else { /** if they do NOT wish to move messages to the trash (or cannot)**/ fputs($imapConnection, "1 LIST \"$mailbox\" *\n"); $data = imapReadData($imapConnection , "1", false, $response, $message); while (substr($data[0], strpos($data[0], " ")+1, 4) == "LIST") { - for ($i = 0; $i < count($boxesUnformatted); $i++) { - if (($boxesUnformatted[$i] == $mailbox) || - (substr($boxesUnformatted[$i], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) { - removeFolder($imapConnection, "$boxesUnformatted[$i]"); + for ($i = 0; $i < count($boxes); $i++) { + if (($boxes[$i]["UNFORMATTED"] == $mailbox) || + (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) { + removeFolder($imapConnection, $boxes[$i]["UNFORMATTED"]); } } fputs($imapConnection, "1 LIST \"$mailbox\" *\n"); diff --git a/src/folders_rename_getname.php b/src/folders_rename_getname.php index 5a8dec1c..bd78024c 100644 --- a/src/folders_rename_getname.php +++ b/src/folders_rename_getname.php @@ -7,7 +7,6 @@ $imapConnection = loginToImapServer($username, $key, $imapServerAddress); selectMailbox($imapConnection, $old, $numMessages); - getFolderList($imapConnection, $boxesFormatted, $boxesUnformatted, $boxesRaw); $dm = findMailboxDelimeter($imapConnection); if (strpos($old, $dm)) { diff --git a/src/left_main.php b/src/left_main.php index b224497b..e4ca02f6 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -30,15 +30,34 @@ if ($unseen) $line .= ""; - $line .= ""; - $line .= readShortMailboxName($mailbox, $delimeter); - if (($move_to_trash == true) && (trim($mailbox) == $trash_folder)) { - $urlMailbox = urlencode($mailbox); - $line .= "    (empty)"; + $special_color = false; + for ($i = 0; $i < count($special_folders); $i++) { + if (($special_folders[$i] == $mailbox) && ($use_special_folder_color == true)) + $special_color = true; + } + + if ($special_color == true) { + $line .= ""; + $line .= readShortMailboxName($mailbox, $delimeter); + $line .= ""; + } else { + $line .= ""; + $line .= readShortMailboxName($mailbox, $delimeter); + $line .= ""; } - $line .= "\n"; + + if ($unseen) + $line .= ""; + if ($numUnseen > 0) { - $line .= " ($numUnseen)"; + $line .= " ($numUnseen)"; + } + + if (($move_to_trash == true) && (trim($mailbox) == $trash_folder)) { + $urlMailbox = urlencode($mailbox); + $line .= ""; + $line .= "    (empty)"; + $line .= "\n"; } return $line; } @@ -48,18 +67,16 @@ // open a connection on the imap port (143) $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 10); // the 10 is to hide the output - fputs($imapConnection, "1 list \"\" *\n"); - $str = imapReadData($imapConnection, "1", true, $response, $message); + getFolderList($imapConnection, $boxes); echo "
    "; echo "Folders
    "; echo "(refresh folder list)

    "; echo "\n"; $delimeter = findMailboxDelimeter($imapConnection); - for ($i = 0;$i < count($str); $i++) { - $mailbox = Chop($str[$i]); - $boxFlags = getMailboxFlags($mailbox); - $mailbox = findMailboxName($mailbox); + for ($i = 0;$i < count($boxes); $i++) { + $mailbox = $boxes[$i]["UNFORMATTED"]; + $boxFlags = getMailboxFlags($boxes[$i]["RAW"]); $boxCount = countCharInString($mailbox, $delimeter); @@ -69,73 +86,23 @@ $line .= "  "; if (trim($boxFlags[0]) != "") { + $noselect = false; for ($h = 0; $h < count($boxFlags); $h++) { - if (strtolower($boxFlags[$h]) == "noselect") { - $line .= ""; - $line .= readShortMailboxName($mailbox, $delimeter); - $line .= ""; - } else { - $line .= formatMailboxName($imapConnection, $mailbox, $delimeter); - } - } - } else { - $line .= formatMailboxName($imapConnection, $mailbox, $delimeter); - } - $folder_list[$i]["FORMATTED"] = trim($line); - $folder_list[$i]["PLAIN"] = trim($mailbox); - $folder_list[$i]["ID"] = $i; - } - - /** Alphebetize the folders */ - $original = $folder_list; - - for ($i = 0; $i < count($original); $i++) { - $folder_list[$i]["PLAIN"] = strtolower($folder_list[$i]["PLAIN"]); - } - - $folder_list = ary_sort($folder_list, "PLAIN", 1); - - for ($i = 0; $i < count($original); $i++) { - for ($j = 0; $j < count($original); $j++) { - if ($folder_list[$i]["ID"] == $original[$j]["ID"]) { - $folder_list[$i]["PLAIN"] = $original[$j]["PLAIN"]; - $folder_list[$i]["FORMATTED"] = $original[$j]["FORMATTED"]; + if (strtolower($boxFlags[$h]) == "noselect") + $noselect = true; } - } - } - /** If it is the inbox, list it first **/ - for ($i = 0; $i < count($folder_list); $i++) { - if ($folder_list[$i]["PLAIN"] == $special_folders[0]) { - echo ""; - echo trim($folder_list[$i]["FORMATTED"]); - echo "
    "; - $folder_list[$i]["USED"] = true; - } - } - /** Now the other special folders **/ - if ($list_special_folders_first == true) { - for ($i = 0; $i < count($folder_list); $i++) { - for ($j = 1; $j < count($special_folders); $j++) { - if (substr($folder_list[$i]["PLAIN"], 0, strlen($special_folders[$j])) == $special_folders[$j]) { - echo ""; - echo trim($folder_list[$i]["FORMATTED"]); - echo "
    "; - $folder_list[$i]["USED"] = true; - } + if ($noselect == true) { + $line .= ""; + $line .= readShortMailboxName($mailbox, $delimeter); + $line .= ""; + } else { + $line .= formatMailboxName($imapConnection, $mailbox, $delimeter); } + } else { + $line .= formatMailboxName($imapConnection, $mailbox, $delimeter); } - } - /** Then list all the other ones (not equal to INBOX) **/ - /** NOTE: .mailboxlist is a netscape thing.. just ignore it **/ - for ($i = 0; $i < count($folder_list); $i++) { - if (($folder_list[$i]["PLAIN"] != $special_folders[0]) && - ($folder_list[$i]["PLAIN"] != ".mailboxlist") && - ($folder_list[$i]["USED"] == false)) { - echo ""; - echo trim($folder_list[$i]["FORMATTED"]); - echo "
    "; - } + echo "$line
    "; } echo "
    "; diff --git a/src/login.php b/src/login.php index b8a46bc6..714c1445 100644 --- a/src/login.php +++ b/src/login.php @@ -13,6 +13,7 @@ \n"; echo "
    \n"; diff --git a/src/move_messages.php b/src/move_messages.php index 280a2399..eab4901e 100644 --- a/src/move_messages.php +++ b/src/move_messages.php @@ -47,7 +47,6 @@ // loop because we never increment j. so check to see if msg[0] is set or not to fix this. while ($j < count($msg)) { if ($msg[$i]) { - echo "MSG: $msg[$i]
    "; deleteMessages($imapConnection, $msg[$i], $msg[$i], $numMessages, $trash_folder, $move_to_trash, $auto_expunge, $mailbox); $j++; } @@ -55,7 +54,7 @@ } messages_deleted_message($mailbox, $sort, $startMessage, $color); } else { - echo "

    No messages selected.
    "; + error_message("No messages were selected.", $mailbox, $sort, $startMessage, $color); } } else { // Move messages displayPageHeader($color, $mailbox); diff --git a/src/webmail.php b/src/webmail.php index 060c923c..aaaaf785 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -17,7 +17,10 @@ ?> -OM-USA WebMail +<? + include ("../config/config.php"); + echo "$org_title"; +?> -- 2.25.1