}
$indent_array = array();
if (!$thread_new) {
- $thread_new = array();
+ $thread_new = array();
}
/* looping through the parts of one message thread */
to get the indent level
*/
$level = 0;
- $spaces = 0;
+ $spaces = array();
+ $spaces_total = 0;
$indent = 0;
$fake = FALSE;
for ($k=1;$k<(count($thread_new[$i]))-1;$k++) {
}
if (isset($chars['41'])) { /* testing for ) */
$level = $level - $chars['41'];
- $spaces = 0;
+ $spaces[$level] = 0;
/* if we were faking lets stop, this portion
of the thread is over
*/
}
}
if (isset($chars['32'])) { /* testing for space */
- $spaces = $spaces + $chars['32'];
+ if (!isset($spaces[$level])) {
+ $spaces[$level] = 0;
+ }
+ $spaces[$level] = $spaces[$level] + $chars['32'];
+ }
+ for ($x=0;$x<=$level;$x++) {
+ if (isset($spaces[$x])) {
+ $spaces_total = $spaces_total + $spaces[$x];
+ }
}
- $indent = $level + $spaces;
+ $indent = $level + $spaces_total;
/* must have run into a message that broke the thread
so we are adjusting for that portion
*/
errors would occur
*/
$indent_array[$child] = abs($indent);
+ $spaces_total = 0;
}
}
return $indent_array;
$server_sort_array = 'no';
return $server_sort_array;
}
- $thread_temp = preg_split("//", $thread_list, -1, PREG_SPLIT_NO_EMPTY);
+ if (isset($thread_list)) {
+ $thread_temp = preg_split("//", $thread_list, -1, PREG_SPLIT_NO_EMPTY);
+ }
$char_count = count($thread_temp);
$counter = 0;
$thread_new = array();