FILTER_SANITIZE_STRING,
      'flag'   => FILTER_NULL_ON_FAILURE
    );
    $args = array(
      'ste'         => array(
        'filter' => FILTER_VALIDATE_INT,
        'flag'   => FILTER_NULL_ON_FAILURE
      ),
      'system'      => array(
        'filter' => FILTER_VALIDATE_INT,
        'flag'   => FILTER_NULL_ON_FAILURE
      ),
      'site'        => array(
        'filter' => FILTER_VALIDATE_INT,
        'flag'   => FILTER_NULL_ON_FAILURE
      ),
      'start_date'  => $defaults,
      'end_date'    => $defaults,
      'assumptions' => $defaults,
      'constraints' => $defaults,
      'scope'       => $defaults,
      'ao'          => $defaults
    );
    $params = filter_input_array(INPUT_POST, $args);
    $sys = $db->get_System($params['system'])[0];
    $site = $db->get_Site($params['site'])[0];
    $ste = new ste($params['ste'], $sys, $site, $params['start_date'], $params['end_date'], null, null);
    $ste->set_Assumptions($params['assumptions']);
    $ste->set_Constraints($params['constraints']);
    $ste->set_Scope($params['scope']);
    $ste->set_AO($params['ao']);
    $db->save_STE($ste);
  }
  elseif ($action == 'save-system') {
    $defaults = array(
      'filter' => FILTER_SANITIZE_STRING,
      'flag'   => FILTER_NULL_ON_FAILURE
    );
    $args = array(
      'system'      => array(
        'filter' => FILTER_VALIDATE_INT,
        'flag'   => FILTER_NULL_ON_FAILURE
      ),
      'name'        => $defaults,
      'mac'         => $defaults,
      'class'       => $defaults,
      'description' => $defaults,
      'abbr'        => $defaults,
      'accred_type' => $defaults
    );
    $params = filter_input_array(INPUT_POST, $args);
    $system = new system($params['system'], $params['name'], $params['mac'], $params['class']);
    $system->set_Description($params['description']);
    $system->set_Abbreviation($params['abbr']);
    switch ($params['accred_type']) {
      case 'diacap':
        $system->set_Accreditation_Type(accrediation_types::DIACAP);
        break;
      case 'rmf':
        $system->set_Accreditation_Type(accrediation_types::RMF);
        break;
      case 'pci':
        $system->set_Accreditation_Type(accrediation_types::PCI);
        break;
      case 'nispom':
        $system->set_Accreditation_Type(accrediation_types::NISPOM);
        break;
      case 'hipaa':
        $system->set_Accreditation_Type(accrediation_types::HIPAA);
        break;
      case 'cobit':
        $system->set_Accreditation_Type(accrediation_types::COBIT);
        break;
      case 'sox':
        $system->set_Accreditation_Type(accrediation_types::SOX);
        break;
      default:
        $system->set_Accreditation_Type(accrediation_types::DIACAP);
    }
    $db->save_System($system);
    ?>
    
    
     FILTER_SANITIZE_STRING,
      'flag'   => FILTER_NULL_ON_FAILURE
    );
    $params = array(
      'site'      => array(
        'filter' => FILTER_VALIDATE_INT,
        'flag'   => FILTER_NULL_ON_FAILURE
      ),
      'name'      => $defaults,
      'address'   => $defaults,
      'city'      => $defaults,
      'state'     => $defaults,
      'zip'       => $defaults,
      'country'   => $defaults,
      'poc_name'  => $defaults,
      'poc_phone' => $defaults,
      'poc_email' => $defaults
    );
    $p = filter_input_array(INPUT_POST, $params);
    $site = new site($p['site'], $p['name'], $p['address'], $p['city'], $p['state'], $p['zip'], $p['country'], $p['poc_name'], $p['poc_email'], $p['poc_phone']);
    $db->save_Site($site);
    ?>
    
    
     FILTER_SANITIZE_STRING,
      'flag'   => FILTER_NULL_ON_FAILURE
    );
    $args = array(
      'company'            => $params,
      'comp_add'           => $params,
      'last_modified_by'   => $params,
      'creator'            => $params,
      'log_level'          => $params,
      'flatten_echecklist' => array(
        'filter' => FILTER_VALIDATE_BOOLEAN
      ),
      'wrap_text'          => array(
        'filter' => FILTER_VALIDATE_BOOLEAN
      ),
      'notifications'      => array(
        'filter' => FILTER_VALIDATE_BOOLEAN
      ),
      'port_limit'         => array(
        'filter'  => FILTER_VALIDATE_INT,
        'flag'    => FILTER_REQUIRE_ARRAY,
        'options' => array('max_range' => 10000)
      ),
      'max_result_import'  => array(
        'filter'  => FILTER_VALIDATE_INT,
        'flag'    => FILTER_REQUIRE_ARRAY,
        'options' => array('max_range' => 20)
      ),
      'output_format'      => array(
        'filter'  => FILTER_VALIDATE_REGEXP,
        'flag'    => FILTER_NULL_ON_FAILURE,
        'options' => array('regexp' => "/xlsx|xls|html|csv|pdf|ods/")
      )
    );
    $fields = filter_input_array(INPUT_POST, $args);
  }
}
if ($page) {
  if ($page == 'STEMgmt' || $page == 'EditSTE') {
    $all_systems = $db->get_System();
    $all_sites = $db->get_Site();
    $title_prefix = "ST&E Mgmt";
    $ste_mgmt = "style='color:#FFF;'";
  }
  elseif ($page == 'MSMgmt' || $page == 'EditMS') {
    $ms_mgmt = "style='color:#FFF;'";
    $title_prefix = "System Mgmt";
    $all_systems = $db->get_System();
  }
  elseif ($page == 'SiteMgmt' || $page == 'EditSite') {
    $site_mgmt = "style='color:#FFF;'";
    $title_prefix = "Site Mgmt";
    $all_sites = $db->get_Site();
  }
  elseif ($page == 'CatMgmt') {
    $cat_mgmt = "style='color:#FFF;'";
    $title_prefix = "Catalog Mgmt";
  }
  elseif ($page == 'Settings') {
    $settings = "style='color:#FFF;'";
    $title_prefix = "Settings";
  }
  elseif ($page == 'TgtSearch') {
    $tgt_search = "style='color:#fff;'";
    $title_prefix = "Target Search";
  }
  elseif ($page == 'RefSearch') {
    $ref_search = "style='color:#fff;'";
    $title_prefix = "Reference Search";
  }
  elseif ($page == 'ScanSearch') {
    $scan_search = "style='color:#fff;'";
    $title_prefix = "Scan Search";
  }
  elseif ($page == 'FindSearch') {
    $find_search = "style='color:#fff;'";
    $title_prefix = "Finding Search";
  }
  elseif ($page == 'Search') {
    $title_prefix = "Search";
    $search = "style='color:#FFF;'";
  }
}
include_once 'header.inc';
?>