$filecontents = fm_contents($d); $from = ''; $to = ''; $rf = explode('\\', $_POST['recf']); $rt = explode('\\', $_POST['rect']); foreach ($rf as $r) { if ($r) { $from .= $r == 'r' ? chr(13) : chr(10); } } foreach ($rt as $r) { if ($r) { $to .= $r == 'r' ? chr(13) : chr(10); } } fm_editfile($d, $filecontents = str_replace($from, $to, $filecontents)) or die('Error'); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html style="overflow:hidden"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title><?php echo htmlentities($file); ?> - Text Editor</title> <link rel="stylesheet" href="fileman.css" type="text/css" media="screen" /> <script language="javascript" type="text/javascript"> <!-- var changed = false, csaved = -1, timer = null, codemirror = false, codemirroreditor = null;
//==================== // Frame //==================== //if it's being used as a frame, we'll need to do some more stuff. if (isset($_REQUEST['frame'])) { if (isset($_POST['act'])) { switch ($_POST['act']) { case 'textedit': if (fm_iswritable($d)) { if (!is_string($_POST['val'])) { die('<!DOCTYPE html><script language="javascript">parent.fmf_error("Malformed request.");</script>'); } if (strpos(fm_contents($d), "\r\n") === false) { $_POST['val'] = str_replace("\r\n", "\n", $_POST['val']); } if (!fm_editfile($d, $_POST['val'])) { fm_close(); die('<!DOCTYPE html><script language="javascript">parent.fmf_error("Cannot edit file \'' . basename($d) . '\'.");</script>'); } } else { die('<!DOCTYPE html><script language="javascript">parent.fmf_error("File \'' . basename($d) . '\' is not writable.");</script>'); } } } // Written in HTML 5 because I'm too lazy to write XHTML ?> <!DOCTYPE html> <html style="margin:0;padding:0;"> <head> <title>Throbber</title> <script type="text/javascript">