Script for converting flowBB forum to static HTML pages
An HTML converter is used to archive the forum or only the threads under discussion.
This script is useful if you no longer want to maintain the forum, restore its database, or just delete it. The content manager is always the target of spammers who try to find flaws in the code to access the site as administrators. If the forum is abandoned, the CMS will no longer be updated and over time it will become more and more vulnerable. Converting to HTML avoids risk.
You can also include a thread on a site page.
Archive content
- forum2html.php Conversion script.
- forum.css Style sheet to include in static pages.
- template.php Static page template.
- bubble.png Default image used by the style.
You can replace the template.php content with a site page template. But beware, it is loaded into the script by the PHP loadHTMLile function, which has limitations.
Similarly, you can change the default style that represents messages in the filer.
UsingfluxBB2HTML
The script and other archive files, including template.php, will be placed at the root of the flowBB forum. This allows you to access configuration files to change their paths .
It is better to change the name of the script if it must stay in place for a long time: otherwise visitors could run it from their browser ...
The program has an interface that allows you to enter a topic number, or the interval between two numbers. Click Convert to start autoplaying forum pages to static pages. If they are stored in the same directory as the script, then usually in the directory of the original forum.
Their URL is formed from the word "forum," followed by keywords in the header, separated by dashes, followed by the topic number.
When creating HTML pages, you can select
- Create an index page with a link to each page. Links have already been created through the interface .
- Or place links on site pages on created pages.
- Or take the <div class = "forum"> tag with its content and include it on another page of the site where the discussion is relevant. Remember to include a link in the forum.css stylesheet as well. The copied code starts with a comment <! --- Generated by fluxbb2HTML--> and ends <! --- Stream End -> </div> .
After the conversion is complete, you can delete the database and erase all files in flowBB .
You can disable the conversion of BB tags to HTML in messages by setting $ TRANSLATE _ BB to false at the beginning of the script.
Redirections
URLs of dynamic pages converted to HTML are not redirected. If necessary, add redirection to the .htaccess file. Redirection is useful only if there are many backlinks on the page.
If the discussion thread was embedded in a site page, you do not need to redirect the dynamic URL to get links.
Program operation
The script includes a set.php file containing database access codes and table prefix.
It also includes a cache/cache_config.php containing a date format that can be defined by the forum administrator.
FlowBB tables used by script
Topics
same | poster | subjective | published by | ... | moved_to |
Wire number | Wire name | null if not moved |
We are interested in the ID that is used to select the topic, the name, so the subjective field and the moved_to field should be zero if the object is not moved, without which it is ignored .
Messages
same | poster | message | published by | ... | topic_id |
Author name | Contents | Date | Wire number |
The posted message, author name, date are saved in the main program. If you wish, you can get additional information, in which case the program will have to be expanded.
topic_id is the number of the thread under discussion, which is shared by all banknotes in the thread. We don't need a message ID.
If you want to show information about the author, such as the registration date, like the flowBB program, you should look at an additional table, custom, but the current script does not. In the HTML version, the author's name is a simple text field, not a link to a leaf, as in flowBB.
SQL Commands
To select wires whose numbers are given in the parameters:
if(intval($starting) == intval($ending))
$condition = "((id = '$starting') AND (moved_to IS NULL))";
else
$condition = "((id >= '$starting') AND (id <= '$ending') AND (moved_to IS NULL))"; $sql = "SELECT id, subject, posted, moved_to FROM $tabletopics WHERE $condition ORDER BY posted ASC";
Note that it is checked whether the stream has been moved, in which case the moved_to field is not null and the stream is ignored.
To select all messages in one conversation thread:
$query = "SELECT poster, message, posted FROM $tableposts WHERE topic_id='$id'";
We take the same identifier that is stored here in the column topic_id and select useful information: username, message content, date.