<" but am unable to make this work. I imagine that these are changed to < and > before it gets to the gramelin chec..."> <" but am unable to make this work. I imagine that these are changed to < and > before it gets to the gramelin chec...">
Previous Thread
Next Thread
Print Thread
Hop To
Joined: Oct 2006
Posts: 37
G
newbie
newbie
G Offline
Joined: Oct 2006
Posts: 37
I would like a gramelin code of "<><" but am unable to make this work. I imagine that these are changed to < and > before it gets to the gramelin check.

Last edited by Rick; 11/08/2006 3:02 PM.
Joined: Oct 2006
Posts: 37
G
newbie
newbie
G Offline
Joined: Oct 2006
Posts: 37
Darn, can't just move the translation of < and > to after the gramelin code because the gramelin code inserts <img> tags.

This works, however. Around line 923 of libs/ubbthreads.inc.php, translate the smiley code characters also. Now they'll match the text, if they occur.

Change:
Code
if ($smiley) {
    @eval("\$string = $code;");
To:
Code
if ($smiley) {
   $smiley = str_replace( '&', '&amp;', $smiley );
   $smiley = str_replace( '<', '&lt;', $smiley );
   $smiley = str_replace( '>', '&gt;', $smiley );
   @eval("\$string = $code;");
This works on my system.

Another advantage of this is you can now safely insert $smiley into the ALT of the image tags that follow a few lines down (the first two). I've also inserted TITLEs to help explain the gramelins to anyone that doesn't recognize them.

OK, so this is the entire IF statement:
Code
if ($smiley) {
   $smiley = str_replace( '&', '&amp;', $smiley );
   $smiley = str_replace( '<', '&lt;', $smiley );
   $smiley = str_replace( '>', '&gt;', $smiley );

   @eval("\$string = $code;");
   $string = preg_quote($string,'/');
   $smiley = preg_quote($smiley,'/');
   for($i = 0; $i< 2; $i++) {
      $body = preg_replace("/( |\n|^|\r\])$smiley( |$|\n|\r|\[)/i","\\1<img src=\"{$config['BASE_URL']}/images/graemlins/default/$image\" alt=\"$smiley\" title=\"$string\" height=\"$height\" width=\"$width\" />\\2",$body);
   }
   $body = preg_replace("/(\[|:)$string(\]|:)/i","<img src=\"{$config['BASE_URL']}/images/graemlins/default/$image\" alt=\"$smiley\" title=\"$string\" height=\"$height\" width=\"$width\" />",$body);
} else {
   @eval("\$string = $code;");
   $string = preg_quote($string,'/');
   $body = preg_replace("/(\[|:)$string(\]|:)/i","<img src=\"{$config['BASE_URL']}/images/graemlins/default/$image\" alt=\"\" title=\"$string\" height=\"$height\" width=\"$width\" />",$body);
}

This also fulfills this suggestion.

Last edited by GregH; 11/06/2006 7:25 AM.
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Thanks for the changes. Will get this implemented and do some testing with it.

Joined: Jun 2006
Posts: 16,299
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,299
Likes: 116
I sense a future <3 gremlin lol


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Is UBB.threads still going?
by Aaron101 - 04/01/2022 8:18 AM
Who's Online Now
3 members (Nightcrawler, Outdoorking, 1 invisible), 818 guests, and 395 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)