Monni Language Offline Min izāmō Posts: 413 Location: Kaarina, Finland Joined: Jul 16th, 2014 Gender: Mood: Frustrated Zodiac sign: 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 GTalk Skype/VoIP Facebook Twitter YouTube ICQ IP Logged
Dandello Forum AdministratorYaBB Modder Offline I love YaBB 2.7! Posts: 2253 Location: The Land of YaBB Joined: Feb 12th, 2014 Gender: Mood: Annoyed Zodiac sign: 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) $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. WWW IP Logged
Monni Language Offline Min izāmō Posts: 413 Location: Kaarina, Finland Joined: Jul 16th, 2014 Gender: Mood: Frustrated Zodiac sign: 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. 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 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; } } } GTalk Skype/VoIP Facebook Twitter YouTube ICQ IP Logged
Dandello Forum AdministratorYaBB Modder Offline I love YaBB 2.7! Posts: 2253 Location: The Land of YaBB Joined: Feb 12th, 2014 Gender: Mood: Annoyed Zodiac sign: 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. Perfection is not possible. Excellence, however, is excellent. WWW IP Logged
Monni Language Offline Min izāmō Posts: 413 Location: Kaarina, Finland Joined: Jul 16th, 2014 Gender: Mood: Frustrated Zodiac sign: 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... GTalk Skype/VoIP Facebook Twitter YouTube ICQ IP Logged
Monni Language Offline Min izāmō Posts: 413 Location: Kaarina, Finland Joined: Jul 16th, 2014 Gender: Mood: Frustrated Zodiac sign: 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. 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. GTalk Skype/VoIP Facebook Twitter YouTube ICQ IP Logged
Dandello Forum AdministratorYaBB Modder Offline I love YaBB 2.7! Posts: 2253 Location: The Land of YaBB Joined: Feb 12th, 2014 Gender: Mood: Annoyed Zodiac sign: 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. Perfection is not possible. Excellence, however, is excellent. WWW IP Logged
Monni Language Offline Min izāmō Posts: 413 Location: Kaarina, Finland Joined: Jul 16th, 2014 Gender: Mood: Frustrated Zodiac sign: 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 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. GTalk Skype/VoIP Facebook Twitter YouTube ICQ IP Logged
Dandello Forum AdministratorYaBB Modder Offline I love YaBB 2.7! Posts: 2253 Location: The Land of YaBB Joined: Feb 12th, 2014 Gender: Mood: Annoyed Zodiac sign: Re: Board picture shows up as raw html Reply #1 - Oct 13th, 2014 at 4:43am Mark & QuoteQuote 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. WWW IP Logged
Monni Language Offline Min izāmō Posts: 413 Location: Kaarina, Finland Joined: Jul 16th, 2014 Gender: Mood: Frustrated Zodiac sign: Board picture shows up as raw html Oct 13th, 2014 at 4:25am Mark & QuoteQuote Latest change in SVN just breaks... GTalk Skype/VoIP Facebook Twitter YouTube ICQ IP Logged