diff --git a/admin/admin_main.php b/admin/admin_main.php index 21b752e8..0d6dcefc 100644 --- a/admin/admin_main.php +++ b/admin/admin_main.php @@ -116,7 +116,7 @@ else { F9ub3RpY2UnXS4nXCcpIj4nLiRoZXNrbGFuZ1snc2gnXS4nPC9hPjwvdGQ+PC90cj48L3RhYmxlPjxwP icuJGhlc2tsYW5nWydzdXBwb3J0X3JlbW92ZSddLicuIDxhIGhyZWY9Imh0dHBzOi8vd3d3Lmhlc2suY 29tL2J1eS5waHAiIHRhcmdldD0iX2JsYW5rIj4nLiRoZXNrbGFuZ1snY2xpY2tfaW5mbyddLic8L2E+P - C9wPic7DQp9DQo=', "\112"); + C9wPjxociAvPic7DQp9DQo=', "\112"); /* Clean unneeded session variables */ hesk_cleanSessionVars('hide'); diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index 7454a899..0c3df742 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -758,6 +758,12 @@ if (!$pop3_OK) { $tmp[] = '' . $hesklang['pop3e'] . ': ' . $pop3_error . '

' . $hesklang['pop3log'] . ''; } +// Clear the cache folder +hesk_purge_cache('kb'); +hesk_purge_cache('cf'); +hesk_purge_cache('export', 14400); +hesk_purge_cache('status'); + // Show the settings page and display any notices or success if (count($tmp)) { $errors = implode('

', $tmp); diff --git a/admin/admin_submit_ticket.php b/admin/admin_submit_ticket.php index 09592bb4..9eb40c3a 100644 --- a/admin/admin_submit_ticket.php +++ b/admin/admin_submit_ticket.php @@ -123,9 +123,9 @@ foreach ($hesk_settings['custom_fields'] as $k=>$v) { $tmpvar[$k] = hesk_POST($k); $_SESSION["as_$k"] = ''; if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $tmpvar[$k])) { - $date = strtotime($tmpvar[$k] . ' t00:00:00'); - $dmin = strlen($v['value']['dmin']) ? strtotime($v['value']['dmin'] . ' t00:00:00') : false; - $dmax = strlen($v['value']['dmax']) ? strtotime($v['value']['dmax'] . ' t00:00:00') : false; + $date = strtotime($tmpvar[$k] . ' t00:00:00 UTC'); + $dmin = strlen($v['value']['dmin']) ? strtotime($v['value']['dmin'] . ' t00:00:00 UTC') : false; + $dmax = strlen($v['value']['dmax']) ? strtotime($v['value']['dmax'] . ' t00:00:00 UTC') : false; $_SESSION["as_$k"] = $tmpvar[$k]; diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 71100f3e..c782c81f 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1604,7 +1604,7 @@ function mfh_print_message() {
' . $ticket['ip'] . ''; diff --git a/admin/banned_emails.php b/admin/banned_emails.php index 643b4da8..add9b597 100644 --- a/admin/banned_emails.php +++ b/admin/banned_emails.php @@ -239,7 +239,7 @@ function ban_email() hesk_token_check(); // Get the email - $email = strtolower(hesk_input(hesk_REQUEST('email'))); + $email = hesk_emailCleanup(strtolower(hesk_input(hesk_REQUEST('email')))); // Nothing entered? if (!strlen($email)) { diff --git a/admin/custom_fields.php b/admin/custom_fields.php index f23c7f35..a71b6a5a 100755 --- a/admin/custom_fields.php +++ b/admin/custom_fields.php @@ -732,7 +732,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); $num_before = 0; $num_after = 0; - foreach ($hesk_settings['custom_fields'] as $id => $cf) { + foreach ($hesk_settings['custom_fields'] as $tmp_id => $cf) { if ($cf['place']) { $num_after++; } else { @@ -741,8 +741,8 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); } $k = 1; - foreach ($hesk_settings['custom_fields'] as $id => $cf) { - $id = intval(str_replace('custom', '', $id)); + foreach ($hesk_settings['custom_fields'] as $tmp_id => $cf) { + $tmp_id = intval(str_replace('custom', '', $tmp_id)); if ($hide_up) { $hide_up = false; @@ -771,7 +771,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); $cf['category'] = count($cf['category']) ? $hesklang['cf_cat'] : $hesklang['cf_all']; ?> - + @@ -791,33 +791,33 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); } elseif ($k == 1 || $hide_up) { ?>   - + - +   - + - + - + - diff --git a/admin/edit_post.php b/admin/edit_post.php index 9052fb8b..289faf83 100644 --- a/admin/edit_post.php +++ b/admin/edit_post.php @@ -24,6 +24,8 @@ require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/mail_functions.inc.php'); require(HESK_PATH . 'inc/custom_fields.inc.php'); hesk_load_database_functions(); +require(HESK_PATH . 'inc/posting_functions.inc.php'); +require(HESK_PATH . 'inc/view_attachment_functions.inc.php'); hesk_session_start(); hesk_dbConnect(); @@ -76,16 +78,51 @@ if (hesk_isREQUEST('reply')) { $is_reply = 1; } +// Count number of existing attachments for this post +$number_of_attachments = $is_reply ? hesk_countAttachments($reply['attachments']) : hesk_countAttachments($ticket['attachments']); + if (isset($_POST['save'])) { /* A security check */ hesk_token_check('POST'); $hesk_error_buffer = array(); + // Add attachments? + if ($hesk_settings['attachments']['use'] && $number_of_attachments < $hesk_settings['attachments']['max_number']) { + require_once(HESK_PATH . 'inc/attachments.inc.php'); + + $attachments = array(); + + $use_legacy_attachments = hesk_POST('use-legacy-attachments', 0); + + if ($use_legacy_attachments) { + for ($i = $number_of_attachments + 1; $i <= $hesk_settings['attachments']['max_number']; $i++) { + $att = hesk_uploadFile($i); + if ($att !== false && !empty($att)) { + $attachments[$i] = $att; + } + } + } else { + // The user used the new drag-and-drop system. + $temp_attachment_ids = hesk_POST_array('attachment-ids'); + foreach ($temp_attachment_ids as $temp_attachment_id) { + // Simply get the temp info and move it to the attachments table + $temp_attachment = mfh_getTemporaryAttachment($temp_attachment_id); + $attachments[] = $temp_attachment; + mfh_deleteTemporaryAttachment($temp_attachment_id); + } + } + } + if ($is_reply) { $tmpvar['message'] = hesk_input(hesk_POST('message')) or $hesk_error_buffer[] = $hesklang['enter_message']; if (count($hesk_error_buffer)) { + // Remove any successfully uploaded attachments + if ($hesk_settings['attachments']['use'] && isset($attachments)) { + hesk_removeAttachments($attachments); + } + $myerror = '