** Unsubscribes to an existing folder
******************************************************************************/
function sqimap_unsubscribe ($imap_stream, $mailbox) {
+ global $imap_server_type;
+
+ /** This is a hack for UW server
+ ** Sometimes a folder will have a / at the end. If that's the case,
+ ** the unsubscribe doesn't work for a box named "mailbox/". We have
+ ** to strip off the / at the end. There may be a better way of doing
+ ** this, but this is the best I've found so far. (lme - April 26, 2000)
+ **/
+ if ($imap_server_type == "uw") {
+ if (substr($mailbox, -1) == "/") {
+ $mailbox = substr($mailbox, 0, strlen($mailbox)-1);
+ }
+ }
+
fputs ($imap_stream, "a001 UNSUBSCRIBE \"$mailbox\"\r\n");
$read_ary = sqimap_read_data($imap_stream, "a001", true, $response, $message);
}
if ($flags) {
$boxes[$g]["flags"] = explode(" ", $flags);
}
+ /**** I'm not sure why this was even in here to begin with.. (lme)
for ($i=0; $i < count($boxes[$g]["flags"]); $i++) {
if ($boxes[$g]["flags"][$i] == "noselect") {
$boxes[$g]["unformatted-dm"] = $boxes[$g]["unformatted-dm"].$dm;
echo $boxes[$g]["unformatted-dm"]." - debug<br>";
}
}
+ ****/
}
return $boxes;
}
/******************************************************************************
** Returns some general header information -- FROM, DATE, and SUBJECT
******************************************************************************/
- function sqimap_get_small_header ($imap_stream, $id, &$from, &$subject, &$date) {
+ function sqimap_get_small_header ($imap_stream, $id, &$from, &$subject, &$date, $sent) {
//fputs ($imap_stream, "a001 FETCH $id BODY[HEADER.FIELDS (DATE FROM SUBJECT)]\r\n");
fputs ($imap_stream, "a001 FETCH $id RFC822.HEADER\r\n");
$read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
$subject = _("(no subject)");
$from = _("Unknown Sender");
for ($i = 0; $i < count($read); $i++) {
- if (strtolower(substr($read[$i], 0, 5)) == "from:") {
- $from = sqimap_find_displayable_name(substr($read[$i], 5));
- } else if (strtolower(substr($read[$i], 0, 5)) == "date:") {
+ if ($sent == true) {
+ if (strtolower(substr($read[$i], 0, 3)) == "to:")
+ $from = sqimap_find_displayable_name(substr($read[$i], 3));
+ } else {
+ if (strtolower(substr($read[$i], 0, 5)) == "from:")
+ $from = sqimap_find_displayable_name(substr($read[$i], 5));
+ }
+
+ if (strtolower(substr($read[$i], 0, 5)) == "date:") {
$date = substr($read[$i], 5);
} else if (strtolower(substr($read[$i], 0, 8)) == "subject:") {
$subject = htmlspecialchars(substr($read[$i], 8));
function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage) {
global $color, $msgs, $msort;
+ global $sent_folder;
+
$msg = $msgs[$key];
$senderName = $msg["FROM"];
if ($msg["FLAG_FLAGGED"] == true) { $flag = "<font color=$color[2]>"; $flag_end = "</font>"; }
if ($msg["FLAG_SEEN"] == false) { $bold = "<b>"; $bold_end = "</b>"; }
if ($msg["FLAG_ANSWERED"] == true) { $ans = " [A]"; }
+ if ($mailbox == $sent_folder) { $italic = "<i>"; $italic_end = "</i>"; }
echo " <td width=1% align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."></TD>\n";
- echo " <td width=30%>$bold$flag$senderName$flag_end$bold_end</td>\n";
+ echo " <td width=30%>$italic$bold$flag$senderName$flag_end$bold_end$italic_end</td>\n";
echo " <td nowrap width=1%><center>$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end</center></td>\n";
echo " <td width=%>$bold<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0\">$flag$subject$flag_end</a>$ans$bold_end</td>\n";
**/
function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num, $use_cache) {
global $msgs, $msort;
- include ("../config/config.php");
+ global $sent_folder;
if (!$use_cache) {
if ($numMessages >= 1) {
for ($q = 0; $q < $numMessages; $q++) {
- sqimap_get_small_header ($imapConnection, $q+1, $f, $s, $d);
+ if ($mailbox == $sent_folder)
+ sqimap_get_small_header ($imapConnection, $q+1, $f, $s, $d, true);
+ else
+ sqimap_get_small_header ($imapConnection, $q+1, $f, $s, $d, false);
+
$from[$q] = $f;
$date[$q] = $d;
$subject[$q] = $s;
// generic function to convert the msgs array into an HTML table
function displayMessageArray($imapConnection, $numMessages, $startMessage, &$msgs, $msort, $mailbox, $sort, $color,$show_num) {
- global $folder_prefix;
+ global $folder_prefix, $sent_folder;
+ global $imapServerAddress;
// do a check to see if the config stuff has already been included or not
- if (!isset($imapServerAddress))
- include("../config/config.php");
+// if (!isset($imapServerAddress))
+// include("../config/config.php");
// if cache isn't already set, do it now
if (!session_is_registered("msgs"))
echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
echo " <TD WIDTH=1%><B> </B></TD>";
/** FROM HEADER **/
- echo " <TD WIDTH=30%><B>". _("From") ."</B>";
+ if ($mailbox == $sent_folder)
+ echo " <TD WIDTH=30%><B>". _("To") ."</B>";
+ else
+ echo " <TD WIDTH=30%><B>". _("From") ."</B>";
+
if ($sort == 2)
echo " <A HREF=\"right_main.php?newsort=3&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
else if ($sort == 3)