Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) [img] Tag BugFix (Read 6274 times)
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
[img] Tag BugFix
Apr 20th, 2003 at 1:22pm
Print Post  


This is a bugfix for YaBB SP1/1.1/1.2/1.3/1.3.1/1.3.2

It solves a problem in the [img] tag which is causing images ending with "n", "b", "s" and "p" to no longer function. Since v1.1, this mod also allows images with https://

Version History:
v1.1: images with https:// are displayed properly now.
v1.0: fixed images ending with n,b,s and p.
« Last Edit: Aug 24th, 2004 at 12:31am by Administrator »  

img_tag_bugfix_v11.mod (Attachment deleted)

The Administrator.
Back to top
WWW  
IP Logged
 
Grandmaster_E
New Member
*
Offline



Posts: 3
Joined: Apr 17th, 2003
Gender: Male
Re: [img] Tag BugFix
Reply #1 - Apr 20th, 2003 at 1:45pm
Print Post  
Maybe it isn't a bug but a block against dangerous files.  Undecided
  
Back to top
 
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: [img] Tag BugFix
Reply #2 - Apr 20th, 2003 at 1:49pm
Print Post  
No, it's really a bug (I wrote the code in the first place Wink). For example when you put http://www.bla.com/myimage.php into the tag (for example to generate a dynamic image), it will produce <img src="http://www.bla.com/myimage.ph">. Note that there is no way to execute dangerous code by putting non-image files into the image source except javascript which is already blocked by forcing http:// in front.
  

The Administrator.
Back to top
WWW  
IP Logged
 
Grandmaster_E
New Member
*
Offline



Posts: 3
Joined: Apr 17th, 2003
Gender: Male
Re: [img] Tag BugFix
Reply #3 - Apr 20th, 2003 at 1:52pm
Print Post  
Allright, I get it.  Wink
  
Back to top
 
IP Logged
 
xxx
Guest


Re: [img] Tag BugFix
Reply #4 - Apr 20th, 2003 at 5:07pm
Print Post  
Finally!!!! I saw this problem several times in my board. Haven't had any idea what to do about it.

Thanx a lot!
  
Back to top
 
IP Logged
 
LoonyPandora
God Member
*****
Offline


Daft Cow?

Posts: 1705
Location: London
Joined: Jun 27th, 2002
Gender: Male
Re: [img] Tag BugFix
Reply #5 - Apr 20th, 2003 at 5:12pm
Print Post  
That seems like a very 'random' kind of bug. how did a bug like that appear? and why only those letters? ???
  

Apple Technical Support
Code
Select All
#!/usr/bin/perl --
($sig ='ddiissjjttuuffss ddaoouu ssffaee uuiijjtt
jj ssvvmmff auu qqffssmm ttmmaoohhjjoohh nnauuddiifftt')
=~y~b-v~a-z~s;
print $sig; 

Back to top
WWWICQ  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: [img] Tag BugFix
Reply #6 - Apr 20th, 2003 at 10:05pm
Print Post  
hehe well the overwhelming possibillities of regular expressions Wink

Basically, this part of the regular exression for the [img] tag:
Code
Select All
[\s*\t*\n*(&nbsp;)*($char_160)*]* 


was used to filter out any invisible characters before the image url. The mistake is that () doesn't work in [] so &nbsp; isn't read as one group but as single characters (that's why n, b, s and p got thrown out).

The fix was to get rid of the [] and use the logical OR methode instead:
Code
Select All
(?:\s|\t|\n|&nbsp;|$char_160)* 



Hope someone understood what I just wrote Tongue
  

The Administrator.
Back to top
WWW  
IP Logged
 
James Bone
Junior Member
**
Offline


Mod breaker/tester!

Posts: 78
Location: Stonehenge, England
Joined: Jan 27th, 2003
Gender: Male
Re: [img] Tag BugFix
Reply #7 - Apr 20th, 2003 at 10:16pm
Print Post  
Quote:
hehe well the overwhelming possibillities of regular expressions Wink

Basically, this part of the regular exression for the [img] tag:
Code
Select All
[\s*\t*\n*(&nbsp;)*($char_160)*]* 


was used to filter out any invisible characters before the image url. The mistake is that () doesn't work in [] so &nbsp; isn't read as one group but as single characters (that's why n, b, s and p got thrown out).

The fix was to get rid of the [] and use the logical OR methode instead:
Code
Select All
(?:\s|\t|\n|&nbsp;|$char_160)* 



Hope someone understood what I just wrote Tongue


Holy crap, i spend too much time in the programming boards...i understood!

* James Bone is going mad

  

I am a Mod breaker/tester! (hopefully more a tester than a breaker Wink)
YaBB Support Specialist - Level 1
Back to top
WWW  
IP Logged
 
LoonyPandora
God Member
*****
Offline


Daft Cow?

Posts: 1705
Location: London
Joined: Jun 27th, 2002
Gender: Male
Re: [img] Tag BugFix
Reply #8 - Apr 21st, 2003 at 1:34am
Print Post  
Well, I got the gist of it Wink

very interesting, now we know the story of 'n' 'b' 's' and 'p' 8)
  

Apple Technical Support
Code
Select All
#!/usr/bin/perl --
($sig ='ddiissjjttuuffss ddaoouu ssffaee uuiijjtt
jj ssvvmmff auu qqffssmm ttmmaoohhjjoohh nnauuddiifftt')
=~y~b-v~a-z~s;
print $sig; 

Back to top
WWWICQ  
IP Logged
 
al
Junior Member
**
Offline


#!/usr/bin/perl

Posts: 63
Joined: Apr 16th, 2003
Gender: Male
Re: [img] Tag BugFix
Reply #9 - Apr 25th, 2003 at 9:40am
Print Post  
It's not worked on my board. :'(
My YaBBC.pl
[code]$yabbcplver = "1 Gold - SP 1";

$yyYaBBCloaded = 1;

sub validwidth {
     return ( $_[0] > 400 ? 400 : $_[0] );
}

sub MakeSmileys {
 $message =~ s/\[smilie=(\w+\.(gif|jpg|png|bmp))\]/\<img border="0" src="$smiliesurl\/$1" \/\>/isg;
 $message =~ s/\[smiley=(\w+\.(gif|png|bmp|jpg))\]/\<img border="0" src="$smiliesurl\/$1" \/\>/isg;
 $message =~ s/(\W|\A)\;\)/$1\<img border=0 src=$imagesdir\/wink.gif\>/g;
 $message =~ s/(\W|\A)\;\-\)/$1\<img border=0 src=$imagesdir\/wink.gif\>/g;
 $message =~ s/(\W|\A)\;D/$1\<img border=0 src=$imagesdir\/grin.gif\>/g;
 $message =~ s/\Q:'(\E/\<img border=0 src=$imagesdir\/cry.gif\>/g;
 $message =~ s/(\W)\:\-\//$1\<img border=0 src=$imagesdir\/undecided.gif\>/g;
 $message =~ s/:\-\//<img border=0 src=$imagesdir\/undecided.gif\>/g;
 $message =~ s/\Q:-X\E/\<img border=0 src=$imagesdir\/lipsrsealed.gif\>/g;
 $message =~ s/\Q:-[\E/\<img border=0 src=$imagesdir\/embarassed.gif\>/g;
 $message =~ s/\Q:-*\E/\<img border=0 src=$imagesdir\/kiss.gif\>/g;
 $message =~ s/\Q>:(\E/\<img border=0 src=$imagesdir\/angry.gif\>/g;
 $message =~ s/\Q>:(\E/\<img border=0 src=$imagesdir\/angry.gif\>/g;
 $message =~ s/\Q::)\E/\<img border=0 src=$imagesdir\/rolleyes\.gif\>/g;
 $message =~ s/\Q:P\E/\<img border=0 src=$imagesdir\/tongue\.gif\>/g;
 $message =~ s/\Q:)\E/\<img border=0 src=$imagesdir\/smiley\.gif\>/g;
 $message =~ s/\Q:-)\E/\<img border=0 src=$imagesdir\/smiley\.gif\>/g;
 $message =~ s/\Q:D\E/\<img border=0 border=0 src=$imagesdir\/cheesy.gif\>/g;
 $message =~ s/\Q:-(\E/\<img border=0 src=$imagesdir\/sad.gif\>/g;
 $message =~ s/\Q:(\E/\<img border=0 src=$imagesdir\/sad.gif\>/g;
 $message =~ s/\Q:o\E/\<img border=0 src=$imagesdir\/shocked.gif\>/gi;
 $message =~ s/\Q8-)\E/\<img border=0 src=$imagesdir\/cool.gif\>/g;
 $message =~ s/\Q:???:\E/\<img border=0 src=$imagesdir\/huh.gif\>/g;
 $message =~ s/\Q:lol:\E/\<img border=0 src=$imagesdir\/sm_lol.gif\>/g;
 $message =~ s/\Q:-o-:\E/\<img border=0 src=$imagesdir\/sm_notknow.gif\>/g;
 $message =~ s/\Q:guru:\E/\<img border=0 src=$imagesdir\/sm_guru.gif\>/g;
 $message =~ s/\Q:flag:\E/\<img border=0 src=$imagesdir\/sm_flag.gif\>/g;
 $message =~ s/\Q:bast:\E/\<img border=0 src=$imagesdir\/sm_bast.gif\>/g;
 $message =~ s/\Q:?-0:\E/\<img border=0 src=$imagesdir\/sm_ga.gif\>/g;
 $message =~ s/\Q:cool2:\E/\<img border=0 src=$imagesdir\/sm_cool2.gif\>/g;
 $message =~ s/\Q:tort:\E/\<img border=0 src=$imagesdir\/sm_bday.gif\>/g;
 $message =~ s/\Q:sleep:\E/\<img border=0 src=$imagesdir\/sm_sleep.gif\>/g;
 $count=0;
     while($SmilieURL[$count]) {
           if ($SmilieURL[$count]=~ /\//i) {$tmpurl = $SmilieURL[$count];} else {$tmpurl = qq~$imagesdir/$SmilieURL[$count]~;}
           $tmpcode = $SmilieCode[$count];
           $tmpcode =~ s/$/\$/g;
           $tmpcode =~ s/@/\@/g;
           $message =~ s/\Q$tmpcode\E/\<img border=0 src=$tmpurl\>/g;
           $count++
     }
}

$MAXIMGWIDTH = 400;
$MAXIMGHEIGHT = 500;
sub restrictimage {
     my($w,$h,$s) = @_;
     $w = $w <= $MAXIMGWIDTH ? $w : $MAXIMGWIDTH;
     $h = $h <= $MAXIMGHEIGHT ? $h : $MAXIMGHEIGHT;
     return qq~<img src="$s" width="$w" height="$h" alt="" border="0">~;
}

sub quotemsg {
     my( $qauthor, $qlink, $qdate, $qmessage ) = @_;
     $qmessage =~ s~\/me\s+(.*?)(\n.*?)~<font color="#FF0000">* $qauthor $1</font>$2~ig;
     $qmessage =~ s~<font color="#FF0000">(.*?)\/me~<font color="#FF0000">$1\&\#47\;me~ig;
     $qmessage =~ s~\/me\s+([\s\S]*)~<font color="#FF0000">* $qauthor $1</font>~ig;
     $qdate = &timeformat($qdate);
     $_ = $txt{'704'};
     $_ =~ s~AUTHOR~$qauthor~g;
     $_ =~ s~QUOTELINK~$scripturl?action=display;$qlink~g;
     $_ =~ s~DATE~$qdate~g;
     $_ =~ s~QUOTE~$qmessage~g;
     return $_;
}

sub simplequotemsg {
     my $qmessage = $_[0];
     $qmessage =~ s~\/me\s+(.*?)(\n.*?)~<font color="#FF0000">* $1</font>~ig;
     $qmessage =~ s~<font color="#FF0000">(.*?)\/me~<font color="#FF0000">$1\&\#47\;me~ig;
     $qmessage =~ s~\/me\s+([\s\S]*)~<font color="#FF0000">* $1</font>~ig;
     $qmessage =~ s~\/me~\&\#47\;me~ig;
     $_ = $txt{'705'};
     $_ =~ s~QUOTE~$qmessage~g;
     return $_;
}

{
     my %killhash = (
     ';' => ';',
     '!' => '!',
     '(' => '(',
     ')' => ')',
     '-' => '-',
     '.' => '.',
     '/' => '/',
     ':' => ':',
     '?' => '?',
     '[' => '[',      '\\' => '\',      ']' => ']',
     '^' => '^'
     );
     sub codemsg {
           my $code = $_[0];
           if($code !~ /&\S*;/) { $code =~ s/;/;/g; }
           $code =~ s~([\(\)\-\:\\\/\?\!\]\[\.\^])~$killhash{$1}~g;
           $_ = $txt{'706'};
           $_ =~ s~CODE~$code~g;
           return $_;
     }
}

sub killScript {
   my $script =$_[0];
   $script =~ s~(\D)~~g;
   return $script;
 }

sub DoUBBC {
     $message =~ s~\[code\]~ \[code\]~ig;
     $message =~ s~\[/code\]~ \[/code\]~ig;
     $message =~ s~\[quote\]~ \[quote\]~ig;
     $message =~ s~\[/quote\]~ \[/quote\]~ig;
     $message =~ s~\[glow\]~ \[glow\]~ig;
     $message =~ s~\[/glow\]~ \[/glow\]~ig;
     $message =~ s~<br>~\n~ig;
     $message =~ s~\[code\]\n*(.+?)\n*\[/code\]~&codemsg($1)~eisg;
     if ($message =~ /\/isg || $ns =~ "NS") {$message =~ s/\//isg;} else { &MakeSmileys; }
     $message =~ s~\[([^\]]{0,30})\n([^\]]{0,30})\]~\[$1$2\]~g;
     $message =~ s~\[/([^\]]{0,30})\n([^\]]{0,30})\]~\[/$1$2\]~g;
     $message =~ s~(\w+://[^<>\s\n\"\]\[]+)\n([^<>\s\n\"\]\[]+)~$1\n$2~g;
     $message =~ s~\[b\](.+?)\[/b\]~<b>$1</b>~isg;
     $message =~ s~\[i\](.+?)\[/i\]~<i>$1</i>~isg;
     $message =~ s~\[u\](.+?)\[/u\]~<u>$1</u>~isg;
     $message =~ s~\[s\](.+?)\[/s\]~<s>$1</s>~isg;
     $message =~ s~\[move\](.+?)\[/move\]~<marquee>$1</marquee>~isg;

     $message =~ s~\[glow(.*?)\](.*?)\[/glow\]~qq^[glow$1]^ . &elimnests($2) . q^[/glow]^~eisg;
     $message =~ s~\[shadow(.*?)\](.*?)\[/shadow\]~qq^[shadow$1]^ . &elimnests($2) . q^[/shadow]^~eisg;

#      $message =~ s~\[shadow=(\S+?),(.+?),(.+?)\](.+?)\[/shadow\]~q^[&table width=^ . validwidth($3) . qq^ style="filter:shadow\(color=$1, direction=$2\)"\]$4\[/\&table\]^~eisg;
#      $message =~ s~\[glow=(\S+?),(.+?),(.+?)\](.+?)\[/glow\]~q^[&table width=^ . validwidth($3) . qq^ style="filter:glow\(color=$1, strength=$2\)"\]$4\[/\&table\]^~eisg;
     $message =~ s~\[shadow=(\S+?),(.+?),(.+?)\](.+?)\[/shadow\]~q^[&table width=^ . validwidth(&killScript($3)) . qq^ style="filter:shadow\(color=$1, direction=$2\)"\]$4\[/\&table\]^~eisg;
     $message =~ s~\[glow=(\S+?),(.+?),(.+?)\](.+?)\[/glow\]~q^[&table width=^ . validwidth(&killScript($3)) . qq^ style="filter:glow\(color=$1, strength=$2\)"\]$4\[/\&table\]^~eisg;



     $message =~ s~\[color=([\w#]+)\](.*?)\[/color\]~<font color="$1">$2</font>~isg;
     $message =~ s~\[black\](.*?)\[/black\]~<font color=000000>$1</font>~isg;
     $message =~ s~\[white\](.*?)\[/white\]~<font color=FFFFFF>$1</font>~isg;
     $message =~ s~\[red\](.*?)\[/red\]~<font color=FF0000>$1</font>~isg;
     $message =~ s~\[green\](.*?)\[/green\]~<font color=00FF00>$1</font>~isg;
     $message =~ s~\[blue\](.*?)\[/blue\]~<font color=0000FF>$1</font>~isg;

     $message =~ s~\[font=(.+?)\](.+?)\[/font\]~<font face="$1">$2</font>~isg;
     $message =~ s~\[size=(.+?)\](.+?)\[/size\]~<font size="$1">$2</font>~isg;

     $char_160 = chr(160);
     $message =~ s~\[img\](?:\s|\t|\n| |$char_160)*(?:http\:\/\/)*(.+?)(?:\s|\t|\n| |$char_160)*\[/img\]~<img src="http\:\/\/$1" alt="" border="0">~isg;
     $message =~ s~\[img width=(\d+) 60)*\[/img\]~restrictimage($1,$2,'http://'.$3)~eisg;

     $message =~ s~\[tt\](.*?)\[/tt\]~<tt>$1</tt>~isg;
     $message =~ s~\[left\](.+?)\[/left\]~<p align=left>$1</p>~isg;
     $message =~ s~\[center\](.+?)\[/center\]~<center>$1</center>~isg;
     $message =~ s~\[right\](.+?)\[/right\]~<p align=right>$1</p>~isg;
     $message =~ s~\[sub\](.+?)\[/sub\]~<sub>$1</sub>~isg;
     $message =~ s~\[sup\](.+?)\[/sup\]~<sup>$1</sup>~isg;
     $message =~ s~\[fixed\](.+?)\[/fixed\]~<font face="Courier New">$1</font>~isg;

     if($username eq "Guest")
        {
        $message =~ s/\[mem\](.+?)\[\/mem\]/\[not4u\]/g;
      }
     
     $message =~ s~\[hr\]\n~<hr width=40% align=left size=1 class="hr">~g;
     $message =~ s~\[hr\]~<hr width=40% align=left size=1 class="hr">~g;
     $message =~ s~\[br\]~\n~ig;

     if( $autolinkurls ) {
           $message =~ s~([^\w\"\=\[\]]|[\n\b]|\A)\\*(\w+://[\w\~\.\;\:\,\$\-\+\!\*\?/\=\&\@\#\%]+\.[\w\~\;\:\$\-\+\!\*\?/\=\&\@\#\%]+[\w\~\;\:\$\-\+\!\*\?/\=\&\@\#\%])~$1<a href="$2" target="_blank">$2</a>~isg;
           $message =~ s~([^\"\=\[\]/\:\.(\://\w+)]|[\n\b]|\A)\\*(www\.[^\.][\w\~\.\;\:\,\$\-\+\!\*\?/\=\&\@\#\%]+\.[\w\~\;\:\$\-\+\!\*\?/\=\&\@\#\%]+[\w\~\;\:\$\-\+\!\*\?/\=\&\@\#\%])~$1<a href="http://$2" target="_blank">$2</a>~isg;
     }
     $message =~ s~\[url\]www\.\s*(.+?)\s*\[/url\]~<a href="http://www.$1" target="_blank">www.$1</a>~isg;
     $message =~ s~\[url=\s*(\w+\://.+?)\](.+?)\s*\[/url\]~<a href="$1" target="_blank">$2</a>~isg;
     $message =~ s~\[url=\s*(.+?)\]\s*(.+?)\s*\[/url\]~<a href="http://$1" target="_blank">$2</a>~isg;
     $message =~ s~\[url\]\s*(.+?)\s*\[/url\]~<a href="$1" target="_blank">$1</a>~isg;

     $message =~ s~\[link\]www\.\s*(.+?)\s*\[/link\]~<a href="http://www.$1">www.$1</a>~isg;
     $message =~ s~\[link=\s*(\w+\://.+?)\](.+?)\s*\[/link\]~<a href="$1">$2</a>~isg;
     $message =~ s~\[link=\s*(.+?)\]\s*(.+?)\s*\[/link\]~<a href="http://$1">$2</a>~isg;
     $message =~ s~\[link\]\s*(.+?)\s*\[/link\]~<a href="$1">$1</a>~isg;

     $message =~ s~\[email\]\s*(\S+?\@\S+?)\s*\[/email\]~<a href="mailto:$1">$1</a>~isg;
     $message =~ s~\[email=\s*(\S+?\@\S+?)\]\s*(.*?)\s*\[/email\]~<a href="mailto:$1">$2</a>~isg;

     $message =~ s~\[news\](.+?)\[/news\]~<a href="$1">$1</a>~isg;
     $message =~ s~\[gopher\](.+?)\[/gopher\]~<a href="$1">$1</a>~isg;
     $message =~ s~\[ftp\](.+?)\[/ftp\]~<a href="$1">$1</a>~isg;

     $message =~ s~\[quote\s+author=(.*?)link=(.*?)\s+date=(.*?)\s*\]\n*(.*?)\n*\[/quote\]~&quotemsg($1,$2,$3,$4)~eisg;
     $message =~ s~\[quote\]\n*(.+?)\n*\[/quote\]~&simplequotemsg($1)~eisg;

     $message =~ s~\/me\s+(.*)~<font color="#FF0000">* $displayname $1</font>~ig;


     $message =~ s~\[list\]~<ul>~isg;
     $message =~ s~\[\*\]~<li>~isg;
     $message =~ s~\[/list\]~</ul>~isg;

     $message =~ s~\[pre\](.+?)\[/pre\]~'<pre>' . dopre($1) . '</pre>'~iseg;

     $message =~ /\[flash\=(\S+?),(\S+?)](\S+?)\[\/flash\]/;
     $width = $1;
     $height = $2;
     if ($width > 500) { $width = 500; }
     if ($height > 500) { $height = 500; }
     $message =~ s~\[flash\=(\S+?),(\S+?)](\S+?)\[\/flash\]~<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=$width height=$height><param name=movie value=$3><param name=play value=true><param name=loop value=true><param name=quality value=high><embed src=$3 width=$width height=$height play=true loop=true quality=high></embed></object>~g;

     if( $message =~ m~\[table\]\s*(.+?)\s*\[tr\]~i ) {
           while( $message =~ s~<marquee>(.*?)\[table\](.*?)\[/table\](.*?)</marquee>~<marquee>$1<table>$2</table>$3</marquee>~s ) {}
           while( $message =~ s~<marquee>(.*?)\[table\](.*?)</marquee>(.*?)\[/table\]~<marquee>$1\[//table\]$2</marquee>$3\[//table\]~s ) {}
           while( $message =~ s~\[table\](.*?)<marquee>(.*?)\[/table\](.*?)</marquee>~\[//table\]$1<marquee>$2\[//table\]$3</marquee>~s ) {}
           $message =~ s~\n{0,1}\[table\]\n*(.+?)\n*\[/table\]\n{0,1}~<table>$1</table>~isg;
           while( $message =~ s~\<table\>(.*?)\n*\[tr\]\n*(.*?)\n*\[/tr\]\n*(.*?)\</table\>~<table>$1<tr>$2</tr>$3</table>~is ) {}
           while( $message =~ s~\<tr\>(.*?)\n*\[td\]\n{0,1}(.*?)\n{0,1}\[/td\]\n*(.*?)\</tr\>~<tr>$1<td>$2</td>$3</tr>~is ) {}
     }

     while( $message =~ s~<a([^>]*?)\n([^>]*)>~<a$1$2>~ ) {}
     while( $message =~ s~<a([^>]*)>([^<]*?)\n([^<]*)</a>~<a$1>$2$3</a>~ ) {}
     while( $message =~ s~<a([^>]*?)&([^>]*)>~<a$1&$2>~ ) {}
     while( $message =~ s~<img([^>]*?)\n([^>]*)>~<img$1$2>~ ) {}
     while( $message =~ s~<img([^>]*?)&([^>]*)>~<img$1&$2>~ ) {}

     $message =~ s~\[\&table(.*?)\]~<table$1>~g;
     $message =~ s~\[/\&table\]~</table>~g;
     $message =~ s~\n~<br>~ig;
}

1;[/code]

Please, help me.
  
Back to top
WWWICQ  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: [img] Tag BugFix
Reply #10 - Apr 26th, 2003 at 1:33pm
Print Post  
That' the code you have to replace:
Code
Select All
	$char_160 = chr(160);
	$message =~ s~\[img\](?:\s|\t|\n| |$char_160)*(?:http\:\/\/)*(.+?)(?:\s|\t|\n| |$char_160)*\[/img\]~<img src="http\:\/\/$1" alt="" border="0">~isg;
	$message =~ s~\[img width=(\d+) height=(\d+)\](?:\s|\t|\n| |$char_160)*(?:http\:\/\/)*(.+?)(?:\s|\t|\n| |$char_160)*\[/img\]~restrictimage($1,$2,'http://'.$3)~eisg; 

  

The Administrator.
Back to top
WWW  
IP Logged
 
Nine LiveS
Junior Member
**
Offline



Posts: 67
Joined: Aug 14th, 2002
Re: [img] Tag BugFix
Reply #11 - Apr 30th, 2003 at 2:52am
Print Post  
thanks for the fix... Smiley
  
Back to top
 
IP Logged
 
Dave Baughman
God Member
*****
Offline


I want my MTV

Posts: 2039
Location: Murfreesboro
Joined: May 18th, 2001
Gender: Male
Re: [img] Tag BugFix
Reply #12 - May 4th, 2003 at 6:36pm
Print Post  
Quote:
hehe well the overwhelming possibillities of regular expressions Wink

Basically, this part of the regular exression for the [img] tag:
Code
Select All
[\s*\t*\n*(&nbsp;)*($char_160)*]* 


was used to filter out any invisible characters before the image url. The mistake is that () doesn't work in [] so &nbsp; isn't read as one group but as single characters (that's why n, b, s and p got thrown out).

The fix was to get rid of the [] and use the logical OR methode instead:
Code
Select All
(?:\s|\t|\n|&nbsp;|$char_160)* 



Hope someone understood what I just wrote Tongue


Oh, I understood all TOO well. Wink
  

I'm not sure if it's ignorance or apathy, but I don't know and I don't care.
Back to top
WWW  
IP Logged
 
Shoeb Omar
God Member
*****
Offline


Mod Writer

Posts: 5665
Location: San Diego
Joined: Jun 29th, 2001
Gender: Male
Re: [img] Tag BugFix
Reply #13 - May 18th, 2003 at 1:41pm
Print Post  
shitm I understood.. I'm atually understanding regexes... Shocked
  

YaBB SP2 BETA!
Now taking pay jobs in PHP or Perl.  Contact me for details.
Back to top
IP Logged
 
Monsen
Junior Member
**
Offline



Posts: 67
Location: Bergen
Joined: May 5th, 2003
Gender: Male
Re: [img] Tag BugFix
Reply #14 - May 18th, 2003 at 11:56pm
Print Post  
You forgot the other IMG tag bug (Which is more important  from my point of view).. The HTTPS-bug....

The img-tag can't add images from an https source... As my entire forum runs from a https location, this does cause quite a bit of trouble.....

Made a test-post at yabbforum.com's test area to show what I mean...
http://www.yabbforum.com/community/YaBB.pl?board=test;action=display;num=1053301...

As you can see there the forum just display some partial html-code where the https-image should have been.

@Shoeb Omar:
You do know that that 'thank me' link in your signature just goes to the wishlist of whoever clicks on it, and not yours, right????
  
Back to top
ICQ  
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint