Index: trunk/lib/ACL.inc.php
===================================================================
--- trunk/lib/ACL.inc.php	(revision 188)
+++ trunk/lib/ACL.inc.php	(revision 189)
@@ -398,12 +398,12 @@
         }
         
-        // If $parent is null, use root object.
-        if (is_null($parent)) {
-            $parent = 'root';
+        // If $new_parent is null, use root object.
+        if (is_null($new_parent)) {
+            $new_parent = 'root';
         }
         
         // Ensure node and parent name aren't empty.
-        if ('' == trim($name) || '' == trim($parent)) {
-            $app->logMsg(sprintf('Cannot add node, parent (%s) or name (%s) missing.', $name, $parent), LOG_WARNING, __FILE__, __LINE__);
+        if ('' == trim($name) || '' == trim($new_parent)) {
+            $app->logMsg(sprintf('Cannot add node, parent (%s) or name (%s) missing.', $name, $new_parent), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
@@ -412,5 +412,5 @@
         $qid = $db->query("SELECT lft, rgt FROM $tbl WHERE name = '" . $db->escapeString($name) . "'");
         if (!list($lft, $rgt) = mysql_fetch_row($qid)) {
-            $app->logMsg(sprintf('Cannot delete nonexistant %s name: %s', $type, $name), LOG_NOTICE, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Cannot move nonexistant %s name: %s', $type, $name), LOG_NOTICE, __FILE__, __LINE__);
             return false;
         }
@@ -448,4 +448,5 @@
         $db->query("UPDATE $tbl SET lft = lft - $total_transversal_value WHERE lft > $rgt");
         $db->query("UPDATE $tbl SET rgt = rgt - $total_transversal_value WHERE rgt > $rgt");
+
         // Apply transformation to new parent rgt also.
         $new_parent_rgt = $new_parent_rgt > $rgt ? $new_parent_rgt - $total_transversal_value : $new_parent_rgt;
@@ -463,5 +464,4 @@
         $db->query("UPDATE $tbl SET rgt = rgt + $total_transversal_value WHERE rgt >= $new_parent_rgt AND $primary_key NOT IN ('" . join("','", $ids) . "')");
 
-        die;
         $app->logMsg(sprintf('Moved %s node %s to new parent %s.', $type, $name, $new_parent), LOG_DEBUG, __FILE__, __LINE__);
         return true;
Index: trunk/lib/App.inc.php
===================================================================
--- trunk/lib/App.inc.php	(revision 188)
+++ trunk/lib/App.inc.php	(revision 189)
@@ -561,5 +561,5 @@
         // SCREEN ACTION
         if ($this->getParam('log_screen_priority') && $priority <= $this->getParam('log_screen_priority')) {
-            echo "[{$event['date']}] [{$event['type']}] [{$event['file:line']}] [{$event['message']}]\n";
+            echo "[{$event['type']}] [{$event['message']}]\n";
         }
 
Index: trunk/lib/Auth_SQL.inc.php
===================================================================
--- trunk/lib/Auth_SQL.inc.php	(revision 188)
+++ trunk/lib/Auth_SQL.inc.php	(revision 189)
@@ -845,21 +845,5 @@
             $app->logMsg(sprintf('Password reset but notification failed, no email address for user %s (%s).', $user_data[$this->_params['db_primary_key']], $user_data[$this->_params['db_username_column']]), LOG_NOTICE, __FILE__, __LINE__);
         } else {
-            // Body for email.
-            $email_body = <<<EOF
-Hello {NAME},
-
-Your password at {SITE_NAME} has been reset. {REASON}
-Your new login information is:
-
-USERNAME: {USERNAME}
-PASSWORD: {PASSWORD}
-
-If you have any questions or concerns please reply to this email or visit the website below.
-
-Thank you,
-{SITE_NAME}
-{SITE_URL}/
-
-EOF;
+            // Send the new password in an email.
             $email = new Email(array(
                 'to' => $user_data['email'],
@@ -867,12 +851,13 @@
                 'subject' => sprintf('%s password change', $app->getParam('site_name'))
             ));
-            $email->setString($email_body);
+            $email->setTemplate('codebase/services/templates/email_reset_password.txt');
             $email->replace(array(
-                'site_name' => $app->getParam('site_name'),
-                'site_url' => $app->getParam('site_url'),
-                'name' => ('' != $user_data['first_name'] . $user_data['last_name'] ? $user_data['first_name'] . ' ' . $user_data['last_name'] : $user_data[$this->_params['db_username_column']]),
-                'username' => $user_data[$this->_params['db_username_column']],
-                'password' => $password,
-                'reason' => $reason,
+                'SITE_NAME' => $app->getParam('site_name'),
+                'SITE_URL' => $app->getParam('site_url'),
+                'SITE_EMAIL' => $app->getParam('site_email'),
+                'NAME' => ('' != $user_data['first_name'] . $user_data['last_name'] ? $user_data['first_name'] . ' ' . $user_data['last_name'] : $user_data[$this->_params['db_username_column']]),
+                'USERNAME' => $user_data[$this->_params['db_username_column']],
+                'PASSWORD' => $password,
+                'REASON' => ('' == trim($reason) ? '' : trim($reason) . ' '), // Add a space after the reason if it exists for better fromatting.
             ));
             $email->send();
Index: trunk/lib/Utilities.inc.php
===================================================================
--- trunk/lib/Utilities.inc.php	(revision 188)
+++ trunk/lib/Utilities.inc.php	(revision 189)
@@ -229,12 +229,12 @@
     switch ($where) {
     case 'start' :
-        return preg_replace(array(sprintf('/^.{4,}(.{%s})$/', $part1 + $part2), '/\s*\.{3,}\s*/'), array('...$1', '...'), $str);
+        return preg_replace(array(sprintf('/^.{4,}(.{%s})$/sU', $part1 + $part2), '/\s*\.{3,}\s*/sU'), array('...$1', '...'), $str);
         break;
     default :
     case 'middle' :
-        return preg_replace(array(sprintf('/^(.{%s}).{4,}(.{%s})$/', $part1, $part2), '/\s*\.{3,}\s*/'), array('$1...$2', '...'), $str);
+        return preg_replace(array(sprintf('/^(.{%s}).{4,}(.{%s})$/sU', $part1, $part2), '/\s*\.{3,}\s*/sU'), array('$1...$2', '...'), $str);
         break;    
     case 'end' :
-        return preg_replace(array(sprintf('/^(.{%s}).{4,}$/', $part1 + $part2), '/\s*\.{3,}\s*/'), array('$1...', '...'), $str);
+        return preg_replace(array(sprintf('/^(.{%s}).{4,}$/sU', $part1 + $part2), '/\s*\.{3,}\s*/sU'), array('$1...', '...'), $str);
         break;    
     }
@@ -273,5 +273,5 @@
 
 /*
-* Returns a human readable amount of time elapsed since the given unix timestamp.
+* Returns a human readable amount of time for the given amount of seconds.
 * 
 * 45 seconds
@@ -285,5 +285,5 @@
 *
 * @access   public
-* @param    int $time Unix timestamp of date to find elapsed from.
+* @param    int $seconds Seconds of time.
 * @param    string $max_unit Key value from the $units array.
 * @param    string $format Sprintf formatting string.
@@ -293,12 +293,6 @@
 * @since    23 Jun 2006 12:15:19
 */
-function timeElapsed($time, $max_unit=null, $format='%01.1f')
-{
-    if ($time <= time()) {
-        $elapsed = $time_diff = time() - $time;
-    } else {
-        $elapsed = $time_diff = $time - time();
-    }
-    
+function humanTime($seconds, $max_unit=null, $format='%01.1f')
+{
     // Units
     $units = array(
@@ -316,12 +310,13 @@
     $max_unit = isset($units[$max_unit]) ? $max_unit : 'decade';
 
+    $final_time = $seconds;
     foreach ($units as $k => $v) {
-        if ($max_unit != $k && $time_diff >= $v[0]) {
-            $elapsed = $time_diff / $v[0];
+        if ($max_unit != $k && $seconds >= $v[0]) {
+            $final_time = $seconds / $v[0];
             $last_unit = $k;
         }
     }
-    $elapsed = sprintf($format, $elapsed);
-    return sprintf('%s %s', $elapsed, (1 == $elapsed ? $units[$last_unit][1] : $units[$last_unit][2]));    
+    $final_time = sprintf($format, $final_time);
+    return sprintf('%s %s', $final_time, (1 == $final_time ? $units[$last_unit][1] : $units[$last_unit][2]));    
 }
 
