$len) { return substr($str, 0, $len - 3) . "..."; } else { return $str; } } // strip cr's between UBB tags function StripEnters($tmpstr) { $counter = 0; $newstr = ""; while( $counter <= strlen($tmpstr)) { if( ($tmpstr[$counter] <> chr(13)) && ($tmpstr[$counter] <> chr(10))) { $newstr .= $tmpstr[$counter]; } else { if( $counter > 1) { if( $tmpstr[$counter] == chr(13)) { if( $tmpstr[$counter - 1] <> ']') { $newstr .= $tmpstr[$counter]; } } } } } return $newstr; } function runUbbParser($ubb, $ubb_ispdfcreate, $stripcr) { // initialize variables // DISABLE $ubb_ispdfcreate = false; // DISABLE $stripcr = true; $spec = ""; $tmpstr = $ubb; $tmpout = ''; $tmpparsed = ''; // open the HTML editor $outstr = file_get_contents(TPLPATH . 'howto_editor_php.html'); // and replace the ubb $outstr = str_replace('@$ubb$@', stripslashes($tmpstr), $outstr); // replace the pdf value if( $ubb_ispdfcreate) { $outstr = str_replace('@$pdf$@', 'CHECKED', $outstr); } // and do the same with the stripcr value if( $stripcr) { $outstr = str_replace('@$stripcr$@', 'CHECKED', $outstr); } // and display the string $tmpout .= $outstr; $outstr = ""; // add some line feeds $tmpout .= "






"; // now add the html if( !($ubb_ispdfcreate)) { $outstr .= file_get_contents(TPLPATH . 'howto_open.html'); $starttime = GetMicroTimer(); $outstr .= UbbParse($tmpstr, '', $ubb_ispdfcreate, $spec); $endtime = GetMicroTimer(); $outstr .= file_get_contents(TPLPATH . 'howto_close.html'); } else { $outstr .= file_get_contents(TPLPATH . 'howtopdf_open.html'); $outstr .= UbbParse($tmpstr, '', $ubb_ispdfcreate, $spec); $outstr .= file_get_contents(TPLPATH . 'howtopdf_close.html'); } // now ugly hardcode the selector $selectorstr = ''; // and add it to the output string if( !($ubb_ispdfcreate)) { $outstr = $selectorstr . $outstr; } // and remove the neters from the output string $outstr = str_replace(chr(13), '', $outstr); $outstr = str_replace(chr(10), '', $outstr); $outstr = str_replace('', "\r\n", $outstr); // replace the sectionlist $outstr = str_replace('[sectionlist]', getSectionListString($spec), $outstr); // and remove slashes $outstr = stripslashes($outstr); // and dispaly it $tmpout .= '
' . $outstr . '
'; $tmpparsed = $outstr; // and display some seperating stuff $tmpout .= '!






'; // add some norml stuff to prevent it from being parsed by the forum if( !($ubb_ispdfcreate)) { $outstr = '[norml]' . $outstr . '[/norml]'; } // now give the result in an edit box, ready to be pasted $tmpout .= ''; // create an temporary filename $tmpname = time(); // and replace the output $tmpcmd = PDFCONVERTER; $tmpcmd = str_replace('$@outfile@$', PDFTEMPNAME . $tmpname . '.pdf', $tmpcmd); $tmpcmd = str_replace('$@infile@$', PDFTEMPNAME . $tmpname . '.html', $tmpcmd); // create the temporary html file WriteFile(PDFTEMPNAME . $tmpname . '.html', $outstr); // create the ubb file WriteFile(PDFTEMPNAME . $tmpname . '.ubb', $tmpstr); // show the processing time if( !($ubb_ispdfcreate)) { // echo '



Processing time: ' . $endtime - $starttime . '


'; } // show the user the urls $tmpout .= '' . $tmpname . '.html -- Print HTML versie
'; $tmpout .= '' . $tmpname . '.ubb -- UBB (input) versie
'; // show the user we are creating an pdf if( $ubb_ispdfcreate) { $tmpout .= 'Aanmaken PDF - dit kan een tijdje duren - ze zijn straks te vinden op onderstaande lokatie (dit kan tot 15 minuten duren!)
'; $tmpout .= '' . $tmpname . '.pdf -- PDF versie
'; // flush output flush(); // and run the pdf thingie shell_exec($tmpcmd); // and show were done $tmpout .= "Done ..."; } return Array('out' => $tmpout, 'parsed' => $tmpparsed); }