elkarte / Elkarte

ElkArte Forum. A free, open source, modern discussion forum / BB
https://elkarte.github.io/Elkarte/
BSD 3-Clause "New" or "Revised" License
176 stars 61 forks source link

BBCode defined in database. #1969

Open Vekseid opened 9 years ago

Vekseid commented 9 years ago

Per the title, this is what MyBB does, though its implementation is not as flexible as SMF's. That said, if we could make tags be a part of the database, we could remove the need to code for them entirely,

At a glance, this is the only major feature MyBB 1.6 possesses that Elkarte lacks, outside of its vastly superior theme system.

emanuele45 commented 9 years ago

hmm... that's a tough one.

Quite a few of the "core" tags require supporting code (think about all the validations) and/or some special treatment in the "main loop" of parse_bbc. That means that we'd have to either save the code directly into the database or have "supporting" code somewhere in the files. TBH I'm not a fan of code in the database (both because use eval/create_function is not fun and because allow entering code in the admin panel is a security hole by itself (yes, I know the theme is the same, but that's on the todo list for... well, some point in the future)). And have supporting code would probably be a bit messy because separate part of the implementation in the database and part in the code looks confusing to me (also in term of explaining to an admin that is trying to create a new bbcode or change one that he has to look in a place for something and somewhere else for another part of the same stuff).

Actually, exactly yesterday I was thinking about the possibility to provide an admin interface to create simple bbcodes. Not fancy stuff with validation and alike (except maybe for simple masks (nohtml, email, regex, etc.) like the custom profile fields), just basic replacements with or without parameters (I didn't go that far thinking). That would mean save some of the bbcode in the database, but keep the others where they currently are.

Vekseid commented 9 years ago

That would work too. MyBB is a simple regex base.

I'd like to be able to support simple Youtube/Vimeo/etc. autoembedding, at least, possibly with noembed tags.

joshuaadickerson commented 8 years ago

I just saw this. The way I envision it is using a callback if necessary. Most BBC doesn't need a callback. The table structure would be pretty simple - at least the way I tried to do it. It would just be a single field which contains a serialized array and a field for "enabled." Everything from the $txt key for the buttons to the code type would be in the array.