Page Index Toggle Pages: 1 ReplyAdd Poll Send Topic
Normal Topic Board picture shows up as raw html (Read 2786 times)
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Board picture shows up as raw html
Oct 13th, 2014 at 4:25am
Mark & QuoteQuote  
Latest change in SVN just breaks...
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Board picture shows up as raw html
Reply #1 - Oct 13th, 2014 at 4:43am
Mark & QuoteQuote  
Smiley
I've been fighting that glitch. So far it's winning.
Edited:
Okay - I've just checked the trunk Revision 1595 and I'm not seeing raw code on Board Pictures. Exactly what screen is showing raw code?
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Board picture shows up as raw html
Reply #2 - Oct 13th, 2014 at 9:37am
Mark & QuoteQuote  
For some reason $bdpic is empty in both BoardIndex.pm and MessageIndex.pm.

Code
Select All
 Index: cgi-bin/yabb2/Sources/BoardIndex.pm
 ===================================================================
 --- cgi-bin/yabb2/Sources/BoardIndex.pm	(revision 1595)
 +++ cgi-bin/yabb2/Sources/BoardIndex.pm	(working copy)
 @@ -807,6 +807,7 @@
                  $INFO{'zeropost'} = 0;
                  $zero             = q{};
                  $bdpicfld = q{};
 +                $bdpic = qq~$imagesdir/boards.$bdpicExt~;
                  fopen( BRDPIC, "<$boardsdir/brdpics.db" );
                  my @brdpics = <BRDPIC>;
                  fclose( BRDPIC);
 Index: cgi-bin/yabb2/Sources/MessageIndex.pm
 ===================================================================
 --- cgi-bin/yabb2/Sources/MessageIndex.pm	(revision 1595)
 +++ cgi-bin/yabb2/Sources/MessageIndex.pm	(working copy)
 @@ -1454,6 +1454,7 @@
          }
      }
      $bdpicfld = q{};
 +    $bdpic = qq~boards.$bdpicExt~;
      fopen( BRDPIC, "<$boardsdir/brdpics.db" );
      my @brdpics = <BRDPIC>;
      fclose( BRDPIC);
 @@ -1465,11 +1466,10 @@
                  $bdpic = $brdpic;
              }
              else {
 -                $bdpicfld = 'Boards/';
 -				if ( -e "$htmldir/Templates/Forum/$useimages/$bdpicfld/$brdpic" ) {
 -					$bdpic = $brdpic;
 -				}
 -				else { $bdpic = qq~boards.$bdpicExt~; }
 +                if ( -e "$htmldir/Templates/Forum/$useimages/Boards/$brdpic" ) {
 +                    $bdpicfld = 'Boards/';
 +                    $bdpic = $brdpic;
 +                }
              }
          }
      }
  



This makes sure $bdpic is not empty if the board file is empty or does not exist.
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Board picture shows up as raw html
Reply #3 - Oct 13th, 2014 at 2:05pm
Mark & QuoteQuote  
Thanks - for some reason those sections were just not throwing blanks on my test installs.  Huh
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Board picture shows up as raw html
Reply #4 - Oct 13th, 2014 at 2:23pm
Mark & QuoteQuote  
Dandello wrote on Oct 13th, 2014 at 2:05pm:
Thanks - for some reason those sections were just not throwing blanks on my test installs.  Huh


That's because you go to admin panel.... I don't.... I just copy the files on server and log in as normal user. It's to test how the changes behave on upgraded forums, especially if change requires new files or settings entries to work correctly... That way it also takes less time to see if new changes break hell loose...

If something doesn't work, I can just revert one or two files to previous revision and diagnose where things fall through defaults...

In cases when something is unreadable, new code should always fall back to a safe default instead of throwing random output or garbage.

Now we know passing undefined to qq returns garbage instead of empty string.
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Board picture shows up as raw html
Reply #5 - Oct 13th, 2014 at 2:48pm
Mark & QuoteQuote  
The new version on subversion still looks wrong... you didn't apply all the changes...
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Board picture shows up as raw html
Reply #6 - Oct 13th, 2014 at 2:55pm
Mark & QuoteQuote  
This is why it's so good to have multiple testers and code reviewers.  Smiley
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Board picture shows up as raw html
Reply #7 - Oct 13th, 2014 at 2:59pm
Mark & QuoteQuote  
Dandello wrote on Oct 13th, 2014 at 2:55pm:
This is why it's so good to have multiple testers and code reviewers.  Smiley


I need to make a new patch because I noticed some of the improvements you made to my patch were actually useful... There was redundant else statements...

Code
Select All
 Index: cgi-bin/yabb2/Sources/BoardIndex.pm
 ===================================================================
 --- cgi-bin/yabb2/Sources/BoardIndex.pm	(revision 1596)
 +++ cgi-bin/yabb2/Sources/BoardIndex.pm	(working copy)
 @@ -822,7 +822,6 @@
                              if ( -e "$htmldir/Templates/Forum/$useimages/Boards/$brdpic" ) {
                                  $bdpic = qq~$imagesdir/Boards/$brdpic~;
                              }
 -                            else { $bdpic = qq~$imagesdir/boards.$bdpicExt~; }
                              last;
                          }
                      }
 @@ -830,7 +829,6 @@
                          if ( $boardname =~ m/[ht|f]tp[s]{0,1}:\/\//sm  ) {
                              $bdpic = qq~$imagesdir/$extern~;
                          }
 -                        else {$bdpic = qq~$imagesdir/boards.$bdpicExt~; }
                      }
                  }

 @@ -2025,4 +2023,4 @@
      }
  }

 -1;
 \ No newline at end of file
 +1;
 Index: cgi-bin/yabb2/Sources/MessageIndex.pm
 ===================================================================
 --- cgi-bin/yabb2/Sources/MessageIndex.pm	(revision 1596)
 +++ cgi-bin/yabb2/Sources/MessageIndex.pm	(working copy)
 @@ -1465,12 +1465,9 @@
              if ( $brdpic =~ /\//ism ) {
                  $bdpic = $brdpic;
              }
 -            else {
 +            elsif ( -e "$htmldir/Templates/Forum/$useimages/Boards/$brdpic" ) {
                  $bdpicfld = 'Boards/';
 -                if ( -e "$htmldir/Templates/Forum/$useimages/$bdpicfld/$brdpic" ) {
 -                    $bdpic = $brdpic;
 -                }
 -                else { $bdpic = qq~boards.$bdpicExt~; }
 +                $bdpic = $brdpic;
              }
          }
      }
  

  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: Board picture shows up as raw html
Reply #8 - Oct 13th, 2014 at 3:15pm
Mark & QuoteQuote  
The patch I did for MessageIndex looks like this now:
Code (Perl)
Select All
    $bdpic = qq~$imagesdir/boards.$bdpicExt~;
     fopen( BRDPIC, "<$boardsdir/brdpics.db" );
     my @brdpics = <BRDPIC>;
     fclose( BRDPIC);
     chomp @brdpics;
     for (@brdpics) {
         my ( $brdnm, $style, $brdpic ) = split /[|]/xsm, $_;
         if ( $brdnm eq $currentboard && $usestyle eq $style) {
             if ( $brdpic =~ /\//ism ) {
                 $bdpic = $brdpic;
             }
             else {
                 if ( -e "$htmldir/Templates/Forum/$useimages/Boards/$brdpic" ) {
                     $bdpic = qq~$imagesdir/Boards/$brdpic~;
                 }
                 else { $bdpic = qq~$imagesdir/boards.$bdpicExt~; }
             }
         }
     }
     if ( ${ $uid . $currentboard }{'ann'} == 1 ) {
         $bdpic = qq~$imagesdir/ann.$bdpicExt~;
     }
     if ( ${ $uid . $currentboard }{'rbin'} == 1 ) {
         $bdpic = qq~$imagesdir/recycle.$bdpicExt~;
     }

     $bdpic =
 qq~ <img src="$bdpic" alt="$curboardname" title="$curboardname" id="brd_img_resize" /> ~;
  


I'm debating as to whether or not we need to add 'last;' statements in the for loop. It was necessary for BoardIndex.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: Board picture shows up as raw html
Reply #9 - Oct 13th, 2014 at 3:30pm
Mark & QuoteQuote  
Dandello wrote on Oct 13th, 2014 at 3:15pm:
I'm debating as to whether or not we need to add 'last;' statements in the for loop. It was necessary for BoardIndex.


There is still one extra else statement in your version, but otherwise it looks pretty clean... Adding "last" might make it few milliseconds faster, but otherwise it shouldn't break without, unless the board file contains duplicate entries or your code is buggy Wink
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
ReplyAdd Poll Send Topic
Bookmarks: del.icio.us Digg Facebook Google LinkedIn reddit Twitter Yahoo
Board picture shows up as raw html

Please type the characters exactly as they appear in the image,
without the first 2 and last 2 characters.
The characters must be typed in the same order,
and they are case-sensitive.
Open Preview Preview

You can resize the textbox by dragging the right or bottom border.
Off Topic Comment Insert Spoiler
Insert Hyperlink Insert FTP Link Insert Image Insert E-mail Insert Media Insert Table Insert Table Row Insert Table Column Insert Horizontal Rule Insert Teletype Insert Code Insert Quote Edited Superscript Subscript Insert List /me - my name Insert Marquee Insert Timestamp No Parse
Bold Italicized Underline Insert Strikethrough Highlight
                       
Change Text Color
Insert Preformatted Text Left Align Centered Right Align
resize_wb
resize_hb







Max 5000 characters. Remaining characters:
Text size: %
More Smilies
View All Smilies
Collapse additional features Collapse/Expand additional features Smiley Wink Cheesy Grin Angry Sad Shocked Cool Huh Roll Eyes Tongue Embarrassed Lips Sealed Undecided Kiss Cry