Impossible to edit

Questions about how to use the online - editors and suggestions how to improve them
delan10
Posts: 32
Joined: Sat May 24, 2008 6:18 pm

Re: Impossible to edit

Post by delan10 » Mon Oct 28, 2013 8:09 pm

Yeeess !
It works.
Thank you again. :D

So it was the hoster not being able to cope with gzip the compression ?

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Impossible to edit

Post by cmb » Tue Oct 29, 2013 2:07 pm

delan10 wrote:So it was the hoster not being able to cope with gzip the compression ?
Most likely the issue is, that the routine implementing the use_gzip="true" variant is conceptionally broken. It seems to me there is a race condition involved, that is not properly handled (after executing tinyMCE_GZ.init(), the code does not necessarily wait for the definition of tinyMCE to be loaded; if that takes too long for whatever reason, instantiating TinyMCE will fail).[1] However, there will be no problems on servers where the PHP ini setting zlib.output_compression is On (you can check that under "System Info and Help" -> "PHP Info"). If that setting is Off, you should set use_gzip="" to be on the safe side.

PS: [1] No, that is not true. The code properly waits as the XHR is done asynchronously. I have to assume that the problem is due to plugins/MLDtinymce_XH/tiny_mce/tiny_mce_gzip.php failing to send the proper response. To find out the reason, debugging would be necessary. Anyway, the workaround setting use_gzip="" seems to work, so I suggest to stick with it and not wasting more time on this issue. :)
Last edited by cmb on Tue Oct 29, 2013 2:49 pm, edited 1 time in total.
Reason: added PS
Christoph M. Becker – Plugins for CMSimple_XH

delan10
Posts: 32
Joined: Sat May 24, 2008 6:18 pm

Re: Impossible to edit

Post by delan10 » Tue Oct 29, 2013 5:03 pm

Thanx again for your help and your explanations ! :)

Bonus question ;) :

Do you know if it is possible to use this tinymce plugin with the plugin realblog XH in a cmsimple 1.4.4 installation ? What should I do to integrate it ?

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Impossible to edit

Post by cmb » Tue Oct 29, 2013 9:34 pm

delan10 wrote:Thanx again for your help and your explanations ! :)
You're welcome.
delan10 wrote:Do you know if it is possible to use this tinymce plugin with the plugin realblog XH in a cmsimple 1.4.4 installation ? What should I do to integrate it ?
I assume it is possible to use the tinymce plugin for Realblog (the _XH suffix was removed a while ago), but I presume it is a lot of work to get that right. Certainly, it would be simpler to upgrade to CMSimple_XH 1.5.9, where TinyMCE can be easily used for Realblog.
Christoph M. Becker – Plugins for CMSimple_XH

delan10
Posts: 32
Joined: Sat May 24, 2008 6:18 pm

Re: Impossible to edit

Post by delan10 » Wed Oct 30, 2013 10:56 am

I assume it is possible to use the tinymce plugin for Realblog (the _XH suffix was removed a while ago), but I presume it is a lot of work to get that right. Certainly, it would be simpler to upgrade to CMSimple_XH 1.5.9, where TinyMCE can be easily used for Realblog.
OK thank you.

In fact the problem is that it is impossible to edit an existing post with realblog (v. XH 1.2) since the hoster (1&1) activated php5.4.
I can create a post but when I try to edit them it deletes the whole post, which is a bit annoying...

Important precision : if the post contains no special characters like é à ù everything is OK.
So once again this has to do with iso and utf8... And this is why I wanted to use tinymce instead of fckeditor, which doesn't work on php5.4 and xh 1.4.4.

Do you think I can use a more recent version of realblog on the concerned cmsimple xh 1.4.4 installations to resolve the problem ?
Or maybe there is a solution to the problem by just modifying 1 or 2 php or js files ? But what to modify ?

I know switching to xh 1.5.9 would be a solution, but for those existing websites I would prefer an "easier" solution that allows me to encode in iso with realblog, whick was possible under earlier php versions.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Impossible to edit

Post by cmb » Wed Oct 30, 2013 12:19 pm

delan10 wrote:In fact the problem is that it is impossible to edit an existing post with realblog (v. XH 1.2) since the hoster (1&1) activated php5.4.
I can create a post but when I try to edit them it deletes the whole post, which is a bit annoying...
Ah, I see. I assume this is caused by a slight change of htmlspecialchars() and htmlentities(): in PHP 5.4 the $encoding parameter was changed to default to 'UTF-8'. The result of calling htmlspecialchars() on a string containing invalid UTF-8 byte sequences will be an empty string. See http://cmsimpleforum.com/viewtopic.php?f=29&t=6373 for further details regarding this issue and http://sourceforge.net/p/cmsimplexh/code/859/ for the changes that have been done to CMSimple_XH 1.1.7 to cater for it (containing the necessary changes for FCKEditor to run on PHP 5.4).

It might suffice to add the desired encoding ('ISO-8859-1') explicitely to all htmlspecialchars() and htmlentities(). A quick search shows only 2 htmlspecialchars() in plugins/realblog/admin.php and 2 in plugins/realblog/index.php. For instance, plugins/realblog/admin.php in line 713 you would have to replace:

Code: Select all

htmlspecialchars($realblog_headline)
with

Code: Select all

htmlspecialchars($realblog_headline, ENT_COMPAT, 'ISO-8859-1')
delan10 wrote:Do you think I can use a more recent version of realblog on the concerned cmsimple xh 1.4.4 installations to resolve the problem ?
No, I don't think so. Likely, they're going to introduce even more problems with regard to non UTF-8 encodings. However, they may fix bugs and vulnerabilities.
delan10 wrote:I know switching to xh 1.5.9 would be a solution, but for those existing websites I would prefer an "easier" solution that allows me to encode in iso with realblog, whick was possible under earlier php versions.
I understand why you're looking for an easy solution. The suggestions given above may be such. However, there might be other issues, and at least your hoster switching to a newer version of PHP might introduce new ones, so I generally recommend upgrading to the latest version of CMSimple_XH as soon as possible, and always keep plugins up-to-date.
Christoph M. Becker – Plugins for CMSimple_XH

delan10
Posts: 32
Joined: Sat May 24, 2008 6:18 pm

Re: Impossible to edit

Post by delan10 » Wed Oct 30, 2013 4:45 pm

Ah, I see. I assume this is caused by a slight change of htmlspecialchars() and htmlentities(): in PHP 5.4 the $encoding parameter was changed to default to 'UTF-8'. The result of calling htmlspecialchars() on a string containing invalid UTF-8 byte sequences will be an empty string. See http://cmsimpleforum.com/viewtopic.php?f=29&t=6373 for further details regarding this issue and http://sourceforge.net/p/cmsimplexh/code/859/ for the changes that have been done to CMSimple_XH 1.1.7 to cater for it (containing the necessary changes for FCKEditor to run on PHP 5.4).
That's it. And that's also the resason why I switched back to tinymce for all my websites running under xh1.4.4 once the hoster 1&1 adopted php5.4. :(
For instance, plugins/realblog/admin.php in line 713 you would have to replace:

Code: Select all
htmlspecialchars($realblog_headline)

with

Code: Select all
htmlspecialchars($realblog_headline, ENT_COMPAT, 'ISO-8859-1')
Your solution works great for the "teasing" part.
But same problem for the full post when trying to edit it (see screenshot)

There might be another place to add the piece of code you proposed ?

[ external image ]
I understand why you're looking for an easy solution. The suggestions given above may be such. However, there might be other issues, and at least your hoster switching to a newer version of PHP might introduce new ones, so I generally recommend upgrading to the latest version of CMSimple_XH as soon as possible, and always keep plugins up-to-date.
Indeed, I'm more and more aware of this. I will definitely consider the upgrade option, but right now I'd be glad if we could find a solution for realblog/fck to accept iso characters ! ;)

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Impossible to edit

Post by cmb » Wed Oct 30, 2013 5:58 pm

delan10 wrote:That's it. And that's also the resason why I switched back to tinymce for all my websites running under xh1.4.4 once the hoster 1&1 adopted php5.4. :(
You could have said so from the beginning. :)
delan10 wrote:Your solution works great for the "teasing" part.
[...]
There might be another place to add the piece of code you proposed ?
The full solution I pointed out should work for both the teaser as well as the article:
cmb wrote:It might suffice to add the desired encoding ('ISO-8859-1') explicitely to all htmlspecialchars() and htmlentities(). A quick search shows only 2 htmlspecialchars() in plugins/realblog/admin.php and 2 in plugins/realblog/index.php. For instance,
I only did mention 1 example of the 4 occurances of htmlspecialchars(). All 4 modifications (in a single block of code; the comments show the files and line numbers):

Code: Select all

// admin.php line, 713
    $t.="<tr><td colspan=\"5\"><textarea class=\"realblog_headline_field\" name=\"realblog_headline\" id=\"realblog_headline\" rows=\"3\" cols=\"60\">".htmlspecialchars($realblog_headline, ENT_COMPAT, 'ISO-8859-1')."</textarea></td></tr>";

// admin.php, line 758
    $t.="<tr><td colspan=\"5\"><textarea class=\"realblog_story_field\" name=\"realblog_story\" id=\"realblog_story\" rows=\"30\" cols=\"80\">" . htmlspecialchars($realblog_story, ENT_COMPAT, 'ISO-8859-1') . "</textarea></td></tr>";

// index.php line, 1914
                    $title="<title>" . htmlspecialchars(stripslashes($record[REALBLOG_TITLE]), ENT_COMPAT, 'ISO-8859-1') . "</title>\n";

// index.php line, 1916
                    $description="<description>" . htmlspecialchars(stripslashes($record[REALBLOG_HEADLINE]), ENT_COMPAT, 'ISO-8859-1') . "</description>\n";
Furthermore you might need to do the following modifications (it seems they are sufficient to use the FCKEditor to edit the page contents):

Code: Select all

// FCEditor/fckeditor_php5.php, line 159
        $HtmlValue = htmlspecialchars( $this->Value, ENT_COMPAT, 'ISO-8859-1' ) ;

// cmsimple/fckeditor.php, line 197
.htmlspecialchars ($c[$s], ENT_COMPAT, 'ISO-8859-1')
Christoph M. Becker – Plugins for CMSimple_XH

delan10
Posts: 32
Joined: Sat May 24, 2008 6:18 pm

Re: Impossible to edit

Post by delan10 » Thu Oct 31, 2013 12:56 pm

Wonderful ! It works like a charm ! Thank you very much :)
Furthermore you might need to do the following modifications (it seems they are sufficient to use the FCKEditor to edit the page contents):

Code: Select all
// FCEditor/fckeditor_php5.php, line 159
$HtmlValue = htmlspecialchars( $this->Value, ENT_COMPAT, 'ISO-8859-1' ) ;

// cmsimple/fckeditor.php, line 197
.htmlspecialchars ($c[$s], ENT_COMPAT, 'ISO-8859-1')
I wish I told you about my problem at the time 1&1 switched to php5.4....
These 2 small modifications would have saved me hours of stress and work as it indeed allows me to edit ISO characters with all my XH_1.4.4 websites (both for standard content pages and for realblog) !!!

Once again, THANK YOU. :)

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Impossible to edit

Post by cmb » Fri Nov 01, 2013 1:36 am

delan10 wrote:Wonderful ! It works like a charm ! Thank you very much :)
Fine. :)
delan10 wrote:I wish I told you about my problem at the time 1&1 switched to php5.4....
These 2 small modifications would have saved me hours of stress and work as it indeed allows me to edit ISO characters with all my XH_1.4.4 websites (both for standard content pages and for realblog) !!!
Well, you may have been even better off, if you would have used (resp. sticked to) CMSimple_XH 1.1x in the first place[1]. The switch to UTF-8 in XH 1.2 was necessary in the long run (and, in my opinion, long time overdue), but unfortunately, it was kept optional, as one could configure an alternative encoding, what was a fault IMO, because catering for single byte and multi byte encodings simultaneously in PHP is a PITA. Making UTF-8 mandatory only happened in CMSimple_XH 1.5.2 (and since then the glitches regarding the character encoding have slowly vanished[2]). That was the reason for us to still support XH 1.1.x. However, XH 1.1.x is going to reach its end of life, and so all users of ANSI encoded CMSimple installations should prepare to switch to UTF-8 in the not to far future. This, undoubtably, requires quite some effort, but it has its benefits, too. The CMSimple_XH demo already shows some of them, and XH 1.6 is going to bring even some more--and don't forget about new (versions of) plugins, which usually are prepared for UTF-8 and often require this character encoding.

[1] Of course, downgrading is counter-intuitive, and might bring up other issues.
[2] There are still issues regarding non UTF-8 encoded file systems, but these can be avoided by only using ASCII characters for file and folder names.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply