php forum
php mysql forum
php mysql smarty
 
Topic Options
#283163 - 01/19/05 02:18 PM Auto link certain words
Pasqualist Offline
Member

Registered: 01/30/03
Posts: 285
Loc: Amsterdam, The Netherlands
I would really love a mod that would change certain words on my forum into predefined links. It would actually work just like the badwords filter, only now each 'bad word' would have it's own substitute link.<br /><br />This way I could have auto-links to previous discussed topics or, the most important: link to my affilates! <img src="http://www.ubbdev.com/forum/images/graemlins/laugh.gif" alt="" /><br /><br />So if the company name of my affiliate program would be mentioned, it would automatically be substututed by my affiliate URL...<br /><br />Crazy idea ?

Top
#283164 - 01/20/05 03:03 AM Re: Auto link certain words [Re: 10k]
Anno Offline
Code Monkey

Registered: 05/23/01
Posts: 562
Loc: Austria
No. <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" />

Top
#283165 - 01/20/05 04:16 PM Re: Auto link certain words [Re: domain123]
DrChaos Offline
Coder

Registered: 09/12/03
Posts: 816
Loc: Hollywood Florida.
That would be sweet.<br /><br />could also work like the bad word filter is the sence that you would put the linkable word like this....<br /><br />halo2=www.bungie.net
_________________________
DrChaos
LeetGamers

Top
#283166 - 01/20/05 06:47 PM Re: Auto link certain words [Re: Duck]
Anno Offline
Code Monkey

Registered: 05/23/01
Posts: 562
Loc: Austria
well....<br /><br />Let's try this.<br /><br />Enable censoring, and enter your link urls there in the form:<br /><br />targetword=http://www.this.is/thelink.htm<br /><br /><br />Then<br />in ubb.inc.php<br /><br />search for:<br /><br />$replacewords[] = $replace;<br /><br />replace with:<br /><br />if (stristr($replace,"http")){<br />$replacewords[]= "[url=".$replace."]".$word."[/url]";<br /> }else{<br /> $replacewords[] = $replace;<br />}<br /><br /><br />in addpost.php<br /><br />search for:<br />if ($config['docensor']) {<br /><br />replace with:<br />if ($config['docensor'] && $preview != 1 ) {

Top
#283167 - 01/20/05 07:28 PM Re: Auto link certain words [Re: domain123]
scroungr Offline
Old Hand

Registered: 10/17/03
Posts: 2409
Loc: Richmond, VA
just inject yourself with the hijack virus.. it does it <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" />
_________________________
Couchtomatoe - www.couch-tomatoe.cc
My abilities are for hire for installs, upgrades, custom themes and custom modifications.

Top
#283168 - 01/21/05 04:51 PM Re: Auto link certain words [Re: 234234]
Pasqualist Offline
Member

Registered: 01/30/03
Posts: 285
Loc: Amsterdam, The Netherlands
Looking forward to test this out!<br />Only what code to change in 6.4 ? This one seems to be for 6.5 <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" /><br /><br />Another question: many words/company names I would like to replace by a link, consist of two words. Could this mod also handle that? For example: "coca cola" <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" />

Top
#283169 - 01/22/05 03:55 AM Re: Auto link certain words [Re: 10k]
Anno Offline
Code Monkey

Registered: 05/23/01
Posts: 562
Loc: Austria
>many words/company names I would like to replace by a link, consist of two words. >Could this mod also handle that?<br /><br />This particular mod as it is, no.<br /><br />This mod will only work for 6.5 since 6.4 handles the censoring differently.

Top
#283170 - 01/22/05 05:29 AM Re: Auto link certain words [Re: domain123]
Pasqualist Offline
Member

Registered: 01/30/03
Posts: 285
Loc: Amsterdam, The Netherlands
Ok, in that case I'll just have to wait for 6.5.1 <img src="http://www.ubbdev.com/forum/images/graemlins/laugh.gif" alt="" /><br />Thanks so far Anno!

Top
#283171 - 01/22/05 03:49 PM Re: Auto link certain words [Re: 10k]
paradox183 Offline
Newbie

Registered: 09/28/04
Posts: 16
I have a similar question. A site that I visit uses an old version of WWWThreads, and when you paste or type a link without using the URL tag, it will automatically convert the link, but it will show up as "The Link" instead of the entire URL. I'd like to do that with 6.5, but the solution is not obvious.<br /><br />This is the section of code I'm looking at (from ubbt.inc.php):<br /><br />
Code:
    // Convert www -&gt; html<br />        $Body = " " . $Body;<br />        $Body = preg_replace("#([\n\r ])([a-z]+?)://([^, \n\r]+)#i", "\\1&lt;a href=\"\\2://\\3\" target=\"_blank\"&gt;\\2://\\3&lt;/a&gt;", $Body);<br />        $Body = preg_replace("#([\n\r ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^, \n\r]*)?)#i", "\\1&lt;a href=\"http://www.\\2.\\3\\4\" target=\"_blank\"&gt;www.\\2.\\3\\4&lt;/a&gt;", $Body);<br />        $Body = preg_replace("#([\n\r ])([a-z0-9\-_.]+?)@([^, \n\r]+)#i", "\\1&lt;a href=\"mailto:\\2@\\3\"&gt;\\2@\\3&lt;/a&gt;", $Body);<br />        $Body = substr($Body, 1);
<br /><br />Is it as easy as changing the first two preg_replace's to the following?<br /><br />
Code:
        $Body = preg_replace("#([\n\r ])([a-z]+?)://([^, \n\r]+)#i", "\\1&lt;a href=\"\\2://\\3\" target=\"_blank\"&gt;The Link&lt;/a&gt; ", $Body);<br />        $Body = preg_replace("#([\n\r ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^, \n\r]*)?)#i", "\\1&lt;a href=\"http://www.\\2.\\3\\4\" target=\"_blank\"&gt;The Link&lt;/a&gt; ", $Body);
<br /><br />Any help would be appreciated.
_________________________
OrangeWhoopass.com

Top
#283172 - 01/22/05 06:44 PM Re: Auto link certain words [Re: Similac]
Anno Offline
Code Monkey

Registered: 05/23/01
Posts: 562
Loc: Austria
>Is it as easy as changing the first two preg_replace's to the following?<br /><br />Yes.

Top



Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks