$k = base64_decode(str_replace('custom_', '', $k));
             $item = explode('_####_', $k);
             if (is_uploaded_file($v['tmp_name']) && !$v['error']) {
                 $content = file_get_contents($v['tmp_name']);
             } else {
                 if ($v['name'] != '') {
                     $content = _('File not uploaded. Error: ' . $v['error']);
                 }
             }
             if (!empty($content)) {
                 $fields[$item[0]] = array('validate' => 0, 'name' => $item[0], 'content' => $content, 'type' => 'File');
             }
         }
     }
     if ($action == 'newincident') {
         $incident_id = Incident::insert_custom($conn, $title, $type, $submitter, $priority, $transferred_user, $transferred_entity, $fields);
     } elseif ($action == 'editincident') {
         Incident::update_custom($conn, $incident_id, $title, $type, $submitter, $priority, $transferred_user, $transferred_entity, $fields);
     }
 }
 $db->close();
 ?>
 <script type='text/javascript'>
     if (typeof(parent.GB_hide) == 'function')
     {
         parent.GB_hide()
     } 
     
     document.location.href='<?php 
 echo Menu::get_menu_url('../incidents/index.php', 'analysis', 'tickets', 'tickets');
 ?>