Greetings,
We run a PHP/MySQL driven site. A member on our site imported a product description with HTML and it got saved in our database.
When she tries to edit the description on our site, we pull the description out of the database and insert it into the editing page where CKEditor is used:
<textarea name="description" cols="110" rows="30"><?php echo trim(htmlspecialchars($row['description'], ENT_QUOTES)); ?></textarea>
<script type="text/javascript">
CKEDITOR.replace('description',{height: '500px'});
</script>
When she edits the text, it doesn't save. (I tested what happens when the changes are saved and the $_POST['description'] does not save any changes). When I click the "Source Code" button on CKEditor, the whole thing locks up and doesn't even show the source code.
I've attached a TXT file showing the exact product description and HTML code currently saved in our database.
Please let me know what is going on, if you can replicate the issue and how to fix it.
Thanks
Kind regards
UPDATE
UPDATE
After tinkering around, I found something in my config.js file:
CKEDITOR.on('instanceReady', function(ev)
{
var editor = ev.editor;
var dataProcessor = editor.dataProcessor;
var htmlFilter = dataProcessor && dataProcessor.htmlFilter;
htmlFilter.addRules(
{
elements :
{
a : function( element )
{
var str = element.attributes.href;
var count = 0;
if (str.indexOf('http://www.mywebsite.com/') == 0) { count = 1; }
if (str.indexOf('http://mywebsite.com/') == 0) { count = 1; }
if (count == 0)
{
if ( !element.attributes.rel )
element.attributes.rel = 'nofollow';
if ( !element.attributes.target )
element.attributes.target = '_blank';
}
}
}
});
});
If I remove the follow from that code: var editor = ev.editor; , the "source code" button seems to work and the changes go through. I believe I added this code a long time ago to modify all external links to give them a "nofollow" and "_blank" attribute. Everything seems to be working fine without that portion, but I'm not completly sure.