diff --git a/install/install_functions.inc.php b/install/install_functions.inc.php index 7bd1c449..92f282ed 100644 --- a/install/install_functions.inc.php +++ b/install/install_functions.inc.php @@ -37,7 +37,6 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} // We will be installing this HESK version: define('HESK_NEW_VERSION','2.6.5'); -define('MODS_FOR_HESK_NEW_VERSION_INT', 250); define('MODS_FOR_HESK_NEW_VERSION','2.5.0'); define('REQUIRE_PHP_VERSION','5.0.0'); define('REQUIRE_MYSQL_VERSION','5.0.7'); diff --git a/install/mods-for-hesk/ajax/install-database-ajax.php b/install/mods-for-hesk/ajax/install-database-ajax.php index 50dbea77..b451e033 100644 --- a/install/mods-for-hesk/ajax/install-database-ajax.php +++ b/install/mods-for-hesk/ajax/install-database-ajax.php @@ -7,53 +7,45 @@ hesk_load_database_functions(); require('../sql/installSql.php'); $version = $_POST['version']; -if ($version == 1) { +if ($version == 2) { executePre140Scripts(); -} elseif ($version == 140) { +} elseif ($version == 3) { execute140Scripts(); -} elseif ($version == 141) { +} elseif ($version == 4) { execute141Scripts(); -} elseif ($version == 150) { +} elseif ($version == 5) { execute150Scripts(); -} elseif ($version == 160) { +} elseif ($version == 6) { execute160Scripts(); -} elseif ($version == 161) { +} elseif ($version == 7) { execute161Scripts(); -} elseif ($version == 170) { +} elseif ($version == 8) { execute170Scripts(); - execute170FileUpdate(); -} elseif ($version == 200) { +} elseif ($version == 9) { execute200Scripts(); - execute200FileUpdate(); -} elseif ($version == 201) { +} elseif ($version == 10) { execute201Scripts(); -} elseif ($version == 210) { +} elseif ($version == 11) { execute210Scripts(); - execute210FileUpdate(); -} elseif ($version == 211) { +} elseif ($version == 12) { execute211Scripts(); - execute211FileUpdate(); -} elseif ($version == 220) { +} elseif ($version == 13) { execute220Scripts(); - execute220FileUpdate(); -} elseif ($version == 221) { +} elseif ($version == 14) { execute221Scripts(); -} elseif ($version == 230) { +} elseif ($version == 15) { execute230Scripts(); - execute230FileUpdate(); -} elseif ($version == 231) { +} elseif ($version == 16) { execute231Scripts(); -} elseif ($version == 232) { +} elseif ($version == 17) { execute232Scripts(); -} elseif ($version == 240) { +} elseif ($version == 18) { execute240Scripts(); - execute240FileUpdate(); -} elseif ($version == 241) { +} elseif ($version == 19) { execute241Scripts(); - execute241FileUpdate(); -} elseif ($version == 242) { +} elseif ($version == 20) { execute242Scripts(); -} elseif ($version == 250) { +} elseif ($version == 21) { migrateSettings(); execute250Scripts(); } else { diff --git a/install/mods-for-hesk/js/version-scripts.js b/install/mods-for-hesk/js/version-scripts.js index f2128677..84c65d71 100644 --- a/install/mods-for-hesk/js/version-scripts.js +++ b/install/mods-for-hesk/js/version-scripts.js @@ -57,6 +57,7 @@ function processUpdates(startingVersion) { startVersionUpgrade('242'); executeUpdate(20, '242', '2.4.2'); } else if (startingVersion < 21) { + startVersionUpgrade('250'); executeUpdate(21, '250', '2.5.0'); } else { installationFinished(); diff --git a/install/mods-for-hesk/modsForHesk.php b/install/mods-for-hesk/modsForHesk.php index 02626a9e..94333325 100644 --- a/install/mods-for-hesk/modsForHesk.php +++ b/install/mods-for-hesk/modsForHesk.php @@ -85,31 +85,7 @@ hesk_dbConnect(); $versionRS = hesk_dbQuery('SELECT `Value` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'settings` WHERE `Key` = \'modsForHeskVersion\''); $versionArray = hesk_dbFetchAssoc($versionRS); $version = $versionArray['Value']; - $no_dotted_version = str_replace('.', '', $version); - $int_version = intval($no_dotted_version); - $int_newest_version = MODS_FOR_HESK_NEW_VERSION_INT; - - // Display file permissions if the user doesn't have 2.5.0 installed yet - if ($int_version < $int_newest_version): ?> - - - modsForHesk_settings.inc.php - - - > - Success'; - } else { - echo ' CHMOD to 0666, yours is '.$fileperm; - $allowInstallation = false; - } - ?> - - - + ?> @@ -163,7 +139,7 @@ hesk_dbConnect(); $v242btn = 'btn-default'; } ?> - 2.4.2
diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 8aa201a6..9e13caff 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -216,27 +216,6 @@ function execute170Scripts() )"); executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '1.7.0' WHERE `Key` = 'modsForHeskVersion'"); } - -function execute170FileUpdate() -{ - - //-- Add the new custom field property to modsForHesk_settings.inc.php - $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); - - //-- Only add the additional settings if they aren't already there. - if (strpos($file, 'custom_field_setting') === false) { - $file .= ' - - //-- Set this to 1 to enable custom field names as keys - $modsForHesk_settings[\'custom_field_setting\'] = 0; - - //-- Set this to 1 to enable email verification for new customers - $modsForHesk_settings[\'customer_email_verification_required\'] = 0;'; - } - - return file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $file); -} - // END Version 1.7.0 // BEGIN Version 2.0.0 @@ -258,27 +237,6 @@ function execute200Scripts() } } -function execute200FileUpdate() -{ - //-- Add the new HTML email property to modsForHesk_settings.inc.php - $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); - - //-- Only add the additional settings if they aren't already there. - if (strpos($file, 'html_emails') === false) { - $file .= ' - - //-- Set this to 1 to enable HTML-formatted emails. - $modsForHesk_settings[\'html_emails\'] = 0; - - //-- Mailgun Settings - $modsForHesk_settings[\'use_mailgun\'] = 0; - $modsForHesk_settings[\'mailgun_api_key\'] = \'API Key\'; - $modsForHesk_settings[\'mailgun_domain\'] = \'mail.domain.com\';'; - } - - return file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $file); -} - function checkForIpOrEmailBans() { global $hesk_settings; @@ -354,23 +312,6 @@ function execute210Scripts() executeQuery("DROP TABLE IF EXISTS `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips`"); executeQuery("DROP TABLE IF EXISTS `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails`"); } - -function execute210FileUpdate() -{ - //-- Add the boostrap theme property to modsForHesk_settings.inc.php - $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); - - //-- Only add the additional settings if they aren't already there. - if (strpos($file, 'use_bootstrap_theme') === false) { - $file .= ' - - //-- Set this to 1 to enable bootstrap-theme.css - $modsForHesk_settings[\'use_bootstrap_theme\'] = 1;'; - } - - return file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $file); -} - // END Version 2.1.0 // BEGIN Version 2.1.1 @@ -395,23 +336,6 @@ function execute211Scripts() ADD INDEX(`dt`)"); executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.1.1' WHERE `Key` = 'modsForHeskVersion'"); } - -function execute211FileUpdate() -{ - //-- Add the new kb article visibility property to modsForHesk_settings.inc.php - $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); - - //-- Only add the additional settings if they aren't already there. - if (strpos($file, 'new_kb_article_visibility') === false) { - $file .= ' - - //-- Default value for new Knowledgebase article: 0 = Published, 1 = Private, 2 = Draft -$modsForHesk_settings[\'new_kb_article_visibility\'] = 0;'; - } - - return file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $file); -} - // END Version 2.1.1 // BEGIN Version 2.2.0 @@ -429,23 +353,6 @@ function execute220Scripts() executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `Closable` = 'yes'"); executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.2.0' WHERE `Key` = 'modsForHeskVersion'"); } - -function execute220FileUpdate() -{ - //-- Add the new attachment property to modsForHesk_settings.inc.php - $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); - - //-- Only add the additional settings if they aren't already there. - if (strpos($file, '$modsForHesk_settings[\'attachments\']') === false) { - $file .= ' - - //-- Setting for adding attachments to email messages. Either 0 for default-HESK behavior, or 1 to send as attachments -$modsForHesk_settings[\'attachments\'] = 0;'; - } - - return file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $file); -} - // END Version 2.2.0 // BEGIN Version 2.2.1 @@ -520,29 +427,6 @@ function execute230Scripts() executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.3.0' WHERE `Key` = 'modsForHeskVersion'"); } - -function execute230FileUpdate() -{ - //-- Add the new merged ticket property to modsForHesk_settings.inc.php - $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); - - //-- Only add the additional settings if they aren't already there. - if (strpos($file, '$modsForHesk_settings[\'show_number_merged\']') === false) { - $file .= ' - - //-- Setting for showing number of merged tickets in the ticket search screen. 0 = Disable, 1 = Enable -$modsForHesk_settings[\'show_number_merged\'] = 1;'; - } - if (strpos($file, '$modsForHesk_settings[\'request_location\']') === false) { - $file .= ' - - //-- Setting for requesting user\'s location. 0 = Disable, 1 = Enable -$modsForHesk_settings[\'request_location\'] = 0;'; - } - - return file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $file); -} - // END Version 2.3.0 @@ -642,36 +526,6 @@ function initializeXrefTable() $hesk_settings['can_sel_lang'] = $oldSetting; hesk_resetLanguage(); } - -function execute240FileUpdate() -{ - global $hesk_settings; - - $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); - - //-- Only add the additional settings if they aren't already there. - if (strpos($file, '$modsForHesk_settings[\'category_order_column\']') === false) { - $file .= ' - - //-- Column to sort categories by. Can be either \'name\' or \'cat_order\' -$modsForHesk_settings[\'category_order_column\'] = \'cat_order\';'; - } - if (strpos($file, '$modsForHesk_settings[\'rich_text_for_tickets\']') === false) { - $file .= ' - - //-- Setting for using rich-text editor for tickets. 0 = Disable, 1 = Enable -$modsForHesk_settings[\'rich_text_for_tickets\'] = 0;'; - } - if (strpos($file, '$modsForHesk_settings[\'kb_attach_dir\']') === false) { - $file .= ' - - //-- Directory to store knowledgebase articles in. -$modsForHesk_settings[\'kb_attach_dir\'] = \'' . $hesk_settings['attach_dir'] . '\';'; - } - - return file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $file); -} - // END Version 2.4.0 // BEGIN Version 2.4.1 @@ -683,22 +537,6 @@ function execute241Scripts() executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.4.1' WHERE `Key` = 'modsForHeskVersion'"); } - -function execute241FileUpdate() -{ - - $file = file_get_contents(HESK_PATH . 'modsForHesk_settings.inc.php'); - - if (strpos($file, '$modsForHesk_settings[\'rich_text_for_tickets_for_customers\']') === false) { - $file .= ' - - //-- Setting for using rich-text editor for customers. 0 = Disable, 1 = Enable -$modsForHesk_settings[\'rich_text_for_tickets_for_customers\'] = 0;'; - } - - return file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $file); -} - // END Version 2.4.1 // Version 2.4.2 @@ -716,6 +554,8 @@ function migrateSettings() { global $hesk_settings; + hesk_dbConnect(); + if (file_exists(HESK_PATH . 'modsForHesk_settings.inc.php')) { require_once(HESK_PATH . 'modsForHesk_settings.inc.php'); @@ -830,6 +670,8 @@ function execute250Scripts() executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('display_user_agent_information', '0')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('navbar_title_url', '" . hesk_dbEscape($hesk_settings['hesk_url']) . "'"); + executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('navbar_title_url', '" . hesk_dbEscape($hesk_settings['hesk_url']) . "')"); + + executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.5.0' WHERE `Key` = 'modsForHeskVersion'"); } // END Version 2.5.0 \ No newline at end of file diff --git a/install/mods-for-hesk/sql/uninstallSql.php b/install/mods-for-hesk/sql/uninstallSql.php index bc95edb9..ecad5fe6 100644 --- a/install/mods-for-hesk/sql/uninstallSql.php +++ b/install/mods-for-hesk/sql/uninstallSql.php @@ -81,8 +81,12 @@ function removeOtherColumns() executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `html`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `html`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` DROP COLUMN `html`"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "std_replies` DROP COLUMN `html`"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "ticket_templates` DROP COLUMN `html`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `user_agent`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `screen_resolution_width`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `screen_resolution_height`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `user_agent`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `screen_resolution_width`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `screen_resolution_height`"); // These queries are ran in case someone used an unfortunate installation they may have not properly cleaned up tables