X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=2e1f99872bed384b661570278f8c4041d3d8f780;hb=0880efc9bde776d6aba642cc0fceaedbd6578fe5;hp=e9a6dcfd98f378f0810a399d8b3c5af998960336;hpb=39de750f7ebb151f2a03db2e9f0304b4d9b90c1b;p=squirrelmail.git diff --git a/src/read_body.php b/src/read_body.php index e9a6dcfd..2e1f9987 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -1,31 +1,35 @@ $value) { - if ($passed_id == $value) { - if ($key == $count) { - break; - } - $result = $server_sort_array[$key + 1]; - break; - } - } +function findNextMessage($uidset,$passed_id='backwards') { + if (!is_array($uidset)) { + return -1; + } + if ($passed_id=='backwards' || !is_array($uidset)) { // check for backwards compattibilty gpg plugin + $passed_id = $uidset; + } + $result = sqm_array_get_value_by_offset($uidset,$passed_id,1); + if ($result === false) { + return -1; } else { - if (is_array($msort)) { - for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) { - if ($passed_id == $msgs[$key]['ID']) { - next($msort); - $key = key($msort); - if (isset($key)){ - $result = $msgs[$key]['ID']; - break; - } - } - } - } + return $result; } - return $result; } /** @@ -78,60 +60,46 @@ function findNextMessage($passed_id) { * @param int $passed_id The current message UID * @return the index of the next valid message from the array */ -function findPreviousMessage($numMessages, $passed_id) { - global $msort, $sort, $msgs, - $thread_sort_messages, - $allow_server_sort, $server_sort_array; - $result = -1; - if (!is_array($server_sort_array)) { - $thread_sort_messages = 0; - $allow_server_sort = FALSE; - } - if ($thread_sort_messages || $allow_server_sort ) { - foreach($server_sort_array as $key=>$value) { - if ($passed_id == $value) { - if ($key != 0) { - $result = $server_sort_array[$key - 1]; - } - break; - } - } + +function findPreviousMessage($uidset, $passed_id) { + if (!is_array($uidset)) { + return -1; + } + $result = sqm_array_get_value_by_offset($uidset,$passed_id,-1); + if ($result === false) { + return -1; } else { - if (is_array($msort)) { - for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) { - if ($passed_id == $msgs[$key]['ID']) { - prev($msort); - $key = key($msort); - if (isset($key)) { - $result = $msgs[$key]['ID']; - break; - } - } - } - } + return $result; } - return $result; } /** * Displays a link to a page where the message is displayed more * "printer friendly". * @param string $mailbox Name of current mailbox - * @param int $passed_id + * @param int $passed_id */ function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) { - global $javascript_on, $color; + global $javascript_on, $show_html_default; - $params = '?passed_ent_id=' . $passed_ent_id . + /* hackydiehack */ + if( !sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET) ) { + $view_unsafe_images = false; + } else { + $view_unsafe_images = true; + } + $params = '?passed_ent_id=' . urlencode($passed_ent_id) . '&mailbox=' . urlencode($mailbox) . - '&passed_id=' . $passed_id; + '&passed_id=' . urlencode($passed_id) . + '&view_unsafe_images='. (bool) $view_unsafe_images . + '&show_html_default=' . $show_html_default; $print_text = _("View Printable Version"); $result = ''; /* Output the link. */ if ($javascript_on) { - $result = '