phpBB HTML on posts extension

Locked
User avatar
axew3
w3all User
w3all User
Posts: 2689
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

phpBB HTML on posts extension

Post by axew3 »

It has been released the HTML on post extension.
Render HTML into phpBB posts, if the user belong to the admin group (ID 5)


1.0.1 has been released, enjoy here:
viewtopic.php?t=1776



[quote]Copy the extension to phpBB/ext/w3all/htmlposts

Go to "ACP" > "Customise" > "Extensions" and enable the "Html posts" extension.
How to use
By default, only users that belong to the GroupID 5 (admins) (can be added more into the listener code) will have the capability to post an HTML content that so will be parsed as html. It is required that the very first post line content, start with (can be changed into the listener code into a custom one) this placeholder:

[HTMLMARKUP]

or the post content will not be parsed as HTML.
NOTE: if we want to display/render (not parse) some active bbcode like or anyone active into our phpBB, then entities should be used
test me i want to show bbcode tags <- will return -> test me i want to show bbcode tags
NOTE: if a single bbcode is found into the post text, then the post will not be parsed as HTML due to generate_text_for_display() that fire after on viewtopic.php


See example: viewtopic.php?p=5875#p5875
User avatar
axew3
w3all User
w3all User
Posts: 2689
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: phpBB HTML on posts extension

Post by axew3 »

Thoughts about coming soon 1.0.1 HTML on phpBB posts extension
How to and what it do:

1)
An HTML post can be parsed as HTML only if the author belong to the Admins group as default primary phpBB group, or the user ID belong to the array of users IDS allowed to manage HTML posts.
If a moderator or any other user, that is allowed to edit a post which himself is not the author, but it is a post by an allowed HTML user, the [HTMLMARKUP] placeholder will be removed automatically. It is for security reasons so to avoid that even a moderator that go to edit a post, could add malicious <script> tags. Only certain and well specified users can post the [HTMLMARKUP] placeholder.
If an user not allowed to post html, insert into the post the [HTMLMARKUP] placeholder, it is removed from the post.
If an user go to edit a post by an author allowed to post html, but he is not allowed to post html, the [HTMLMARKUP] placeholder will be removed from the post.
Anyway and in any case, if the user do not belong to the array of allowed users, the post is parsed as normal phpBB post, even if containing (that's not possible) the starting [HTMLMARKUP] placeholder.
2)
... coming
User avatar
axew3
w3all User
w3all User
Posts: 2689
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: phpBB HTML on posts extension

Post by axew3 »

2) not sure about a thing, but +- finally convinced.
The problem is this explained in examples:

Code: Select all

<table style="width:100%;text-align:center;margin:0; padding: 10px;"><tr>
<td style="max-width:25%"><iframe width="100%" height="100%" src="https://www.youtube.com/embed/xdx-WGUqx2A?controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td>

<td style="max-width:25%"><iframe width="100%" height="100%" src="https://www.youtube.com/embed/xdx-WGUqx2A?controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td>
 
</tr></table>
doing the above, the output will result <br /> tags where there are carriage returns, it is in short explained the result of the parsing in phpBB.
So i have think to apply a cleanup that remove any <br> tag or carriage return etc.
So that also a script in more lines:

Code: Select all

<script>alert('tester last');
</script>
will work because rendered like this:

Code: Select all

<script>alert('tester last');</script>
and not like this:

Code: Select all

<script>alert('tester last');
<br />
</script>
The problem come out if an html contain something like this then:

Code: Select all

<p>i want this text in more lines<br>because yes</p>
the <br> tag will be removed when the post being parsed, and the text will be rendered into one line.

Could be possible a little adjustment that would may allow to wrap the text into some tag like [HTMLTEXT]this <br />will be rendered<br> in three lines[/HTMLTEXT] could be a solution.
So that we'll have an easy html editor, just within phpBB posts.
Is it not very cool? Stay tuned...
User avatar
axew3
w3all User
w3all User
Posts: 2689
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: phpBB HTML on posts extension

Post by axew3 »

The 1.0.1 version will allow to parse any html and javascript and the code can be written in lines as more like.
If we want to write pure text expecting it to be parsed by phpBB as pure text, then we'll use

Code: Select all

[HTMLTEXT]
This is text and any <b>character</b> inside this
will be parsed by phpBB as usual and as html
[/HTMLTEXT]
The extension download will be available soon
viewtopic.php?p=5908#p5908
Locked