Page Index Toggle Pages: 1
Topic Tools
Hot Topic (More than 10 Replies) [Standard] A small bug and a 'curiousity'. (Read 6,381 times)
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: [Standard] A small bug and a 'curiousity'.
Reply #10 - May 9th, 2010 at 10:15pm
Post Tools
ok. Then is same code in Carsten's first post. Smiley

New
Sources/Subs.pl
in CVS.
  

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
Matt Siegman
YaBB Legends (Inactive)
*
Offline



Posts: 3,380
Location: Wichita, KS
Re: [Standard] A small bug and a 'curiousity'.
Reply #9 - May 9th, 2010 at 10:08pm
Post Tools
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
Back to top
 
IP Logged
 
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: [Standard] A small bug and a 'curiousity'.
Reply #8 - May 9th, 2010 at 6:06am
Post Tools
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">~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
Back to top
WWWGTalkFacebook  
IP Logged
 
Matt Siegman
YaBB Legends (Inactive)
*
Offline



Posts: 3,380
Location: Wichita, KS
Re: [Standard] A small bug and a 'curiousity'.
Reply #7 - May 8th, 2010 at 11:38pm
Post Tools
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
Back to top
 
IP Logged
 
Matt Siegman
YaBB Legends (Inactive)
*
Offline



Posts: 3,380
Location: Wichita, KS
Re: [Standard] A small bug and a 'curiousity'.
Reply #6 - May 8th, 2010 at 10:37pm
Post Tools
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
Back to top
 
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: A small bug and a 'curiousity'.
Reply #5 - Nov 12th, 2009 at 10:09pm
Post Tools
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
Back to top
WWW  
IP Logged
 
Carsten
Ex Member


Re: A small bug and a 'curiousity'.
Reply #4 - Nov 12th, 2009 at 9:41pm
Post Tools
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; 

  
Back to top
 
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: A small bug and a 'curiousity'.
Reply #3 - Nov 12th, 2009 at 5:31pm
Post Tools
@ 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
Back to top
WWW  
IP Logged
 
Carsten
Ex Member


Re: A small bug and a 'curiousity'.
Reply #2 - Nov 10th, 2009 at 11:56pm
Post Tools
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 »  
Back to top
 
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: A small bug and a 'curiousity'.
Reply #1 - Nov 10th, 2009 at 9:05pm
Post Tools
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
Back to top
WWW  
IP Logged
 
Carsten
Ex Member


[Standard] A small bug and a 'curiousity'.
Nov 10th, 2009 at 12:06am
Post Tools
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 »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top