From: Michael M Slusarz Date: Mon, 9 Nov 2009 20:42:37 +0000 (-0700) Subject: Add Horde_Mime::isChild() X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3fc228ce520778d76f11acb9131c6439edc75e6b;p=horde.git Add Horde_Mime::isChild() --- diff --git a/framework/Mime/lib/Horde/Mime.php b/framework/Mime/lib/Horde/Mime.php index 9f9afce5e..211a2294d 100644 --- a/framework/Mime/lib/Horde/Mime.php +++ b/framework/Mime/lib/Horde/Mime.php @@ -669,6 +669,20 @@ class Horde_Mime } /** + * Determines if a given MIME ID lives underneath a base ID. + * + * @param string $base The base MIME ID. + * @param string $id The MIME ID to query. + * + * @return boolean Whether $id lives underneath $base. + */ + static public function isChild($base, $id) + { + return ((($base == 0) && ($id != 0)) || + strpos(strval($id), strval($base)) === 0); + } + + /** * Scans $input for uuencoded data and converts it to unencoded data. * * @param string $input The input data