better processing of manual for the web: now it doesnt produce two<head>s etc...

#I HAVENT TEST THIS. can anybody test this on-line please? thanks
This commit is contained in:
nlopess
2004-05-23 16:21:42 +00:00
parent cc2404234f
commit ea24d25a46

View File

@@ -24,13 +24,13 @@
set_time_limit(0); set_time_limit(0);
$search = array( $search = array(
'<BODY', '/(<HTML.*<META.*HTTP-EQUIV="Content-type".*charset=(.*)".*<BODY[^>]+>)/mSs',
'</BODY' '/(<\/BODY\s*><\/HTML\s*>)/mS'
); );
$replace = array( $replace = array(
'<?php if(!isset($_GET["print"]) && !strstr($_SERVER["REQUEST_URI"],"/print/")) { commonHeader(); } ?><BODY', '<?php if(!isset($_GET["print"])&&!strstr($_SERVER["REQUEST_URI"],"/print/")){ini_set("default_charset","\2");commonHeader();}else{ ?> \1 } ?>',
'<?php if(!isset($_GET["print"]) && !strstr($_SERVER["REQUEST_URI"],"/print/")) { commonFooter(); } ?></BODY' '<?php if(!isset($_GET["print"])&&!strstr($_SERVER["REQUEST_URI"],"/print/")){commonFooter();}else{ echo "</body></html>";} ?>'
); );
if ($dir = opendir('phpweb')) { if ($dir = opendir('phpweb')) {
@@ -40,9 +40,10 @@ if ($dir = opendir('phpweb')) {
if(substr($file, -4) == '.php') { if(substr($file, -4) == '.php') {
$text = file_get_contents('phpweb/' . $file); $text = file_get_contents('phpweb/' . $file);
$text = str_replace($search, $replace, $text);
$handler = fopen('phpweb/' . $file, 'w+'); $text = preg_replace($search, $replace, $text);
$handler = fopen('phpweb2/' . $file, 'w+');
fputs($handler, $text); fputs($handler, $text);
fclose($handler); fclose($handler);
} }