Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GS on PHP 5.3
#3
spilarix Wrote:admin/edit.php line 58 :
Code:
$content = stripslashes($data_edit->content);

You just have to replace by :
Code:
$content = $data_edit->content;

Thank you. It works -- backslashes no longer disappear when saving a page. But backslashes still disappear on the public page. To fix this you must also change
admin/inc/theme_functions.php, line 19:
Code:
$content = stripslashes(htmlspecialchars_decode($content, ENT_QUOTES));
replace by:
Code:
$content = htmlspecialchars_decode($content, ENT_QUOTES);

(Note: I've edited the previous paragraph, the bold phrase replaces what I said: "But the public page now displays double backslashes :-)", oops.)


However I think I have found a better solution. Instead of those two changes, just edit admin/changedata.php, line 97:
Code:
if(isset($_POST['post-content'])) { $content = htmlentities($_POST['post-content'], ENT_QUOTES, 'UTF-8'); }
change to:
Code:
if(isset($_POST['post-content'])) { $content = addslashes(htmlentities($_POST['post-content'], ENT_QUOTES, 'UTF-8')); }

A better fix: To make it work with both magic quotes disabled and enabled, same line could be replaced by:
Code:
if(isset($_POST['post-content'])) {
    $content = htmlentities($_POST['post-content'], ENT_QUOTES, 'UTF-8');
    if (get_magic_quotes_gpc()==0) { $content = addslashes($content); }
}

I'm not totally sure, but that (or something like that) could be the fix for this issue.
(I have tested on localhost/PHP 5.3.2 with magic quotes off, and on my shared hosting/PHP 5.2.12 with magic quotes on)

spilarix Wrote:However, I don't understand why you don't have the problem with Php < 5.3.

As I said, it seems it's because of magic quotes, which are usually -I believe- enabled by default on PHP < 5.3
Reply


Messages In This Thread
GS on PHP 5.3 - by Carlos - 2010-04-27, 06:29:27
GS on PHP 5.3 - by spilarix - 2010-04-27, 22:54:04
GS on PHP 5.3 - by Carlos - 2010-05-17, 06:19:16
GS on PHP 5.3 - by Carlos - 2010-05-17, 15:40:19
GS on PHP 5.3 - by ccagle8 - 2010-05-18, 20:35:31
GS on PHP 5.3 - by Carlos - 2010-05-19, 00:46:00
GS on PHP 5.3 - by Carlos - 2010-05-19, 06:02:47



Users browsing this thread: 1 Guest(s)