# Create next/prev links $default_sort = ""; if (-e "$boardsdir/$currentboard.opt" ) { require "$boardsdir/$currentboard.opt"; } fopen(LISTS, "$boardsdir/$INFO{'board'}.txt"); @boardtopics = ; $threadcount = $#boardtopics + 1; fclose(LISTS); # Sort list if ($default_sort ne "") { @tmplist = @boardtopics; $date2 = $date; for($i=0;$i<$threadcount;$i++) { ($mnum, $msub, $mname, $dummy, $mdate, $mreplies, $dummy) = split( /\|/, $boardtopics[$i], 7 ); if ($default_sort eq "subject") { $tmplist[$i] = $msub."|".$boardtopics[$i]; } elsif ($default_sort eq "created") { fopen(FILE, "$datadir/$mnum.txt"); $tmpa = ; fclose(FILE); ($dummy, $dummy, $dummy, $date1, $dummy) = split(/\|/, $tmpa, 5); &calcdifference; $tmplist[$i] = $result."|".$boardtopics[$i]; } elsif ($default_sort eq "author") { $tmplist[$i] = $mname."|".$boardtopics[$i]; } elsif ($default_sort eq "last") { $date1 = $mdate; &calcdifference; $tmplist[$i] = $result."|".$boardtopics[$i]; } elsif ($default_sort eq "replies") { $tmplist[$i] = $mreplies."|".$boardtopics[$i]; } elsif ($default_sort eq "views") { if( -e "$datadir/$mnum.data" ) { fopen(FILE, "$datadir/$mnum.data"); $tmpa = ; fclose(FILE); ($views, $dummy) = split(/\|/, $tmpa, 2); $views = $views ? $views - 1 : 0; } else { $views = "0"; } $tmplist[$i] = $views."|".$boardtopics[$i]; } elsif ($default_sort eq "rating") { if( -e "$datadir/$mnum.data" ) { fopen(FILE, "$datadir/$mnum.data"); $tmpa = ; fclose(FILE); ($dummy, $dummy, $rate, $dummy) = split( /\|/, $tmpa, 4 ); if ($rate eq "") { $rate = "0"; } } else { $rate = "0"; } $tmplist[$i] = $rate."|".$boardtopics[$i]; } } if ($default_sort eq "subject" || $default_sort eq "author") { @sortlist = sort{uc($a) cmp uc($b)} (@tmplist); } elsif ($default_sort eq "created" || $default_sort eq "last") { @sortlist = sort{$a<=>$b} (@tmplist); } else { @sortlist = sort{$b<=>$a} (@tmplist); } for($i=0;$i<$threadcount;$i++) { ($dummy, $tmplist[$i]) = split(/\|/, $sortlist[$i], 2); $boardtopics[$i] = $tmplist[$i]."\n"; } chomp(@boardtopics); } ################################ ### START PREVIOUS/NEXT PLUS ### @threads = @boardtopics; $thisthreadpos = -1; $numthreads = @threads; #work out where this thread is in the list for ($i = 0; $i < $numthreads; $i++) { if ($threads[$i] =~ /^$viewnum/) { $thisthreadpos = $i; } } ($junk, $curtitle) = split(/\|/, $threads[$thisthreadpos]); #do we have a previous or next thread to link to? $previouspos = ($thisthreadpos - 1 >= 0) ? $thisthreadpos - 1 : -1; $nextpos = ($thisthreadpos + 1 < $numthreads) ? $thisthreadpos + 1 : -1; #construct previous link if ($previouspos >= 0) { ($previd, $prevtitle, $junk, $junk, $prevdate) = split(/\|/, $threads[$previouspos]); #should we abbreviate the thread title? if (length($prevtitle) > 20) { $prevtitle = substr($prevtitle, 0, 20) . '...'; } #make sure the link goes to the last page of the thread display fopen(FILE, "$datadir/$previd.txt"); @num_posts = ; fclose(FILE); $num_posts = @num_posts; $num_posts--; #is the previous thread unread? $dlp = &getlog($previd); $threaddate = stringtotime($prevdate); $prevnew = ( $max_log_days_old && $dlp < $threaddate && $username ne 'Guest' && &getlog("$INFO{'board'}--mark") < $threaddate ) ? 'previous_new' : 'previous'; $previouslink = qq~$txt{'768'}: $prevtitle  $prevtitle  «- ~; } else { $previouslink = ''; } #construct next link if ($nextpos > 0) { ($nextid, $nexttitle, $junk, $junk, $nextdate) = split(/\|/, $threads[$nextpos]); #should we abbreviate the thread title? if (length($nexttitle) > 15) { $nexttitle = substr($nexttitle, 0, 20) . '...'; } #make sure the link goes to the last page of the thread display fopen(FILE, "$datadir/$nextid.txt"); @num_posts = ; fclose(FILE); $num_posts = @num_posts; $num_posts--; #is the next thread unread? $dlp = &getlog($nextid); $threaddate = stringtotime($nextdate); $nextnew = ( $max_log_days_old && $dlp < $threaddate && $username ne 'Guest' && &getlog("$INFO{'board'}--mark") < $threaddate ) ? 'next_new' : 'next'; $nextlink = qq~ -»  $nexttitle  $txt{'767'}: $nexttitle~; } else { $nextlink = ''; } $nav = ''; $nav = qq~$previouslink $txt{'33'} $nextlink~; ### END PREVIOUS/NEXT PLUS ##### ################################