Tetra-WebBBS Debugger 6.10

Contents of /home/zoetecnocampoco/public_html/cgi-bin/bbs/lib/webbbs_read.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_read.pl
   12- # Authors:        Rainer Libowski
   13- #                 Tarty
   14- # Derived from code by Darryl Burgdorf
   15- #######################################
   16- #>>>
   17- 
   18- sub WebBBS {
   19- }
   20- 
   21- sub startup_read {
   22- $messagenumber = $tbb->{'get'}->{'id'};
   23- my $filelocation = $data_basedir . $data_subdir . "/bbs" . int( $messagenumber / 1000 ) . '/' . $messagenumber;
   24- if ( !-s $filelocation ) {
   25- if ($archive_URL) {
   26- my ($archive_redirect);
   27- my ( $qs0, $qs1, $qs2 );
   28- if ($SearchFriendlyURLs) {
   29- $qs0 = $qs1 = $qs2 = '/';
   30- }
   31- else {
   32- $qs0 = '?';
   33- $qs1 = ';';
   34- $qs2 = '=';
   35- }
   36- $archive_redirect = $archive_URL . $qs0 . 'md' . $qs2 . 'read' . $qs1 . 'id' . $qs2 . $messagenumber;
   37- print "Status: 301 Moved Permanently\n";
   38- print "Location: $archive_redirect\n\n";
   39- exit;
   40- }
   41- else {
   42- &Initialize_Data;
   43- &Error( "9100", "9101" );
   44- exit;
   45- }
   46- }
   47- &Initialize_Data;
   48- 
   49- if ( $SFU_subject && $SFU_redirects ) {
   50- my ( undef, $subject ) = ( split( /\|/, $MessageList{$messagenumber} ) )[ 0 .. 1 ];
   51- my $sbj      = $tbb->SFU_link_extension($subject);
   52- my $sbj_pure = $sbj . $SFU_pseudo_fileextension;
   53- $sbj_pure =~ s/\/+$//g;
   54- 
   55- if (    ( !$tbb->{'get'}->{'sbj'} )
   56-      || ( $tbb->{'get'}->{'sbj'} ne $sbj_pure ) )
   57- {
   58- my $redirect    = $ENV{'SCRIPT_NAME'} . $QS0;
   59- my %query_items = %{ $tbb->{'get'} };
   60- if ( $is_spider && $query_items{'page'} ) {
   61- delete $query_items{'page'};
   62- }
   63- delete $query_items{'sbj'};
   64- for ( 'page', 'md', 'id' ) {
   65- next unless $query_items{$_};
   66- $redirect .= $_ . $QS2 . $query_items{$_} . $QS1;
   67- delete $query_items{$_};
   68- }
   69- for ( sort keys %query_items ) {
   70- next unless $query_items{$_};
   71- $redirect .= $_ . $QS2 . $query_items{$_} . $QS1;
   72- }
   73- $redirect .= 'sbj' . $QS2 . $sbj . $SFU_pseudo_fileextension;
   74- 
   75- print "Content-type: text/html\n";
   76- print "Status: 301 Moved Permanently\n";
   77- print "Location: $redirect\n\n";
   78- 
   79- &MessageDBM_close();
   80- exit;
   81- }
   82- }
   83- 
   84- if ($DisplayViews) {
   85- &LockOpen( COUNTLOCK, "$dir/countlist.lock" );
   86- unless ($NoCountLock) {
   87- &CountDBMWrite;
   88- }
   89- }
   90- require 'webbbs_share.pl';
   91- 
   92- if ( $tbb->{'get'}->{'smd'} ) {
   93- $messagenumber = '';
   94- if ( $tbb->{'get'}->{'smd'} eq 'prev' ) {
   95- my @older = grep { $_ < $tbb->{'get'}->{'id'} } keys %MessageList;
   96- @older = sort { $b <=> $a } @older;
   97- if (@older) {
   98- $messagenumber = $older[0];
   99- undef @older;
  100- }
  101- }
  102- elsif ( $tbb->{'get'}->{'smd'} eq 'next' ) {
  103- my @younger = grep { $_ > $tbb->{'get'}->{'id'} } keys %MessageList;
  104- @younger = sort { $a <=> $b } @younger;
  105- if (@younger) {
  106- $messagenumber = $younger[0];
  107- undef @younger;
  108- }
  109- }
  110- elsif ( $tbb->{'get'}->{'smd'} eq 'prevtop' ) {
  111- my @older = grep { $_ < $tbb->{'get'}->{'id'} } keys %MessageList;
  112- @older = sort { $b <=> $a } @older;
  113- while ( my $id = shift @older ) {
  114- my ( undef, undef, undef, $prev ) = ( split( /\|/, $MessageList{$id} ) )[ 0 .. 3 ];
  115- next if $prev;
  116- $messagenumber = $id;
  117- undef @older;
  118- }
  119- }
  120- elsif ( $tbb->{'get'}->{'smd'} eq 'nexttop' ) {
  121- my @younger = grep { $_ > $tbb->{'get'}->{'id'} } keys %MessageList;
  122- @younger = sort { $a <=> $b } @younger;
  123- while ( my $id = shift @younger ) {
  124- my ( undef, undef, undef, $prev ) = ( split( /\|/, $MessageList{$id} ) )[ 0 .. 3 ];
  125- next if $prev;
  126- $messagenumber = $id;
  127- undef @younger;
  128- }
  129- }
  130- 
  131- if ( !$messagenumber ) {
  132- $tbb->send_error_plain( "81010", "81011" );
  133- exit;
  134- }
  135- }
  136- 
  137- if ( $messagenumber < 1 ) { $messagenumber = $lastmessage; }
  138- if ( $FORM{'ListType'} =~ /Guestbook/ ) {
  139- &DisplayThread;
  140- }
  141- else {
  142- &DisplayMessage;
  143- }
  144- } ## end sub startup_read
  145- 
  146- sub DisplayMessage {
  147- unless ( ( $ArchiveOnly || ( !($AllowResponses) ) ) || $SepPostFormRead ) {
  148- $SpellCheckerMeta = 1;
  149- }
  150- $subdir = "bbs" . int( $messagenumber / 1000 );
  151- open( FILE, "$dir/$subdir/$messagenumber" ) || &Error( "9100", "9101" );
  152- @message = <FILE>;
  153- close(FILE);
  154- if ($DisplayViews) {
  155- unless ( $CountList{$messagenumber} ) {
  156- $CountList{$messagenumber} = 0;
  157- }
  158- $CountList{$messagenumber}++;
  159- }
  160- ( $admin, $subject, $poster, $email, $date, $image_url, $linkname, $linkurl ) = "";
  161- my $startup = 0;
  162- my $line;
  163- my ( $verified_ref, $poster_id );
  164- foreach $line (@message) {
  165- $line = "" if $line =~ /^<P>\s$/i;
  166- if    ( $line =~ /^SUBJECT>(.*)/i )    { $subject     = $1; }
  167- elsif ( $line =~ /^ADMIN>AdminPost/i ) { $admin       = "AdminPost"; }
  168- elsif ( $line =~ /^ADMIN>/i )          { next; }
  169- elsif ( $line =~ /^POSTER>(.*)/i )     { $poster      = $1; }
  170- elsif ( $line =~ /^EMAIL>(.*)/i )      { $email       = $1; }
  171- elsif ( $line =~ /^DATE>(.*)/i )       { $date        = $1; }
  172- elsif ( $line =~ /^EMAILNOTICES>/i )   { next; }
  173- elsif ( $line =~ /^IP_ADDRESS>(.*)/i ) { $ipaddress   = $1; }
  174- elsif ( $line =~ /^<!--(.*)-->/i )     { $remoteuser  = $1; }
  175- elsif ( $line =~ /^PASSWORD>(.*)/i )   { $oldpassword = $1; }
  176- elsif ( $line =~ /^PREVIOUS>(.*)/i )   { $previous    = $1; }
  177- elsif ( $line =~ /^NEXT>(.*)/i )       { $next        = $1; }
  178- elsif ( $line =~ /^IMAGE>(.*)/i ) {
  179- ( $image_url, undef ) = &find_pics_location( $1, 'UserPics' );
  180- }
  181- elsif ( $line =~ /^LINKNAME>(.*)/i ) { $linkname = $1; }
  182- elsif ( $line =~ /^LINKURL>(.*)/i )  { $linkurl  = $1; }
  183- elsif ( !$startup ) {
  184- $startup = 1;
  185- $title   = $subject;
  186- if ($MsgTitleNoPrefix) {
  187- $subject =~ s/^\S*\s*//gi;
  188- }
  189- $title =~ s/<[^>]*\s+ALT\s*=\s*"(([^>"])*)"[^>]*>/$1/ig;
  190- $title =~ s/<([^>]|\n)*>//g;
  191- 
  192- my $index_anchor = '';
  193- if ( $previous
  194-      && ( $FORM{'ListType'} =~ /Compressed/i ) )
  195- {
  196- $index_anchor = &find_first_in_thread($previous);
  197- }
  198- 
  199- &Header( $title, $MessageHeaderFile );
  200- if ( $AdminRun && ( $FORM{'ListType'} =~ /Chrono/ ) ) {
  201- $FORM{'ListType'} = "By Threads";
  202- }
  203- 
  204- $verified_ref = $tbb->{'db'}->verify_exists_data( 'type' => 'profile',
  205-                                                   'id'   => $poster, );
  206- if ($verified_ref) {
  207- $poster_id = $verified_ref->{'id'};
  208- }
  209- my %subnav_args = ( 'msg_num'      => $messagenumber,
  210-                     'previous'     => $previous,
  211-                     'next'         => $next,
  212-                     'poster_name'  => $poster,
  213-                     'poster_id'    => $poster_id,
  214-                     'index_anchor' => $index_anchor,
  215- );
  216- ( $navbar_top, $navbar_bottom ) =
  217-     $main::tbb->{'tbb_html'}->get_navbar_HTML( 'sub_navbar'  => 'message',
  218-                                                'subnav_args' => \%subnav_args, );
  219- unless ($TopNavbarNoPrint) {
  220- print "<div id='nb_top'>\n" . $navbar_top . "</div>\n";
  221- }
  222- 
  223- if ( $cust{'msg_c01'} ) {
  224- print "<div class=\"msg_c01\">\n" . $cust{'msg_c01'} . "</div>\n";
  225- }
  226- print "<div id='glob_header'>\n", $cust{'glob_header_s'};
  227- if ($printboardname) {
  228- print "<h2>$boardname</h2>\n";
  229- }
  230- print "\n$cust{'glob_header_e'}</div>\n";
  231- if ( $cust{'msg_c02'} ) {
  232- print "<div class=\"msg_c02\">\n" . $cust{'msg_c02'} . "</div>\n";
  233- }
  234- unless ($SingleMsgWrapNoUse) {
  235- print "<div id=\"msg_wrap\">\n", $cust{'msg_wrap_s'}, "\n";
  236- }
  237- 
  238- print "<div class='msg_headln'>\n", $cust{'msg_headln_s'};
  239- if ( $AdminRun && $verified_ref ) {
  240- print $tbb->{'tbb_html_admin'}->get_manage_items_HTML( 'type'             => 'profile',
  241-                                                        'id'               => $poster_id,
  242-                                                        'div_id'           => 'qprofile',
  243-                                                        'first_item_title' => $poster,
  244-                                                        'first_item_value' => 'profile',
  245- );
  246- }
  247- 
  248- print $subject, $cust{'msg_headln_e'}, "</div>\n";
  249- 
  250- unless ($MsgTitleOnly) {
  251- if ( !( $SE_title_only && $is_spider ) ) {
  252- print "<div class=\"msg_userln\">\n", $cust{'msg_userln_s'};
  253- print $text{'1000'}, "<span class='msg_poster'>";
  254- if (    ( $verified_ref && $DisplayProfiles )
  255-      || ( $verified_ref && $AdminRun ) )
  256- {
  257- print "<a href=\"$DestinationURL$BBSquery" . 'md' . $QS2 . "profile" . $QS1 . 'id' . "$QS2" . "$poster_id\">" . "$poster</a>";
  258- }
  259- else { print "$poster"; }
  260- print "</span>";
  261- if ( $AdminRun && $remoteuser && ( $remoteuser ne $poster ) ) {
  262- print " <span class=\"msg_remote\">('REMOTE_USER' = $remoteuser)</span>";
  263- }
  264- if ( $DisplayEmail && $email ) {
  265- print " <span class=\"msg_email\"><<a href=\"";
  266- if ( !$AdminRun && $BlindEmail ) {
  267- print $DestinationURL, $BBSquery, 'md', $QS2, $QueryMode{'bem'}, $QS1, 'id', $QS2, $messagenumber, "\"$BBStarget>", $text{'1050'};
  268- }
  269- else {
  270- $mailsubject = $subject;
  271- if (%SmileyCode) {
  272- foreach $key ( keys %SmileyCode ) {
  273- $key2 = $SmileyCode{$key};
  274- $key2        =~ s/([\[\]\(\)\\\*\+\?\\\|])/\\$1/g;
  275- $mailsubject =~ s/$key2/$key/g;
  276- }
  277- }
  278- $mailsubject =~ s/<[^>]*\s+ALT\s*=\s*"(([^>"])*)"[^>]*>/$1/ig;
  279- $mailsubject =~ s/<([^>]|\n)*>//g;
  280- $mailsubject =~ s/"/'/g;
  281- print "mailto:$email?subject=$mailsubject\">$email";
  282- }
  283- print "</a>></span>";
  284- }
  285- if ( $DisplayIPs && $ipaddress ) {
  286- print " <span class=\"msg_ip\">($ipaddress)</span>";
  287- }
  288- print "<br>\n", "$text{'1001'} <span class=\"msg_date\">", &PrintDate($date), "</span>\n";
  289- print $cust{'msg_userln_e'}, "</div>\n";
  290- }
  291- 
  292- if ( $MessageList{$previous} > 0 ) {
  293- $pdate = $psub = $pposter = "";
  294- ( $pdate, $psub, $pposter, undef ) =
  295-     split( /\|/, $MessageList{$previous} );
  296- $psub    =~ s/&pipe;/\|/g;
  297- $pposter =~ s/&pipe;/\|/g;
  298- print "<div class=\"msg_prev\">$cust{'msg_prev_s'}$text{'1002'} ";
  299- print "<span class=\"msg_subject\">";
  300- if ( $psub eq $text{'0250'} ) {
  301- print "$psub";
  302- }
  303- else {
  304- my $linktitle_extended = '';
  305- if ($SFU_subject) {
  306- $linktitle_extended = $tbb->SFU_link_extension($psub);
  307- $linktitle_extended = $QS1 . 'sbj' . $QS2 . $linktitle_extended . $SFU_pseudo_fileextension;
  308- }
  309- print '<a href="' . $DestinationURL . $BBSquery . 'md' . $QS2 . 'read' . $QS1 . 'id' . $QS2 . $previous . $linktitle_extended . '">' . $psub . '</a>';
  310- }
  311- if ( $SE_title_only && $is_spider ) {
  312- $pposter = '';
  313- }
  314- print " ($pposter)</span> $cust{'msg_prev_e'}</div>\n";
  315- }
  316- }
  317- if ( $cust{'msg_c03'} ) {
  318- print "<div class=\"msg_c03\">\n", $cust{'msg_c03'}, "</div>\n";
  319- }
  320- print "<div class=\"msg_text\">$cust{'msg_text_s'} $MessageOpenCode\n";
  321- print $line;
  322- }
  323- else {
  324- $line =~ s/(<(p|br)>\s*)?<!--\s*t_end\s*-->(\s*<\/p>)?//ig;
  325- 
  326- print $line;
  327- }
  328- }
  329- print "$MessageCloseCode $cust{'msg_text_e'}</div>\n";
  330- if ($image_url) {
  331- my $image = $image_url;
  332- $image =~ s/.*\/([^\/])/$1/gi;
  333- if ( -e "$UserPicsDir/$image" ) {
  334- $image_url = "$UserPicsURL/$image";
  335- }
  336- print "<div class=\"msg_image\">$cust{'msg_image_s'}";
  337- print "<IMG SRC=\"$image_url\" ALT=\"\">$cust{'msg_image_e'}</div>\n";
  338- }
  339- if ($linkurl) {
  340- print "<div class=\"msg_link\">$cust{'msg_link_s'}";
  341- print "<a href=\"$linkurl\" ";
  342- print "target=\"_blank\">";
  343- print "$linkname</a>$cust{'msg_link_e'}</div>\n";
  344- }
  345- if ($AdminRun) {
  346- &DisplayMessageAdmin;
  347- }
  348- else {
  349- if (    ( $AllowUserDeletion || $AllowUserEditHours )
  350-      && ( $subject ne $text{'0250'} ) )
  351- {
  352- 
  353- my $time_now      = time();
  354- my $edit_allowed  = ( $date + ( $AllowUserEditHours * 3600 ) ) - $time_now;
  355- my $submit_button = '';
  356- 
  357- if ( $tbb->{'session'}->{'board_user'}->{'name'} ne $poster ) {
  358- $edit_allowed = 0;
  359- }
  360- 
  361- if ( $AllowUserDeletion || ( $edit_allowed > 0 ) ) {
  362- 
  363- print "<div class=\"msg_delete\">", $cust{'msg_delete_s'};
  364- print "<FORM METHOD='POST' ACTION=\"$cgiurl$BBSquery", 'md' . $QS2 . "delete\"$BBStarget>\n", "<input type='hidden' name='msgnum' ", "value='$messagenumber'>\n";
  365- if ( ( !$AdminRun ) && $AllowUserDeletion && ( $edit_allowed > 0 ) ) {
  366- print "<span style='margin: 0px 12px'>\n", "$text{'0220'} <input type='radio' name='mode' value='delete'>\n", "</span><span style='margin: 0px 12px'>\n", "$text{'0221'} <input type='radio' name='mode' value='edit'>\n", "</span>\n";
  367- $submit_button = $text{'0180'};
  368- }
  369- elsif ($AllowUserDeletion) {
  370- print "<input type='hidden' name='mode' value='delete'>\n";
  371- $submit_button = $text{'0220'};
  372- }
  373- elsif ( ( !$AdminRun ) && ( $edit_allowed > 0 ) ) {
  374- print "<input type='hidden' name='mode' value='edit'>\n";
  375- $submit_button = $text{'0221'};
  376- }
  377- print "$text{'0205'} ", "<INPUT TYPE='PASSWORD' NAME=\"newpassword\" ", "SIZE='15'>\n", "<INPUT TYPE='SUBMIT' class='button' VALUE=\"$submit_button\"> ", "</FORM>\n";
  378- print $cust{'msg_delete_e'}, "</div>\n";
  379- }
  380- }
  381- unless ($SingleMsgWrapNoUse) {
  382- print $cust{'msg_wrap_e'} . "</div>\n";
  383- }
  384- 
  385- if ( $cust{'msg_social_bookmarks'}
  386-      && ( !( $AdminRun || $is_bot || $is_spider ) ) )
  387- {
  388- print &process_social_bookmark_links( 'string' => $cust{'msg_social_bookmarks'},
  389-                                       'msg_id' => $messagenumber,
  390-                                       'title'  => $title,
  391- );
  392- }
  393- 
  394- if ( $cust{'msg_c04'} ) {
  395- print "<div class=\"msg_c04\">\n", $cust{'msg_c04'}, "</div>\n";
  396- }
  397- unless (    ( ( $FORM{'ListType'} =~ /Chrono/ ) || ( $previous == 0 ) )
  398-          && ( $next == 0 ) )
  399- {
  400- print "<div id=\"msg_respons\">\n$cust{'msg_respons_s'}\n";
  401- print "<h3 id='Responses'>";
  402- @responses = split( / /, $next );
  403- $responsecount = 0;
  404- if (    ( $FORM{'ListType'} =~ /Chrono/ )
  405-      && ( !$MsgThreadAlphaSorted ) )
  406- {
  407- print "$text{'1003'}</h3>\n";
  408- if ( $IndexEntryLines eq "news" ) {
  409- print "<div>\n", "<table $tablespec>\n";
  410- }
  411- else {
  412- print "<$ul_dl>\n";
  413- }
  414- if ( $FORM{'ListType'} =~ /Reversed/ ) {
  415- @sortedresponses = reverse(@responses);
  416- }
  417- else {
  418- @sortedresponses = @responses;
  419- }
  420- foreach $response (@sortedresponses) {
  421- if ( $MessageList{$response} > 0 ) {
  422- &PrintMessageDesc( $response, $MsgThreadSubjectNoPrefix, $MsgThreadSubjectOnly );
  423- $responsecount++;
  424- }
  425- }
  426- if ( $IndexEntryLines eq "news" ) {
  427- print "</table></div>\n";
  428- }
  429- else {
  430- print "</$ul_dl>\n";
  431- }
  432- if ( $responsecount eq 0 ) {
  433- print "<p class=\"center\">";
  434- print "$text{'1004'}</p>\n";
  435- }
  436- }
  437- else {
  438- unless ($MsgThreadParentToHeadline) {
  439- print "$text{'1005'}</h3>\n";
  440- }
  441- if ( $IndexEntryLines eq "news" ) {
  442- print "<div>\n", "<table $tablespec>\n";
  443- }
  444- else {
  445- unless ($MsgThreadParentToHeadline) {
  446- print "<$ul_dl>\n";
  447- }
  448- }
  449- &FindStart($messagenumber);
  450- if ($MsgThreadAlphaSorted) {
  451- my ( @collect, @sortedmsg );
  452- &find_responses( $threadstart, \@collect );
  453- if ($MsgThreadParentToHeadline) {
  454- my $parentmsg = shift(@collect);
  455- my ( undef, $headline, undef, undef, undef, undef, undef, undef ) = split( /\|/, $MessageList{$parentmsg} );
  456- print "<a name='m_$parentmsg' ID='m_$parentmsg' href='$DestinationURL$BBSquery";
  457- print 'md' . $QS2 . 'read' . $QS1 . 'id' . $QS2 . "$parentmsg";
  458- print "'$BBStarget>$headline</a></h2>\n<$ul_dl>\n";
  459- $responsecount++;
  460- }
  461- @sortedmsg = &alphasort_subject( \@collect );
  462- foreach $response (@sortedmsg) {
  463- if ( $MessageList{$response} > 0 ) {
  464- &PrintMessageDesc( $response, $MsgThreadSubjectNoPrefix, $MsgThreadSubjectOnly );
  465- $responsecount++;
  466- }
  467- }
  468- }
  469- else {
  470- &ThreadList( $threadstart, $MsgThreadSubjectNoPrefix, $MsgThreadSubjectOnly );
  471- }
  472- if ( $IndexEntryLines eq "news" ) {
  473- print "</table></div>\n";
  474- }
  475- else {
  476- print "</$ul_dl>\n";
  477- }
  478- }
  479- print "$cust{'msg_respons_e'}</div>\n";
  480- }
  481- }
  482- if ($main::fakeform) { print $main::fakeform; }
  483- unless ( ( $ArchiveOnly || ( !($AllowResponses) ) ) || $SepPostFormRead ) {
  484- require 'webbbs_form.pl';
  485- print "<div id=\"msg_form\">\n";
  486- print "<a id='PostResponse' name='PostResponse'></a>\n";
  487- &Print_Form($messagenumber);
  488- if ($AdminRun) {
  489- print "<a id='EditPost' name='EditPost'></a>\n";
  490- &Print_EditForm($messagenumber);
  491- }
  492- print "</div>\n";
  493- }
  494- if ( $cust{'msg_c05'} ) {
  495- print "<div class=\"msg_c05\">\n", $cust{'msg_c05'}, "</div>\n";
  496- }
  497- &Footer( $MessageFooterFile, "credits" );
  498- } ## end sub DisplayMessage
  499- 
  500- sub DisplayThread {
  501- unless ( ( $ArchiveOnly || ( !($AllowResponses) ) ) || $SepPostFormRead ) {
  502- $SpellCheckerMeta = 1;
  503- }
  504- &FindStart($messagenumber);
  505- 
  506- my ( $subject, $next ) = ( split( /\|/, $MessageList{$threadstart} ) )[ 1, 4 ];
  507- 
  508- eval ' &blog_read($threadstart, $next); ';
  509- 
  510- $title = $subject;
  511- $title =~ s/<([^>]|\n)*(>|$)/ /g;
  512- &Header( $title, $MessageHeaderFile );
  513- ( $navbar_top, $navbar_bottom ) =
  514-     $main::tbb->{'tbb_html'}->get_navbar_HTML( 'sub_navbar'  => 'guestbook',
  515-                                                'subnav_args' => undef, );
  516- unless ($TopNavbarNoPrint) {
  517- print "<div id='nb_top'>\n" . $navbar_top . "</div>\n";
  518- }
  519- if ( $cust{'msg_c01'} ) {
  520- print "<div class=\"msg_c01\">\n", $cust{'msg_c01'}, "</div>\n";
  521- }
  522- print '<div id="glob_header">', $cust{'glob_header_s'};
  523- if ($printboardname) {
  524- print "<h2>$boardname</h2>\n";
  525- }
  526- print "$cust{'glob_header_e'}</div>\n";
  527- @guestbookthread = ();
  528- &ThreadGuestbook($threadstart);
  529- @sortedguestbookthread = ( sort { $a <=> $b } @guestbookthread );
  530- if ( $FORM{'ListType'} =~ /Reversed/ ) {
  531- @guestbookthread       = reverse(@sortedguestbookthread);
  532- @sortedguestbookthread = @guestbookthread;
  533- }
  534- undef @guestbookthread;
  535- if ( $cust{'msg_c02'} ) {
  536- print "<div class=\"msg_c02\">\n", $cust{'msg_c02'}, "</div>\n";
  537- }
  538- print "<div id=\"msg_gbook\">\n";
  539- foreach (@sortedguestbookthread) {
  540- &PrintGuestbookDesc($_);
  541- }
  542- 
  543- if ( $cust{'msg_social_bookmarks'}
  544-      && ( !( $AdminRun || $is_bot || $is_spider ) ) )
  545- {
  546- print &process_social_bookmark_links( 'string' => $cust{'msg_social_bookmarks'},
  547-                                       'msg_id' => $threadstart,
  548-                                       'title'  => $title,
  549- );
  550- }
  551- 
  552- if ( $cust{'msg_c08'} ) {
  553- print "<div id=\"msg_c08\">\n", $cust{'msg_c08'}, "</div>\n";
  554- }
  555- print "</div>\n";
  556- &Footer( $MessageFooterFile, "credits" );
  557- } ## end sub DisplayThread
  558- 
  559- sub ThreadGuestbook {
  560- local (@threadresponses);
  561- local ($next) = "";
  562- ( undef, undef, undef, undef, $next, undef ) =
  563-     split( /\|/, $MessageList{ $_[0] } );
  564- push( @guestbookthread, $_[0] );
  565- @threadresponses = split( / /, $next );
  566- foreach $threadresponse (@threadresponses) {
  567- next unless ( $threadresponse > $_[0] );
  568- if ( $MessageList{$threadresponse} > 0 ) {
  569- &ThreadGuestbook($threadresponse);
  570- }
  571- }
  572- } ## end sub ThreadGuestbook
  573- 
  574- sub SetCookieData {
  575- &GetCookie($boardname);
  576- $FORM{'ListType'} = $Cookies{'listtype'};
  577- $FORM{'password'} = $Cookies{'password'};
  578- if ( !$name )  { $name  = $Cookies{'name'}; }
  579- if ( !$email ) { $email = $Cookies{'email'}; }
  580- } ## end sub SetCookieData
  581- 
  582- sub find_responses {
  583- my ( $msg, $aryref ) = @_;
  584- next unless ( int( $MessageList{$msg} ) > 0 );
  585- push( @$aryref, $msg );
  586- my ( $date, $sub, $poster, $prev, $next, $count, $admin, $ip ) =
  587-     split( /\|/, $MessageList{$msg} );
  588- my @next = split( / /, $next );
  589- for (@next) {
  590- &find_responses( $_, $aryref );
  591- }
  592- } ## end sub find_responses
  593- 
  594- sub process_social_bookmark_links {
  595- my %args = @_;
  596- 
  597- my $linktitle_extended = '';
  598- if ($SFU_subject) {
  599- $linktitle_extended = $tbb->SFU_link_extension( $args{'title'} );
  600- $linktitle_extended = $QS1 . 'sbj' . $QS2 . $linktitle_extended . $SFU_pseudo_fileextension;
  601- }
  602- my $url     = $tbb->{'conf'}->{'main'}->{'longcgiurl'} . $QS0 . 'md' . $QS2 . 'read' . $QS1 . 'id' . $QS2 . $args{'msg_id'};
  603- my $seo_url = $url . $linktitle_extended;
  604- $url     = $tbb->{'basic'}->url_encode($url);
  605- $seo_url = $tbb->{'basic'}->url_encode($seo_url);
  606- my $title = $tbb->{'basic'}->url_encode( $args{'title'} );
  607- $args{'string'} =~ s/<!--\s*SEO_URL\s*-->/$seo_url/gi;
  608- $args{'string'} =~ s/<!--\s*URL\s*-->/$url/gi;
  609- $args{'string'} =~ s/<!--\s*TITLE\s*-->/$title/gi;
  610- return $args{'string'};
  611- } ## end sub process_social_bookmark_links
  612- 
  613- 1;