miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Specific miniBB Support Forums / Specific /  
 

Problem with addon code

 
Author judex001
Partaker
#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
Partaker
#3 | Posted: 21 Oct 2008 15:38 
It works fine now - thanks a lot.

Specific miniBB Support Forums / Specific /
 Problem with addon code
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑