From a9d8d13ebd414fd044cea1860d859034f7960d3c Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 19 Jan 2015 11:17:38 -0500 Subject: [PATCH] Allow users to migrate IP/email bans --- install/migrateBans.php | 40 +++++++++++++++++++++++++++++++++++++++ install/updateTo2-0-0.php | 32 +++++++++++++++++++------------ 2 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 install/migrateBans.php diff --git a/install/migrateBans.php b/install/migrateBans.php new file mode 100644 index 00000000..b30a32ed --- /dev/null +++ b/install/migrateBans.php @@ -0,0 +1,40 @@ + + +

Installation / Update complete!

+

Please delete the install folder for security reasons, and then proceed back to the Help Desk

+ + \ No newline at end of file diff --git a/install/updateTo2-0-0.php b/install/updateTo2-0-0.php index 5f5929d3..79693291 100644 --- a/install/updateTo2-0-0.php +++ b/install/updateTo2-0-0.php @@ -4,23 +4,31 @@ define('HESK_PATH','../'); require(HESK_PATH . 'install/install_functions.inc.php'); require(HESK_PATH . 'hesk_settings.inc.php'); -$updateSuccess = true; - hesk_dbConnect(); hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` DROP COLUMN `note_id`"); hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."notes` DROP COLUMN `edit_date`"); hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."notes` DROP COLUMN `number_of_edits`"); hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` DROP COLUMN `default_notify_customer_email`"); -//TODO Migrate Mods for HESK Banned IPs / Emails to HESK 2.6.0's tables. Luckily the table names are different, so there won't be a problem when HESK tries to install. - -hesk_dbQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."denied_ips`"); -hesk_dbQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."denied_emails`"); - -if ($updateSuccess) { +$banRS = hesk_dbQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."denied_emails` + UNION ALL SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."denied_ips`"); +if (hesk_dbNumRows($banRS) > 0) +{ + $usersRS = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `active` = '1' ORDER BY `name`"); ?> - -

Installation / Update complete!

-

Please delete the install folder for security reasons, and then proceed back to the Help Desk

- +

Migrating IP / E-mail Bans

+

Mods for HESK has detected that you have added IP address and/or email bans using Mods for HESK. As part of the upgrade process, +Mods for HESK will migrate these bans for you to HESK 2.6.0's IP/email ban feature. Select the user below that will be the "creator" of the bans, +then click "Submit".

+
+ + +
\ No newline at end of file