MTP / Frontpage Extensions switcheroo
<?php
$di = new RecursiveDirectoryIterator(__DIR__,RecursiveDirectoryIterator::SKIP_DOTS);
$it = new RecursiveIteratorIterator($di);
$oldHeader = "<div align=\"center\">
<center>
<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-width: 0\" bordercolor=\"#111111\" width=\"100%\" bgcolor=\"#FFFFFF\">
<tr>
<td width=\"264\" style=\"border-style: none; border-width: medium\">
<map name=\"FPMap0_I1\">
<area href=\"../index.html\" shape=\"rect\" coords=\"10, 10, 39, 49\">
<area href=\"http://www.morethanpaper.com/Merchant2/merchant.mvc?Screen=LOGN&Store_Code=MTP\" shape=\"rect\" coords=\"57, 4, 83, 62\">
<area href=\"http://www.morethanpaper.com/Merchant2/merchant.mvc?Screen=BASK&Store_Code=MTP\" shape=\"rect\" coords=\"100, 6, 141, 62\">
<area href=\"http://www.morethanpaper.com/Merchant2/merchant.mvc?Screen=OINF&Store_Code=MTP\" shape=\"rect\" coords=\"154, 9, 190, 62\">
</map>
<p align=\"center\">
<img border=\"0\" src=\"../images/TopBorderGraphics/MenuStructure.jpg\" align=\"center\" usemap=\"#FPMap0_I1\" width=\"191\" height=\"63\"></td>
<td width=\"614\" style=\"border-style: none; border-width: medium\">
<p style=\"margin-top: 0; margin-bottom: 0\" align=\"center\">
<a href=\"../index.html\">
<img border=\"0\" src=\"../images/TopBorderGraphics/Logo_2010.jpg\" alt=\"More Than Paper... Birth Announcements, Stationery, Stickers & more at discount prices everyday\" width=\"565\" height=\"90\"></a></td>
<td width=\"219\" style=\"border-style: none; border-width: medium\" bgcolor=\"#FFFFFF\">
<!-- SearchSpring Search Box Begins -->
<div class=\"cse-branding-form\">
<form action=\"http://search.morethanpaper.com/search/index\" id=\"cse-search-box\">
<font face=\"Comic Sans MS\" size=\"3\">
<p align=\"center\" style=\"margin-top: 0; margin-bottom: 6\">
<b><font face=\"Comic Sans MS\" size=\"2\" color=\"#008000\">
<a style=\"text-decoration: none\" href=\"http://www.morethanpaper.com/AboutUs.htm\">
<font color=\"#006600\" face=\"Comic Sans MS\">About Us</font></a> | <a style=\"text-decoration: none\" href=\"http://www.morethanpaper.com/ContactUs.htm\">
<font color=\"#006600\" face=\"Comic Sans MS\">Contact Us</font></a></font></b><p align=\"left\" style=\"margin-top: 0; margin-bottom: 0\">
<b>
<font face=\"Comic Sans MS\" size=\"1\" color=\"#006600\">search this site:</font></b><p align=\"left\" style=\"margin-top: 0; margin-bottom: 0\">
</font><input type=\"text\" name=\"query\" id=\"query\" class=\"searchspring-query\" size=\"18\" />
<input type=\"submit\" name=\"sa\" value=\"Search\" style=\"font-family: Comic Sans MS; font-size: 8pt; font-weight: bold; color: #FFFFFF; background-color: #006600\" />
</form>
</div>
<!-- SearchSpring Search Box Ends -->
</font>
</td>
</tr>
</table>
</center>
</div>
<hr color=\"#008000\">
<script type=\"text/javascript\">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-4286835-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
";
//$oldSidebar = preg_replace('(<table border="0" width="193" height="1289" bgcolor="#006600">)[\s\S]*?(?=</td><td valign="top" width="24"></td><!--msnavigation--><td valign="top"><p align="center"><b>)', $newLeft, $file_contents);
$oldFooter = "<hr color=\"#006600\">
<p align=\"center\" style=\"line-height: 150%; margin-top: 0; margin-bottom: 0\">
<map name=\"FPMap1_I3\">
<font face=\"Comic Sans MS\" color=\"#006600\">
<area href=\"mailto:orders@morethanpaper.com\" shape=\"rect\" coords=\"88, 47, 371, 60\">
</map>
<a href=\"http://www.morethanpaper.com/ContactUs.htm\" style=\"text-decoration: none\">
<font color=\"#006600\">Contact Us</font></a> |
<a href=\"http://www.morethanpaper.com/AboutUs.htm\" style=\"text-decoration: none\">
<font color=\"#006600\">About Us</font></a> |
<a href=\"http://www.morethanpaper.com/EmailSiteToFriend/EmailSiteToFriendForm.htm\" style=\"text-decoration: none\">
<font color=\"#006600\">Send This Site to a Friend</font></a> |
<a href=\"http://www.morethanpaper.com/MailingList/mailinglistform.htm\" style=\"text-decoration: none\">
<font color=\"#006600\">Join Our
Mailing List</font></a></font></p>
<p align=\"center\" style=\"line-height: 150%; margin-top: 0; margin-bottom: 0\">
<font face=\"Comic Sans MS\" color=\"#006600\">
<a href=\"http://www.morethanpaper.com/CustomersandFAQ/faqs.htm\" style=\"text-decoration: none\">
<font color=\"#006600\">FAQ</font></a> |
<a href=\"http://www.morethanpaper.com/CustomersandFAQ/Customers.htm\" style=\"text-decoration: none\" >
<font color=\"#006600\">What Our
Customers Say</font></a> |
<a href=\"http://www.morethanpaper.com/store_map_MTP.html\" style=\"text-decoration: none\">
<font color=\"#006600\">Site Map</font></a> |
<a href=\"http://www.morethanpaper.com/PrivacyandSecurity.html\" style=\"text-decoration: none\">
<font color=\"#006600\">Privacy &
Security</font></a></font></p>
<p align=\"center\" style=\"line-height: 100%; margin-top: 0; margin-bottom: 0\">
</p>
<p align=\"center\" style=\"line-height: 100%; margin-top: 0; margin-bottom: 0\">
<b><font color=\"#006600\" size=\"2\" face=\"Tempus Sans ITC\">
<img border=\"0\" src=\"../images/BottomBorderEfaxEmail.gif\" usemap=\"#FPMap1_I3\" width=\"480\" height=\"64\"><br>
</font></b></p>
<div align=\"center\">
<center>
<table border=\"0\" cellspacing=\"1\" width=\"27%\">
<tr>
<td width=\"25%\" valign=\"bottom\">
<p align=\"center\"><img border=\"0\" src=\"../CreditCards/Amex2_small.jpg\" width=\"50\" height=\"35\"><img border=\"0\" src=\"../CreditCards/VisaFlag_small.jpg\" width=\"50\" height=\"31\"><img border=\"0\" src=\"../CreditCards/MasterCard_small.jpg\" width=\"50\" height=\"31\"><img border=\"0\" src=\"../CreditCards/Discover_small.jpg\" width=\"50\" height=\"33\"></td>
</tr>
</table>
</center>
</div>
<p align=\"center\" style=\"line-height: 100%; margin-top: 0; margin-bottom: 0\">
</p>
<p align=\"center\" style=\"line-height: 100%; margin-top: 0; margin-bottom: 0\"><font face=\"Comic Sans MS\" size=\"1\" color=\"#006600\">
<br>
Send
email to <a href=\"mailto:webmaster@morethanpaper.com\">webmaster@morethanpaper.com</a>
with questions or comments regarding this website.</font></p>
<p align=\"center\" style=\"line-height: 100%; margin-top: 0; margin-bottom: 0\"><font color=\"#006600\" size=\"1\" face=\"Comic Sans MS\">
<br>
Copyright ©
1999-2014 More Than Paper, Inc. All rights reserved.<br>
No part of this HTML nor graphic images may be utilized, reproduced, stored in a
retrieval system, <br>
or transmitted in any form or by any means -- electronic, mechanical,
photocopying, </font></p>
<p align=\"center\" style=\"line-height: 100%; margin-top: 0; margin-bottom: 0\"><font color=\"#006600\" size=\"1\" face=\"Comic Sans MS\">
recording or otherwise -- without the written permission of the copyright owner.</font></p>
<script type=\"text/javascript\">
adroll_adv_id = \"2TT5R4CKA5DCLJBEZR3DIQ\";
adroll_pix_id = \"YPJ2VSI3TFG33G3E5FEDFS\";
(function () {
var oldonload = window.onload;
window.onload = function(){
__adroll_loaded=true;
var scr = document.createElement(\"script\");
var host = ((\"https:\" == document.location.protocol) ? \"https://s.adroll.com\" : \"http://a.adroll.com\");
scr.setAttribute('async', 'true');
scr.type = \"text/javascript\";
scr.src = host + \"/j/roundtrip.js\";
((document.getElementsByTagName('head') || [null])[0] ||
document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
if(oldonload){oldonload()}};
}());
</script>
</td></tr></table></body>
</html>";
$newHeader = '
<!-- START GLOBAL HEADER -->
<?php include ($_SERVER[\'DOCUMENT_ROOT\'] .\'/global/header.php\'); ?>
<!-- END GLOBAL HEADER -->';
$newLeft = '
<!-- START GLOBAL LEFT -->
<?php include ($_SERVER[\'DOCUMENT_ROOT\'] .\'/global/left.php\'); ?>
<!-- END GLOBAL LEFT -->';
$newFooter = '
<!-- START GLOBAL FOOTER -->
<?php include ($_SERVER[\'DOCUMENT_ROOT\'] .\'/global/footer.php\'); ?>
<!-- END GLOBAL FOOTER -->';
$removegenerator = '<meta name="GENERATOR" content="Microsoft FrontPage 5.0">';
$removemico = '<meta name="Microsoft Border" content="tlb, default">';
$removemsnav = '<!--msnavigation-->';
$removepgid = '<meta name="ProgId" content="FrontPage.Editor.Document">';
function replace_extension($filename, $new_extension) {
$info = pathinfo($filename);
return $info['filename'] . '.' . $new_extension;
}
foreach($it as $file)
{
if(pathinfo($file,PATHINFO_EXTENSION) == "htm") {
$file = str_replace('/home8/tesstacu/public_html/fun/morethanpaper/','',$file);
$path_to_file = $file;
$file_contents = file_get_contents($path_to_file);
$file_contents = preg_replace('/(<table border="0" width="193" height="1289" bgcolor="#006600">)[\s\S]*?(?=<\/td><td valign="top" width="24"><\/td><\!\-\-msnavigation\-\-><td valign="top"><p align="center"><b>)/', $newLeft, $file_contents);
$file_contents = preg_replace('/(<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>\n\n<hr color="#006600">)[\s\S]*?(?=<\/body>\n\n<\/html>)/', $newFooter, $file_contents);
$file_contents = str_replace($oldHeader,$newHeader,$file_contents);
//$file_contents = str_replace($oldLeft,$newLeft,$file_contents);
//$file_contents = str_replace($oldFooter,$newFooter,$file_contents);
$file_contents = str_replace($removegenerator,'',$file_contents);
$file_contents = str_replace($removemico,'',$file_contents);
$file_contents = str_replace($removemsnav,'',$file_contents);
$file_contents = str_replace($removepgid, '', $file_contents);
file_put_contents($path_to_file,$file_contents);
//replace_extension($file, '.php');
echo $file .'<br />';
}
}
?>