//Checking form token if (!isset($_POST['ajax_validation_all']) || POST('ajax_validation_all') == FALSE) { if (Token::verify('tk_ag_form', POST('token')) == FALSE) { Token::show_error(); exit; } } $id = POST('id'); $name = trim(POST('ag_name')); $owner = POST('owner'); $descr = POST('descr'); $validation_errors = validate_form_fields('POST', $validate); if (empty($validation_errors)) { $db = new ossim_db(); $conn = $db->connect(); if (Asset_group::is_group_name_duplicated($conn, $id, $name)) { $agn_msg = sprintf(_('The group "%s" already exists. Please choose a different name for your group.'), Util::htmlentities($name)); $validation_errors['ag_name'] = $agn_msg; } $db->close(); } $data['status'] = 'OK'; $data['data'] = $validation_errors; if (POST('ajax_validation_all') == TRUE) { if (is_array($validation_errors) && !empty($validation_errors)) { $data['status'] = 'error'; echo json_encode($data); } else { echo json_encode($data); } exit;