Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

HTML tags show up in profile status and event stream

9 years 11 months ago
  • Matthew's Avatar
    Topic Author
  • Matthew
  • Offline
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
Licenses:
JomSocial Expired

Is anyone able to explain why this html does not work when put into the 'share status' box on the user's profile or the event wall? I'm using the Default Blacklist for registered users, but can't see anything wrong. It doesn't interpret the HTML, it just displays it like text:

<hr style="text-align:left;margin-left:0;color:#8b8989;background-color:#8b8989;border:1px solid #8b8989;height:2px;width:100%;"><p style="text-align:center;"><img src=" api.ning.com/files/fXUwj8AcBIni0nhTHsupU...peed_Certified_1.png " width="418" class="aligncenter" alt="Single Speed Certified Image"></p><hr style="text-align:left;margin-left:0;color:#8b8989;background-color:#8b8989;border:1px solid #8b8989;height:2px;width:100%;">

The attachment is a screenshot of the result.

Thanks,
Matthew

Attachment img.png not found



By the way, it lso doesn't work if I only insert the img tag section, even if it only includes the src and alt properties...

Attachments:
9 years 11 months ago
Licenses:

Hi Matthew,

at sharebox/activities stream we have some restriction. especially for HTML.
sharebox will not rendered any HTML from user input. it's not safe if we allow it. the stream activities can broken and many unpredictable issues.

Regards,
Albert

9 years 11 months ago
  • Matthew's Avatar
    Topic Author
  • Matthew
  • Offline
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
Licenses:
JomSocial Expired

I see. Why is it ok to use HTML in event descriptions, but not streams, especially if the default blacklist of html tags is in place to stop malicious html code? If it can't be used at all in streams is there a way to strip it out (or display an error to the user), so at least the plain text is shown instead of displaying the raw html code, which just makes the users think there has been an error?

Thanks,
Matthew

9 years 11 months ago
Licenses:

Hi Matthew,

Here the changes option:
edit the file /components/com_community/libraries/activities.php line 1517
1. remove all HTML tags

$str = strip_tags(rtrim(str_replace('&nbsp;', '', $str)));

2. allow HTML
$str = rtrim(str_replace('&nbsp;', '', $str));

I hope this can help you.

Regards,
Albert

9 years 11 months ago
  • Matthew's Avatar
    Topic Author
  • Matthew
  • Offline
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
Licenses:
JomSocial Expired

Thanks for that. If I allow HTML will the default blacklist still be applied/stripped?

Thanks,
Matthew

9 years 11 months ago
Licenses:

Hi Matthew,

blacklist will be not applied. if want blacklist applied you can use this function:
www.php.net//manual/en/function.strip-tags.php

$str = strip_tags(rtrim(str_replace('&nbsp;', '', $str)), '<p><a><img><hr>');

that function only allow <p>, <a>, <img>, and <hr>. all tags will be stripped.

Regards,
Albert

The following user(s) said Thank You: Matthew
Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW