Forum Activity for @ultrajam

SteveX
@ultrajam
07/31/15 02:16:35AM
2,584 posts

links in emails from Jamroom Support missing links now


Using Jamroom

Probably the same problem, but the link to the post is missing in New Reply emails from our jrForum 1.6.0
updated by @ultrajam: 08/05/15 11:38:14AM
SteveX
@ultrajam
07/30/15 06:01:28AM
2,584 posts

jrAdminSkin module views


Using Jamroom

I want to just use Elastic as the admin skin for forms etc, and use another skin for the rest of the site.

So I have installed jrAdminSkin and set Elastic as the active admin skin, and Nova as the active skin and active profile skin.

Module views such as /blog/ and /profile/list_profiles are displayed with the Elastic header and footer. Shouldn't they be using the active skin's header and footer (Nova)?


updated by @ultrajam: 09/08/15 06:25:14AM
SteveX
@ultrajam
07/30/15 04:17:43AM
2,584 posts

PHP Fatal error: Cannot set directive after finalization


Jamroom Developers

Thanks Michael.

Try adding elements and attributes to the whitelist using jrFramer - so set that active and allowed.

Replace jrFramer_html_purifier_listener with this:
function jrFramer_html_purifier_listener($_data,$_user,$_conf,$_args,$event)
{ if (isset($_conf['jrFramer_active']) && $_conf['jrFramer_active'] == 'on') { $_data->set('HTML.SafeIframe', true); $_data->set('URI.SafeIframeRegexp', '%(.*)%'); // ADDITIONAL TESTING CODE $_elem = $_data->get('HTML.AllowedElements'); // Set additional elements $_elem['abbr'] = 1; $_elem['blockquote'] = 1; $_elem['cite'] = 1; $_elem = implode(',', array_keys($_elem)); $_data->set('HTML.AllowedElements', $_elem); $_attr = $_data->get('HTML.AllowedAttributes'); // Set additional attributes $_attr['abbr.title'] = 1; $_attr['cite.title'] = 1; $_attr['blockquote.class'] = 1; // this needs to be present in the function in util.php as well $_attr['blockquote.data-content'] = 1; $_attr = implode(',', array_keys($_attr)); $_data->set('HTML.AllowedAttributes', $_attr); } return $_data; }

You will get the fatal error when visiting a page with an editor field in it.

To fix that error add this at line 1564 of util.php:
$pc->autoFinalize = false;

Then add blockquote and cite to your quota config Allowed HTML Tags if necessary.

Clear caches after each change to attributes or elements.

Then add this to an editor field and save:
<blockquote class="blockquote-reverse" data-content="test-content-12">
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
  <footer>Someone famous in <cite title="Source Title">Source Title</cite></footer>
</blockquote>

data-content="test-content-12" will be stripped out on save. Which isn't what I expected to happen.

You can test that the listener is adding the attributes in by commenting out $_attr['blockquote.class'] = 1; then clearing caches, then saving the editor field again - the blockquote class will be stripped out. Remove the comment, clear caches, resave the editor field and the class will be saved.

So that is working fine with class, but not with data-content.

To get data-content to save it needs to be added in the listener, and ALSO in the jrCOre_strip_html function in util.php

Find this line:
$def->addAttribute('a', 'data-lightbox', 'Text');
and add this line after it:
$def->addAttribute('blockquote', 'data-content', 'Text');

Empty caches, save the editor field and the data-content attribute will be saved.
Comment out either the line whitelisting data-content in the jrCore_strip_html function OR jrFramer_html_purifier_listener (empty caches etc) and data-content will be stripped out. It needs to be allowed in both places.

This means that (once the fatal error has been fixed) with the current listener you cannot add to the attributes whitelist. Class, title etc can be whitelisted for an element, but not data elements, aria attributes, etc. They need to be allowed in BOTH places ('HTML.AllowedElements' and the HTML Definition), and adding via listener only adds in HTML.AllowedElements.
updated by @ultrajam: 07/30/15 04:21:23AM
SteveX
@ultrajam
07/29/15 09:38:33AM
2,584 posts

PHP Fatal error: Cannot set directive after finalization


Jamroom Developers

It is really strange though, I can set blockquote.class in my listener, but not blockquote.data-content.

To get blockquote.data-content to work I need to add it in my listener, and also in jrCore_strip_html alongside where you have added code to allow for data-lightbox. It doesn't seem to work if it is added in one place or the other, it needs to be in both.
updated by @ultrajam: 07/29/15 09:41:15AM
SteveX
@ultrajam
07/29/15 06:40:05AM
2,584 posts

PHP Fatal error: Cannot set directive after finalization


Jamroom Developers

This doesn't seem to be a problem with my module, but with adding to the whitelist (I tried disabling my modules and adding an attribute to the htmlpurifier whitelist in the jrFramer listener - got the same error).

I think I have a fix:

In order to add or set the whitelist (AllowedElements or AllowedAttributes) autoFinalize needs to be set to false before the html_purifier trigger event runs on line 1564 of /modules/jrCore/lib/util.php.
$pc->autoFinalize = false;
It actually did this until 5.2.37
SteveX
@ultrajam
07/29/15 05:46:34AM
2,584 posts

PHP Fatal error: Cannot set directive after finalization


Jamroom Developers

There is a typo on line 1478 of util.php
Quote: emned.allowfullscreen
emned should be embed
updated by @ultrajam: 07/29/15 05:46:57AM
SteveX
@ultrajam
07/28/15 01:21:25PM
2,584 posts

PHP Fatal error: Cannot set directive after finalization


Jamroom Developers

The listener's the only part related to htmlpurifier - the rest is just templates, css and js with a button for using the templates in tinymce.

Why does htmlpurifier run on editor fields on their way out of the database? Shouldn't it clean the html once on save rather than each time a page with editor content is displayed?

We are supporting the full set of bootstrap classes, javascript (data-*) and aria attributes in TinyMCE. If it's in the bootstrap docs it needs to work in TinyMCE, and the accessibility features are essential.

I'm done for the night, so I'll roll back to the previous version of the core for tomorrow day and try this out again tomorrow evening.
SteveX
@ultrajam
07/28/15 12:34:15PM
2,584 posts

PHP Fatal error: Cannot set directive after finalization


Jamroom Developers

Thanks Brian.

No use of autoFinalize anywhere. The listener is just this (abbreviated):

function ujEditorTemplates_html_purifier_listener($_data, $_user, $_conf, $_args, $event)
{ $_elem = $_data->get('HTML.AllowedElements'); // Set additional Bootstrap elements $_elem['abbr'] = 1; $_elem['blockquote'] = 1; $_elem['cite'] = 1; // ...plus a load more of these... $_elem = implode(',', array_keys($_elem)); $_data->set('HTML.AllowedElements', $_elem); $_attr = $_data->get('HTML.AllowedAttributes'); // Set additional Bootstrap attributes $_attr['abbr.title'] = 1; $_attr['cite.title'] = 1; $_attr['blockquote.class'] = 1; // ...plus a load more of these... $_attr = implode(',', array_keys($_attr)); $_data->set('HTML.AllowedAttributes', $_attr); return $_data; }

updated by @ultrajam: 07/28/15 12:34:42PM
SteveX
@ultrajam
07/28/15 11:22:15AM
2,584 posts

PHP Fatal error: Cannot set directive after finalization


Jamroom Developers

Very happy to see the change to add html5 elements to htmlpurifier in the latest core update - Thanks! :)

However, I have a problem with existing pages containing an editor field not loading and throwing a fatal error:
Quote:
[28-Jul-2015 19:01:29 Europe/Dublin] PHP Fatal error: Cannot set directive after finalization invoked on line 329 in file /home/academicskills/public_html/modules/ujEditorTemplates-release-0.6.2/include.php in /home/academicskills/public_html/modules/jrCore-release-5.2.37/contrib/htmlpurifier/HTMLPurifier.standalone.php on line 2607 [x 5]
The code on line 329 adds my bootstrap specific elements and reads:
$_data->set('HTML.AllowedElements', $_elem);

This has been working well up until today's update, do you know if this is something I need to fix within my module or is it something similar to where this error occurred back in December?
https://www.jamroom.net/the-jamroom-network/forum/jamroom-developers/18891/adding-attributes-to-htmlpurifier-in-a-listener
updated by @ultrajam: 09/03/15 02:28:24AM
SteveX
@ultrajam
07/12/15 12:10:24PM
2,584 posts

HTML Tags Being Removed


Design and Skin Customization

There was a similar issue with ul lists - my fix for that was to enter the list all on one line, so you could give that a try with the figure and figcaption.
https://www.jamroom.net/the-jamroom-network/forum/my_posts/30834/textarea-ul-list-on-multiple-lines-fails-allowed_html-validation
updated by @ultrajam: 07/12/15 12:10:47PM
  92