You are not logged in.
- Topics: Active | Unanswered
Pages: 1
#1 2020-04-18 05:02:31
- abdellah
- Member
- From: Morocco
- Registered: 2010-10-19
- Posts: 42
[MOD] Awesome icons
https://fluxbb.org/resources/mods/awesome-icons/
With this mod you can add Font Awesome icons to topics, 21 default icons are installed.
You can add / delete / edit / icons from the plugin.
To have more icons go to the Font Awesome site.
Lang: French - English
Last edited by abdellah (2020-04-19 09:18:08)
Offline
#2 2020-04-18 07:00:34
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
Modification unsafe.
The code adds sql injection capability.
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
#3 2020-04-18 10:19:56
- abdellah
- Member
- From: Morocco
- Registered: 2010-10-19
- Posts: 42
Re: [MOD] Awesome icons
Modification unsafe.
The code adds sql injection capability.
Hello Visman, you can be more specific on the problematic lines ?
I deleted the mod while waiting to correct it
Last edited by abdellah (2020-04-18 10:29:28)
Offline
#4 2020-04-18 10:54:13
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
readme.txt
Using the $awesome_icon variable in sql queries. Queries can be modified. You do not control the data that came from the form to this variable.
I did not look at the plugin file.
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
#5 2020-04-18 11:52:47
- abdellah
- Member
- From: Morocco
- Registered: 2010-10-19
- Posts: 42
Re: [MOD] Awesome icons
readme.txt
Using the $awesome_icon variable in sql queries. Queries can be modified. You do not control the data that came from the form to this variable.I did not look at the plugin file.
Thank you, I indeed forgot to control this variable I correct with the intval function
$awesome_icon = isset($_POST['awesome_icon']) ? intval($_POST['awesome_icon']) : 0;
I will reread my code to see if I have not forgotten to control other variables
Offline
#6 2020-04-18 16:37:23
- abdellah
- Member
- From: Morocco
- Registered: 2010-10-19
- Posts: 42
Re: [MOD] Awesome icons
Hi Visman, I have modified a few lines, when you have a little time please see if you have noticed any other problem
Offline
#7 2020-04-19 02:22:39
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
readme.txt
Data from the code and color columns is displayed in the user's browser without pun_htmlspecialchars().
AP_Awesome_Icons.php
$tbl_exists = $db->query('DESCRIBE '.$db->prefix.'awesome_icons');
Each database driver has a table_exists() method.
All data received from POST and GET are added to sql-queries without checking and processing.
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
#8 2020-04-19 09:25:01
- abdellah
- Member
- From: Morocco
- Registered: 2010-10-19
- Posts: 42
Re: [MOD] Awesome icons
readme.txt
Data from the code and color columns is displayed in the user's browser without pun_htmlspecialchars().AP_Awesome_Icons.php
$tbl_exists = $db->query('DESCRIBE '.$db->prefix.'awesome_icons');
Each database driver has a table_exists() method.
All data received from POST and GET are added to sql-queries without checking and processing.
It's ok I just updated the code, thanks for your help Visman
Offline
#10 2020-07-14 14:55:55
- Peeteris
- Member
- Registered: 2019-10-06
- Posts: 52
Re: [MOD] Awesome icons
Doesn't work with Visman's FluxBB for some reason.
File: /post.php
Line: 339
FluxBB reported: Unable to create topic
Database reported: table topics has no column named a_icon_id (Errno: 1)
File: /viewforum.php
Line: 207
FluxBB reported: Unable to fetch topic list
Database reported: no such column: t.a_icon_id (Errno: 1)
viewforum.php lines from 195-207
// Fetch list of topics to display on this page
if ($pun_user['is_guest'] || $pun_config['o_show_dot'] == '0')
{
// Without "the dot"
$sql = 'SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.poll_type, t.a_icon_id, ai.code, ai.color FROM '.$db->prefix.'topics AS t LEFT JOIN ' . $db->prefix . 'awesome_icons AS ai ON (ai.id=t.a_icon_id) WHERE t.id IN('.implode(',', $topic_ids).') ORDER BY t.sticky DESC, '.$sort_by.', t.id DESC';
}
else
{
// With "the dot"
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.poll_type, t.a_icon_id, ai.code, ai.color FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' LEFT JOIN '.$db->prefix.'awesome_icons AS ai ON (ai.id=t.a_icon_id) WHERE t.id IN('.implode(',', $topic_ids).') GROUP BY t.id'.($db_type == 'pgsql' ? ', t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id' : '').' ORDER BY t.sticky DESC, t.'.$sort_by.', t.id DESC';
}
$result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
Last edited by Peeteris (2020-07-14 14:57:28)
Offline
#11 2020-07-18 02:38:45
- abdellah
- Member
- From: Morocco
- Registered: 2010-10-19
- Posts: 42
Re: [MOD] Awesome icons
Doesn't work with Visman's FluxBB for some reason.
File: /post.php Line: 339 FluxBB reported: Unable to create topic Database reported: table topics has no column named a_icon_id (Errno: 1)
File: /viewforum.php Line: 207 FluxBB reported: Unable to fetch topic list Database reported: no such column: t.a_icon_id (Errno: 1)
viewforum.php lines from 195-207
// Fetch list of topics to display on this page if ($pun_user['is_guest'] || $pun_config['o_show_dot'] == '0') { // Without "the dot" $sql = 'SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.poll_type, t.a_icon_id, ai.code, ai.color FROM '.$db->prefix.'topics AS t LEFT JOIN ' . $db->prefix . 'awesome_icons AS ai ON (ai.id=t.a_icon_id) WHERE t.id IN('.implode(',', $topic_ids).') ORDER BY t.sticky DESC, '.$sort_by.', t.id DESC'; } else { // With "the dot" $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.poll_type, t.a_icon_id, ai.code, ai.color FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' LEFT JOIN '.$db->prefix.'awesome_icons AS ai ON (ai.id=t.a_icon_id) WHERE t.id IN('.implode(',', $topic_ids).') GROUP BY t.id'.($db_type == 'pgsql' ? ', t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id' : '').' ORDER BY t.sticky DESC, t.'.$sort_by.', t.id DESC'; } $result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
The modification is tested and works on a clean FluxBB installation without any other modification.
in your case it must be adapted if FluxBB has already been modified
Offline
#12 2020-07-18 03:20:50
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
@Peeteris, have you added a_icon_id column to the topics table? install_mod.php run on installation?
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
#13 2020-07-20 20:13:22
- Peeteris
- Member
- Registered: 2019-10-06
- Posts: 52
Re: [MOD] Awesome icons
@Peeteris, have you added a_icon_id column to the topics table? install_mod.php run on installation?
I ran install_mod.php !
Also for every new code i didn't replace it but only added what's new (because in most of the lines there were added code from you - like poll and so on.
After that and realizing it's not working, I actually tried to just replace and do everything as mentioned in readme file.
Still didn't help.
But! I didn't make any changes in database manually. I thought install_mod.php should do that?
I'm using sqlite3
Offline
#14 2020-07-21 03:55:16
- abdellah
- Member
- From: Morocco
- Registered: 2010-10-19
- Posts: 42
Re: [MOD] Awesome icons
Hi
you don't have to do anything manually on the database, normally install_mod.php will create the fields.
Have you checked whether you have the a_icon_id column in topics?
Offline
#15 2020-07-21 04:27:15
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
@Peeteris probably install_mod.php had runtime errors.
I am testing the installation and I see:
Warning: SQLite3::exec(): cannot start a transaction within a transaction in \www\fluxbb-visman-sqlite\include\dblayer\sqlite3.php on line 72
Installation successful
Your database has been successfully prepared for Awesome icons. See readme.txt for further instructions.
Warning: SQLite3::exec(): cannot commit - no transaction is active in \www\fluxbb-visman-sqlite\include\dblayer\sqlite3.php on line 79
Warning: SQLite3::exec(): cannot rollback - no transaction is active in \www\fluxbb-visman-sqlite\include\dblayer\sqlite3.php on line 83
I will solve this problem, then write the result.
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
#16 2020-07-21 04:44:20
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
@abdellah, delete
// Start transaction
$db->start_transaction();
from install_mod.php.
common.php calls this method at startup https://github.com/fluxbb/fluxbb/blob/m … on.php#L90
P.S. Although Warnings were shown when running install_mod.php, changes were made to the database.
Since when you restart the file, the error "Database reported: UNIQUE constraint failed: forum_awesome_icons.id (Errno: 19)" appears.
P.P.S. I will install the modification completely, I will write.
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
#17 2020-07-21 05:53:28
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
@abdellah, in install_mod.php delete
// End transaction
$db->end_transaction();
from install() function.
in AP_Awesome_Icons.php replace
// Load the awesome_icons.php language file
require PUN_ROOT . 'lang/' . $pun_user['language'] . '/awesome_icons.php';
to
// Load the awesome_icons.php language file
if (file_exists(PUN_ROOT.'lang/'.$admin_language.'/awesome_icons.php'))
require PUN_ROOT.'lang/'.$admin_language.'/awesome_icons.php';
else
require PUN_ROOT.'lang/English/awesome_icons.php';
for
Warning: require(...\www\fluxbb-visman-sqlite/lang/Russian/awesome_icons.php): failed to open stream: No such file or directory in ...\www\fluxbb-visman-sqlite\plugins\AP_Awesome_Icons.php on line 21
Fatal error: require(): Failed opening required '...\www\fluxbb-visman-sqlite/lang/Russian/awesome_icons.php' (include_path='.;.../etc/php/pear') in ...\www\fluxbb-visman-sqlite\plugins\AP_Awesome_Icons.php on line 21
.../admin_loader.php?plugin=AP_Awesome_Icons.php
Notice: Undefined index: code in C:\laragon\www\fluxbb-visman-sqlite\plugins\AP_Awesome_Icons.php on line 27
Many possible sql-injections in AP_Awesome_Icons.php. pun_htmlspecialchars() function does not protect against sql injection.
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
#18 2020-07-21 06:05:04
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
@Peeteris, update include/dblayer/sqlite3.php https://github.com/MioVisman/FluxBB_by_ … 7167ee0c4d
and use install_mod.php
<?php
/***********************************************************************/
// Some info about your mod.
$mod_title = 'Awesome icons';
$mod_version = '1.0.0';
$release_date = '2020-04-17';
$author = 'Abdellah Ouljdid';
$author_email = 'abdellah@styleoriental.org';
// Versions of FluxBB this mod was created for. A warning will be displayed, if versions do not match
$fluxbb_versions = array('1.5.9', '1.5.10', '1.5.11');
// Set this to false if you haven't implemented the restore function (see below)
$mod_restore = true;
// This following function will be called when the user presses the "Install" button
function install()
{
global $db;
$db->add_field('topics', 'a_icon_id', 'INT(10)', false);
// Create "awesome_icons" table
$schema = array(
'FIELDS' => array(
'id' => array(
'datatype' => 'SERIAL',
'allow_null' => false
),
'code' => array(
'datatype' => 'VARCHAR(100)',
'allow_null' => false,
'default' => '\'\''
),
'color' => array(
'datatype' => 'VARCHAR(7)',
'allow_null' => true
)
),
'PRIMARY KEY' => array('id')
);
$db->create_table('awesome_icons', $schema) or error('Unable to create awesome_icons table', __FILE__, __LINE__, $db->error());
// Insert default Icons
$icons = array(
"1, 'fas fa-align-left', '#357082'",
"2, 'fas fa-question-circle', '#3c40c6'",
"3, 'fas fa-exclamation-circle', '#3c40c6'",
"4, 'fas fa-heart', '#c0392b'",
"5, 'fab fa-hotjar', '#d35400'",
"6, 'fas fa-star', '#f39c12'",
"7, 'fas fa-lightbulb', '#f1c40f'",
"8, 'fas fa-volume-up', '#218c74'",
"9, 'fas fa-music', '#218c74'",
"10, 'fas fa-headphones', '#218c74'",
"11, 'fas fa-download', '#2980b9'",
"12, 'fas fa-bomb', '#1e272e'",
"13, 'fas fa-bullhorn', '#218c74'",
"14, 'fab fa-youtube', '#e74c3c'",
"15, 'fas fa-guitar', '#cd6133'",
"16, 'fas fa-flushed', '#f39c12'",
"17, 'fas fa-thumbs-up', '#cc8e35'",
"18, 'fas fa-mug-hot', '#34495e'",
"19, 'fab fa-sketch', '#ffc048'",
"20, 'fas fa-grin-beam', '#f39c12'",
"21, 'fas fa-flag', '#55E6C1'"
);
foreach ($icons as $icon)
$db->query('INSERT INTO ' . $db->prefix . 'awesome_icons (id, code, color) VALUES (' . $icon . ')') or error('Unable to insert in awesome_icons table', __FILE__, __LINE__, $db->error());
}
// This following function will be called when the user presses the "Restore" button (only if $mod_restore is true (see above))
function restore()
{
global $db;
$db->drop_field('topics', 'a_icon_id');
$db->drop_table('awesome_icons') or error('Unable to drop awesome_icons table', __FILE__, __LINE__, $db->error());
}
/***********************************************************************/
// DO NOT EDIT ANYTHING BELOW THIS LINE!
// Circumvent maintenance mode
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_ROOT', './');
require PUN_ROOT . 'include/common.php';
// We want the complete error message if the script fails
if (!defined('PUN_DEBUG'))
define('PUN_DEBUG', 1);
// Make sure we are running a FluxBB version that this mod works with
$version_warning = !in_array($pun_config['o_cur_version'], $fluxbb_versions);
$style = (isset($pun_user)) ? $pun_user['style'] : $pun_config['o_default_style'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo pun_htmlspecialchars($mod_title) ?> installation</title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $style . '.css' ?>" />
</head>
<body>
<div id="punwrap">
<div id="puninstall" class="pun" style="margin: 10% 20% auto 20%">
<?php
if (isset($_POST['form_sent'])) {
if (isset($_POST['install'])) {
// Run the install function (defined above)
install();
?>
<div class="block">
<h2><span>Installation successful</span></h2>
<div class="box">
<div class="inbox">
<p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title) ?>. See readme.txt for further instructions.</p>
</div>
</div>
</div>
<?php
} else {
// Run the restore function (defined above)
restore();
?>
<div class="block">
<h2><span>Restore successful</span></h2>
<div class="box">
<div class="inbox">
<p>Your database has been successfully restored.</p>
</div>
</div>
</div>
<?php
}
} else {
?>
<div class="blockform">
<h2><span>Mod installation</span></h2>
<div class="box">
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?foo=bar">
<div><input type="hidden" name="form_sent" value="1" /></div>
<div class="inform">
<p>This script will update your database to work with the following modification:</p>
<p><strong>Mod title:</strong> <?php echo pun_htmlspecialchars($mod_title . ' ' . $mod_version) ?></p>
<p><strong>Author:</strong> <?php echo pun_htmlspecialchars($author) ?> (<a href="mailto:<?php echo pun_htmlspecialchars($author_email) ?>"><?php echo pun_htmlspecialchars($author_email) ?></a>)</p>
<p><strong>Disclaimer:</strong> Mods are not officially supported by FluxBB. Mods generally can't be uninstalled without running SQL queries manually against the database. Make backups of all data you deem necessary before installing.</p>
<?php if ($mod_restore) : ?>
<p>If you've previously installed this mod and would like to uninstall it, you can click the Restore button below to restore the database.</p>
<?php endif; ?>
<?php if ($version_warning) : ?>
<p style="color: #a00"><strong>Warning:</strong> The mod you are about to install was not made specifically to support your current version of FluxBB (<?php echo $pun_config['o_cur_version']; ?>). This mod supports FluxBB versions: <?php echo pun_htmlspecialchars(implode(', ', $fluxbb_versions)); ?>. If you are uncertain about installing the mod due to this potential version conflict, contact the mod author.</p>
<?php endif; ?>
</div>
<p class="buttons"><input type="submit" name="install" value="Install" /><?php if ($mod_restore) : ?><input type="submit" name="restore" value="Restore" /><?php endif; ?></p>
</form>
</div>
</div>
<?php
}
?>
</div>
</div>
</body>
</html>
<?php
// End the transaction
$db->end_transaction();
// Close the db connection (and free up any result data)
$db->close();
First do Restore, then do Install
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
#19 2020-07-21 11:23:03
- Peeteris
- Member
- Registered: 2019-10-06
- Posts: 52
Re: [MOD] Awesome icons
@Peeteris, update include/dblayer/sqlite3.php https://github.com/MioVisman/FluxBB_by_ … 7167ee0c4d
and use install_mod.php
<?php /***********************************************************************/ // Some info about your mod. $mod_title = 'Awesome icons'; $mod_version = '1.0.0'; $release_date = '2020-04-17'; $author = 'Abdellah Ouljdid'; $author_email = 'abdellah@styleoriental.org'; // Versions of FluxBB this mod was created for. A warning will be displayed, if versions do not match $fluxbb_versions = array('1.5.9', '1.5.10', '1.5.11'); // Set this to false if you haven't implemented the restore function (see below) $mod_restore = true; // This following function will be called when the user presses the "Install" button function install() { global $db; $db->add_field('topics', 'a_icon_id', 'INT(10)', false); // Create "awesome_icons" table $schema = array( 'FIELDS' => array( 'id' => array( 'datatype' => 'SERIAL', 'allow_null' => false ), 'code' => array( 'datatype' => 'VARCHAR(100)', 'allow_null' => false, 'default' => '\'\'' ), 'color' => array( 'datatype' => 'VARCHAR(7)', 'allow_null' => true ) ), 'PRIMARY KEY' => array('id') ); $db->create_table('awesome_icons', $schema) or error('Unable to create awesome_icons table', __FILE__, __LINE__, $db->error()); // Insert default Icons $icons = array( "1, 'fas fa-align-left', '#357082'", "2, 'fas fa-question-circle', '#3c40c6'", "3, 'fas fa-exclamation-circle', '#3c40c6'", "4, 'fas fa-heart', '#c0392b'", "5, 'fab fa-hotjar', '#d35400'", "6, 'fas fa-star', '#f39c12'", "7, 'fas fa-lightbulb', '#f1c40f'", "8, 'fas fa-volume-up', '#218c74'", "9, 'fas fa-music', '#218c74'", "10, 'fas fa-headphones', '#218c74'", "11, 'fas fa-download', '#2980b9'", "12, 'fas fa-bomb', '#1e272e'", "13, 'fas fa-bullhorn', '#218c74'", "14, 'fab fa-youtube', '#e74c3c'", "15, 'fas fa-guitar', '#cd6133'", "16, 'fas fa-flushed', '#f39c12'", "17, 'fas fa-thumbs-up', '#cc8e35'", "18, 'fas fa-mug-hot', '#34495e'", "19, 'fab fa-sketch', '#ffc048'", "20, 'fas fa-grin-beam', '#f39c12'", "21, 'fas fa-flag', '#55E6C1'" ); foreach ($icons as $icon) $db->query('INSERT INTO ' . $db->prefix . 'awesome_icons (id, code, color) VALUES (' . $icon . ')') or error('Unable to insert in awesome_icons table', __FILE__, __LINE__, $db->error()); } // This following function will be called when the user presses the "Restore" button (only if $mod_restore is true (see above)) function restore() { global $db; $db->drop_field('topics', 'a_icon_id'); $db->drop_table('awesome_icons') or error('Unable to drop awesome_icons table', __FILE__, __LINE__, $db->error()); } /***********************************************************************/ // DO NOT EDIT ANYTHING BELOW THIS LINE! // Circumvent maintenance mode define('PUN_TURN_OFF_MAINT', 1); define('PUN_ROOT', './'); require PUN_ROOT . 'include/common.php'; // We want the complete error message if the script fails if (!defined('PUN_DEBUG')) define('PUN_DEBUG', 1); // Make sure we are running a FluxBB version that this mod works with $version_warning = !in_array($pun_config['o_cur_version'], $fluxbb_versions); $style = (isset($pun_user)) ? $pun_user['style'] : $pun_config['o_default_style']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo pun_htmlspecialchars($mod_title) ?> installation</title> <link rel="stylesheet" type="text/css" href="style/<?php echo $style . '.css' ?>" /> </head> <body> <div id="punwrap"> <div id="puninstall" class="pun" style="margin: 10% 20% auto 20%"> <?php if (isset($_POST['form_sent'])) { if (isset($_POST['install'])) { // Run the install function (defined above) install(); ?> <div class="block"> <h2><span>Installation successful</span></h2> <div class="box"> <div class="inbox"> <p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title) ?>. See readme.txt for further instructions.</p> </div> </div> </div> <?php } else { // Run the restore function (defined above) restore(); ?> <div class="block"> <h2><span>Restore successful</span></h2> <div class="box"> <div class="inbox"> <p>Your database has been successfully restored.</p> </div> </div> </div> <?php } } else { ?> <div class="blockform"> <h2><span>Mod installation</span></h2> <div class="box"> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?foo=bar"> <div><input type="hidden" name="form_sent" value="1" /></div> <div class="inform"> <p>This script will update your database to work with the following modification:</p> <p><strong>Mod title:</strong> <?php echo pun_htmlspecialchars($mod_title . ' ' . $mod_version) ?></p> <p><strong>Author:</strong> <?php echo pun_htmlspecialchars($author) ?> (<a href="mailto:<?php echo pun_htmlspecialchars($author_email) ?>"><?php echo pun_htmlspecialchars($author_email) ?></a>)</p> <p><strong>Disclaimer:</strong> Mods are not officially supported by FluxBB. Mods generally can't be uninstalled without running SQL queries manually against the database. Make backups of all data you deem necessary before installing.</p> <?php if ($mod_restore) : ?> <p>If you've previously installed this mod and would like to uninstall it, you can click the Restore button below to restore the database.</p> <?php endif; ?> <?php if ($version_warning) : ?> <p style="color: #a00"><strong>Warning:</strong> The mod you are about to install was not made specifically to support your current version of FluxBB (<?php echo $pun_config['o_cur_version']; ?>). This mod supports FluxBB versions: <?php echo pun_htmlspecialchars(implode(', ', $fluxbb_versions)); ?>. If you are uncertain about installing the mod due to this potential version conflict, contact the mod author.</p> <?php endif; ?> </div> <p class="buttons"><input type="submit" name="install" value="Install" /><?php if ($mod_restore) : ?><input type="submit" name="restore" value="Restore" /><?php endif; ?></p> </form> </div> </div> <?php } ?> </div> </div> </body> </html> <?php // End the transaction $db->end_transaction(); // Close the db connection (and free up any result data) $db->close();
First do Restore, then do Install
Incredible!
Thank you, Visman!
It works like a charm!
Offline
#20 2020-07-21 11:44:38
- Peeteris
- Member
- Registered: 2019-10-06
- Posts: 52
Re: [MOD] Awesome icons
Found out a bug - icon can't be changed for already made topics.
If I make topic with, for example, with heart icon, it can't be changed to any other icon.
If I try to edit post and change it to, for example, YouTube icon, old icon will still be shown in viewtopic, etc.
Offline
#21 2020-07-21 13:33:49
- Visman
- Member
- From: Siberia
- Registered: 2010-07-10
- Posts: 1,476
- Website
Re: [MOD] Awesome icons
@Peeteris, in edit.php replace
$is_modified = ($subject != $cur_post['subject'] ||
to
$is_modified = ($subject != $cur_post['subject'] || $awesome_icon != $cur_post['a_icon_id'] ||
My modification of FluxBB 1.5.11 - rev.82, Parserus, UserAgentAnalyzer
I speak only Russian
Offline
Pages: 1