Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.2
-
Fix Version/s: 4.6.3
-
Component/s: Joomla Integration
-
Documentation Required?:Developer Doc
Description
We just upgraded our CiviCRM to 4.6.2 and were then unable to use the Mailings > New Mailing feature. I traced this down to a syntax error in the HTML code produced by Joomla/K2, specifically "function onAfterRender()" in /plugins/system/k2.php. The relevant section of code was:
if (JString::strpos($response, 'prefix="og: http://ogp.me/ns#"') === false)
{ $searches[] = '<html '; $searches[] = '<html>'; $replacements[] = '<html prefix="og: http://ogp.me/ns#" '; $replacements[] = '<html prefix="og: http://ogp.me/ns#">'; }The problem in our case was that 'prefix="og: ogp.me......' was being passed into a CiviCRM JavaScript variable verbatim without escaping the quotes, even though other HTML elements with quotes do get escaped properly by CiviCRM. Seems that K2 alters the HTML output at a later stage than when CiviCRM grabs the HTML output - something along those lines. I could have probably solved this in CiviCRM's code too, but felt it made sense to do this in the K2 plugin, because why would we want OpenGraph HTML code in our admin area?
So, I changed this to:
$app =& JFactory::getApplication();
if ($app->isSite()){
if (JString::strpos($response, 'prefix="og: http://ogp.me/ns#"') === false)
{ $searches[] = '<html '; $searches[] = '<html>'; $replacements[] = '<html prefix="og: http://ogp.me/ns#" '; $replacements[] = '<html prefix="og: http://ogp.me/ns#">'; }}
Basically, the above checks whether we're on the public side, and only runs if we are. This resolves the issue for me, though I could imagine this might not even be sufficient in some other situations where there might be a frontend conflict, but I do think this is at least an improvement.
I posted this so anyone else encountering this could benefit. There is no need to fix CiviCRM... the problem was in K2's system plugin.
I posted the fix on K2's forum too; http://www.joomlaworks.net/forum/k2-en/41292-system-plugin-shouldn-t-modify-html-tag-on-adminstrator