From 2b69f705fbcf42b54f247375cd88f19f30d0345c Wed, 10 Aug 2011 19:04:37 +0200
From: Bram Goffings <bramgoffings@gmail.com>
Date: Wed, 10 Aug 2011 19:04:26 +0200
Subject: [PATCH] vancode

diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index c0d7a3a..3a4725a 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1497,7 +1497,7 @@
         // Strip the "/" from the end of the thread.
         $max = rtrim($max, '/');
         // Finally, build the thread field for this new comment.
-        $thread = int2vancode(vancode2int($max) + 1) . '/';
+        $thread = comment_int2vancode(comment_vancode2int($max) + 1) . '/';
       }
       else {
         // This is a comment with a parent comment, so increase the part of the
@@ -1515,7 +1515,7 @@
 
         if ($max == '') {
           // First child of this parent.
-          $thread = $parent->thread . '.' . int2vancode(0) . '/';
+          $thread = $parent->thread . '.' . comment_int2vancode(0) . '/';
         }
         else {
           // Strip the "/" at the end of the thread.
@@ -1525,7 +1525,7 @@
           $parent_depth = count(explode('.', $parent->thread));
           $last = $parts[$parent_depth];
           // Finally, build the thread field for this new comment.
-          $thread = $parent->thread . '.' . int2vancode(vancode2int($last) + 1) . '/';
+          $thread = $parent->thread . '.' . comment_int2vancode(comment_vancode2int($last) + 1) . '/';
         }
       }
 
@@ -2447,7 +2447,8 @@
  *
  * Consists of a leading character indicating length, followed by N digits
  * with a numerical value in base 36. Vancodes can be sorted as strings
- * without messing up numerical order.
+ * without messing up numerical order. Vancode is a drupalism. See
+ * http://drupal.org/node/48239 for more information.
  *
  * It goes:
  * 00, 01, 02, ..., 0y, 0z,
@@ -2455,7 +2456,7 @@
  * 2100, 2101, ..., 2zzy, 2zzz,
  * 31000, 31001, ...
  */
-function int2vancode($i = 0) {
+function comment_int2vancode($i = 0) {
   $num = base_convert((int) $i, 10, 36);
   $length = strlen($num);
 
@@ -2465,7 +2466,7 @@
 /**
  * Decode vancode back to an integer.
  */
-function vancode2int($c = '00') {
+function comment_vancode2int($c = '00') {
   return base_convert(substr($c, 1), 36, 10);
 }
 
