Add Poll
 
Options: Text Color Split Pie
 
 
 
 
 
 
 
 
Poll Comment:
Max 500 characters. Remaining characters:
days and minutes. Leave it blank if you don't want to set it now.

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
Topic Summary - Displaying 10 post(s). Click here to show all
Posted by: Monni
Posted on: Oct 13th, 2014 at 3:30pm
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
Posted by: Dandello
Posted on: Oct 13th, 2014 at 3:15pm
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.
Posted by: Monni
Posted on: Oct 13th, 2014 at 2:59pm
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;
              }
          }
      }
  

Posted by: Dandello
Posted on: Oct 13th, 2014 at 2:55pm
This is why it's so good to have multiple testers and code reviewers.  Smiley
Posted by: Monni
Posted on: Oct 13th, 2014 at 2:48pm
The new version on subversion still looks wrong... you didn't apply all the changes...
Posted by: Monni
Posted on: Oct 13th, 2014 at 2:23pm
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.
Posted by: Dandello
Posted on: Oct 13th, 2014 at 2:05pm
Thanks - for some reason those sections were just not throwing blanks on my test installs.  Huh
Posted by: Monni
Posted on: Oct 13th, 2014 at 9:37am
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.
Posted by: Dandello
Posted on: Oct 13th, 2014 at 4:43am
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?
Posted by: Monni
Posted on: Oct 13th, 2014 at 4:25am
Latest change in SVN just breaks...