Nofollow, Bold,  and Underline for Forum Links

September 15, 2009 by Floppy

Much like its inspiring brother phpnuke nofollow news mod, the forum mod is basically the same code with integration into the phpbb2 forums for phpnuke.   The only real difference is where the mod is implemented or which file.

To get started Open /includes/bbcode.php

Find

// Remove our padding..
 $ret = substr($ret, 1);

After Add

//Floppy's Underline and Bold Phnuke Forums Post Hack (www.clanthemes.com)
 $ret = preg_replace('#<a(.*?)</a>#','<strong><u><a$1</a></u></strong>',$ret);
//Floppy's Nofollow External Links for Phpnuke Forums Hack (www.clanthemes.com)
$your_domain = 'clanthemes.com';//Change this to your domain
preg_match_all('#href=&quot;((http://www.|http://|www.)(.*?))&quot;#',$ret,$matches);
foreach($matches[0] as $link){
 if(stristr($link, $your_domain) == false){
 $ret = str_replace($link, $link.' rel=&quot;nofollow&quot;', $ret);
 }
}

Once again, only the nofollow tag is added to external links that do not match your set domain in the code above.  If you want to remove that portion you can just eliminate the below code from the mod.

//Floppy's Nofollow External Links for Phpnuke Forums Hack (www.clanthemes.com)
 $your_domain = 'clanthemes.com';//Change this to your domain
 preg_match_all('#href=&quot;((http://www.|http://|www.)(.*?))&quot;#',$ret,$matches);
 foreach($matches[0] as $link){
 if(stristr($link, $your_domain) == false){
 $ret = str_replace($link, $link.' rel=&quot;nofollow&quot;', $ret);
 }
}

Just put your new edited bbcode.php file back in place on your server to complete the hack.  Let me know if you have any questions.

Related posts:

  1. Make all Phpnuke News Links Bold, Underline, Open in New Window, and External Links Nofollow
  2. BBCode Box 5.1.0