/* automatic script tabbing solution */
if(($action=='ptopic' or $action=='pthread' or $action=='editmsg2') or (isset($_POST['prevForm']) and trim($_POST['postText'])!='')){
if(preg_match_all('/\[script\](.+?)\[\/script\]/is',$_POST['postText'],$replacementI)){

function fjs($val){
if(get_magic_quotes_gpc()==1) $val=stripslashes($val);
$val=explode("\r",$val);
$add='';
foreach($val as $k=>$v){
$v=trim($v);
if(strstr($v,'}')) $add=substr($add,0,-4);
$val[$k]=chunk_split($add.$v,$GLOBALS['post_word_maxlength']," \n");
if(strstr($v,'{')) $add.='    ';
}
$val=str_replace(array("\n\r","\r\n"),"\r",implode("\r",$val));
if(get_magic_quotes_gpc()==1) $val=addslashes($val);
return $val;
}

foreach($replacementI[0] as $val) $_POST['postText']=str_replace($val,fjs($val),$_POST['postText']);
}
}
/*-- automatic script tabbing solution */