This commit has been accessed 619 times via Git panel.
commit 8c3b31811412bf444b622dfe93eb3ccc9ba54834
tree 265e63cc4f2ebbde8dd785f61619969c659893a0
parent 7ee2c8c1f3bc3e5a61cbcec1f7bb348b02487b5e
author Engels Antonio <engels@majcms.org> 1297789180 +0800
committer Engels Antonio <engels@majcms.org> 1297789180 +0800
Optimize prev msg and next msg determination
diff --git a/read.php b/read.php
index 9550ecf..0be4a2e 100644
--- a/read.php
+++ b/read.php
@@ -46,14 +46,10 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$mbox_sort = imap_sort($mbox,"SORTARRIVAL",1);
- foreach ($mbox_sort as $mbox_row => $mbox_num) {
+ $mbox_row = array_search($msgno, $mbox_sort);
- if ($msgno == $mbox_num) {
-
- $mbox_row_prev = $mbox_row - 1;
- $mbox_row_next = $mbox_row + 1;
- }
- }
+ $mbox_row_prev = $mbox_row - 1;
+ $mbox_row_next = $mbox_row + 1;
$msgno_next = $mbox_sort[$mbox_row_prev];
$msgno_prev = $mbox_sort[$mbox_row_next];
tree 265e63cc4f2ebbde8dd785f61619969c659893a0
parent 7ee2c8c1f3bc3e5a61cbcec1f7bb348b02487b5e
author Engels Antonio <engels@majcms.org> 1297789180 +0800
committer Engels Antonio <engels@majcms.org> 1297789180 +0800
Optimize prev msg and next msg determination
diff --git a/read.php b/read.php
index 9550ecf..0be4a2e 100644
--- a/read.php
+++ b/read.php
@@ -46,14 +46,10 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$mbox_sort = imap_sort($mbox,"SORTARRIVAL",1);
- foreach ($mbox_sort as $mbox_row => $mbox_num) {
+ $mbox_row = array_search($msgno, $mbox_sort);
- if ($msgno == $mbox_num) {
-
- $mbox_row_prev = $mbox_row - 1;
- $mbox_row_next = $mbox_row + 1;
- }
- }
+ $mbox_row_prev = $mbox_row - 1;
+ $mbox_row_next = $mbox_row + 1;
$msgno_next = $mbox_sort[$mbox_row_prev];
$msgno_prev = $mbox_sort[$mbox_row_next];