Tetra-WebBBS Debugger 6.10

Contents of /home/zoetecnocampoco/public_html/cgi-bin/bbs/lib/webbbs_index.pl

    1- #<<<
    2- #######################################
    3- #    ---  Tetra-WebBBS  --- 
    4- # By:             tetrabb.com
    5- # Version:        6.10
    6- # Last modified:  2009-11-01
    7- # Copyright (c)   2006-2009
    8- # Website:        http://tetrabb.com
    9- # For more details see license.txt
   10- #
   11- # Core script:    webbbs_index.pl
   12- # Authors:        Rainer Libowski
   13- #                 Tarty
   14- # Derived from code by Darryl Burgdorf
   15- #######################################
   16- #>>>
   17- 
   18- sub WebBBS {
   19- $index_run = 1;
   20- &Parse_Form;
   21- if ( $FORM{'ResetConfig'} ) {
   22- my $filename = $FORM{'name'};
   23- $filename =~ s/[^\w\.\-\']/\+/g;
   24- $filename =~ tr/A-Z/a-z/;
   25- $filename = $UserProfileDir . '/' . $filename . '.txt';
   26- if ( -s $filename ) {
   27- my $pw_ok = $read5x->check_profile_password( 'username' => $FORM{'name'},
   28-                                              'password' => $FORM{'password'},
   29-                                              'file'     => $filename,
   30- );
   31- if ( !$pw_ok ) {
   32- print "Content-type: text/html\n\n";
   33- &Error( '9540', '9541' );
   34- exit;
   35- }
   36- }
   37- }
   38- 
   39- if ( ( $ENV{'REQUEST_METHOD'} =~ /post/i )
   40-      && (    ( $FORM{'KeySearch'} =~ /yes/i )
   41-           && ( !( $AllowSearch || $AllowQuickSearch ) )
   42-           && ( !$AdminRun ) )
   43-     )
   44- {
   45- $tbb->send_error_plain( "1600", "1601", '1700' );
   46- exit;
   47- }
   48- if ( ( $ENV{'REQUEST_METHOD'} =~ /post/i )
   49-      && (    ( length( $FORM{'Keywords'} ) > $MaxSearchLength )
   50-           || ( length( $FORM{'Author'} ) > $MaxSearchLength ) )
   51-     )
   52- {
   53- $tbb->send_error_plain( "1600", "1601", '1700' );
   54- exit;
   55- }
   56- 
   57- &Initialize_Data;
   58- 
   59- if (    ( $ENV{'DOCUMENT_URI'} && ( $cgiurl !~ /$ENV{'DOCUMENT_URI'}/ ) )
   60-      || ( $ENV{'QUERY_STRING'} =~ /quickinfo/i ) )
   61- {
   62- require 'webbbs_share.pl';
   63- &QuickInfo;
   64- }
   65- 
   66- eval ' &blog_index; ';
   67- 
   68- if (    ( !($UseFrames) && ( $ENV{'QUERY_STRING'} =~ /review=(\d+)/i ) )
   69-      || ( !($UseFrames) && ( $ENV{'QUERY_STRING'} =~ /rev=(\d+)/i ) )
   70-      || ( $ENV{'QUERY_STRING'} =~ /read=(\d+)/i ) )
   71- {
   72- $messagenumber = $1;
   73- require 'webbbs_read.pl';
   74- if ( $messagenumber < 1 ) { $messagenumber = $lastmessage; }
   75- if ( $FORM{'ListType'} =~ /Guestbook/ ) {
   76- &DisplayThread;
   77- }
   78- else {
   79- &DisplayMessage;
   80- }
   81- exit;
   82- }
   83- 
   84- if ($DisplayViews) {
   85- if ( $FORM{'ListType'} =~ /Guestbook/ ) {
   86- &LockOpen( COUNTLOCK, "$dir/countlist.lock" );
   87- unless ($NoCountLock) {
   88- &CountDBMWrite;
   89- }
   90- }
   91- else {
   92- &CountDBMRead;
   93- }
   94- }
   95- 
   96- require 'webbbs_share.pl';
   97- 
   98- @messages = ();
   99- if ( $FORM{'ListType'} =~ /UBB/ ) {
  100- foreach $message (@sortedmessages) {
  101- &FindStart($message);
  102- }
  103- }
  104- elsif ( $FORM{'ListType'} =~ /Alpha/ ) {
  105- foreach $message (@sortedmessages) {
  106- $sortsubject{$message} = $MessageList{$message};
  107- $sortsubject{$message} =~ s/^[^\|]*\|([^\|]*).*/$1/;
  108- $sortsubject{$message} =~ s/^$text{'1513'} //;
  109- $sortsubject{$message} =~ s/&pipe;/\|/g;
  110- $sortsubject{$message} =~ tr/A-Z/a-z/;
  111- }
  112- }
  113- if ( $ArchiveOnly && !( $FORM{'KeySearch'} ) ) {
  114- require 'webbbs_misc.pl';
  115- &Search;
  116- }
  117- &DisplayIndex;
  118- 
  119- reset 'A-Za-z';
  120- exit;
  121- } ## end sub WebBBS
  122- 
  123- sub DisplayIndex {
  124- 
  125- unless ( $ArchiveOnly || !($AllowNewThreads) || $SepPostFormIndex ) {
  126- $SpellCheckerMeta = 1;
  127- }
  128- &Header( "$boardname - $text{'0500'}", $HeaderFile );
  129- 
  130- unless ( $FORM{'KeySearch'} ) {
  131- $FORM{'KeySearch'} = "No";
  132- }
  133- 
  134- my $subnavbar = 'index';
  135- if ( $FORM{'KeySearch'} ne "No" ) {
  136- $subnavbar = '';
  137- }
  138- 
  139- ( $navbar_top, $navbar_bottom ) = $main::tbb->{'tbb_html'}->get_navbar_HTML( 'sub_navbar' => $subnavbar );
  140- unless ($TopNavbarNoPrint) {
  141- print "<div id='nb_top'>\n" . $navbar_top . "</div>\n";
  142- }
  143- 
  144- my $topinfo      = "<div id='ind_topinf'>\n<table>\n" . "<tr>\n<th colspan='2'>";
  145- my $topinfo_flat = "<div id='ind_topinf_flat'>\n<table>\n" . "<tr>\n<td>";
  146- if ( $FORM{'KeySearch'} ne "No" ) {
  147- $site_ListType = $FORM{'ListType'};
  148- }
  149- if (    ( $ArchiveOnly || ( $FORM{'KeySearch'} ne "No" ) )
  150-      && ( $FORM{'ListType'} !~ /Alpha/ )
  151-      && ( $FORM{'ListType'} !~ /Chrono/ ) )
  152- {
  153- $FORM{'ListType'} = "Chronologically, Reversed";
  154- $topinfo .= "$text{'0503'}";
  155- }
  156- 
  157- elsif ( $UseCookies
  158-         && ( $Cookies{'lastvisit'} ne $Cookies{'thisvisit'} ) )
  159- {
  160- $topinfo      .= $text{'0504'};
  161- $topinfo_flat .= $text{'0504'};
  162- if ( $FORM{'ResetConfig'} ) {
  163- $topinfo      .= ", $FORM{'name'}";
  164- $topinfo_flat .= ", $FORM{'name'}";
  165- }
  166- elsif ( $Cookies{'name'} ) {
  167- $topinfo      .= ", $Cookies{'name'}";
  168- $topinfo_flat .= ", $Cookies{'name'}" . '.';
  169- }
  170- $topinfo .= "<br>\n$text{'0505'}, ";
  171- $topinfo .= "<<placeholder>>";
  172- $topinfo .= " $text{'0509'}<br>\n($text{'0530'} ";
  173- $topinfo .= &PrintDate( $Cookies{'lastvisit'} ) . ')';
  174- }
  175- elsif (    $UseCookies
  176-         && $Cookies{'name'} )
  177- {
  178- $topinfo      .= $text{'0510'} . ', ' . $Cookies{'name'};
  179- $topinfo_flat .= $text{'0510'} . ', ' . $Cookies{'name'} . '.';
  180- }
  181- else {
  182- $topinfo      .= $text{'0510'};
  183- $topinfo_flat .= $text{'0510'};
  184- }
  185- $topinfo      .= "</th>\n</tr><tr>\n<td>";
  186- $topinfo_flat .= "</td>\n<td class='ar'>";
  187- if ($UseCookies) {
  188- $topinfo_flat .= "<<placeholder>>" . $text{'0506.1'};
  189- }
  190- $topinfo_flat .= "</td>\n</tr>\n</table>\n" . "</div>\n";
  191- $endday = $time + 60;
  192- if ( $FORM{'ListSize'} eq "Range" ) {
  193- if ( $FORM{'StartDateC'} < 1990 ) { $FORM{'StartDateC'} = 1990; }
  194- if ( $FORM{'EndDateC'} < $FORM{'StartDateC'} ) {
  195- $FORM{'EndDateC'} = $FORM{'StartDateC'};
  196- }
  197- $searchrange = "$FORM{'StartDateA'} $months[$FORM{'StartDateB'}] ";
  198- $searchrange .= "$FORM{'StartDateC'} $text{'0511'} $FORM{'EndDateA'} ";
  199- $searchrange .= "$months[$FORM{'EndDateB'}] $FORM{'EndDateC'}";
  200- $startday = &rangedate( $FORM{'StartDateB'} + 1, $FORM{'StartDateA'}, $FORM{'StartDateC'} - 1900 );
  201- $endday = &rangedate( $FORM{'EndDateB'} + 1, $FORM{'EndDateA'} + 1, $FORM{'EndDateC'} - 1900 );
  202- }
  203- elsif ( $FORM{'ListTime'} =~ /(\d+) ([$datematchstring]+)/ ) {
  204- $FORM{'ListTimeA'} = $1;
  205- $FORM{'ListTimeB'} = $2;
  206- if ( $FORM{'ListTimeB'} eq "$text{'0060'}" ) {
  207- $startday = ( $FORM{'ListTimeA'} * 3600 );
  208- }
  209- elsif ( $FORM{'ListTimeB'} eq "$text{'0061'}" ) {
  210- $startday = ( $FORM{'ListTimeA'} * 86400 );
  211- }
  212- elsif ( $FORM{'ListTimeB'} eq "$text{'0062'}" ) {
  213- $startday = ( $FORM{'ListTimeA'} * 604800 );
  214- }
  215- elsif ( $FORM{'ListTimeB'} eq "$text{'0063'}" ) {
  216- $startday = ( $FORM{'ListTimeA'} * 2635200 );
  217- }
  218- elsif ( $FORM{'ListTimeB'} eq "$text{'0064'}" ) {
  219- $startday = ( $FORM{'ListTimeA'} * 31557600 );
  220- }
  221- else {
  222- $FORM{'ListTime'} = "2 $text{'0062'}";
  223- $startday = 1209600;
  224- }
  225- }
  226- elsif ( $FORM{'ListTime'} eq "New Only" ) {
  227- if ( $Cookies{'lastmessage'} ) {
  228- $startday = int( $MessageList{ $Cookies{'lastmessage'} } ) + 1;
  229- }
  230- else {
  231- $startday = $time;
  232- }
  233- }
  234- 
  235- unless ($startday) { $startday = 500000000; }
  236- $totalpages = int( $MessageList{ $sortedmessages[0] } );
  237- $totalpages = ( $time - $totalpages );
  238- $totalpages = int( ( $totalpages / $startday ) + 1 );
  239- if ( $main::tbb->{'get'}->{'page'} =~ /^\d+$/i ) {
  240- unless ( $FORM{'ListTime'} eq "New Only" ) {
  241- $thispage = $main::tbb->{'get'}->{'page'};
  242- $endday   = $endday - ( ( $thispage - 1 ) * $startday );
  243- $startday = $startday * $thispage;
  244- }
  245- }
  246- my $paghead_html = '';
  247- if ( $FORM{'ListSize'} eq "Range" ) {
  248- $topinfo .= "$text{'0514'}<br>\n$searchrange\n";
  249- }
  250- elsif ( $ArchiveOnly || ( $startday eq 500000000 ) ) {
  251- $startday = ( $time - $startday );
  252- if ( $FORM{'KeySearch'} eq "No" ) {
  253- if ($ArchiveOnly) {
  254- $startday = $time;
  255- $topinfo .= "$text{'0514'}<br>\n";
  256- ( $mday, $mon, $year ) = ( localtime( int( $MessageList{ $sortedmessages[0] } ) + ( $HourOffset * 3600 ) ) )[ 3, 4, 5 ];
  257- $topinfo .= "$mday $months[$mon] " . ( $year + 1900 ) . " $text{'0511'} ";
  258- ( $mday, $mon, $year ) = ( localtime( int( $MessageList{ $sortedmessages[ @sortedmessages - 1 ] } ) + ( $HourOffset * 3600 ) ) )[ 3, 4, 5 ];
  259- $topinfo .= "$mday $months[$mon] " . ( $year + 1900 ) . "\n";
  260- }
  261- else { $topinfo .= "$text{'0512'}\n"; }
  262- }
  263- else {
  264- $topinfo .= "$text{'0513'}\n";
  265- }
  266- }
  267- else {
  268- $topinfo .= "$text{'0515'}<br>\n";
  269- if ( $FORM{'ListTime'} eq "New Only" ) {
  270- $topinfo .= "$text{'0516'}\n";
  271- }
  272- else {
  273- $startday = ( $time - $startday );
  274- if ( $thispage > 1 ) {
  275- $pageend      = ( $FORM{'ListTimeA'} * $thispage ) - $FORM{'ListTimeA'};
  276- $pagestart    = $FORM{'ListTimeA'} * $thispage;
  277- $paghead_html = "$pageend $text{'0526'} $pagestart $FORM{'ListTimeB'} $text{'0527'}";
  278- $topinfo .= $paghead_html;
  279- }
  280- else {
  281- $topinfo .= "$text{'0517'} $FORM{'ListTime'}";
  282- }
  283- }
  284- }
  285- my (@hitsonly);
  286- while ( $message = shift(@sortedmessages) ) {
  287- if (    ( $hits{$message} >= $startday )
  288-      && ( $hits{$message} <= $endday ) )
  289- {
  290- push( @hitsonly, $message );
  291- }
  292- else {
  293- delete $hits{$message};
  294- $DontUse{$message} = 1;
  295- }
  296- }
  297- @sortedmessages = @hitsonly;
  298- @hitsonly       = ();
  299- 
  300- if (    ( !( $thispage > 1 ) && ( !$IndTopinfNoPrint ) )
  301-      && ( $Cookies{'lastvisit'} ne $Cookies{'thisvisit'} ) )
  302- {
  303- my $placeholder      = '';
  304- my $placeholder_flat = '0 ';
  305- if ( $Cookies{'lastmessage'} < $lastmessage ) {
  306- $NewCount   = 0;
  307- $startcount = $Cookies{'lastmessage'} + 1;
  308- if ( $startcount < $firstmessage ) {
  309- $startcount = $firstmessage;
  310- }
  311- foreach $messagecount ( $startcount .. $lastmessage ) {
  312- if ( $hits{$messagecount} ) { $NewCount++; }
  313- 
  314- }
  315- my $new = &commas($NewCount);
  316- $placeholder .= $new . " ";
  317- $placeholder_flat = $new . ' ';
  318- if   ( $NewCount > 1 ) { $placeholder .= "$text{'0506'}"; }
  319- else                   { $placeholder .= "$text{'0507'}"; }
  320- }
  321- else {
  322- $placeholder .= "$text{'0508'}";
  323- }
  324- $topinfo      =~ s/<<placeholder>>/$placeholder/i;
  325- $topinfo_flat =~ s/<<placeholder>>/$placeholder_flat/i;
  326- }
  327- 
  328- $SearchString = "";
  329- 
  330- if ( !$main::tbb->{'conf'}->{'search'}->{'enable'} ) {
  331- if ( $FORM{'KeySearch'} eq "Yes" ) {
  332- 
  333- $FORM{'Keywords'} =~ tr/A-Z/a-z/;
  334- 
  335- $FORM{'Keywords'} =~ s/\s+/ /g;
  336- $FORM{'Keywords'} =~ s/^\s//;
  337- $FORM{'Keywords'} =~ s/\s$//;
  338- 
  339- $FORM{'Keywords'} =~ s/([^\w\s])/\\$1/g;
  340- @keywords = split( /\s+/, $FORM{'Keywords'} );
  341- $SearchString = "$text{'0518'} ";
  342- $SearchString .= "<span class=\"strong\">$FORM{'Boolean'}</span> ";
  343- $SearchString .= "$text{'0519'}:<br>\n";
  344- 
  345- foreach $keyword (@keywords) {
  346- $SearchString .= "<span class=\"strong\">$keyword</span>";
  347- $i++;
  348- unless ( $i == @keywords ) { $SearchString .= ", "; }
  349- }
  350- open( SEARCH, "$dir/searchterms.idx" );
  351- while (<SEARCH>) {
  352- if (/^(\d+) (.*)/) {
  353- $message = $1;
  354- $string  = $2;
  355- next unless $hits{$message};
  356- if (    ( int( $MessageList{$message} ) >= $startday )
  357-      && ( int( $MessageList{$message} ) <= $endday ) )
  358- {
  359- $value = 0;
  360- if ( $FORM{'Boolean'} eq $text{'0050'} ) {
  361- foreach $term (@keywords) {
  362- $test = ( $string =~ s/$term//ig );
  363- if ( $test < 1 ) {
  364- $value = 0;
  365- last;
  366- }
  367- else {
  368- $value = $value + $test;
  369- }
  370- }
  371- }
  372- elsif ( $FORM{'Boolean'} eq $text{'0051'} ) {
  373- foreach $term (@keywords) {
  374- $test = ( $string =~ s/$term//ig );
  375- $value = $value + $test;
  376- }
  377- }
  378- if ( $value > 0 ) {
  379- push( @keywordmatches, $message );
  380- }
  381- else {
  382- $DontUse{$message} = 1;
  383- }
  384- }
  385- else {
  386- $DontUse{$message} = 1;
  387- }
  388- }
  389- }
  390- close(SEARCH);
  391- @sortedmessages = ( sort { $a <=> $b } @keywordmatches );
  392- }
  393- else {
  394- if ( $FORM{'KeySearch'} eq "Author" ) {
  395- $SearchString = "$text{'0520'} ";
  396- $SearchString .= "<span class=\"strong\">"$FORM{'Author'}"</span>";
  397- foreach $message (@sortedmessages) {
  398- my ( $date, $sub, $poster, $prev, $next, $count, $admin, $ip ) = split( /\|/, $MessageList{$message} );
  399- if ( $poster =~ /$FORM{'Author'}/i ) {
  400- push( @keywordmatches, $message );
  401- }
  402- }
  403- @sortedmessages = ( sort { $a <=> $b } @keywordmatches );
  404- }
  405- elsif ( $FORM{'KeySearch'} eq "Domain" ) { &DisplayIndexAdmin3; }
  406- elsif ( $FORM{'KeySearch'} eq "All" ) {
  407- $SearchString = "$text{'0521'}";
  408- }
  409- }
  410- }
  411- $DisplayedMessages = @sortedmessages;
  412- $topinfo .= "</td><td align='right'>";
  413- unless ( $FORM{'ListType'} =~ /Compress/ ) {
  414- $topinfo .= &commas($DisplayedMessages) . " $text{'0522'} ";
  415- $topinfo .= &commas($TotalMessages) . " $text{'0523'}<br>\n";
  416- }
  417- 
  418- my %txt_mapper = ( "By Threads, Mixed"                         => '0612',
  419-                    "Chronologically"                           => '0601',
  420-                    "Chronologically, Reversed"                 => '0602',
  421-                    "Alphabetically"                            => '0603',
  422-                    "Alphabetically, Reversed"                  => '0604',
  423-                    "Compressed"                                => '0605',
  424-                    "Compressed, Reversed"                      => '0606',
  425-                    "Compressed, Mixed"                         => '0618',
  426-                    "Compressed, UBB"                           => '0619',
  427-                    "By Threads, UBB"                           => '0616',
  428-                    "Guestbook-Style, Threaded, UBB"            => '0617',
  429-                    "Guestbook-Style"                           => '0607',
  430-                    "Guestbook-Style, Reversed"                 => '0608',
  431-                    "Guestbook-Style, Threaded"                 => '0609',
  432-                    "Guestbook-Style, Alphabetically"           => '0624',
  433-                    "Guestbook-Style, Alphabetically, Reversed" => '0625',
  434-                    "Guestbook-Style, Threaded, Reversed"       => '0610',
  435-                    "Guestbook-Style, Threaded, Mixed"          => '0615',
  436-                    "Guestbook-Style, Compressed, UBB"          => '0623',
  437-                    "Guestbook-Style, Compressed"               => '0620',
  438-                    "Guestbook-Style, Compressed, Reversed"     => '0621',
  439-                    "Guestbook-Style, Compressed, Mixed"        => '0622',
  440-                    "By Threads, Reversed"                      => '0611',
  441- );
  442- 
  443- if ( defined $txt_mapper{ $FORM{'ListType'} } ) {
  444- $topinfo .= '(' . $text{ $txt_mapper{ $FORM{'ListType'} } } . ')';
  445- }
  446- else { $topinfo .= "($text{'0613'})"; }
  447- $topinfo .= "</td>\n</tr>\n</table>\n";
  448- if ($SearchString) {
  449- $SearchString =~ s/\\\\/BaCkSlAsH/g;
  450- $SearchString =~ s/\\//g;
  451- $SearchString =~ s/BaCkSlAsH/\\/g;
  452- if ( $browsable_archive || $IndTopinfNoPrint ) {
  453- $topinfo = "<div id='ind_topinf'><p>" . $SearchString . "</p>\n";
  454- }
  455- else {
  456- $topinfo .= "<p>$SearchString</p>\n";
  457- }
  458- }
  459- $topinfo .= "</div>\n";
  460- 
  461- my ( $pagination_top, $pagination_bottom );
  462- unless (    ( $FORM{'KeySearch'} ne "No" )
  463-          || ( $FORM{'ListTime'} eq "New Only" )
  464-          || ( $totalpages < 2 )
  465-          || ( $TotalMessages < 1 ) )
  466- {
  467- my $open_html = "<div class=\"ind_paginate\">" . $cust{'ind_paginate_s'} . "\n";
  468- unless ($thispage) { $thispage = 1; }
  469- if ($PaginationLength) {
  470- $PaginationLength = int($PaginationLength);
  471- my $make_odd = ( $PaginationLength % 2 ) ? 0 : 1;
  472- $PaginationLength += $make_odd;
  473- }
  474- if ( ( $PaginationLength < 3 ) || ( $PaginationLength > 25 ) ) {
  475- $PaginationLength = 7;
  476- }
  477- my $pag_ref = $basic->paginate( 'thispage'          => $thispage,
  478-                                 'total_pages'       => $totalpages,
  479-                                 'pagination_length' => $PaginationLength,
  480- );
  481- 
  482- my ( $pag_head_top, $pag_head_bottom, $pag_cnt );
  483- unless ($IndPaginateHeadlineNoPrint) {
  484- $pag_head_top    = "<span class='pag_head'>$paghead_html</span>\n";
  485- $pag_head_bottom = "<span class='pag_head'>$text{'0540'} $FORM{'ListTime'} $text{'0541'}</span>\n";
  486- $pag_cnt         = "<span class='pag_cnt'>$text{'1104'} $pag_ref->{'pagination_thispage'} $text{'1105'} $pag_ref->{'pagination_last'} </span>\n";
  487- }
  488- $pageurl = $AdminRun ? $adminurl : $cgiurl;
  489- my $pag_url = $pageurl . $BBSquery_short . 'md' . $QS2 . 'index' . $QS1 . 'page' . $QS2;
  490- 
  491- my $pag_html .= get_pagination_HTML( $pag_ref, $pag_url );
  492- 
  493- my $close_html .= $cust{'ind_paginate_e'} . "\n</div>\n";
  494- 
  495- $pagination_top    = $open_html . $pag_head_top . $pag_cnt . $pag_html . $close_html;
  496- $pagination_bottom = $open_html . $pag_head_bottom . $pag_cnt . $pag_html . $close_html;
  497- }
  498- 
  499- if (    ( $thispage > 1 )
  500-      || ($is_spider) )
  501- {
  502- print "<div id='pag_top'>$pagination_top</div>\n";
  503- }
  504- 
  505- print '<div id="glob_header">' . $cust{'glob_header_s'};
  506- if ( $tbb->{'get'}->{'pver'} ) { print "<br>tbb :: $main::version"; }
  507- if ($printboardname) {
  508- print "<h2>$boardname</h2>\n";
  509- }
  510- if ( $text{'0500'}
  511-      && ( !( ( $FORM{'ListType'} =~ /Compress/ ) && ( $CompressedList eq 'flat' ) ) ) )
  512- {
  513- print "<h3>$text{'0500'}</h3>\n";
  514- }
  515- print $cust{'glob_header_e'}, "\n</div>\n";
  516- if ($rebuildflag) {
  517- print "<p class=\"center\">\n", "<span class=\"small\">$text{'0525'}</span>\n</p>\n";
  518- }
  519- if ( $cust{'ind_c01'} ) {
  520- print "<div id=\"ind_c01\">\n" . $cust{'ind_c01'} . "\n</div>\n";
  521- }
  522- 
  523- if ( !( $thispage > 1 ) && ( !$IndTopinfNoPrint ) ) {
  524- if (    ( $FORM{'ListType'} =~ /Compress/ )
  525-      && ( $CompressedList eq 'flat' ) )
  526- {
  527- print $topinfo_flat;
  528- }
  529- else {
  530- print $topinfo;
  531- }
  532- }
  533- 
  534- if ( $cust{'ind_c02'} ) {
  535- print "<div id='ind_c02'>\n" . $cust{'ind_c02'} . "\n</div>\n";
  536- }
  537- $messagecount = 0;
  538- print "<div id=\"ind_msglist\">\n";
  539- 
  540- unless ( ( $thispage > 1 )
  541-          || (    ( $FORM{'ListType'} =~ /Compress/ )
  542-               && ( $CompressedList eq 'flat' ) )
  543-     )
  544- {
  545- 
  546- print $cust{'sticky'}, "\n";
  547- }
  548- 
  549- if ($AdminRun) {
  550- $DeleteSelect = 1;
  551- $ToBeDeleted  = "";
  552- print "<FORM METHOD='POST' ACTION=\"$adminurl$BBSquery", 'md', $QS2, "manage\"$BBStarget>\n";
  553- }
  554- unless (    ( $FORM{'ListType'} =~ /Guestbook/ )
  555-          && ( $FORM{'ListType'} !~ /Threaded/ )
  556-          && ( $FORM{'ListType'} !~ /Compressed/ ) )
  557- {
  558- if ( $IndexEntryLines eq "news" ) {
  559- print "<table>\n", "<tr>\n", "<th>$text{'1512'}</th>\n", "<th>$text{'1000'}</th>\n", "<th>$text{'1001'}</th>\n", "</tr>\n";
  560- }
  561- elsif (    ( $FORM{'ListType'} =~ /Compress/ )
  562-         && ( $CompressedList eq 'flat' ) )
  563- {
  564- print "<table id='ind_tbl'>\n", "<tr>\n", "<th colspan='3' class='subj'>$text{'0560'}</th>\n";
  565- $colspan_flat_index = 4;
  566- 
  567- unless ( $browsable_archive == 2 ) {
  568- print "<th style='text-align:center;'>$text{'0562'}</th>\n";
  569- $colspan_flat_index++;
  570- }
  571- if ( $DisplayViews == 1 ) {
  572- print "<th style='text-align:center;'>$text{'0563'}</th>\n";
  573- $colspan_flat_index++;
  574- }
  575- if ($UseCookies) {
  576- print "<th style='text-align:center;'>$text{'0564'}</th>\n";
  577- $colspan_flat_index++;
  578- }
  579- unless ( $browsable_archive == 2 ) {
  580- print "<th>$text{'0565'}</th>\n";
  581- $colspan_flat_index += 1;
  582- }
  583- print "</tr>\n";
  584- 
  585- unless ( $thispage > 1 ) {
  586- if ( $cust{'sticky'} ) {
  587- print "<tr><td colspan='", $colspan_flat_index, "'>", $cust{'sticky'}, "</td></tr>\n";
  588- }
  589- }
  590- 
  591- }
  592- else {
  593- print "<$ul_dl>\n";
  594- }
  595- }
  596- 
  597- %already = ();
  598- 
  599- if ( $FORM{'ListType'} =~ /Compress/ ) {
  600- while ( my $message = shift @sortedmessages ) {
  601- next if $already{$message};
  602- $message = &find_first_in_thread($message);
  603- next if $already{$message};
  604- if ( $browsable_archive == 2 ) {
  605- if ($message) {
  606- push( @messages, $message );
  607- $messagecount++;
  608- }
  609- 
  610- next;
  611- }
  612- $respcount   = 0;
  613- $respdate    = 0;
  614- $respmessage = 0;
  615- $showthread  = 0;
  616- $newcount    = 0;
  617- $firstnew    = 1000000000;
  618- &CompressList($message);
  619- if ( $showthread > 0 ) {
  620- push( @messages, $message );
  621- $messagecount++;
  622- $respcount{$message}   = $respcount;
  623- $respdate{$message}    = $respdate;
  624- $respmessage{$message} = $respmessage;
  625- $newcount{$message}    = $newcount;
  626- $firstnew{$message}    = $firstnew;
  627- }
  628- }
  629- 
  630- my %dupcheck = ();
  631- @messages = grep { $dupcheck{$_}++ == 0 } @messages;
  632- undef %dupcheck;
  633- 
  634- if ( $FORM{'ListType'} =~ /UBB/ ) {
  635- 
  636- @sortedmessages = sort ByUBB @messages;
  637- }
  638- elsif (    ( $FORM{'ListType'} =~ /Reversed/ )
  639-         || ( $FORM{'ListType'} =~ /Mixed/ ) )
  640- {
  641- @sortedmessages = sort { $b <=> $a } @messages;
  642- }
  643- elsif ($IndexCompressedAlphaSorted) {
  644- @sortedmessages = &alphasort_subject( \@messages );
  645- }
  646- else {
  647- @sortedmessages = sort { $a <=> $b } @messages;
  648- }
  649- foreach $message (@sortedmessages) {
  650- if ( $NotFirstEntry && ( $CompressedList ne 'flat' ) ) {
  651- my $adspacer = &get_adspacer($thread_count);
  652- if ($adspacer) {
  653- print $adspacer;
  654- }
  655- else {
  656- print "$ThreadSpacer";
  657- }
  658- }
  659- else { $NotFirstEntry = 1; }
  660- 
  661- $respcnt_html = '';
  662- unless ( $IndexSubjectOnly
  663-          || ( $browsable_archive == 2 ) )
  664- {
  665- $respcount{$message}--;
  666- $respcnt_html .= "<div class='ind_respcnt'>";
  667- 
  668- if ( $respcount{$message} == 0 ) {
  669- $respcnt_html .= "$text{'0550.1'}";
  670- }
  671- elsif ( $respcount{$message} == 1 ) {
  672- $respcnt_html .= "$respcount{$message} $text{'0550'}";
  673- }
  674- else {
  675- $respcnt_html .= "$respcount{$message} $text{'0551'}";
  676- }
  677- if ( $newcount{$message} > 0 ) {
  678- $respcnt_html .= " ($newcount{$message} $text{'0552'})";
  679- }
  680- if ( $respcount{$message} > 0 ) {
  681- $respcnt_html .= "<span class='ind_respcnt_latest'>$text{'0553.1'} " . &PrintDate( $respdate{$message} ) . "</span>";
  682- }
  683- 
  684- $respcnt_html .= "</div>\n";
  685- }
  686- 
  687- &PrintMessageDesc( $message, $IndexSubjectNoPrefix, $IndexSubjectOnly );
  688- 
  689- unless (    $IndexSubjectOnly
  690-          || ( $browsable_archive == 2 )
  691-          || ( $CompressedList eq 'flat' ) )
  692- {
  693- print $respcnt_html;
  694- }
  695- 
  696- }
  697- }
  698- elsif (    ( ( $FORM{'ListType'} =~ /Chrono/ ) || ( $FORM{'ListType'} =~ /Guestbook/ ) || ( $FORM{'ListType'} =~ /Alpha/ ) )
  699-         && ( $FORM{'ListType'} !~ /Thread/ ) )
  700- {
  701- if ( $FORM{'ListType'} =~ /Alpha/ ) {
  702- if ( $FORM{'ListType'} =~ /Reversed/ ) {
  703- foreach $key ( sort ByAlphaReversed @sortedmessages ) {
  704- push( @messages, $key );
  705- }
  706- }
  707- else {
  708- foreach $key ( sort ByAlpha @sortedmessages ) {
  709- push( @messages, $key );
  710- }
  711- }
  712- }
  713- else {
  714- if ( $FORM{'ListType'} =~ /Reversed/ ) {
  715- @messages = reverse(@sortedmessages);
  716- }
  717- else {
  718- @messages = @sortedmessages;
  719- }
  720- }
  721- foreach $message (@messages) {
  722- unless ( $DontUse{$message} ) {
  723- if ( $FORM{'ListType'} =~ /Guestbook/ ) {
  724- &PrintGuestbookDesc($message);
  725- }
  726- else {
  727- &PrintMessageDesc( $message, $IndexSubjectNoPrefix, $IndexSubjectOnly );
  728- }
  729- $messagecount++;
  730- }
  731- }
  732- }
  733- elsif (    ( $FORM{'ListType'} eq "By Threads" )
  734-         || ( $FORM{'ListType'} eq "Guestbook-Style, Threaded" ) )
  735- {
  736- foreach $message (@sortedmessages) {
  737- unless ( $already{$message} || $DontUse{$message} ) {
  738- if ($NotFirstEntry) {
  739- my $adspacer = &get_adspacer($thread_count);
  740- if ($adspacer) {
  741- print $adspacer;
  742- }
  743- else {
  744- print "$ThreadSpacer";
  745- }
  746- }
  747- else { $NotFirstEntry = 1; }
  748- &ThreadList( $message, $IndexSubjectNoPrefix, $IndexSubjectOnly );
  749- $messagecount++;
  750- }
  751- }
  752- }
  753- else {
  754- if ( $FORM{'ListType'} =~ /UBB/ ) {
  755- @messages = ();
  756- foreach $key ( sort ByUBB @sortedmessages ) {
  757- push( @messages, $key );
  758- }
  759- @reversedmessages = @messages;
  760- }
  761- else {
  762- @reversedmessages = reverse(@sortedmessages);
  763- }
  764- foreach $message (@reversedmessages) {
  765- unless ( $already{$message} || $DontUse{$message} ) {
  766- $date = $sub = $poster = $prev = $next = $count = $admin = $ip = "";
  767- ( $date, $sub, $poster, $prev, $next, $count, $admin, $ip ) =
  768-     split( /\|/, $MessageList{$message} );
  769- unless ( ( $MessageList{$prev} > 0 ) && !( $DontUse{$prev} ) ) {
  770- if ($NotFirstEntry) {
  771- my $adspacer = &get_adspacer($thread_count);
  772- if ($adspacer) {
  773- print $adspacer;
  774- }
  775- else {
  776- print "$ThreadSpacer";
  777- }
  778- }
  779- else { $NotFirstEntry = 1; }
  780- &ThreadList( $message, $IndexSubjectNoPrefix, $IndexSubjectOnly );
  781- $messagecount++;
  782- }
  783- }
  784- }
  785- }
  786- unless (    ( $FORM{'ListType'} =~ /Guestbook/ )
  787-          && ( $FORM{'ListType'} !~ /Threaded/ )
  788-          && ( $FORM{'ListType'} !~ /Compressed/ ) )
  789- {
  790- if ( $IndexEntryLines eq "news" ) {
  791- print "</table>\n";
  792- }
  793- elsif (    ( $FORM{'ListType'} =~ /Compress/ )
  794-         && ( $CompressedList eq 'flat' )
  795-         && $index_run )
  796- {
  797- print "</table>\n";
  798- }
  799- else {
  800- print "</$ul_dl>\n";
  801- }
  802- }
  803- if ($AdminRun) { &DisplayIndexAdmin4; }
  804- elsif ( $messagecount < 1 ) {
  805- print "<p class=\"center\">\n";
  806- if ( $FORM{'ListSize'} eq "Range" ) {
  807- print "$text{'0524'}";
  808- }
  809- elsif ( $ArchiveOnly and !( $FORM{'KeySearch'} ne "No" ) ) {
  810- print "$text{'0528'}";
  811- }
  812- else {
  813- if ( $FORM{'ListTime'} ) {
  814- print "$text{'0529'}";
  815- }
  816- else {
  817- print "$text{'0524'}";
  818- }
  819- }
  820- print "</p>\n";
  821- }
  822- print "</div>\n";
  823- if ( $cust{'ind_c03'} ) {
  824- print "<div id=\"ind_c03\">" . $cust{'ind_c03'} . "</div>\n";
  825- }
  826- 
  827- print "<div id='pag_bottom'>$pagination_bottom</div>\n";
  828- 
  829- if ( $cust{'ind_c04'} ) {
  830- print "<div id=\"ind_c04\">" . $cust{'ind_c04'} . "</div>\n";
  831- }
  832- 
  833- if ($main::fakeform) { print $main::fakeform; }
  834- unless ( $ArchiveOnly || !($AllowNewThreads) || $SepPostFormIndex ) {
  835- print '<div id="misc_msgform">', $cust{'misc_msgform_s'};
  836- require 'webbbs_form.pl';
  837- print "<a id='PostMessage' name='PostMessage'> </a>\n";
  838- &Print_Form;
  839- print $cust{'misc_msgform_e'} . "</div>\n";
  840- }
  841- &Footer( $FooterFile, "credits" );
  842- } ## end sub DisplayIndex
  843- 
  844- sub rangedate {
  845- ( $perp_mon, $perp_day, $perp_year ) = @_;
  846- %day_counts = ( 1, 0, 2, 31, 3, 59, 4, 90, 5, 120, 6, 151, 7, 181, 8, 212, 9, 243, 10, 273, 11, 304, 12, 334 );
  847- $perp_days = ( ( $perp_year - 69 ) * 365 ) + ( int( ( $perp_year - 69 ) / 4 ) );
  848- $perp_days += $day_counts{$perp_mon};
  849- if (    ( int( ( $perp_year - 68 ) / 4 ) eq ( ( $perp_year - 68 ) / 4 ) )
  850-      && ( $perp_mon > 2 ) )
  851- {
  852- $perp_days++;
  853- }
  854- $perp_days += $perp_day;
  855- $perp_days -= 366;
  856- $perp_secs = ( $perp_days * 86400 ) + 18000;
  857- $hour      = ( localtime($perp_secs) )[2];
  858- if ( $hour > 0 ) { $perp_secs -= 3600; }
  859- $perp_secs -= ( $HourOffset * 3600 );
  860- return $perp_secs;
  861- } ## end sub rangedate
  862- 
  863- sub ByUBB {
  864- $sortorder{$b} <=> $sortorder{$a};
  865- }
  866- 
  867- sub ByAlpha {
  868- $sortsubject{$a} cmp $sortsubject{$b};
  869- }
  870- 
  871- sub ByAlphaReversed {
  872- $sortsubject{$b} cmp $sortsubject{$a};
  873- }
  874- 
  875- sub CompressList {
  876- local (@threadresponses);
  877- local ( $date, $sub, $poster, $prev, $next, $count, $admin, $ip ) = "";
  878- ( $date, $sub, $poster, $prev, $next, $count, $admin, $ip ) =
  879-     split( /\|/, $MessageList{ $_[0] } );
  880- $respcount++;
  881- $threadviews += $CountList{ $_[0] };
  882- if ( $date > $respdate ) {
  883- ( $resppost, $respdate, $respposter, $respmessage ) = ( $_[0], $date, $poster, $_[0] );
  884- }
  885- unless ( $DontUse{ $_[0] } ) { $showthread = 1; }
  886- if ( $Cookies{'lastmessage'}
  887-      && ( $Cookies{'lastmessage'} < $_[0] ) )
  888- {
  889- $newcount++;
  890- if ( $firstnew > $_[0] ) { $firstnew = $_[0]; }
  891- 
  892- if ( $BlogView && ( !$prev ) ) {
  893- $newcount--;
  894- }
  895- }
  896- if ($next) {
  897- $next =~ s/^\s//gi;
  898- @threadresponses = split( / /, $next );
  899- foreach $threadresponse (@threadresponses) {
  900- next unless ( $threadresponse > $_[0] );
  901- if ( $MessageList{$threadresponse} > 0 ) {
  902- &CompressList($threadresponse);
  903- }
  904- }
  905- }
  906- $already{ $_[0] } = 1;
  907- } ## end sub CompressList
  908- 
  909- sub SetCookieData {
  910- unless ($CookieAlreadyRead) {
  911- &GetCookie($boardname);
  912- $Cookies{'UseFrames'} = "No";
  913- }
  914- return if ( $CookieReadOnly > 0 );
  915- if ( !$AllowUserPrefs ) { $Cookies{'listtype'} = "";
  916- $Cookies{'listtime'} = "";
  917- }
  918- unless ( $FORM{'ListType'} ) { $FORM{'ListType'} = $Cookies{'listtype'}; }
  919- unless ( $FORM{'ListTime'} ) { $FORM{'ListTime'} = $Cookies{'listtime'}; }
  920- unless ( $FORM{'password'} ) { $FORM{'password'} = $Cookies{'password'}; }
  921- if ( $FORM{'KeySearch'} eq "No" ) {
  922- $listtype = $FORM{'ListType'};
  923- $listtime = $FORM{'ListTime'};
  924- }
  925- unless ( $FORM{'ResetConfig'} ) {
  926- if ( !$name )        { $name        = $Cookies{'name'}; }
  927- if ( !$email )       { $email       = $Cookies{'email'}; }
  928- if ( !$message_url ) { $message_url = $Cookies{'linkurl'}; }
  929- if ( !$message_url_title ) {
  930- $message_url_title = $Cookies{'linkname'};
  931- }
  932- if ( !$image_url ) { $image_url = $Cookies{'imageurl'}; }
  933- }
  934- if ( !$listtype ) { $listtype = $Cookies{'listtype'}; }
  935- if ( !$listtime ) { $listtime = $Cookies{'listtime'}; }
  936- unless ( $Cookies{'lastvisit'} ) {
  937- $Cookies{'lastvisit'}   = $lastvisit = $todaydate;
  938- $Cookies{'lastmessage'} = $lastseen  = $lastmessage;
  939- $Cookies{'thisvisit'}   = $thisvisit = $todaydate;
  940- $Cookies{'thismessage'} = $thisseen  = $lastmessage;
  941- }
  942- if ( $Cookies{'timestamp'}
  943-      && ( ( $time - $Cookies{'timestamp'} ) > $SessionTime ) )
  944- {
  945- $Cookies{'lastvisit'}   = $lastvisit = $Cookies{'thisvisit'};
  946- $Cookies{'lastmessage'} = $lastseen  = $Cookies{'thismessage'};
  947- $Cookies{'thisvisit'}   = $thisvisit = $todaydate;
  948- $Cookies{'thismessage'} = $thisseen  = $lastmessage;
  949- }
  950- elsif (    ( $main::tbb->{'get'}->{'resetnew'} )
  951-         && ($AllowRemoveNew) )
  952- {
  953- open( NUMBER, "$dir/data.txt" );
  954- $lastmessage = <NUMBER>;
  955- close(NUMBER);
  956- $Cookies{'lastvisit'}   = $lastvisit = $todaydate;
  957- $Cookies{'lastmessage'} = $lastseen  = $lastmessage;
  958- $Cookies{'thisvisit'}   = $thisvisit = $todaydate + 1;
  959- $Cookies{'thismessage'} = $thisseen  = $lastmessage;
  960- }
  961- else {
  962- $lastvisit = $Cookies{'lastvisit'};
  963- $lastseen  = $Cookies{'lastmessage'};
  964- $thisvisit = $Cookies{'thisvisit'};
  965- $thisseen  = $Cookies{'thismessage'};
  966- }
  967- if (    ( $ENV{'DOCUMENT_URI'} && ( $cgiurl !~ /$ENV{'DOCUMENT_URI'}/ ) )
  968-      || ( $ENV{'QUERY_STRING'} =~ /quickinfo/i ) )
  969- {
  970- return;
  971- }
  972- &WriteCookie;
  973- } ## end sub SetCookieData
  974- 
  975- sub get_teaser_html {
  976- my $msgnum  = shift;
  977- my $file    = $dir . '/bbs' . int( $msgnum / 1000 ) . '/' . $msgnum;
  978- my $msg_ref = $read5x->read_message($file);
  979- my @lines   = split( /\n/, $msg_ref->{'text'} );
  980- @lines = grep { !/^<(br|p)>$AutoQuoteChar/i } @lines;
  981- my $teaser = join( ' ', @lines );
  982- unless ($teaser_html) {
  983- $teaser =~ s/<[^!>]*>//ig;
  984- $teaser =~ s/'/\'\;/g;
  985- }
  986- $teaser =~ s/<[^>]*$//i;
  987- my $foundendmark = 0;
  988- if ($teaser_check_endmark) {
  989- if ( $teaser =~ /^(.+?)(<(p|br)>\s*)?<!--\s*t_end\s*-->/is ) {
  990- $teaser       = $1;
  991- $foundendmark = 1;
  992- 
  993- my $start_divs = () = $teaser =~ /<div/ig;
  994- my $end_divs   = () = $teaser =~ /<\/div/ig;
  995- my $missing_divs = $start_divs - $end_divs;
  996- if ($missing_divs) {
  997- my $cnt = 0;
  998- while ( $missing_divs > $cnt ) {
  999- $teaser .= "</div>\n";
 1000- $cnt++;
 1001- }
 1002- }
 1003- }
 1004- }
 1005- unless ($foundendmark) {
 1006- if ( $teaser_length < length($teaser) ) {
 1007- $teaser = substr( $teaser, 0, $teaser_length );
 1008- $teaser =~ s/^(.+)\s+(.*)$/$1/;
 1009- $teaser .= ' ...';
 1010- }
 1011- }
 1012- if ($teaser_more_link) {
 1013- $teaser =~ s/<br>$//i;
 1014- $teaser .= "<span class='teaser_mlnk'><a href='" . $DestinationURL . $BBSquery . 'md' . $QS2 . 'read' . $QS1 . 'id' . $QS2 . $msgnum . "'>" . $text{'21100'} . "</a></span>\n";
 1015- }
 1016- if ( $teaser_image && $msg_ref->{'image_url'} ) {
 1017- my ( $image_url, undef ) = &find_pics_location( $msg_ref->{'image_url'}, 'UserPics' );
 1018- if ( ( $teaser_image == 1 ) && ($image_url) ) {
 1019- $teaser = "<img src='$image_url' class='teaser_ima' alt=''>\n" . $teaser;
 1020- }
 1021- elsif ( ( $teaser_image == 2 ) && ($image_url) ) {
 1022- my ($replace);
 1023- if ( $teaser =~ /<!--\s*t_image_l\s*-->/i ) {
 1024- $replace = "<img src='$image_url' class='teaser_ima' style='float:left;' alt=''>\n";
 1025- $teaser =~ s/<!--\s*t_image_l\s*-->/$replace/i;
 1026- }
 1027- elsif ( $teaser =~ /<!--\s*t_image_r\s*-->/i ) {
 1028- $replace = "<img src='$image_url' class='teaser_ima' style='float:right;' alt=''>\n";
 1029- $teaser =~ s/<!--\s*t_image_r\s*-->/$replace/i;
 1030- }
 1031- else {
 1032- $replace = "<img src='$image_url' class='teaser_ima' alt=''>\n";
 1033- $teaser =~ s/<!--\s*t_image\s*-->/$replace/i;
 1034- }
 1035- }
 1036- $teaser .= "\n<div class='clearall'></div>";
 1037- }
 1038- my $html = '';
 1039- if ($teaser) {
 1040- $html = "<div class='teaser'>" . $teaser . "\n</div>\n";
 1041- }
 1042- return $html;
 1043- } ## end sub get_teaser_html
 1044- 
 1045- sub quick_search {
 1046- if ( ( !$AllowQuickSearch ) && ( !$AdminRun ) ) {
 1047- $tbb->send_error_plain( "1600", "1601", '1700' );
 1048- exit;
 1049- }
 1050- $post->{'ListSize'}  = 'Recent';
 1051- $post->{'ListTimeA'} = '20';
 1052- $post->{'ListTimeB'} = $text{'0064'};
 1053- $post->{'KeySearch'} = 'Yes';
 1054- $post->{'Boolean'}   = $text{'0050'};
 1055- &WebBBS;
 1056- } ## end sub quick_search
 1057- 
 1058- sub get_pagination_HTML {
 1059- my ( $pag_ref, $pag_url ) = @_;
 1060- my $html = '';
 1061- 
 1062- if ( $pag_ref->{'pagination_prefix'} ) {
 1063- $html .= "<a href='$pag_url" . $pag_ref->{'pagination_first'} . "'>" . "<img src='$html_basedir/icons/first.png' alt='' title='$text{'1100'}'></a>\n";
 1064- if ( $pag_ref->{'pagination_backward'} ) {
 1065- $html .= "<a href='$pag_url" . $pag_ref->{'pagination_backward'} . "'>" . "<img src='$html_basedir/icons/backward.png' alt='' title='$text{'1106'}'></a>\n";
 1066- }
 1067- $html .= "<a href='$pag_url" . $pag_ref->{'pagination_previous'} . "'>" . "<img src='$html_basedir/icons/previous.png' alt='' title='$text{'1101'}'></a>\n";
 1068- }
 1069- 
 1070- my @loop = @{ $pag_ref->{'pagination_list'} };
 1071- while ( my $pag = shift @loop ) {
 1072- if ( $pag->{'is_thispage'} ) {
 1073- $html .= "<span class='strong'>" . $pag->{'id'} . "</span>\n";
 1074- }
 1075- else {
 1076- $html .= "<a href='$pag_url" . $pag->{'id'} . "'>" . $pag->{'id'} . "</a>\n";
 1077- }
 1078- }
 1079- 
 1080- if ( $pag_ref->{'pagination_suffix'} ) {
 1081- $html .= "<a href='$pag_url" . $pag_ref->{'pagination_next'} . "'>" . "<img src='$html_basedir/icons/next.png' alt='' title='$text{'1102'}'></a>\n";
 1082- if ( $pag_ref->{'pagination_forward'} ) {
 1083- $html .= "<a href='$pag_url" . $pag_ref->{'pagination_forward'} . "'>" . "<img src='$html_basedir/icons/forward.png' alt='' title='$text{'1107'}'></a>\n";
 1084- }
 1085- $html .= "<a href='$pag_url" . $pag_ref->{'pagination_last'} . "'>" . "<img src='$html_basedir/icons/last.png' alt='' title='$text{'1103'}'></a>\n";
 1086- }
 1087- 
 1088- return $html;
 1089- } ## end sub get_pagination_HTML
 1090- 
 1091- sub get_adspacer {
 1092- my $thread_cnt = shift;
 1093- my $frequency  = $cust{'adfrequency'};
 1094- if (    ( !$thread_cnt )
 1095-      || ( !$frequency )
 1096-      || ( $thread_cnt % $frequency ) )
 1097- {
 1098- return undef;
 1099- }
 1100- else {
 1101- my $ary_index = int( $thread_cnt / $frequency ) - 1;
 1102- if ( $cust{'adspacers'}->[$ary_index] ) {
 1103- if ( ref $cust{'adspacers'}->[$ary_index] eq 'ARRAY' ) {
 1104- return &pick_random_ad( $cust{'adspacers'}->[$ary_index] );
 1105- }
 1106- else {
 1107- return $cust{'adspacers'}->[$ary_index];
 1108- }
 1109- }
 1110- else {
 1111- return undef;
 1112- }
 1113- }
 1114- 
 1115- } ## end sub get_adspacer
 1116- 
 1117- sub pick_random_ad {
 1118- my $ary_ref = shift;
 1119- my $len     = @{$ary_ref};
 1120- return undef unless $len;
 1121- my $rand_index = int( rand($len) );
 1122- return $ary_ref->[$rand_index];
 1123- } ## end sub pick_random_ad
 1124- 
 1125- 1;