Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Board picture shows up as raw html (Read 5582 times)
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: Board picture shows up as raw html
Reply #9 - Oct 13th, 2014 at 3:30pm
Print Post  
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
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: Board picture shows up as raw html
Reply #8 - Oct 13th, 2014 at 3:15pm
Print Post  
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
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: Board picture shows up as raw html
Reply #7 - Oct 13th, 2014 at 2:59pm
Print Post  
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
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: Board picture shows up as raw html
Reply #6 - Oct 13th, 2014 at 2:55pm
Print Post  
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
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: Board picture shows up as raw html
Reply #5 - Oct 13th, 2014 at 2:48pm
Print Post  
The new version on subversion still looks wrong... you didn't apply all the changes...
  
Back to top
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: Board picture shows up as raw html
Reply #4 - Oct 13th, 2014 at 2:23pm
Print Post  
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
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: Board picture shows up as raw html
Reply #3 - Oct 13th, 2014 at 2:05pm
Print Post  
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
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: Board picture shows up as raw html
Reply #2 - Oct 13th, 2014 at 9:37am
Print Post  
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
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: Board picture shows up as raw html
Reply #1 - Oct 13th, 2014 at 4:43am
Print Post  
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
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Board picture shows up as raw html
Oct 13th, 2014 at 4:25am
Print Post  
Latest change in SVN just breaks...
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint