miniBB ®®
Fight the automated spam - protect your miniBB-forums,
getting the Captcha addon! Click here to read more.
Captcha Addon for miniBB
Community Forum
 | Forums | File Bank | Sign Up | Reply | Search | Statistics | Manual |
Specific miniBB Community Forum / Specific /

Problem with addon code

 
judex001
Forums Member
#1 | Posted: 21 Oct 2008 13:44
Reply 
Hi,

First thanks for a wonderful forum app and all the work around.

I try to add the addon code to my forum but it seems I have a problem when I try to use it in a new topic (I don't have any problem when replying).

When I click on post topic, I got an error message :

Fatal error: Cannot redeclare code_unprotect() (previously declared in /home/content/f/x/c/fxconfidential/html/forum/bb_codes.php:87) in .../forum/bb_codes.php on line 87

=====================================================
line 87 :/* ADDON -- code */
line 88 : if(preg_match_all('/\{ \[ \}code\{ \] \}(.+?)\{ \[ \}\/code\{ \] and ...\}/is',$msg,$replacementI)){

function code_unprotect($val){
if(get_magic_quotes_gpc()==1) $val=stripslashes($val);
$val=str_replace("{ : }",":",$val);
$val=str_replace("{ ; }",";",$val);
$val=str_replace("{ [ }","[",$val);
$val=str_replace("{ ] }","]",$val);
$val=str_replace(array("\n\r","\r\n"),"\r",$val);
if(get_magic_quotes_gpc()==1) $val=addslashes($val);
return $val;
}


foreach($replacementI[0] as $val) $msg=str_replace($val,code_unprotect($val),$msg);
}

$pattern=array(); $replacement=array();
$pattern[]="/\[code\](.+?)\[\/code\]/is";
$replacement[]='<div class="jscript"><pre>\\1</pre></div>';
$msg=preg_replace($pattern, $replacement, $msg);
/* END ADDON -- code */
=====================================================

Thanks for your help
Paul
CEO
#2 | Posted: 21 Oct 2008 14:46
Reply 
Try to put the following condition:

if(!function_exists('code_unprotect')){
...
}

surrounding code_unprotect function.
judex001
Forums Member
#3 | Posted: 21 Oct 2008 15:38
Reply 
It works fine now - thanks a lot.
 
Your Reply
Bold Style  Italic Style  Image Link  URL Link 


» Username  » Password 
You are welcome to post anonymously by entering a nickname with no password (if that nickname has not been taken by another member) or by leaving both fields empty. If you have a forums membership account, you can also sign in from this page without posting a message, or sign in and post at once.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 
Online now: Guests - 46
Members - 0
Most users ever online: 191 [24 Dec 2007 14:33]
Guests - 191 / Members - 0

Forums are powered by miniBB®