miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Specific miniBB Support Forums / Specific /   

Problem with addon code

Author judex001
Registered
#1 | Posted: 21 Oct 2008 13:44 
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

Author Paul
Lead Developer
#2 | Posted: 21 Oct 2008 14:46 
Try to put the following condition:

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

surrounding code_unprotect function.

Author judex001
Registered
#3 | Posted: 21 Oct 2008 15:38 
It works fine now - thanks a lot.

Specific miniBB Support Forums / Specific / Problem with addon code Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB