<?php
session_start();
if (!isset($_SESSION['login']))
{include("index.php");
exit();}
?>
<html>
<head>
<title>
<?php
extract($_GET);
echo "Rotide Egap v1.4 - Saving $file";
?>
</title>
<style type='text/css'>
body
{
font-family:arial, serif;
}
</style>
</head>
<body>
<?php
extract($_POST);
$user=$_SESSION['login'];
echo "<img src='http://netlink.kaibasoftware.com/Images/Logos/rotide1_4.gif' alt=''/>";
echo "\n<br/>\n<br/>\n";
echo "Saving $file...";
#print_r($_POST);
$filename="Users/$user/$file";
#for Advanced Editing
if ($egap_a_code)
{
$egap_a=fopen($filename, "w");
fwrite($egap_a,$egap_a_code);
fclose($egap_a);
}
#for Basic Editing
if ($egap_b_code)
{
#echo "<pre>".htmlentities($egap_b_code)."</pre>";
//place in the CSS link script
$css ="<html>";
$css.="\n <head>";
$css.="\n <title>".substr($file, 0, strlen($file)-5)."</title>";
$css.="\n <!--For IE No-Cache-->";
$css.="\n <meta http-equiv='Expires' content='-1'>";
$css.="\n <link media='screen' type='text/css' rel='stylesheet' href='www.css'/>";
$css.="\n <meta http-equiv='Pragma' content='no-cache'>";
$css.="\n </head>";
$css.="\n <!--Body OnLoad for Mozilla No-Cache-->";
$css.="\n <body onLoad='if (\"Navigator\" == navigator.appName) document.forms[0].reset();'>";
$search = stristr($egap_b_code, $css);
if ($search==FALSE)
$egap_b_code=$css.$egap_b_code;
//problem: when replacing the <LINK> string, PHP replaces with blank line
#$egap_b_code=str_replace($css, null, $egap_b_code);
$egap_b_code=str_replace('<td onclick="drop(this)">',"<td>", $egap_b_code);
$egap_b_code=str_replace(" "," ", $egap_b_code);
$egap_b_code=str_replace("><",">\n<", $egap_b_code);
#echo $egap_b_code;
$egap_b=fopen($filename,'w');
fwrite($egap_b,$egap_b_code);
fclose($egap_b);
#echo "<pre>".htmlentities($egap_b_code)."</pre>";
}
echo "\n<br/>\n<br/>\n";
echo "<b>$file Saved!</b>";
echo "\n<br/>\n<br/>\n";
echo "<small>This page will refresh to the <b>Site Manager</b> in 2 seconds...</small>";
echo "\n<meta http-equiv='refresh' content='2;URL=main.php?id=cms&file=$file'>";
?>
</body>
</html>