Index: trunk/lib/App.inc.php
===================================================================
--- trunk/lib/App.inc.php	(revision 72)
+++ trunk/lib/App.inc.php	(revision 84)
@@ -343,5 +343,5 @@
 
     /**
-     * Add a message to the string globalmessage, which is printed in the header.
+     * Add a message to the session, which is printed in the header.
      * Just a simple way to print messages to the user.
      *
@@ -856,11 +856,20 @@
     }
 
-    /**
-     * Redirects a user by calling the App::dieURL(). It will use:
-     * 1. the stored boomerang URL, it it exists
-     * 2. the referring URL, it it exists.
-     * 3. an empty string, which will force App::dieURL to use the default URL.
-     */
-    function dieBoomerangURL($id=null, $carry_args=null)
+    /*
+    * Redirects a user by calling App::dieURL(). It will use:
+    * 1. the stored boomerang URL, it it exists
+    * 2. a specified $default_url, it it exists
+    * 3. the referring URL, it it exists.
+    * 4. redirect_home_url configuration variable.
+    *
+    * @access   public
+    * @param    string  $id             Identifier for this script.
+    * @param    mixed   $carry_args     Additional arguments to carry in the URL automatically (see App::oHREF()).
+    * @param    string  $default_url    A default URL if there is not a valid specified boomerang URL.
+    * @return   bool                    False if the session is not running. No return otherwise.
+    * @author   Quinn Comendant <quinn@strangecode.com>
+    * @since    31 Mar 2006 19:17:00
+    */
+    function dieBoomerangURL($id=null, $carry_args=null, $default_url=null)
     {
         if (!isset($this) || !is_a($this, 'App') && !is_subclass_of($this, 'App')) {
@@ -883,4 +892,7 @@
             // Delete stored boomerang.
             $this->deleteBoomerangURL($id);
+        } else if (isset($default_url)) {
+            $url = $default_url;
+        }
         } else if (!refererIsMe()) {
             // Ensure that the redirecting page is not also the referrer.
@@ -893,6 +905,5 @@
         }
 
-
-        // A redirection will never happen immediatly twice.
+        // A redirection will never happen immediately twice.
         // Set the time so ensure this doesn't happen.
         $_SESSION[$this->app]['boomerang']['time'] = time();
@@ -916,5 +927,5 @@
             return false;
         }
-        // A redirection will never happen immediatly after setting the boomerangURL.
+        // A redirection will never happen immediately after setting the boomerangURL.
         // Set the time so ensure this doesn't happen. See App::validBoomerangURL for more.
 
Index: trunk/lib/NodeHeirarchy.inc.php
===================================================================
--- trunk/lib/NodeHeirarchy.inc.php	(revision 72)
+++ trunk/lib/NodeHeirarchy.inc.php	(revision 84)
@@ -342,5 +342,5 @@
      * @return string   The parents as an array of serialized node identifiers.
      */
-    function getParents($child_type=null, $child_id=null)
+    function getParents($child_type=null, $child_id=null, $type_constraint=null, $order='')
     {
         if (!isset($child_type) || !isset($child_id)) {
@@ -352,4 +352,12 @@
                 return false;
             }
+        }
+
+        $in_clause = '';
+        if (isset($type_constraint)) {
+            if (!is_array($type_constraint)) {
+                $type_constraint = array($type_constraint);
+            }
+            $in_clause = "AND parent_type IN ('" . join("','", array_map('addslashes', $type_constraint)) . "')";
         }
 
@@ -359,4 +367,6 @@
             WHERE child_type = '" . addslashes($child_type) . "'
             AND child_id = '" . addslashes($child_id) . "'
+            $in_clause
+            " . addslashes($order) . "
         ");
 
Index: trunk/lib/Utilities.inc.php
===================================================================
--- trunk/lib/Utilities.inc.php	(revision 72)
+++ trunk/lib/Utilities.inc.php	(revision 84)
@@ -192,5 +192,5 @@
 
 /**
- * Encodes an email into a user (at) domain (dot) com format.
+ * Encodes an email into a "user at domain dot com" format.
  *
  * @access  public
@@ -205,4 +205,33 @@
     $replace = array($at, $dot);
     return preg_replace($search, $replace, $email);
+}
+
+/**
+ * Turns "a really long string" into "a rea...string"
+ *
+ * @access  public
+ * @param   string  $str    Input string
+ * @param   int     $len    Maximum string length.
+ * @param   string  $where  Where to cut the string. One of: 'start', 'middle', or 'end'.
+ * @return  string          Truncated output string
+ * @author  Quinn Comendant <quinn@strangecode.com>
+ * @since   29 Mar 2006 13:48:49
+ */
+function truncate($str, $len, $where='middle')
+{
+    $part1 = floor(($len - 3) / 2);
+    $part2 = ceil(($len - 3) / 2);
+    switch ($where) {
+    case 'start' :
+        return preg_replace(array(sprintf('/^.{4,}(.{%s})$/', $part1 + $part2), '/\s*\.{3,}\s*/'), array('...$1', '...'), $str);
+        break;
+    default :
+    case 'middle' :
+        return preg_replace(array(sprintf('/^(.{%s}).{4,}(.{%s})$/', $part1, $part2), '/\s*\.{3,}\s*/'), array('$1...$2', '...'), $str);
+        break;    
+    case 'end' :
+        return preg_replace(array(sprintf('/^(.{%s}).{4,}$/', $part1 + $part2), '/\s*\.{3,}\s*/'), array('$1...', '...'), $str);
+        break;    
+    }
 }
 
