<?php
include "includes/config.inc.php3";
include "includes/site_edit.lib.php3";
include "includes/header.php3";
include "includes/footer.php3";
show_header("main");
switch ($op) {
case "replace":
$contents = stripslashes($contents);
if ($key_search) {
$contents = str_replace($key_search,$key_replace,$contents);
}
break;
case "write":
if (is_dir($filepath)) {
$filepath = $filepath . "/" . $filename;
} else {
$filepath = dirname($filepath) . "/" . $filename;
}
$fd = fopen($filepath,"w");
$contents = stripslashes($contents);
$len = strlen($contents);
$wlen = fwrite($fd,$contents,$len);
fclose($fd);
break;
default:
$filename = "";
$contents = "";
if (is_file($filepath)) {
$filename = basename($filepath);
$fd = fopen($filepath, "r");
$contents = fread ($fd, filesize ($filepath));
fclose ($fd);
}
break;
}
?>
<?php echo $filepath ?>
<hr>
<form action="op_edit.php3?op=replace" method="post" target=_parent>
<input name="contents" type="hidden" value="<?php
printf("%s",htmlspecialchars($contents)); ?>">
<input name="filepath" type="hidden" value="<?php echo $filepath ?>">
<input name="filename" type="hidden" value="<?php echo $filename ?>">
<input name="key_search" type="text" value="<?php echo $key_search ?>">
<input name="key_replace" type="text" value="<?php echo $key_replace ?>">
<input type="submit" value="Replace">
</form>
<form action="op_edit.php3?op=write" method="post" target=_parent>
<textarea type="text" name="contents" style="WIDTH:100%; HEIGHT:80%" rows="30"><?php
printf("%s",htmlspecialchars($contents)); ?></textarea>
<input name="filepath" type="hidden" value="<?php echo $filepath ?>">
<input name="filename" type="text" value="<?php echo $filename ?>">
<input type="submit" value="<?php echo $strSave ?>">
</form>
<a href="includes/jeditor.html" target="jeditor">jeditor</a>
<?php show_footer(); ?>