diff --git a/admin/admin_main.php b/admin/admin_main.php index 111ed08a..c6bb29ce 100644 --- a/admin/admin_main.php +++ b/admin/admin_main.php @@ -1,7 +1,7 @@ Helpdesk settings */ $set['hesk_title'] = hesk_input( hesk_POST('s_hesk_title'), $hesklang['err_htitle']); $set['hesk_title'] = str_replace('\\"','"',$set['hesk_title']); -$set['hesk_url'] = hesk_input( hesk_POST('s_hesk_url'), $hesklang['err_hurl']); +$set['hesk_url'] = rtrim( hesk_input( hesk_POST('s_hesk_url'), $hesklang['err_hurl']), '/'); // ---> check admin folder $set['admin_dir'] = isset($_POST['s_admin_dir']) && ! is_array($_POST['s_admin_dir']) ? preg_replace('/[^a-zA-Z0-9_-]/', '', $_POST['s_admin_dir']) : 'admin'; @@ -487,6 +493,19 @@ for ($i=1;$i<=20;$i++) { $set['custom_fields'][$this_field]['type'] = 'text'; } + + // Try to detect if field type changed to anything except "select" + if ($set['custom_fields'][$this_field]['type'] != 'select') + { + // If type is "radio" or "checkbox" remove "please select", keep other options + $set['custom_fields'][$this_field]['value'] = str_replace('{HESK_SELECT}', '', $set['custom_fields'][$this_field]['value']); + + // Field type changed to "text" or "textarea", clear default value if it contains "#HESK#" separator + if ( in_array($set['custom_fields'][$this_field]['type'], array('text','textarea')) && ! in_array($hesk_settings['custom_fields'][$this_field]['type'], array('text','textarea')) && strpos($set['custom_fields'][$this_field]['value'], '#HESK#') !== false ) + { + $set['custom_fields'][$this_field]['value'] = ''; + } + } } else { diff --git a/admin/admin_submit_ticket.php b/admin/admin_submit_ticket.php index 33f675ff..71f24e8e 100644 --- a/admin/admin_submit_ticket.php +++ b/admin/admin_submit_ticket.php @@ -1,7 +1,7 @@