--- comment_mover.module.20061023 2006-09-01 05:05:12.000000000 -0400 +++ comment_mover.module 2006-11-17 16:49:54.000000000 -0500 @@ -393,25 +393,7 @@ function comment_mover_build_thread($edi // Strip the "/" from the end of the thread. $max = rtrim($max, '/'); - // Next, we increase this value by one. Note that we can't - // use 1, 2, 3, ... 9, 10, 11 because we order by string and - // 10 would be right after 1. We use 1, 2, 3, ..., 9, 91, - // 92, 93, ... instead. Ugly but fast. - $decimals = (string) substr($max, 0, strlen($max) - 1); - $units = substr($max, -1, 1); - if ($units) { - $units++; - } - else { - $units = 1; - } - - if ($units == 10) { - $units = '90'; - } - - // Finally, build the thread field for this new comment. - $thread = $decimals . $units .'/'; + $thread = int2vancode(vancode2int($max)+1) . '/'; } else { // This is comment with a parent comment: we increase @@ -439,19 +421,7 @@ function comment_mover_build_thread($edi $parent_depth = count(explode('.', $parent->thread)); $last = $parts[$parent_depth]; - // Next, we increase this value by one. Note that we can't - // use 1, 2, 3, ... 9, 10, 11 because we order by string and - // 10 would be right after 1. We use 1, 2, 3, ..., 9, 91, - // 92, 93, ... instead. Ugly but fast. - $decimals = (string)substr($last, 0, strlen($last) - 1); - $units = substr($last, -1, 1); - $units++; - if ($units == 10) { - $units = '90'; - } - - // Finally, build the thread field for this new comment. - $thread = $parent->thread .'.'. $decimals . $units .'/'; + $thread = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/'; } } @@ -464,14 +434,14 @@ function comment_mover_build_thread($edi */ function comment_mover_get_thread($parent) { if (isset($parent['cid'])) { - $query = "SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name , c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.thread FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d AND SUBSTRING(c.thread, 1, LENGTH('%s')) = '%s' AND c.cid != %d AND c.status = 0 GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread ORDER BY c.thread DESC"; + $query = "SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name , c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.thread FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d AND SUBSTRING(c.thread, 1, LENGTH('%s')) = '%s' AND c.cid != %d AND c.status = 0 GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread ORDER BY c.thread"; $depth = substr_count($parent['thread'], '.'); $thread = substr($parent['thread'], 0, strlen($parent['thread']) - 1); $result = db_query($query, $parent['nid'], $thread, $thread, $parent['cid']); } else { - $query = "SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name , c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.thread FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread ORDER BY c.thread DESC"; + $query = "SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name , c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.thread FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread ORDER BY c.thread"; $result = db_query($query, $parent['nid']); $depth = - 1; }