By Altitudes on Sunday, 29 May 2016
Replies 11
Likes 0
Views 1K
Votes 0
Hello

As of now, there is no field supporting HTML in ES (I am talking of a field whose value would be different for each event, so existing HTML field which is more a label is not the solution ).

Would it be something difficult to do? Starting from the existing Textarea field that I can duplicate, can you give me a clue on what would need to be changed (in particular so that text typed in the field does not have its HTML tags stripped)?

Thanks
We are actually pretty reluctant to create a html field because it poses great security risks. Especially with script kiddies where they can actually just bring the entire site down when injection malicious stuffs on the page.

When the power of HTML editing is given to anyone on the site, it's a great risk and chances are that, your site would be hacked pretty easily.
·
Sunday, 29 May 2016 18:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes you're right. In my particular case the field would be editable in backend only, by people knowing what they are doing.

To be more precise, this field would be used to add a PayPal button on an event. This would be a very easy way to allow people paying for an event: an admin would just have to create the PayPal button, and copy/paste the HTML to the event field in backend.

If you were to create such a field, yes, a few things need to be considered including possible security issues (so not all HTML tags would be allowed).
But my request was just: how can I create such a field, starting from the Textarea field for example. I am aware that this is a bit beyond a normal support request, and maybe not that easy to do
·
Sunday, 29 May 2016 18:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, I would suggest that you take a look at the custom field /media/com_easysocial/apps/fields/user/html/html.php . This would give you a head start
·
Sunday, 29 May 2016 18:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello

Finally I started from the following existing field which already supports HTML:
/media/com_easysocial/apps/fields/event/description/

The value for this field is stored in the clusters table (instead of fields table), so I had to remove the corresponding code.

Then the issue I had was that when the value was stored in the fields data table, HTML tags were stripped... So I defined (for backend editing):
    public function onAdminEditBeforeSave(&$post, &$cluster)
{
$desc = $this->input->get($this->inputName, '', 'raw');
$post[$this->inputName] = $desc;
}

It works, but is that correct? To be honest, I don't really know what I am doing
·
Saturday, 04 June 2016 03:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Yep, this is correct but risky if anyone has admin access as they could inject anything here. If you trust every users that logged into the back end, then it's perfectly fine
·
Sunday, 05 June 2016 17:43
·
0 Likes
·
0 Votes
·
0 Comments
·
OK, but I must say I don't understand why the core event Description field is less risky. It has the following code:
    public function onAdminEditBeforeSave(&$post, &$cluster)
{
$desc = $this->input->get($this->inputName, '', 'raw');

// Set the description on the event
$cluster->description = $desc;

unset($post[$this->inputName]);
}
·
Sunday, 05 June 2016 18:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, I don't really get you here
·
Sunday, 05 June 2016 20:14
·
0 Likes
·
0 Votes
·
0 Comments
·
You say my custom field is risky because it allows users to inject any value in it. But the event Description field (which is a core field) also allows it, no?
·
Monday, 06 June 2016 00:52
·
0 Likes
·
0 Votes
·
0 Comments
·
It is a risk if you allow untrusted users to access the admin section
·
Monday, 06 June 2016 18:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Anyway, if ever someone is interested in this custom field, there it is (provided as is). It's called Extended Description and is heavily based on event Description field (which is a core field).
·
Tuesday, 07 June 2016 03:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for sharing.
·
Tuesday, 07 June 2016 10:18
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post