gWorldz / get-simple-cms

Automatically exported from code.google.com/p/get-simple-cms
GNU General Public License v3.0
0 stars 0 forks source link

Theme edit: backslashes are stripped #279

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I noticed a problem when editing theme files if there are backslashes.

Example: if you edit template.php (in the backend), insert <?php echo '\\'; ?> 
somewhere, and save it, it is changed to <?php echo '\'; ?> and the site is 
then broken.

Happened with GS 3.0 too (hadn't noticed this before).
Both with magic quotes gpc on and off.
Haven't been able to test with PHP 5.2 (anyone?)

A fix that works for me:
Edit admin/theme-edit.php, line 49.
Change:
    $FileContents = stripslashes($_POST['content']);
to:
    $FileContents = $_POST['content'];

Original issue reported on code.google.com by carnav on 5 Jan 2012 at 9:13

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r620.

Original comment by MichaelS...@gmail.com on 5 Jan 2012 at 12:01

GoogleCodeExporter commented 9 years ago
It seems we now have problems with hosts with magic quotes enabled:
http://get-simple.info/forum/post/21705/#p21705

Suggested patch:

Edit admin/theme-edit.php, change line 49:

$FileContents = $_POST['content'];

to:

$FileContents = get_magic_quotes_gpc() ? stripslashes($_POST['content']) : 
$_POST['content'];

Original comment by carnav on 15 Jan 2012 at 4:44

GoogleCodeExporter commented 9 years ago
I've added this in r627 

Original comment by MichaelS...@gmail.com on 15 Jan 2012 at 9:11