From 7e818af01688ddff09d0fbc310b112d04270f94e Mon Sep 17 00:00:00 2001 From: jmunro Date: Sun, 6 Oct 2002 23:29:14 +0000 Subject: [PATCH] fix for prev/next for those poor souls not using server side sorting. Just because sort=6 does not mean that the next index will be sequential. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3781 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/read_body.php | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/src/read_body.php b/src/read_body.php index d9a7fbe7..fca049e6 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -52,20 +52,14 @@ function findNextMessage($passed_id) { } } } else { - if ($sort == 6) { - if ($passed_id != 1) { - $result = $passed_id - 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; - } + 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; } } } @@ -95,21 +89,14 @@ function findPreviousMessage($numMessages, $passed_id) { } } } else { - if ($sort == 6) { - if ($passed_id != $numMessages) { - $result = $passed_id + 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)) { - //echo $msort[$key]; /* Why again were we echoing here? */ - $result = $msgs[$key]['ID']; - break; - } + 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; } } } -- 2.25.1