}
+/* fixes the sort_array for the prev_del/next_del links when
+ * using server side sorting or thread sorting
+ */
+
+function fix_sort_array () {
+ global $username, $data_dir, $allow_server_sort, $allow_thread_sort,
+ $thread_sort_messages,
+ $mailbox, $imapConnection, $sort, $uid_support, $mbx_response;
+ switch (true) {
+ case ($allow_thread_sort && $thread_sort_messages):
+ $server_sort_array = get_thread_sort($imapConnection);
+ break;
+ case ($allow_server_sort):
+ $server_sort_array = sqimap_get_sort_order($imapConnection, $sort, $mbx_response);
+ break;
+ case ($uid_support):
+ $server_sort_array = sqimap_get_php_sort_order($imapConnecion, $mbx_response);
+ break;
+ default:
+ break;
+ }
+}
+
/*
* Warning: this function relies on the internal representation of
* of the message cache for the current mailbox. As such, it is fragile
* perhaps even as inline code to sqimap_mailbox_expunge(). In the
* meantime, you have been warned. [alane@geeksrus.net 2001/05/06]
*/
+
function delete_move_del_arr_elem($arr, $index) {
$tmp = array();
- $lim = count($arr);
$j = 0;
- for ($i = 0; $i < $lim; $i++) {
- if ($i != $index) {
- $tmp[$j++] = $arr[$i];
- }
+ foreach ($arr as $v) {
+ if ($j != $index) {
+ $tmp[] = $v;
+ }
+ $j++;
}
return $tmp;
}
function delete_move_show_msg_array() {
global $msort, $msgs;
-
$keys = array_keys($msort);
for ($i = 0; $i < count($keys); $i++) {
echo '<p>key ' . $keys[$i] . ' msgid ' . $msgs[$keys[$i]]['ID'] . '</p>';
function delete_move_expunge_from_all($id) {
- global $msgs, $msort, $sort, $imapConnection, $mailbox;
-
- // delete_move_show_msg_array();
-
+ global $msgs, $msort, $sort, $imapConnection, $mailbox, $uid_support;
$delAt = -1;
for ($i = 0; $i < count($msort); $i++) {
if ($msgs[$i]['ID'] == $id) {
$delAt = $i;
} elseif ($msgs[$i]['ID'] > $id) {
- $msgs[$i]['ID']--;
+ if (!$uid_support) {
+ $msgs[$i]['ID']--;
+ }
}
}
$msgs = delete_move_del_arr_elem($msgs, $delAt);
$msort = delete_move_del_arr_elem($msort, $delAt);
-
if ($sort < 6) {
if ($sort % 2) {
asort($msort);
arsort($msort);
}
}
+ session_register('msgs');
+ session_register('msort');
sqimap_mailbox_expunge($imapConnection, $mailbox, true);
}
if ($delete_id) {
delete_move_next_delete();
+ fix_sort_array();
} elseif ($move_id) {
delete_move_next_move();
+ fix_sort_array();
}
}
function delete_move_next_read($currloc) {
global $delete_move_next_formATtop, $delete_move_next_formATbottom,
$color, $where, $what, $currentArrayIndex, $passed_id,
- $urlMailbox, $sort, $startMessage, $delete_id, $move_id,
- $imapConnection, $auto_expunge, $move_to_trash;
+ $mailbox, $sort, $startMessage, $delete_id, $move_id,
+ $imapConnection, $auto_expunge, $move_to_trash, $mbx_response,
+ $uid_support;
+
+ $urlMailbox = urlencode($mailbox);
if (!(($where && $what) || ($currentArrayIndex == -1))) {
-
- $next = findNextMessage();
- $prev = findPreviousMessage();
+ $next = findNextMessage($passed_id);
+ $prev = findPreviousMessage($mbx_response['EXISTS'], $passed_id);
$prev_if_del = $prev;
$next_if_del = $next;
- if ($auto_expunge || $move_to_trash) {
+ if (!$uid_support && ($auto_expunge || $move_to_trash)) {
if ($prev_if_del > $passed_id) {
$prev_if_del--;
}
}
}
- $location = get_location();
- echo "<base href=\"$location/\">" .
- '<table cols=1 cellspacing=0 width=100% border=0 cellpadding=2>'.
+ /* Base is illegal within documents
+ * $location = get_location();
+ * echo "<base href=\"$location/\">" . */
+ echo '<table cellspacing=0 width="100%" border=0 cellpadding=2>'.
'<tr>'.
- "<td bgcolor=\"$color[9]\" width=100% align=center><small>";
+ "<td bgcolor=\"$color[9]\" width=\"100%\" align=center><small>";
- if ($prev > 0) {
- echo "<a href=\"read_body.php?passed_id=$prev&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Previous") . "</A> | ";
- } else {
- echo _("Previous") . " | ";
- }
- if ($next > 0) {
- echo "<a href=\"read_body.php?passed_id=$next&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Next") . "</A> | ";
- } else {
- echo _("Next") . " | ";
- }
+// if ($prev > 0) {
+// echo "<a href=\"read_body.php?passed_id=$prev&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Previous") . "</A> | \n";
+// } else {
+// echo _("Previous") . " | ";
+// }
+// if ($next > 0) {
+// echo "<a href=\"read_body.php?passed_id=$next&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0\">" . _("Next") . "</A> | \n";
+// } else {
+// echo _("Next") . " | ";
+// }
if ($prev > 0){
- echo "<a href=\"read_body.php?passed_id=$prev_if_del&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0&delete_id=$passed_id\">" . _("Delete & Prev") . "</a>" . " | ";
+ echo "<a href=\"read_body.php?passed_id=$prev_if_del&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0&delete_id=$passed_id\">" . _("Delete & Prev") . "</a>" . " | \n";
}
else {
echo _("Delete & Prev") . " | ";
}
if ($next > 0){
- echo "<a href=\"read_body.php?passed_id=$next_if_del&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0&delete_id=$passed_id\">" . _("Delete & Next") . "</a>";
+ echo "<a href=\"read_body.php?passed_id=$next_if_del&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage&show_more=0&delete_id=$passed_id\">" . _("Delete & Next") . "</a>\n";
} else {
echo _("Delete & Next");
}
function delete_move_next_moveNextForm($next) {
global $color, $where, $what, $currentArrayIndex, $passed_id,
- $urlMailbox, $sort, $startMessage, $delete_id, $move_id,
+ $mailbox, $sort, $startMessage, $delete_id, $move_id,
$imapConnection;
- echo '<form action="read_body.php" method="post">'.
- '<tr>'.
- "<td bgcolor=\"$color[9]\" width=\"100%\" align=\"center\"><small>".
+ echo '<tr>'.
+ "<td bgcolor=\"$color[9]\" width=\"100%\" align=\"center\">".
+ '<form action="read_body.php" method="post"><small>'.
"<input type=\"hidden\" name=\"passed_id\" value=\"$next\">".
- "<input type=\"hidden\" name=\"mailbox\" value=\"$urlMailbox\">".
+ "<input type=\"hidden\" name=\"mailbox\" value=\"".$mailbox."\">".
"<input type=\"hidden\" name=\"sort\" value=\"$sort\">".
"<input type=\"hidden\" name=\"startMessage\" value=\"$startMessage\">".
"<input type=\"hidden\" name=\"show_more\" value=\"0\">".
echo '</select> '.
'<input type="submit" value="' . _("Move") . '">'.
'</small>'.
+ '</form>'.
'</td>'.
- '</tr>' .
- '</form>';
+ '</tr>';
}
function delete_move_next_moveRightMainForm() {
global $color, $where, $what, $currentArrayIndex, $passed_id,
- $urlMailbox, $sort, $startMessage, $delete_id, $move_id,
+ $mailbox, $sort, $startMessage, $delete_id, $move_id,
$imapConnection;
- echo '<form action="right_main.php" method="post">' .
- '<tr>' .
- "<td bgcolor=\"$color[9]\" width=\"100%\" align=\"center\"><small>".
- "<input type=\"hidden\" name=\"mailbox\" value=\"$urlMailbox\">".
+ echo '<tr>' .
+ "<td bgcolor=\"$color[9]\" width=\"100%\" align=\"center\">".
+ '<form action="right_main.php" method="post"><small>' .
+ "<input type=\"hidden\" name=\"mailbox\" value=\"".$mailbox."\">".
"<input type=\"hidden\" name=\"sort\" value=\"$sort\">".
"<input type=\"hidden\" name=\"startMessage\" value=\"$startMessage\">".
"<input type=\"hidden\" name=\"move_id\" value=\"$passed_id\">".
echo ' </select>' .
'<input type=submit value="' . _("Move") . '">'.
'</small>'.
+ '</form>' .
'</td>'.
- '</tr>' .
- '</form>';
+ '</tr>';
}
global $imapConnection, $delete_id, $mailbox, $auto_expunge;
sqimap_messages_delete($imapConnection, $delete_id, $delete_id, $mailbox);
- if ($auto_expunge){
+ if ($auto_expunge) {
delete_move_expunge_from_all($delete_id);
// sqimap_mailbox_expunge($imapConnection, $mailbox, true);
}
// Move message
sqimap_messages_copy($imapConnection, $move_id, $move_id, $targetMailbox);
- sqimap_messages_flag($imapConnection, $move_id, $move_id, 'Deleted');
+ sqimap_messages_flag($imapConnection, $move_id, $move_id, 'Deleted', true);
if ($auto_expunge) {
delete_move_expunge_from_all($move_id);
// sqimap_mailbox_expunge($imapConnection, $mailbox, true);
$delete_move_next_b, $delete_move_next_formATbottom;
echo "<tr><td align=right valign=top>\n".
- _("delete_move_next:") . "</td>\n".
+ _("Delete/Move/Next Buttons:") . "</td>\n".
"<td><input type=checkbox name=delete_move_next_ti";
if ($delete_move_next_t == 'on') {
echo " checked";
}
- echo '> <- ' . _("display at top").
+ echo '> ' . _("Display at top").
" <input type=checkbox name=delete_move_next_formATtopi";
if ($delete_move_next_formATtop == 'on') {
echo ' checked';
}
- echo '> <- ' . _("with move option") . '<br>';
+ echo '> ' . _("with move option") . '<br>';
echo '<input type=checkbox name=delete_move_next_bi';
if($delete_move_next_b != 'off') {
echo ' checked';
}
- echo '> <- ' . _("display at bottom") .
+ echo '> ' . _("Display at bottom") .
'<input type=checkbox name=delete_move_next_formATbottomi';
if ($delete_move_next_formATbottom != 'off') {
echo ' checked';
}
- echo '> <- ' . _("with move option") . '<br>'.
+ echo '> ' . _("with move option") . '<br>'.
"</td></tr>\n";
}
}
-?>
\ No newline at end of file
+?>