$_POST["value_{$i}"] = 0; } if (POST("conf_{$i}") == "pass_length_min") { if (POST("value_{$i}") < 1) { $_POST["value_{$i}"] = 7; } $pass_length_min = POST("value_{$i}"); } // passwords array contains some variables to validate with OSS_PASSWORD constant if (in_array(POST("conf_{$i}"), $passwords)) { ossim_valid(POST("value_{$i}"), OSS_NULLABLE, OSS_PASSWORD, 'illegal:' . POST("conf_{$i}")); } else { ossim_valid(POST("value_{$i}"), OSS_ALPHA, OSS_NULLABLE, OSS_SCORE, OSS_DOT, OSS_PUNC, "\\{\\}\\|;\\(\\)\\%\\", 'illegal:' . POST("conf_{$i}")); } if (POST("value_{$i}") != '') { if (!(ossim_error() || valid_value(POST("conf_{$i}"), POST("value_{$i}"), $numeric_values, $s_error))) { if ($flag_status == 2) { $error_string .= ' '; } $error_string .= $s_error; $flag_status = 2; } } } if ($flag_status != 2) { $api_client = new Alienvault_client(); for ($i = 0; $i < POST('nconfs'); $i++) { if (isset($_POST["conf_{$i}"]) && isset($_POST["value_{$i}"])) { if ($pass_fields[POST("conf_{$i}")] == 1 && Util::is_fake_pass(POST("value_{$i}")) || POST("value_{$i}") == 'skip_this_config_value') { continue; } else {
function fields_sql($fields, $default_field = '', $opts = array()) { if (!is_array($fields)) { $fields = array(); } //valid $fields_sql2insert = ""; //prep string of fields & values $fields_sqlUpdate = ""; //prep sql of update statement $fields_sqlCond = ""; //prep string of sql condition of fields $_fields = ""; //prep string of fields that separate by comas $fields_sqlOR = ""; //sql of OR condition to get more records foreach ($fields as $field => $value) { if (is_numeric($field)) { $field = $default_field; } //get default field for all value $_fields .= $field . ','; //list fields //detect of operator $operator = '='; //default equal operator if (is_string($value)) { $value = str_replace('"', '\\"', $value); $value = '"' . mysql_real_escape_string(valid_value($value)) . '"'; //mysql_real_escape_string } if (is_array($value)) { //final entrust for array if (isset($value['operator'])) { $operator = $value['operator']; } if (isset($value['value'])) { $value = '"' . mysql_real_escape_string(valid_value($value['value'])) . '"'; } } $fields_sqlUpdate .= $field . ' ' . $operator . ' ' . $value . ','; //set sql of update, alway sensitive $fields_sql2insert .= $value . ','; //prep sql of insert,trim($value,'"') if (isset($opts['sensitive']) && $opts['sensitive'] == false) { $field = 'LCASE(' . $field . ')'; $value = strtolower($value); } $fields_sqlCond .= $field . ' ' . $operator . ' ' . $value . ' AND '; //set sql of fields condition $fields_sqlOR .= $field . ' ' . $operator . ' ' . $value . ' OR '; //sql of OR condition } return array('fields' => substr($_fields, 0, strlen($_fields) - 1), 'fields_sql2insert' => substr($fields_sql2insert, 0, strlen($fields_sql2insert) - 1), 'fields_sqlUpdate' => substr($fields_sqlUpdate, 0, strlen($fields_sqlUpdate) - 1), 'fields_sqlCond' => substr($fields_sqlCond, 0, strlen($fields_sqlCond) - 5), 'fields_sqlOR' => substr($fields_sqlOR, 0, strlen($fields_sqlOR) - 4)); }
?> " /> <br><br> <input type="button" onclick="lastupdate(this.form)" class="button" style="font-size:120%;font-weight:bold" value=" <?php echo gettext("Acknowledge Updates"); ?> " /> <br> <!-- end sumbit --> <?php } if (POST('update')) { require_once 'classes/Config.inc'; $config = new Config(); for ($i = 0; $i < POST('nconfs'); $i++) { if (valid_value(POST("conf_{$i}"), POST("value_{$i}"))) { if (!$ossim_conf->is_in_file(POST("conf_{$i}"))) { $config->update(POST("conf_{$i}"), POST("value_{$i}")); //echo POST("conf_$i")."=".POST("value_$i"); } } } header("Location: " . $_SERVER['SCRIPT_NAME'] . "?refresh=true"); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> <?php echo gettext("Updates");