Hesk v3.2.0

This commit is contained in:
Luke Tainton
2021-03-06 16:23:18 +00:00
parent a5296eea55
commit ac0640212a
222 changed files with 16911 additions and 1089 deletions

View File

@@ -249,7 +249,7 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."banned_ips` (
hesk_dbQuery("
CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(60) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`cat_order` smallint(5) unsigned NOT NULL DEFAULT '0',
`autoassign` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`type` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
@@ -414,6 +414,27 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."logins` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
");
// -> Log of overdue tickets
hesk_dbQuery("
CREATE TABLE IF NOT EXISTS `".hesk_dbEscape($hesk_settings['db_pfix'])."log_overdue` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ticket` mediumint(8) UNSIGNED NOT NULL,
`category` smallint(5) UNSIGNED NOT NULL,
`priority` enum('0','1','2','3') NOT NULL,
`status` tinyint(3) UNSIGNED NOT NULL,
`owner` smallint(5) UNSIGNED NOT NULL DEFAULT '0',
`due_date` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00',
`comments` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ticket` (`ticket`),
KEY `category` (`category`),
KEY `priority` (`priority`),
KEY `status` (`status`),
KEY `owner` (`owner`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
");
// -> Private messages
hesk_dbQuery("
CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."mail` (
@@ -432,7 +453,7 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."mail` (
");
// ---> Insert welcome email
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."mail` (`id`, `from`, `to`, `subject`, `message`, `dt`, `read`, `deletedby`) VALUES (NULL, 9999, 1, 'HESK quick start guide', '".hesk_dbEscape("</p><div style=\"text-align:justify; padding-left: 10px; padding-right: 10px;\">\r\n\r\n<p>&nbsp;<br /><b>Welcome to HESK! You'll find it is a great tool for improving your customer support.</b></p>\r\n\r\n<p><b>Here is a short guide to get you started.</b><br />&nbsp;</p>\r\n\r\n<hr />\r\nSTEP #1: setup your profile\r\n<hr />\r\n<ol>\r\n<li>go to <a href=\"profile.php\">Profile</a>,</li>\r\n<li>set your name and email address.</li>\r\n</ol>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #2: configure HESK\r\n<hr />\r\n<ol>\r\n<li>go to <a href=\"admin_settings_general.php\">Settings</a>,</li>\r\n<li>for a quick start, just modify these on the \"General\" tab:<br /><br />\r\nWebsite title<br />\r\nWebsite URL<br />\r\nWebmaster email<br />&nbsp;\r\n</li>\r\n<li>you can come back to the settings page later and explore all the options. To view details about a setting, click the [?]</li>\r\n</ol>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #3: add ticket categories\r\n<hr />\r\n<p>Go to <a href=\"manage_categories.php\">Categories</a> to add ticket categories.</p>\r\n<p>You cannot delete the default category, but you can rename it.</p>\r\n\r\n<p>&nbsp;</p>\r\n\r\n<hr />\r\nSTEP #4: add staff accounts\r\n<hr />\r\n<p>Go to <a href=\"manage_users.php\">Users</a> to create new staff accounts.</p>\r\n<p>You can use two user types in HESK:</p>\r\n<ul>\r\n<li><b>Administrators</b>, who have full access to all HESK features</li>\r\n<li><b>Staff</b>, who have access to limited privileges and categories</li>\r\n</ul>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #5: useful tools\r\n<hr />\r\n<p>You can do a lot on the <a href=\"banned_emails.php\">Tools</a> page, for example:</p>\r\n<ul>\r\n<li>create custom ticket statuses,</li>\r\n<li>add custom input fields to the \"Submit a ticket\" form,</li>\r\n<li>modify email templates,</li>\r\n<li>and more.</li>\r\n</ul>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #6: create a knowledgebase\r\n<hr />\r\n<p>A clear and comprehensive knowledgebase can drastically reduce the number of support tickets you receive, thereby saving you significant time and effort in the long run.</p>\r\n<p>Go to <a href=\"manage_knowledgebase.php\">Knowledgebase</a> to create categories and write articles for your knowledgebase.</p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #7: don't repeat yourself\r\n<hr />\r\n<p>Sometimes several support tickets are addressing the same issues - allowing you to use pre-written (&quot;canned&quot;) responses.</p>\r\n<p>To compose canned responses go to <a href=\"manage_canned.php\">Canned</a> page.</p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #8: secure your help desk\r\n<hr />\r\n<p>Make sure your help desk is as secure as possible by going through <a href=\"https://www.hesk.com/knowledgebase/?article=82\">HESK security check list</a></p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #9: stay updated\r\n<hr />\r\n<p>HESK regularly receives improvements and bug fixes, make sure you know about them!</p>\r\n<ul>\r\n<li>for fast notifications, <a href=\"https://twitter.com/HESKdotCOM\">follow us on <b>Twitter</b></a></li>\r\n<li>for email notifications, subscribe to our low-volume zero-spam <a href=\"https://www.hesk.com/newsletter.php\">newsletter</a></li>\r\n</ul>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #10: look professional\r\n<hr />\r\n<p>To look more professional and not advertise the tools you use, <a href=\"https://www.hesk.com/buy.php\">remove &quot;Powered by&quot; links</a> from your help desk.</p>\r\n\r\n<p>&nbsp;</p>\r\n\r\n<p>Again, welcome to HESK and enjoy using it!</p>\r\n\r\n<p>Klemen Stirn<br />\r\nAuthor and owner</p>\r\n\r\n</div><p>")."', NOW(), '0', 9999)");
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."mail` (`id`, `from`, `to`, `subject`, `message`, `dt`, `read`, `deletedby`) VALUES (NULL, 9999, 1, 'HESK quick start guide', '".hesk_dbEscape("</p><div style=\"text-align:justify; padding-left: 10px; padding-right: 10px;\">\r\n\r\n<p>&nbsp;<br /><b>Welcome to HESK! You'll find it is a great tool for improving your customer support.</b></p>\r\n\r\n<p><b>Here is a short guide to get you started.</b><br />&nbsp;</p>\r\n\r\n<hr />\r\nSTEP #1: set up your profile\r\n<hr />\r\n<ol>\r\n<li>go to <a href=\"profile.php\">Profile</a>,</li>\r\n<li>set your name and email address.</li>\r\n</ol>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #2: configure HESK\r\n<hr />\r\n<ol>\r\n<li>go to <a href=\"admin_settings_general.php\">Settings</a>,</li>\r\n<li>for a quick start, just modify these on the \"General\" tab:<br /><br />\r\nWebsite title<br />\r\nWebsite URL<br />\r\nWebmaster email<br />&nbsp;\r\n</li>\r\n<li>you can come back to the settings page later and explore all the options. To view details about a setting, click the [?]</li>\r\n</ol>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #3: add ticket categories\r\n<hr />\r\n<p>Go to <a href=\"manage_categories.php\">Categories</a> to add ticket categories.</p>\r\n<p>You cannot delete the default category, but you can rename it.</p>\r\n\r\n<p>&nbsp;</p>\r\n\r\n<hr />\r\nSTEP #4: add staff accounts\r\n<hr />\r\n<p>Go to <a href=\"manage_users.php\">Team</a> to create new staff accounts.</p>\r\n<p>You can use two user types in HESK:</p>\r\n<ul>\r\n<li><b>Administrators</b>, who have full access to all HESK features</li>\r\n<li><b>Staff</b>, who have access to limited privileges and categories</li>\r\n</ul>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #5: useful tools\r\n<hr />\r\n<p>You can do a lot on the <a href=\"banned_emails.php\">Tools</a> page, for example:</p>\r\n<ul>\r\n<li>create custom ticket statuses,</li>\r\n<li>add custom input fields to the \"Submit a ticket\" form,</li>\r\n<li>modify email templates,</li>\r\n<li>and more.</li>\r\n</ul>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #6: create a knowledgebase\r\n<hr />\r\n<p>A clear and comprehensive knowledgebase can drastically reduce the number of support tickets you receive, thereby saving you significant time and effort in the long run.</p>\r\n<p>Go to <a href=\"manage_knowledgebase.php\">Knowledgebase</a> to create categories and write articles for your knowledgebase.</p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #7: don't repeat yourself\r\n<hr />\r\n<p>Sometimes several support tickets are addressing the same issues - allowing you to use pre-written (&quot;canned&quot;) responses.</p>\r\n<p>To compose canned responses go to <a href=\"manage_canned.php\">Canned</a> page.</p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #8: secure your help desk\r\n<hr />\r\n<p>Make sure your help desk is as secure as possible by going through <a href=\"https://www.hesk.com/knowledgebase/?article=82\">HESK security check list</a></p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #9: stay updated\r\n<hr />\r\n<p>HESK regularly receives improvements and bug fixes; make sure you know about them!</p>\r\n<ul>\r\n<li>for fast notifications, <a href=\"https://twitter.com/HESKdotCOM\">follow us on <b>Twitter</b></a></li>\r\n<li>for email notifications, subscribe to our low-volume zero-spam <a href=\"https://www.hesk.com/newsletter.php\">newsletter</a></li>\r\n</ul>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\nSTEP #10: look professional\r\n<hr />\r\n<p>To look more professional and not advertise the tools you use, <a href=\"https://www.hesk.com/buy.php\">remove &quot;Powered by&quot; links</a> from your help desk.</p>\r\n\r\n<p>&nbsp;</p>\r\n\r\n<p>Again, welcome to HESK and enjoy using it!</p>\r\n\r\n<p>Klemen<br />\r\n<a href=\"https://www.hesk.com\">https://www.hesk.com</a></p>\r\n\r\n</div><p>")."', NOW(), '0', 9999)");
// -> Notes
hesk_dbQuery("
@@ -475,8 +496,9 @@ hesk_dbQuery("
CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`replyto` mediumint(8) unsigned NOT NULL DEFAULT '0',
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`message` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`message_html` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
`dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`attachments` mediumtext COLLATE utf8_unicode_ci,
`staffid` smallint(5) unsigned NOT NULL DEFAULT '0',
@@ -495,6 +517,7 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."reply_drafts` (
`owner` smallint(5) unsigned NOT NULL,
`ticket` mediumint(8) unsigned NOT NULL,
`message` mediumtext CHARACTER SET utf8 NOT NULL,
`message_html` mediumtext CHARACTER SET utf8 DEFAULT NULL,
`dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY `owner` (`owner`),
KEY `ticket` (`ticket`)
@@ -537,6 +560,7 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."std_replies` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`message` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`message_html` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
`reply_order` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
@@ -553,6 +577,7 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` (
`priority` enum('0','1','2','3') COLLATE utf8_unicode_ci NOT NULL DEFAULT '3',
`subject` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`message` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`message_html` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
`dt` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00',
`lastchange` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`firstreply` timestamp NULL DEFAULT NULL,
@@ -626,6 +651,8 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` (
`custom48` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`custom49` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`custom50` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`due_date` timestamp NULL DEFAULT NULL,
`overdue_email_sent` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`),
KEY `trackid` (`trackid`),
KEY `archive` (`archive`),
@@ -643,6 +670,7 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."ticket_templates` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`message` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`message_html` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
`tpl_order` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
@@ -655,7 +683,7 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` (
`user` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`pass` char(40) COLLATE utf8_unicode_ci NOT NULL,
`isadmin` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`signature` varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`language` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
@@ -673,6 +701,8 @@ CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` (
`notify_assigned` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`notify_pm` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`notify_note` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`notify_overdue_unassigned` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`notify_overdue_my` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`default_list` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`autoassign` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`heskprivileges` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
@@ -737,6 +767,16 @@ function hesk_iSaveSettings()
// If SSL is enabled, let's force it by default
$set['force_ssl'] = HESK_SSL ? 1 : 0;
// Generate an URL access key
$length = mt_rand(20, 30);
$result = '';
$characters = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ1234567890-_.';
$charactersLength = strlen($characters);
for ($i = 0; $i < $length; $i++) {
$result .= $characters[mt_rand(0, $charactersLength-1)];
}
$set['url_key'] = $result;
hesk_iSaveSettingsFile($set);
return true;

View File

@@ -15,7 +15,7 @@
if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
// We will be installing this HESK version:
define('HESK_NEW_VERSION','3.1.2');
define('HESK_NEW_VERSION','3.2.0');
define('REQUIRE_PHP_VERSION','5.3.0');
define('REQUIRE_MYSQL_VERSION','5.0.7');
@@ -34,6 +34,11 @@ if (!isset($hesk_settings['x_frame_opt']))
$hesk_settings['x_frame_opt'] = 1;
}
if (!isset($hesk_settings['samesite']))
{
$hesk_settings['samesite'] = 'Lax';
}
if (!isset($hesk_settings['force_ssl']))
{
$hesk_settings['force_ssl'] = 0;
@@ -212,6 +217,8 @@ $hesk_settings[\'webmaster_mail\']=\'' . $set['webmaster_mail'] . '\';
$hesk_settings[\'noreply_mail\']=\'' . $set['noreply_mail'] . '\';
$hesk_settings[\'noreply_name\']=\'' . $set['noreply_name'] . '\';
$hesk_settings[\'site_theme\']=\'' . $set['site_theme'] . '\';
$hesk_settings[\'admin_css\']=' . $set['admin_css'] . ';
$hesk_settings[\'admin_css_url\']=\'' . $set['admin_css_url'] . '\';
// --> Language settings
$hesk_settings[\'can_sel_lang\']=' . $set['can_sel_lang'] . ';
@@ -239,6 +246,7 @@ $hesk_settings[\'max_listings\']=' . $set['max_listings'] . ';
$hesk_settings[\'print_font_size\']=' . $set['print_font_size'] . ';
$hesk_settings[\'autoclose\']=' . $set['autoclose'] . ';
$hesk_settings[\'max_open\']=' . $set['max_open'] . ';
$hesk_settings[\'due_soon\']=' . $set['due_soon'] . ';
$hesk_settings[\'new_top\']=' . $set['new_top'] . ';
$hesk_settings[\'reply_top\']=' . $set['reply_top'] . ';
$hesk_settings[\'hide_replies\']=' . $set['hide_replies'] . ';
@@ -264,6 +272,7 @@ $hesk_settings[\'short_link\']=' . $set['short_link'] . ';
$hesk_settings[\'select_cat\']=' . $set['select_cat'] . ';
$hesk_settings[\'select_pri\']=' . $set['select_pri'] . ';
$hesk_settings[\'cat_show_select\']=' . $set['cat_show_select'] . ';
$hesk_settings[\'staff_ticket_formatting\']=' . $set['staff_ticket_formatting'] . ';
// --> SPAM Prevention
$hesk_settings[\'secimg_use\']=' . $set['secimg_use'] . ';
@@ -278,10 +287,13 @@ $hesk_settings[\'question_ans\']=\'' . $set['question_ans'] . '\';
// --> Security
$hesk_settings[\'attempt_limit\']=' . $set['attempt_limit'] . ';
$hesk_settings[\'attempt_banmin\']=' . $set['attempt_banmin'] . ';
$hesk_settings[\'flood\']=' . $set['flood'] . ';
$hesk_settings[\'reset_pass\']=' . $set['reset_pass'] . ';
$hesk_settings[\'email_view_ticket\']=' . $set['email_view_ticket'] . ';
$hesk_settings[\'x_frame_opt\']=' . $set['x_frame_opt'] . ';
$hesk_settings[\'samesite\']=\'' . $set['samesite'] . '\';
$hesk_settings[\'force_ssl\']=' . $set['force_ssl'] . ';
$hesk_settings[\'url_key\']=\'' . $set['url_key'] . '\';
// --> Attachments
$hesk_settings[\'attachments\']=array (
@@ -344,6 +356,7 @@ $hesk_settings[\'imap_job_wait\']=' . $set['imap_job_wait'] . ';
$hesk_settings[\'imap_host_name\']=\'' . $set['imap_host_name'] . '\';
$hesk_settings[\'imap_host_port\']=' . $set['imap_host_port'] . ';
$hesk_settings[\'imap_enc\']=\'' . $set['imap_enc'] . '\';
$hesk_settings[\'imap_noval_cert\']=' . $set['imap_noval_cert'] . ';
$hesk_settings[\'imap_keep\']=' . $set['imap_keep'] . ';
$hesk_settings[\'imap_user\']=\'' . $set['imap_user'] . '\';
$hesk_settings[\'imap_password\']=\'' . $set['imap_password'] . '\';
@@ -604,7 +617,12 @@ function hesk_iCheckSetup()
';
}
// 2. File hesk_settings.inc.php must be writable
// 2. json_encode / json_decode must be available
if (!extension_loaded('json')) {
$correct_these[] = 'The JSON PHP extension is required. Ask your hosting company about how to have the JSON extension enabled.';
}
// 3. File hesk_settings.inc.php must be writable
if ( ! is__writable(HESK_PATH . 'hesk_settings.inc.php') )
{
// -> try to CHMOD it
@@ -626,7 +644,7 @@ function hesk_iCheckSetup()
}
}
// 3. Folder attachments must exist
// 4. Folder attachments must exist
$hesk_settings['attach_dir_name'] = isset($hesk_settings['attach_dir']) ? $hesk_settings['attach_dir'] : 'attachments';
$hesk_settings['attach_dir'] = HESK_PATH . $hesk_settings['attach_dir_name'];
@@ -667,7 +685,7 @@ function hesk_iCheckSetup()
';
}
// 3.2 Folder cache must exist
// 4.2 Folder cache must exist
$hesk_settings['cache_dir_name'] = isset($hesk_settings['cache_dir']) ? $hesk_settings['cache_dir'] : 'cache';
$hesk_settings['cache_dir'] = HESK_PATH . $hesk_settings['cache_dir_name'];
@@ -708,7 +726,7 @@ function hesk_iCheckSetup()
';
}
// 4. MySQL must be available
// 5. MySQL must be available
if ( ! function_exists('mysql_connect') && ! function_exists('mysqli_connect') )
{
$correct_these[] = '
@@ -718,10 +736,10 @@ function hesk_iCheckSetup()
';
}
// 5. Can we use GD library?
// 6. Can we use GD library?
$GD_LIB = ( extension_loaded('gd') && function_exists('gd_info') ) ? true : false;
// 6. Make sure old files are deleted
// 7. Make sure old files are deleted
$hesk_settings['admin_dir'] = isset($hesk_settings['admin_dir']) ? $hesk_settings['admin_dir'] : 'admin';
$old_files = array(

View File

@@ -1201,14 +1201,66 @@ function hesk_iUpdateTables()
// 3.1.1 no changes
// 3.1.2 no changes
// Updating 2.8.3 through 3.1.1 to 3.2.0
if ($update_all_next || $hesk_settings['update_from'] == '2.8.3') {
// Modify tickets table with due date-related fields only if it doesn't exist (MfH users will already have these columns)
$existing_column_rs = hesk_dbQuery("SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = '".hesk_dbEscape($hesk_settings['db_pfix'])."tickets'
AND table_schema = '".hesk_dbEscape($hesk_settings['db_name'])."'
AND column_name = 'due_date'");
if (hesk_dbNumRows($existing_column_rs) === 0) {
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` ADD COLUMN `message_html` mediumtext DEFAULT NULL AFTER `message`, ADD COLUMN `due_date` timestamp NULL DEFAULT NULL, ADD COLUMN `overdue_email_sent` tinyint(1) DEFAULT '0'");
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ADD COLUMN `notify_overdue_unassigned` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1' AFTER `notify_note`");
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ADD COLUMN `notify_overdue_my` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1' AFTER `notify_overdue_unassigned`");
} else {
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` ADD COLUMN `message_html` mediumtext DEFAULT NULL AFTER `message`");
}
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `message_html` = `message`, `lastchange`=`lastchange`");
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` CHANGE `name` `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', ADD COLUMN `message_html` mediumtext DEFAULT NULL AFTER `message`");
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` SET `message_html` = `message`");
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."reply_drafts` ADD COLUMN `message_html` mediumtext COLLATE utf8_unicode_ci NULL AFTER `message`");
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."reply_drafts` SET `message_html` = `message`");
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."std_replies` ADD COLUMN `message_html` mediumtext COLLATE utf8_unicode_ci NULL AFTER `message`");
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."std_replies` SET `message_html` = `message`");
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."ticket_templates` ADD COLUMN `message_html` mediumtext COLLATE utf8_unicode_ci NULL AFTER `message`");
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."ticket_templates` SET `message_html` = `message`");
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."users` CHANGE `name` `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT ''");
hesk_dbQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` CHANGE `name` `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT ''");
// -> Log of overdue tickets
hesk_dbQuery("
CREATE TABLE IF NOT EXISTS `".hesk_dbEscape($hesk_settings['db_pfix'])."log_overdue` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ticket` mediumint(8) UNSIGNED NOT NULL,
`category` smallint(5) UNSIGNED NOT NULL,
`priority` enum('0','1','2','3') NOT NULL,
`status` tinyint(3) UNSIGNED NOT NULL,
`owner` smallint(5) UNSIGNED NOT NULL DEFAULT '0',
`due_date` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00',
`comments` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ticket` (`ticket`),
KEY `category` (`category`),
KEY `priority` (`priority`),
KEY `status` (`status`),
KEY `owner` (`owner`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
");
$update_all_next = 1;
}
// Insert the "HESK updated to latest version" mail for the administrator
if ( file_exists(HESK_PATH.'hesk_license.php') )
{
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."mail` (`id`, `from`, `to`, `subject`, `message`, `dt`, `read`, `deletedby`) VALUES (NULL, 9999, 1, 'HESK updated to version ".HESK_NEW_VERSION."', '".hesk_dbEscape("</p><div style=\"text-align:justify; padding-left: 10px; padding-right: 10px;\">\r\n\r\n<p>&nbsp;<br /><b>Congratulations, your HESK has been successfully updated.</b></p>\r\n\r\n<p><b>Before you go, let me invite you to:</b><br />&nbsp;</p>\r\n\r\n<hr />\r\n#1: help us improve\r\n<hr />\r\n<p>You can suggest what features should be added to HESK by posting them <a href=\"https://hesk.uservoice.com/forums/69851-general\" target=\"_blank\">here</a>.</p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n#2: stay updated\r\n<hr />\r\n<p>HESK regularly receives improvements and bug fixes, make sure you know about them!</p>\r\n<ul>\r\n<li>for fast notifications, <a href=\"https://twitter.com/HESKdotCOM\">follow HESK on <b>Twitter</b></a></li>\r\n<li>for email notifications, subscribe to our low-volume zero-spam <a href=\"https://www.hesk.com/newsletter.php\">newsletter</a></li>\r\n</ul>\r\n\r\n<p>&nbsp;</p>\r\n\r\n<p>Best regards,</p>\r\n\r\n<p>Klemen Stirn<br />\r\nAuthor and owner</p>\r\n\r\n</div><p>")."', NOW(), '0', 9999)");
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."mail` (`id`, `from`, `to`, `subject`, `message`, `dt`, `read`, `deletedby`) VALUES (NULL, 9999, 1, 'HESK updated to version ".HESK_NEW_VERSION."', '".hesk_dbEscape("</p><div style=\"text-align:justify; padding-left: 10px; padding-right: 10px;\">\r\n\r\n<p>&nbsp;<br /><b>Congratulations, your HESK has been successfully updated.</b></p>\r\n\r\n<p><b>Before you go, let me invite you to:</b><br />&nbsp;</p>\r\n\r\n<hr />\r\n#1: help us improve\r\n<hr />\r\n<p>You can suggest what features should be added to HESK by posting them <a href=\"https://hesk.uservoice.com/forums/69851-general\" target=\"_blank\">here</a>.</p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n#2: stay updated\r\n<hr />\r\n<p>HESK regularly receives improvements and bug fixes; make sure you know about them!</p>\r\n<ul>\r\n<li>for fast notifications, <a href=\"https://twitter.com/HESKdotCOM\">follow HESK on <b>Twitter</b></a></li>\r\n<li>for email notifications, subscribe to our low-volume zero-spam <a href=\"https://www.hesk.com/newsletter.php\">newsletter</a></li>\r\n</ul>\r\n\r\n<p>&nbsp;</p>\r\n\r\n<p>Best regards,</p>\r\n\r\n<p>Klemen<br />\r\n<a href=\"https://www.hesk.com/\">https://www.hesk.com</a></p>\r\n\r\n</div><p>")."', NOW(), '0', 9999)");
}
else
{
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."mail` (`id`, `from`, `to`, `subject`, `message`, `dt`, `read`, `deletedby`) VALUES (NULL, 9999, 1, 'HESK updated to version ".HESK_NEW_VERSION."', '".hesk_dbEscape("</p><div style=\"text-align:justify; padding-left: 10px; padding-right: 10px;\">\r\n\r\n<p>&nbsp;<br /><b>Congratulations, your HESK has been successfully updated.</b></p>\r\n\r\n<p><b>Before you go, let me invite you to:</b><br />&nbsp;</p>\r\n\r\n<hr />\r\n#1: help us improve\r\n<hr />\r\n<p>You can suggest what features should be added to HESK by posting them <a href=\"https://hesk.uservoice.com/forums/69851-general\" target=\"_blank\">here</a>.</p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n#2: stay updated\r\n<hr />\r\n<p>HESK regularly receives improvements and bug fixes, make sure you know about them!</p>\r\n<ul>\r\n<li>for fast notifications, <a href=\"https://twitter.com/HESKdotCOM\">follow HESK on <b>Twitter</b></a></li>\r\n<li>for email notifications, subscribe to our low-volume zero-spam <a href=\"https://www.hesk.com/newsletter.php\">newsletter</a></li>\r\n</ul>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n#3: look professional\r\n<hr />\r\n<p>To look more professional and not advertise the tools you use, <a href=\"https://www.hesk.com/buy.php\">remove &quot;Powered by&quot; links</a> from your help desk.</p>\r\n\r\n<p>&nbsp;</p>\r\n\r\n<p>Best regards,</p>\r\n\r\n<p>Klemen Stirn<br />\r\nAuthor and owner</p>\r\n\r\n</div><p>")."', NOW(), '0', 9999)");
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."mail` (`id`, `from`, `to`, `subject`, `message`, `dt`, `read`, `deletedby`) VALUES (NULL, 9999, 1, 'HESK updated to version ".HESK_NEW_VERSION."', '".hesk_dbEscape("</p><div style=\"text-align:justify; padding-left: 10px; padding-right: 10px;\">\r\n\r\n<p>&nbsp;<br /><b>Congratulations, your HESK has been successfully updated.</b></p>\r\n\r\n<p><b>Before you go, let me invite you to:</b><br />&nbsp;</p>\r\n\r\n<hr />\r\n#1: help us improve\r\n<hr />\r\n<p>You can suggest what features should be added to HESK by posting them <a href=\"https://hesk.uservoice.com/forums/69851-general\" target=\"_blank\">here</a>.</p>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n#2: stay updated\r\n<hr />\r\n<p>HESK regularly receives improvements and bug fixes; make sure you know about them!</p>\r\n<ul>\r\n<li>for fast notifications, <a href=\"https://twitter.com/HESKdotCOM\">follow HESK on <b>Twitter</b></a></li>\r\n<li>for email notifications, subscribe to our low-volume zero-spam <a href=\"https://www.hesk.com/newsletter.php\">newsletter</a></li>\r\n</ul>\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n#3: look professional\r\n<hr />\r\n<p>To look more professional and not advertise the tools you use, <a href=\"https://www.hesk.com/buy.php\">remove &quot;Powered by&quot; links</a> from your help desk.</p>\r\n\r\n<p>&nbsp;</p>\r\n\r\n<p>Best regards,</p>\r\n\r\n<p>Klemen<br />\r\n<a href=\"https://www.hesk.com/\">https://www.hesk.com</a></p>\r\n\r\n</div><p>")."', NOW(), '0', 9999)");
}
return true;
@@ -1311,6 +1363,8 @@ function hesk_defaultSettings()
$hesk_settings['noreply_mail']='noreply@example.com';
$hesk_settings['noreply_name']='Help Desk';
$hesk_settings['site_theme']='hesk3';
$hesk_settings['admin_css']=0;
$hesk_settings['admin_css_url']='https://www.example.com/hesk-style.css';
// --> Language settings
$hesk_settings['can_sel_lang']=0;
@@ -1340,9 +1394,10 @@ function hesk_defaultSettings()
$hesk_settings['print_font_size']=12;
$hesk_settings['autoclose']=0;
$hesk_settings['max_open']=0;
$hesk_settings['due_soon']=7;
$hesk_settings['new_top']=0;
$hesk_settings['reply_top']=0;
$hesk_settings['hide_replies']=-1;
$hesk_settings['hide_replies']=0;
$hesk_settings['limit_width']=800;
// --> Features
@@ -1365,6 +1420,7 @@ function hesk_defaultSettings()
$hesk_settings['select_cat']=0;
$hesk_settings['select_pri']=0;
$hesk_settings['cat_show_select']=15;
$hesk_settings['staff_ticket_formatting']=0;
// --> SPAM Prevention
$hesk_settings['secimg_use']=1;
@@ -1379,10 +1435,13 @@ function hesk_defaultSettings()
// --> Security
$hesk_settings['attempt_limit']=6;
$hesk_settings['attempt_banmin']=60;
$hesk_settings['flood']=3;
$hesk_settings['reset_pass']=1;
$hesk_settings['email_view_ticket']=1;
$hesk_settings['x_frame_opt']=1;
$hesk_settings['samesite']='Lax';
$hesk_settings['force_ssl']=0;
$hesk_settings['url_key']='';
// --> Attachments
$hesk_settings['attachments']=array (
@@ -1445,6 +1504,7 @@ function hesk_defaultSettings()
$hesk_settings['imap_host_name']='mail.example.com';
$hesk_settings['imap_host_port']=993;
$hesk_settings['imap_enc']='ssl';
$hesk_settings['imap_noval_cert']=1;
$hesk_settings['imap_keep']=0;
$hesk_settings['imap_user']='';
$hesk_settings['imap_password']='';
@@ -1504,6 +1564,26 @@ function hesk_iDetectVersion()
{
global $hesk_settings, $hesklang;
// Get a list of tables from the database
$tables = array();
$res = hesk_dbQuery('SHOW TABLES FROM `'.hesk_dbEscape($hesk_settings['db_name']).'`');
while ($row = hesk_dbFetchRow($res))
{
$tables[] = $row[0];
}
// If we don't have four basic tables this is not a valid HESK install
if ( ! in_array($hesk_settings['db_pfix'].'categories', $tables) || ! in_array($hesk_settings['db_pfix'].'replies', $tables) || ! in_array($hesk_settings['db_pfix'].'tickets', $tables) || ! in_array($hesk_settings['db_pfix'].'users', $tables) )
{
hesk_iDatabase(3);
}
// Version 3.2.0 tables installed?
if (in_array($hesk_settings['db_pfix'].'log_overdue', $tables))
{
return '3.2.0';
}
// Version 2.8.3 tables installed?
$res = hesk_dbQuery("SELECT CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".hesk_dbEscape($hesk_settings['db_pfix'])."tickets' AND table_schema = '".hesk_dbEscape($hesk_settings['db_name'])."' AND column_name = 'name' LIMIT 0, 1");
$row = hesk_dbFetchRow($res);
@@ -1513,8 +1593,7 @@ function hesk_iDetectVersion()
}
// Version 2.8.2 tables installed?
$res = hesk_dbQuery("SHOW TABLES FROM `".hesk_dbEscape($hesk_settings['db_name'])."` LIKE '".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages'");
if (hesk_dbNumRows($res))
if (in_array($hesk_settings['db_pfix'].'service_messages', $tables))
{
$res = hesk_dbQuery("SHOW COLUMNS FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` LIKE 'language'");
if (hesk_dbNumRows($res))
@@ -1530,15 +1609,6 @@ function hesk_iDetectVersion()
return '2.8';
}
// Get a list of tables from the database
$tables = array();
$res = hesk_dbQuery('SHOW TABLES FROM `'.hesk_dbEscape($hesk_settings['db_name']).'`');
while ($row = hesk_dbFetchRow($res))
{
$tables[] = $row[0];
}
// Version 2.7 tables installed?
if (
in_array($hesk_settings['db_pfix'].'custom_fields', $tables) ||
@@ -1618,12 +1688,6 @@ function hesk_iDetectVersion()
// It's a version older than 0.94 or no tables found
else
{
// If we don't have four basic tables this is not a valid HESK install
if ( ! in_array('hesk_categories', $tables) || ! in_array('hesk_replies', $tables) || ! in_array('hesk_tickets', $tables) || ! in_array('hesk_users', $tables) )
{
hesk_iDatabase(3);
}
// Version 0.90 didn't have the notify column in users table
$res = hesk_dbQuery("SELECT * FROM `hesk_users` WHERE `id`=1 LIMIT 1");
$row = hesk_dbFetchAssoc($res);