When the preferences are set to have the output template as "HTML" then there needs to be a way to allow HTML through the module in the node body if desired by the admin. The following change could be a preference to be set by the admin:

On line #673 of the subscriptions_content.module, this line needs to be disabled to allow the HTML through:

$text = drupal_html_to_text($text);

It would seem really simple to accommodate this. Could you please implement this in a 6.x-1.5 release?

Comments

salvis’s picture

Status: Active » Needs work

to have the output template as "HTML"

Where do you set that preference? What else is needed to send out HTML notifications?

Would you like to post a patch? Since this is subscriptions_content.module, the checkbox should go into the Content Settings fieldset, just above "Generate the !full_node variable."

gregarios’s picture

My mistake... the allowance of HTML is done in the Mime Mail module when used with Subscriptions — except that Subscriptions strips it's own HTML out of the node body. I just need to have a preference allowing the node body to have HTML in it, by disabling that one line of code.

I will see if I can write a patch to accomplish this in the next week or so. Shall I work off of 6.x-1.x-dev or 6.x.1.4?

gregarios’s picture

Title: Add Preference to allow simple HTML through on nodes. » Add Preference to allow simple HTML through on nodes. (patch available)
Status: Needs work » Patch (to be ported)
StatusFileSize
new2.01 KB

Attached is the patch. Please put it up in a new 1.5 release of you could. Thank you Salvis! :-)
(This is rolled on the 6.x-1.x-dev version)

gregarios’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
gregarios’s picture

Title: Add Preference to allow simple HTML through on nodes. (patch available) » Add Preference to allow simple HTML through on nodes. (important: patch available)
StatusFileSize
new4.89 KB

Attached is an even BETTER patch, which includes the changes my patch in #3 does, plus adds another much needed addition to your module... the ability to have an external mail template sourced from the Theme directory.

My addition just looks in the theme directory for a copy of the subscriptions_mail.templates.inc file and uses it if it exists, instead of the one in the modules directory.

Please take a look at this patch, and use it in a 1.5 release if you could. Thanks Salvis.

This patch is rolled in 6.x-1.x-dev and will finally free my customizations from the module directory completely! (if you release it) :-)

(I've fully tested this on my production site: www.kpbj.com)

salvis’s picture

Title: Add Preference to allow simple HTML through on nodes. (important: patch available) » Add Preference to allow simple HTML through on nodes.
Status: Patch (to be ported) » Needs work

Yes, always against the -dev version.

This looks good, except we need to pass it through the filter of the node.

(Just mark it NR.)

gregarios’s picture

This looks good, except we need to pass it through the filter of the node.

Ummm... huh? :-)

salvis’s picture

When you create a node, you select a filter (possibly by default), "Full HTML" for example. This filter needs to be applied when you render a node, whether to the browser or to an HTML mail message.

gregarios’s picture

The filter already applies since the node is created before the subscription gets created, right? How in the world would my changes have disrupted that at all, since it is functioning exactly as before except for the location of the template file and the removal of the one line of code that strips-out the html (that the node filter already allowed to be there)?

gregarios’s picture

Wait... I think I might see what you mean. However, I have no idea how to accomplish this, and actually would prefer it if my filters were not applied to the node body for emails...

salvis’s picture

Stripping out the HTML is the ultimate filter. Removing that leaves us without any filter, I think.

Filters are applied on output, not on input.

salvis’s picture

Sending unfiltered HTML would expose your email recipients to all sorts of attacks.

Why would you want to not apply any filter?

gregarios’s picture

Yes. No filter at all is what I would like -- just the raw node body that was created without any post-processing. Many of the post-processing filters would never work in an email anyway, like Lightbox, curly-quotes, etc, etc... We could just leave a disclaimer on the checkbox... there's no way to do every node filter possibility even if we tried, but at least this allows SOME raw HTML though so images and links will work.

gregarios’s picture

How would raw HTML in an email, that already exists in the website, make someone open to attack? The worst it would do is email everyone raw HTML, and plain old HTML with no Javascript or anything is never a security risk is it?

salvis’s picture

We need to filter not to add effects, but to remove hazardous HTML, as as when we render the node to the browser.

You want your email to look the same as in the browser, and the closest we can get is to apply the same filter.

gregarios’s picture

How can this be done? Is it difficult?

salvis’s picture

with no Javascript or anything is never a security risk is it?

Removing JavaScript is one of the things that filtering does. No filter => all scripting, embedded objects, iframes, etc. are delivered to the email recipient!

gregarios’s picture

Or, maybe instead of just removing all HTML, we could customize a filter of our own that specifically allows all "p", "a" and "img" tags, etc?

salvis’s picture

Oh, actually, we're doing that already with check_markup(). Sorry, my bad...

salvis’s picture

Status: Needs work » Needs review
salvis’s picture

Status: Needs review » Needs work

Oh, I hadn't actually seen your #5 when I posted what became my #6.

Let's fix one issue at a time. In this thread we'll "Add Preference to allow simple HTML through on nodes."

The other code is inacceptable as it is because of duplication and broken indenting.

salvis’s picture

Also, the order in hook_uninstall() should be alphabetical.

gregarios’s picture

Also, the order in hook_uninstall() should be alphabetical.

LOL really?

The other code is inacceptable as it is because of duplication and broken indenting.

I'm not sure what you mean -- you mean the code syntax indenting? I wasn't sure how to make it not duplicate... can you help me out with this? Do I make a function containing this:

global $theme_path;
if (is_file($theme_path .'/subscriptions_mail.templates.inc')) {
   include_once $theme_path .'/subscriptions_mail.templates.inc';
}
else {
   include_once drupal_get_path('module', 'subscriptions_mail') .'/subscriptions_mail.templates.inc';
}
gregarios’s picture

Status: Needs work » Needs review
StatusFileSize
new5.24 KB

Ok ok ok... new patch. See if you like it. I think it addresses your issues. :)

Indented correctly? Check.
Duplications rewritten? Check.
hook_uninstall() alphabetical? Check.
README updated? Check.
Tested on production site? Check.

salvis’s picture

Status: Needs review » Needs work

No. Stop, please.

This issue is about "Add Preference to allow simple HTML through on nodes." and we will not do anything here but "Add Preference to allow simple HTML through on nodes." I should not have started talking about the additional stuff in #5, because I will definitely not commit a grab bag of stuff.

Anything that is not "Add Preference to allow simple HTML through on nodes." will need to go into a new issue.

Repost #3, but put the variable_del() in the correct place. If you find a sorted list somewhere, why would you put your new item into a random spot? Do you enjoy creating chaos?

gregarios’s picture

Status: Needs work » Needs review
StatusFileSize
new2 KB

New patch. See attached...

By the way, just because someone doesn't organize the way you do doesn't mean they "enjoy creating chaos." I happened to have purposefully put the variable_del('subscriptions_allow_html_node_output'); code next to the other variable deletion referencing the "node" portion of the process. I figured that the database could care less the way it was organized, so I apparently made the wrong choice. Sorry. :-/

salvis’s picture

Status: Needs review » Fixed

Pushed to the -dev version (give it up to 12h to be repackaged).

Thank you for your patch and your patience.

I've adjusted the description to try to minimize the potential support load caused by this new checkbox.

For the record: This is a D6-only patch. It does not apply to D7, because under D7 we always pass HTML to drupal_mail() and the mailsystem determines how to handle the rest.

By the way, just because someone doesn't organize the way you do doesn't mean they "enjoy creating chaos." I happened to have purposefully put the variable_del('subscriptions_allow_html_node_output'); code next to the other variable deletion referencing the "node" portion of the process.

I did consider the possibility that you hadn't noticed the alphabetical arrangement. However, your reply...

Also, the order in hook_uninstall() should be alphabetical.

LOL really?

... seems to indicate that you don't think it's worth preserving. But if there is a structure in pre-existing code, then you need a pretty good reason for breaking it.

gregarios’s picture

Thank you Salvis. I honestly hadn't noticed the alphabetization at all until you mentioned it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

added some formatting...