Project

General

Profile

« Previous | Next » 

Revision c13b0b31

Added by Ermal LUÇI about 15 years ago

Ticket #777. Use Base64 encoding for file content so javascript/php does not get confused!

View differences:

usr/local/www/edit.php
1 1
<?php
2
/* $Id$ */
3 2
/*
4 3
	edit.php
5 4
	Copyright (C) 2004, 2005 Scott Ullrich
......
56 55
				echo "|" . gettext("No file name specified") . ".|";
57 56
			} else {
58 57
				conf_mount_rw();
59
				$_REQUEST['data'] = str_replace("\r", "", $_REQUEST['data']);
58
				$_REQUEST['data'] = str_replace("\r", "", base64_decode($_REQUEST['data']));
60 59
				$ret = file_put_contents($_REQUEST['file'], $_REQUEST['data']);
61 60
				conf_mount_ro();
62 61
				if($_REQUEST['file'] == "config.xml")
......
78 77
require("head.inc");
79 78
outputCSSFileInline("code-syntax-highlighter/SyntaxHighlighter.css");
80 79
outputJavaScriptFileInline("filebrowser/browser.js");
80
outputJavaScriptFileInline("javascript/base64.js");
81 81

  
82 82
?>
83 83

  
......
131 131
		$("fileStatus").innerHTML = "<?=gettext("Saving file"); ?> ...";
132 132
		Effect.Appear("fileStatusBox", { duration: 0.5 });
133 133
		
134
		var fileContent = escape($("fileContent").value);
134
		var fileContent = Base64.encode($("fileContent").value);
135 135
		fileContent = fileContent.replace(/\+/g,"%2B");
136 136
		
137 137
		new Ajax.Request(

Also available in: Unified diff