From: Michael M Slusarz Date: Wed, 12 Nov 2008 20:59:08 +0000 (-0700) Subject: Fix mimeIdArithmetic(). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=50b3f83354ae493d4eda65579d3b0d9a6d932cc0;p=horde.git Fix mimeIdArithmetic(). --- diff --git a/framework/Mime/lib/Horde/Mime.php b/framework/Mime/lib/Horde/Mime.php index 76adec0c0..e0e3e75e3 100644 --- a/framework/Mime/lib/Horde/Mime.php +++ b/framework/Mime/lib/Horde/Mime.php @@ -461,11 +461,9 @@ class Horde_Mime { $pos = strrpos($id, '.'); - /* Check for moving beyond the top of the message. */ - if (is_null($pos) && - ($id == '0') && - in_array($action, array('prev', 'up'))) { - return null; + /* Check the boundary case (ID = 0). */ + if (($pos === false) && ($id == '0')) { + return in_array($action, array('prev', 'up')) ? null : 1; } switch ($action) { @@ -475,13 +473,13 @@ class Horde_Mime case 'next': case 'prev': - $id = is_null($pos) + $id = ($pos === false) ? intval($id) + (($action == 'next') ? 1 : -1) : substr_replace($id, intval(substr($id, $pos + 1)) + (($action == 'next') ? 1 : -1), $pos + 1); break; case 'up': - $id = is_null($pos) + $id = ($pos === false) ? 0 : substr($id, 0, $pos); break;