FILTER_VALIDATE_INT, 'flag' => FILTER_NULL_ON_FAILURE ); $string = array( 'filter' => FILTER_SANITIZE_STRING, 'flag' => FILTER_NULL_ON_FAILURE ); $boolean = array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flag' => FILTER_NULL_ON_FAILURE ); $args = array( 'action' => $string, 'cat' => $int, 'selected_tgts' => $string, 'osSoftware' => $int, 'location' => $string, 'auto_status' => $int, 'man_status' => $int, 'data_status' => $int, 'fp_cat1_status' => $int, 'remove_existing' => $boolean, 'checklists' => array( 'filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY ), 'post_process' => $boolean ); $post = filter_input_array(INPUT_POST, $args); $cat = filter_input(INPUT_GET, 'cat', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); $ste = filter_input(INPUT_COOKIE, 'ste', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); $tgts = $db->get_Target_By_Category($cat); $task_statuses = $db->get_Task_Statuses(); $task_statuses[null] = 'Not Reviewed'; if ($post['action'] == 'update_bulk') { set_time_limit(300); $sel_tgts = json_decode(html_entity_decode($post['selected_tgts'])); foreach ($sel_tgts as $tgt_id) { $tgt = $db->get_Target_Details($ste, $tgt_id)[0]; if ($post['cat']) { $tgt->set_Cat_ID($post['cat']); } if ($post['osSoftware']) { $os = $db->get_Software($post['osSoftware']); if (is_array($os) && count($os) && isset($os[0]) && is_a($os[0], 'software')) { $tgt->set_OS_ID($os[0]->get_ID()); $tgt->set_OS_String($os[0]->get_Shortened_SW_String()); } } if ($post['location']) { $tgt->set_Location($post['location']); } if ($post['auto_status']) { $tgt->set_Auto_Status_ID($post['auto_status']); } if ($post['man_status']) { $tgt->set_Man_Status_ID($post['man_status']); } if ($post['data_status']) { $tgt->set_Data_Status_ID($post['data_status']); } if ($post['fp_cat1_status']) { $tgt->set_FP_Cat1_Status_ID($post['fp_cat1_status']); } if ($post['remove_existing']) { foreach ($tgt->checklists as $key => $chk) { unset($tgt->checklists[$key]); } $db->delete_Target_Checklists($tgt); } if ($post['checklists']) { $chks = array(); foreach ($post['checklists'] as $key => $chk) { $tgt->checklists[] = $db->get_Checklist($chk)[0]; } } $pp = ($post['post_process'] ? true : false); $db->save_Target($tgt, $pp); } header("Location: /ste"); } include_once 'header.inc'; ?>