YaBB Community and Support Forum
YaBB Home About YaBB Download YaBB YaBB Support Customize Your Forum Development Contribute to the Project
  Welcome, Guest. Please Login or Register


 
Page Index Toggle Pages: 1
Topic Tools
 
[Standard] A small bug and a 'curiousity'. (Read 6,062 times)
 Nov 10th, 2009 at 12:06am
There are no actions to perform.  
Carsten 
Ex Member


None
[Standard] A small bug and a 'curiousity'.
Minor bug in 'template' sub routine in Subs.pl to manage the (rare) occations where quotemarks in img url's are escaped:
Code Select All
		$output =~ s~img src=("|')$imagesdir/(.+?)('|")~ "img src=$1" . &ImgLoc($2) . $3 ~eisg; 


Should be:
Code Select All
		$output =~ s~img src=(\\*"|')$imagesdir/(.+?)(\1)~ "img src=$1" . &ImgLoc($2) . $3 ~eisg; 




Just curious - what is this meant to do in the same sub routine as above (two instances):
Code Select All
$message =~ s/ style="display:none"/ style="display:visible"/g; 


First i don't get the idea and second there's no such value 'visible' for the display property.
« Last Edit: Mar 25th, 2010 at 2:47am by N/A »  
 
IP Logged  
 Reply #1 - Nov 10th, 2009 at 9:05pm
There are no actions to perform.  

deti 
Legacy Dev Team
Development Team
****
Offline
Posts: 2,650
Prien am Chiemsee, Germany


None
Re: A small bug and a 'curiousity'.
In the actual code we have
Code Select All
	# check if image exists, otherwise use the default template image
	if ($imagesdir ne $defaultimagesdir) {
		my %img_locs;
		sub ImgLoc {
			if (exists $img_locs{$_[0]}) {
				$img_locs{$_[0]};
			} elsif (-e "$forumstylesdir/$useimages/$_[0]") {
				$img_locs{$_[0]} = qq~$imagesdir/$_[0]~;
			} else {
				$img_locs{$_[0]} = qq~$defaultimagesdir/$_[0]~;
			}
		}
		$output =~ s~(src|value|url)(=|\()("|'| )$imagesdir/([^'" ]+).~ "$1$2$3" . &ImgLoc($4) . $3 ~eisg;
	} 


what do you suggest for this new code Carsten?


Quote:
Just curious - what is this meant to do in the same sub routine as above (two instances):

See sub imagemsg in YaBBC.pl. It hast to do with the greybox for images. This images are not displayed in the "news" without this RegEx.

Quote:
... second there's no such value 'visible' for the display property.

What do you suggest to use then?
 
Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
WWW  
IP Logged  
 Reply #2 - Nov 10th, 2009 at 11:56pm
There are no actions to perform.  
Carsten 
Ex Member


None
Re: A small bug and a 'curiousity'.
I'd suggest you change:
Code Select All
		$output =~ s~(src|value|url)(=|\()("|'| )$imagesdir/([^'" ]+).~ "$1$2$3" . &ImgLoc($4) . "$3" ~eisg; 


to:
Code Select All
		$output =~ s~(src|value|url)(=\\*|\()("|'| )$imagesdir/([^'" ]+).~ "$1$2$3" . &ImgLoc($4) . "$3" ~eisg; 




The appropriate value for the 'display' property would be 'inline'.
Code Select All
$message =~ s/ style="display:none"/ style="display:inline"/g; 


Or maybe even better in this case - just simply remove it:
Code Select All
$message =~ s/ style="display:none"//g; 

« Last Edit: Nov 11th, 2009 at 12:35am by N/A »  
 
IP Logged  
 Reply #3 - Nov 12th, 2009 at 5:31pm
There are no actions to perform.  

deti 
Legacy Dev Team
Development Team
****
Offline
Posts: 2,650
Prien am Chiemsee, Germany


None
Re: A small bug and a 'curiousity'.
@
Carsten

Are you sure? What with the escape before the closing quote? Shouldn't it be this way:
Code Select All
		$output =~ s~(src|value|url)(=\\*|\()("|'| )$imagesdir/([^'"\\ ]+).~ "$1$2$3" . &ImgLoc($4) . "$3" ~eisg; 




Thanks for the style idea!
 
Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
WWW  
IP Logged  
 Reply #4 - Nov 12th, 2009 at 9:41pm
There are no actions to perform.  
Carsten 
Ex Member


None
Re: A small bug and a 'curiousity'.
deti wrote on Nov 12th, 2009 at 5:31pm:
Are you sure? What with the escape before the closing quote? Shouldn't it be this way

Hmm, maybe i was a little hasty on that code - guess your new code will make $3 add an extra quotemark at the end.

That parantese 4 pattern is rather nifty but i'm afraid you'll need something a little more traditional to solve the escape problem - something like this:
Code Select All
		$output =~ s~(src|value|url)(=|\()(\\*"|'| )$imagesdir/(.+?)(\3)~ "$1$2$3" . &ImgLoc($4) . $3 ~eisg; 

 
 
IP Logged  
 Reply #5 - Nov 12th, 2009 at 10:09pm
There are no actions to perform.  

deti 
Legacy Dev Team
Development Team
****
Offline
Posts: 2,650
Prien am Chiemsee, Germany


None
Re: A small bug and a 'curiousity'.
Looks OK. Thanks Carsten!
 
Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
WWW  
IP Logged  
 Reply #6 - May 8th, 2010 at 10:37pm
There are no actions to perform.  

Matt Siegman 
YaBB Legends (Inactive)
*
Offline
Posts: 3,380
Wichita, KS


None
Re: [Standard] A small bug and a 'curiousity'.
I changed display:visible to display:block, as that is the correct CSS to force visibility. I changed the regex per Carsten's recommendation.

This has been uploaded to SVN. If it needs uploaded somewhere else, let me know.

Can be moved to [Fixed] once someone confirms I don't need to put it anywhere else.
 
-- Matt Siegman 8) Wish List
 
IP Logged  
 Reply #7 - May 8th, 2010 at 11:38pm
There are no actions to perform.  

Matt Siegman 
YaBB Legends (Inactive)
*
Offline
Posts: 3,380
Wichita, KS


None
Re: [Standard] A small bug and a 'curiousity'.
I'm having some trouble getting CVS working. Here's the diff for someone else to upload to CVS:

Code Select All
@@ -447,7 +447,7 @@
 				if ($enable_ubbc) {
 					if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; }
 					&DoUBBC;
-					$message =~ s/ style="display:none"/ style="display:visible"/g;
+					$message =~ s/ style="display:none"/ style="display:block"/g;
 				}
 				&wrap2;
 				$message =~ s/"/\\"/g;
@@ -504,7 +504,7 @@
 				$img_locs{$_[0]} = qq~$defaultimagesdir/$_[0]~;
 			}
 		}
-		$output =~ s~(src|value|url)(=|\()("|'| )$imagesdir/([^'" ]+).~ "$1$2$3" . &ImgLoc($4) . $3 ~eisg;
+		$output =~ s~(src|value|url)(=|\()(\\*"|'| )$imagesdir/(.+?)(\3)~ "$1$2$3" . &ImgLoc($4) . $3 ~eisg;
 	}

 	# add formsession to each <form ..>-tag

 

 
-- Matt Siegman 8) Wish List
 
IP Logged  
 Reply #8 - May 9th, 2010 at 6:06am
There are no actions to perform.  

Jet Li 
Legacy Dev Team
Development Team
****
Offline
Posts: 6,588
Hong Kong


None
Re: [Standard] A small bug and a 'curiousity'.
IN CVS we have this
Code Select All
	## new and old tag template style decoding ##
	while ($output =~ s~(<|{)yabb\s+(\w+)(}|>)~${"yy$2"}~g) {}
	$output =~ s~(a href=\S+?action=viewprofile;username=.+?)>~$1 rel="nofollow" rel="nofollow">~isg;
	if ($imagesdir ne $defaultimagesdir) {
		$output =~ s~img src=("|')$imagesdir/(.+?)('|")~ "img src=$1" . &ImgLoc($2) . $3 ~eisg;
		$output =~ s~\.src='$imagesdir/(.+?)'~ ".src='" . &ImgLoc($1) . "'" ~eisg; # For Javascript generated images
		$output =~ s~input type="image" src="$imagesdir/(.+?)"~ 'input type="image" src="' . &ImgLoc($1) . '"' ~eisg; # For input images
		$output =~ s~option value="$imagesdir/(.+?)"~ 'option value="' . &ImgLoc($1) . '"' ~eisg; # For the post page
	}
	$output =~ s~</form>~<input type="hidden" name="formsession" value="$formsession" /></form>~g; 

 
...
PM me for YaBB Installation Service
WWW Jet Li 100000788351637  
IP Logged  
 Reply #9 - May 9th, 2010 at 10:08pm
There are no actions to perform.  

Matt Siegman 
YaBB Legends (Inactive)
*
Offline
Posts: 3,380
Wichita, KS


None
Re: [Standard] A small bug and a 'curiousity'.
interesting.... the CVS and SVN must have some subtle difference...

The equivalent new code for CVS would be:
Code Select All
		$output =~ s~img src=(\\*"|')$imagesdir/(.+?)(\1)~ "img src=$1" . &ImgLoc($2) . $3 ~eisg;
 



I think....
 
-- Matt Siegman 8) Wish List
 
IP Logged  
 Reply #10 - May 9th, 2010 at 10:15pm
There are no actions to perform.  

Jet Li 
Legacy Dev Team
Development Team
****
Offline
Posts: 6,588
Hong Kong


None
Re: [Standard] A small bug and a 'curiousity'.
ok. Then is same code in Carsten's first post. Smiley

New
Sources/Subs.pl
in CVS.
 
...
PM me for YaBB Installation Service
WWW Jet Li 100000788351637  
IP Logged  
Page Index Toggle Pages: 1
Topic Tools
 

Get Yet another Bulletin Board at SourceForge.net. Fast, secure and Free Open Source software downloads Support This Project BoardMod - YaBB features and templates YaBB Codex - support on installation and usage YaBB Toolbar for your browser

YaBB Facebook Group Page

Vulnerability Scanner

Valid RSS Valid XHTML Valid CSS Powered by Perl
YaBB Chat and Support Community » Powered by YaBB 3.0 Beta!
YaBB Forum Software © 2000-2011. All Rights Reserved.