Article posting code

View: New views
1 Messages — Rating Filter:   Alert me  

Article posting code

by lsproc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have investigated into the issue with article posting code [1], and
from the appearance of a trace I have here, I suspect that the issue
lies with the <a> tag not being converted in TinyMCE correctly to
BBCode.

In a testcase I wrote, the result of having a bold line of text with a
URL in it was:

<li>[b]<a>THIS IS A URL</a>
[/b]</li>

This is with using the same initialization parameters that BUGS uses.

Upon looking in the trace where the entry the in the database is
modified, the very first mention of a test URL I put in has [b] tags
around it, but the a tag had already been converted to HTML entities.
It appears that the html_entity_decode is not decoding the entity
correctly, which would solve this problem:

    0.8787    8673848       ->
html_entity_decode('&lt;a&gt;<span
style="font-weight:bold">Test</span>&lt;/a&gt;', 3, 'utf-8')
/var/www/lighttpd/bugs/include/common_functions.inc.php:194
                             >=> '<a><span
style="font-weight:bold">Test</span></a>'
                           >=> '<a><span
style="font-weight:bold">Test</span></a>'

This is happening as previously the entity was encoded again:

    0.8777    8660920         ->
htmlspecialchars('<a>[b]Test[/b]</a>', 3, 'utf-8')
/var/www/lighttpd/bugs/include/common_functions.inc.php:9
                               >=>
'&lt;a&gt;[b]Test[/b]&lt;/a&gt;'
                             >=>
'&lt;a&gt;[b]Test[/b]&lt;/a&gt;'

Looking again (with a different entry), the initial encoding occured at:

    0.7585    8514328           -> htmlspecialchars('Text
body\r\n[b]Bold[/b]\r\n[i]Italic[/i]\r\n<span>Underline</span>\r\n<a>URL</a>',
3, 'utf-8') /var/www/lighttpd/bugs/include/classes/BUGSrequest.class.php:95
                                 >=> 'Text
body\r\n[b]Bold[/b]\r\n[i]Italic[/i]\r\n<span>Underline</span>\r\n<a>URL</a>'
                               >=> 'Text
body\r\n[b]Bold[/b]\r\n[i]Italic[/i]\r\n<span>Underline</span>\r\n<a>URL</a>'
                             >=> 'Text
body\r\n[b]Bold[/b]\r\n[i]Italic[/i]\r\n<span>Underline</span>\r\n<a>URL</a>'

In short we appear to have two issues here:
1. TinyMCE is not converting the <a> tag. I cant help on this as
regular expressions and JavaScript both are not my thing. I guess that
would be easiest to chase up with MoxieCode. The latest version of
TinyMCE doesnt fix the issue. This is the root cause - whee it isnt
BUGS' fault :D
2. Entities are doubly encoded, stopping reversion of what happened.

As an aside, editing the link in TinyMCE does not show the old URLs
value in the dialog. Not sure if this is related.

Hope it helps!
-Philip (lsproc)

References:
[1]: http://www.thebuggenie.com/forum/viewtopic.php?f=3&t=24

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Bugs-bug-genie-developers mailing list
Bugs-bug-genie-developers@...
https://lists.sourceforge.net/lists/listinfo/bugs-bug-genie-developers