From 3fdbced605c8948cf57f247dacec9497bbd6c139 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 00:25:20 -0400 Subject: [PATCH 01/13] Update install pages for 2.4.0 --- install/install_functions.inc.php | 2 +- .../ajax/install-database-ajax.php | 3 ++ install/mods-for-hesk/installModsForHesk.php | 3 ++ install/mods-for-hesk/js/version-scripts.js | 3 ++ install/mods-for-hesk/modsForHesk.php | 31 +++++++++++++------ 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/install/install_functions.inc.php b/install/install_functions.inc.php index 41e2c64f..eef55759 100644 --- a/install/install_functions.inc.php +++ b/install/install_functions.inc.php @@ -37,7 +37,7 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} // We will be installing this HESK version: define('HESK_NEW_VERSION','2.6.4'); -define('MODS_FOR_HESK_NEW_VERSION','2.3.2'); +define('MODS_FOR_HESK_NEW_VERSION','2.4.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 17070024..a00501cf 100644 --- a/install/mods-for-hesk/ajax/install-database-ajax.php +++ b/install/mods-for-hesk/ajax/install-database-ajax.php @@ -45,6 +45,9 @@ if ($version == 1) { execute231Scripts(); } elseif ($version == 232) { execute232Scripts(); +} elseif ($version == 240) { + execute240Scripts(); + execute240FileUpdate(); } else { $response = 'The version "'.$version.'" was not recognized. Check the value submitted and try again.'; print $response; diff --git a/install/mods-for-hesk/installModsForHesk.php b/install/mods-for-hesk/installModsForHesk.php index 5e576af3..3e6ba0fa 100644 --- a/install/mods-for-hesk/installModsForHesk.php +++ b/install/mods-for-hesk/installModsForHesk.php @@ -58,6 +58,9 @@ function echoInitialVersionRows($version) { if ($version < 232) { printRow('v2.3.2'); } + if ($version < 240) { + printRow('v2.4.0'); + } } function printRow($version) { diff --git a/install/mods-for-hesk/js/version-scripts.js b/install/mods-for-hesk/js/version-scripts.js index f55b3614..62d45456 100644 --- a/install/mods-for-hesk/js/version-scripts.js +++ b/install/mods-for-hesk/js/version-scripts.js @@ -47,6 +47,9 @@ function processUpdates(startingVersion) { } else if (startingVersion < 232) { startVersionUpgrade('232'); executeUpdate(232, '232', '2.3.2'); + } else if (startingVersion < 240) { + startVersionUpgrade('240'); + executeUpdate(240, '240', '2.4.0'); } else { installationFinished(); } diff --git a/install/mods-for-hesk/modsForHesk.php b/install/mods-for-hesk/modsForHesk.php index d28174a9..a1d2fd61 100644 --- a/install/mods-for-hesk/modsForHesk.php +++ b/install/mods-for-hesk/modsForHesk.php @@ -137,6 +137,17 @@ hesk_dbConnect(); } ?>
+
+ + v2.3.2 +
+
+
+
-
-
-
+
+
+
-
-
-
-
- v1.5.0 -

+
+ v1.5.0 +
@@ -280,6 +291,8 @@ hesk_dbConnect(); +
+
From e107f0eabb6f103b4fd655363ef5a1627d937404 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 00:27:45 -0400 Subject: [PATCH 02/13] Update uninstaller --- install/mods-for-hesk/sql/uninstallSql.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install/mods-for-hesk/sql/uninstallSql.php b/install/mods-for-hesk/sql/uninstallSql.php index 96adb576..cfca06a9 100644 --- a/install/mods-for-hesk/sql/uninstallSql.php +++ b/install/mods-for-hesk/sql/uninstallSql.php @@ -78,6 +78,10 @@ function removeOtherColumns() { executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` DROP COLUMN `manager`"); executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` DROP COLUMN `permission_template`"); executeQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."permission_templates`"); + executeQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."quick_help_sections`"); + executeQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref`"); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` DROP COLUMN `download_count`"); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_attachments` DROP COLUMN `download_count`"); // These queries are ran in case someone used an unfortunate installation they may have not properly cleaned up tables From a812b4379ac85b1c7dc7573c4e917ce598f429c3 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 00:30:08 -0400 Subject: [PATCH 03/13] Add line break --- install/mods-for-hesk/modsForHesk.php | 1 + 1 file changed, 1 insertion(+) diff --git a/install/mods-for-hesk/modsForHesk.php b/install/mods-for-hesk/modsForHesk.php index a1d2fd61..5afebb74 100644 --- a/install/mods-for-hesk/modsForHesk.php +++ b/install/mods-for-hesk/modsForHesk.php @@ -292,6 +292,7 @@ hesk_dbConnect(); v1.3.0
+
v1.2.4 From 1cbeb19a7acfcd7c1025d2724d0075c0d72289ff Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 14:17:15 -0400 Subject: [PATCH 04/13] Change version reqirements for showing the tasks section --- install/mods-for-hesk/installModsForHesk.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install/mods-for-hesk/installModsForHesk.php b/install/mods-for-hesk/installModsForHesk.php index 3e6ba0fa..ac5ff53d 100644 --- a/install/mods-for-hesk/installModsForHesk.php +++ b/install/mods-for-hesk/installModsForHesk.php @@ -110,7 +110,7 @@ function printRow($version) { - + @@ -119,10 +119,12 @@ function printRow($version) { + + From d22c1db84d47d47a4c1ebddd2390672f592c9796 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 14:15:51 -0400 Subject: [PATCH 05/13] Fix installer issues --- install/mods-for-hesk/sql/installSql.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 76cdb845..1ba9a366 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -1,7 +1,5 @@ $value) { $languages[$key] = $hesk_settings['languages'][$key]['folder']; @@ -607,9 +605,11 @@ function initializeXrefTable() { $statusesRs = executeQuery("SELECT `ID`, `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`"); while ($row = hesk_dbFetchAssoc($statusesRs)) { foreach ($languages as $language => $languageCode) { + hesk_setLanguage($language); $sql = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` (`language`, `text`, `status_id`) VALUES ('".hesk_dbEscape($language)."', '".hesk_dbEscape($hesklang[$row['Key']])."', ".intval($row['ID']).")"; executeQuery($sql); + hesk_resetLanguage(); } } } From f2b8fb8f74b10fd0074b4687f59f843dc732b261 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 14:55:25 -0400 Subject: [PATCH 06/13] Grab the next status id when inserting --- admin/manage_statuses.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/admin/manage_statuses.php b/admin/manage_statuses.php index cc6ac8da..47e36722 100644 --- a/admin/manage_statuses.php +++ b/admin/manage_statuses.php @@ -644,8 +644,13 @@ function createStatus() { $row = hesk_dbFetchRow($res); $my_order = $row[0]+10; - $insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`Key`, `TextColor`, `IsClosed`, `Closable`, `sort`) - VALUES ('STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."', ".intval($my_order).")"; + // Get the next status id + $res = hesk_dbQuery("SELECT `Id` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `Id` DESC LIMIT 1"); + $row = hesk_dbFetchAssoc($res); + $nextId = $row['Id'] + 1; + + $insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`Id`, `Key`, `TextColor`, `IsClosed`, `Closable`, `sort`) + VALUES (".intval($nextId).", 'STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."', ".intval($my_order).")"; hesk_dbQuery($insert); $newStatusId = hesk_dbInsertID(); From 663d0e3863952f13050ee736e0be9c140e95f3ee Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 15:09:30 -0400 Subject: [PATCH 07/13] Also enforce language column --- inc/common.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/common.inc.php b/inc/common.inc.php index 1c43e76f..3083b242 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -1962,7 +1962,7 @@ function mfh_getDisplayTextForStatusId($statusId) { $statusRs = hesk_dbQuery("SELECT `text`, `Key`, `language` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `statuses` LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` ON `status_id` = `statuses`.`ID` - WHERE `statuses`.`ID` = ".intval($statusId)); + WHERE `statuses`.`ID` = ".intval($statusId)." AND `language` = ".hesk_dbEscape($hesk_settings['language'])); $statusRec = hesk_dbFetchAssoc($statusRs); if ($statusRec['language'] == $hesk_settings['language'] && $statusRec['text'] != NULL) { From 5a25becff65b3bb1fd156ff2af785e28a6b1b418 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 15:09:35 -0400 Subject: [PATCH 08/13] It's ID, not Id --- admin/manage_statuses.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/manage_statuses.php b/admin/manage_statuses.php index 47e36722..92fb65ef 100644 --- a/admin/manage_statuses.php +++ b/admin/manage_statuses.php @@ -645,11 +645,11 @@ function createStatus() { $my_order = $row[0]+10; // Get the next status id - $res = hesk_dbQuery("SELECT `Id` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `Id` DESC LIMIT 1"); + $res = hesk_dbQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `Id` DESC LIMIT 1"); $row = hesk_dbFetchAssoc($res); - $nextId = $row['Id'] + 1; + $nextId = $row['ID'] + 1; - $insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`Id`, `Key`, `TextColor`, `IsClosed`, `Closable`, `sort`) + $insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`ID`, `Key`, `TextColor`, `IsClosed`, `Closable`, `sort`) VALUES (".intval($nextId).", 'STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."', ".intval($my_order).")"; hesk_dbQuery($insert); From 9612b61e4667fea35007784af86c6119c55efbba Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 15:22:08 -0400 Subject: [PATCH 09/13] Fix missing quotes --- inc/common.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/common.inc.php b/inc/common.inc.php index 3083b242..e75d5408 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -1962,7 +1962,7 @@ function mfh_getDisplayTextForStatusId($statusId) { $statusRs = hesk_dbQuery("SELECT `text`, `Key`, `language` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `statuses` LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` ON `status_id` = `statuses`.`ID` - WHERE `statuses`.`ID` = ".intval($statusId)." AND `language` = ".hesk_dbEscape($hesk_settings['language'])); + WHERE `statuses`.`ID` = ".intval($statusId)." AND `language` = '".hesk_dbEscape($hesk_settings['language'])."'"); $statusRec = hesk_dbFetchAssoc($statusRs); if ($statusRec['language'] == $hesk_settings['language'] && $statusRec['text'] != NULL) { From 19cf074fc4433140bcc9413b4687de8250d874d9 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 8 Aug 2015 15:53:35 -0400 Subject: [PATCH 10/13] Make sure we can change to the other languages during installation --- install/mods-for-hesk/sql/installSql.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 1ba9a366..8b1faa34 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -603,15 +603,18 @@ function initializeXrefTable() { } $statusesRs = executeQuery("SELECT `ID`, `Key` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses`"); + $oldSetting = $hesk_settings['can_sel_lang']; + $hesk_settings['can_sel_lang'] = 1; while ($row = hesk_dbFetchAssoc($statusesRs)) { foreach ($languages as $language => $languageCode) { hesk_setLanguage($language); $sql = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` (`language`, `text`, `status_id`) VALUES ('".hesk_dbEscape($language)."', '".hesk_dbEscape($hesklang[$row['Key']])."', ".intval($row['ID']).")"; executeQuery($sql); - hesk_resetLanguage(); } } + $hesk_settings['can_sel_lang'] = $oldSetting; + hesk_resetLanguage(); } function execute240FileUpdate() { From bea4422bdcb77476f0960e588ba948b57e244d28 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 9 Aug 2015 11:49:41 -0400 Subject: [PATCH 11/13] Enforce the language on the JOIN, not the WHERE --- inc/common.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/common.inc.php b/inc/common.inc.php index e75d5408..8fe783c0 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -1962,10 +1962,11 @@ function mfh_getDisplayTextForStatusId($statusId) { $statusRs = hesk_dbQuery("SELECT `text`, `Key`, `language` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` AS `statuses` LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` ON `status_id` = `statuses`.`ID` - WHERE `statuses`.`ID` = ".intval($statusId)." AND `language` = '".hesk_dbEscape($hesk_settings['language'])."'"); + AND `language` = '".hesk_dbEscape($hesk_settings['language'])."' + WHERE `statuses`.`ID` = ".intval($statusId)); $statusRec = hesk_dbFetchAssoc($statusRs); - if ($statusRec['language'] == $hesk_settings['language'] && $statusRec['text'] != NULL) { + if ($statusRec['text'] != NULL) { // We found a record. Use the text field return $statusRec['text']; } else { From 8fa5bc95b800c4447212469dcf4f080839364cac Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 9 Aug 2015 17:02:04 -0400 Subject: [PATCH 12/13] #304 Fix inserting canned templates/responses in the TinyMCE editor --- admin/admin_ticket.php | 27 ++++++++++++++++++++++----- admin/manage_canned.php | 6 +++++- admin/new_ticket.php | 6 +++++- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 02073ebd..9842b6bd 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1943,7 +1943,7 @@ function hesk_printReplyForm() { function hesk_printCanned() { - global $hesklang, $hesk_settings, $can_reply, $ticket; + global $hesklang, $hesk_settings, $can_reply, $ticket, $modsForHesk_settings; /* Can user reply to tickets? */ if ( ! $can_reply) @@ -1972,13 +1972,19 @@ function hesk_printCanned() while ($mysaved = hesk_dbFetchRow($res)) { $can_options .= '\n"; - echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n"; + if ($modsForHesk_settings['rich_text_for_tickets']) { + echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved[2]))."';\n"; + } else { + echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n"; + } } ?> function setMessage(msgid) { + var isHtml = ; + var myMsg=myMsgTxt[msgid]; if (myMsg == '') @@ -2021,12 +2027,23 @@ function hesk_printCanned() { if (document.getElementById('moderep').checked) { - document.getElementById('HeskMsg').innerHTML=''; + if (isHtml){ + tinymce.get("message").setContent(''); + tinymce.get("message").execCommand('mceInsertRawHTML', false, myMsg); + } else { + document.getElementById('message').value = myMsg; + } } else { - var oldMsg = document.getElementById('message').value; - document.getElementById('HeskMsg').innerHTML=''; + if (isHtml) { + var oldMsg = tinymce.get("message").getContent(); + tinymce.get("message").setContent(''); + tinymce.get("message").execCommand('mceInsertRawHTML', false, oldMsg + myMsg); + } else { + var oldMsg = document.getElementById('message').value; + document.getElementById('message').value = oldMsg + myMsg; + } } } else diff --git a/admin/manage_canned.php b/admin/manage_canned.php index d6fa2b6a..19c38d66 100644 --- a/admin/manage_canned.php +++ b/admin/manage_canned.php @@ -159,8 +159,12 @@ function hesk_insertAtCursor(myField, myValue) { $options .= '>'.$mysaved['title'].''; - $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved['message']) )."';\n"; $javascript_titles.='myTitle['.$mysaved['id'].']=\''.addslashes($mysaved['title'])."';\n"; + if ($modsForHesk_settings['rich_text_for_tickets']) { + $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved['message']) )."';\n"; + } else { + $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved['message']) )."';\n"; + } echo ' diff --git a/admin/new_ticket.php b/admin/new_ticket.php index 8799deac..fcb65702 100644 --- a/admin/new_ticket.php +++ b/admin/new_ticket.php @@ -563,7 +563,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); while ($mysaved = hesk_dbFetchRow($res)) { $can_options .= '\n"; - echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n"; + if ($modsForHesk_settings['rich_text_for_tickets']) { + echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved[2]))."';\n"; + } else { + echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n"; + } echo 'mySubjectTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[1]))."';\n"; } From f64aa7a2cc145a628fa6bfa9cf9da756856d98cb Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 9 Aug 2015 17:04:11 -0400 Subject: [PATCH 13/13] Should be ID, not Id --- admin/manage_statuses.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/manage_statuses.php b/admin/manage_statuses.php index 92fb65ef..13d9a4fd 100644 --- a/admin/manage_statuses.php +++ b/admin/manage_statuses.php @@ -645,7 +645,7 @@ function createStatus() { $my_order = $row[0]+10; // Get the next status id - $res = hesk_dbQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `Id` DESC LIMIT 1"); + $res = hesk_dbQuery("SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` ORDER BY `ID` DESC LIMIT 1"); $row = hesk_dbFetchAssoc($res); $nextId = $row['ID'] + 1;
Migrate IP / Email Bans Waiting...
Initialize Statuses Waiting...