Skip to content
Snippets Groups Projects
Commit 34f460bc authored by Till Brehm's avatar Till Brehm
Browse files

Update interface/lib/classes/validate_server_directive_snippets.inc.php

parent f2698ddc
No related branches found
No related tags found
1 merge request!1226Resolve "Can't change Directives Snippes"
Pipeline #5483 passed
......@@ -42,10 +42,11 @@ class validate_server_directive_snippets {
function validate_snippet($field_name, $field_value, $validator) {
global $app;
$type=(isset($app->remoting_lib->dataRecord['type']))?$app->remoting_lib->dataRecord['type']:$_POST['type'];
$id = (isset($app->remoting_lib->dataRecord['directive_snippets_id']))?$app->remoting_lib->dataRecord['directive_snippets_id']:$_POST['id'];
$type=(isset($app->remoting_lib->dataRecord['type']))?$app->remoting_lib->dataRecord['type']:$_POST['type'];
$types = array('apache','nginx','php','proxy');
if(!in_array($type,$types)) return $this->get_error('directive_snippets_invalid_type');
$check = $app->db->queryAllRecords('SELECT * FROM directive_snippets WHERE name = ? AND type = ?', $field_value, $type);
$check = $app->db->queryAllRecords('SELECT * FROM directive_snippets WHERE name = ? AND type = ? AND directive_snippets_id != ?', $field_value, $type, $id);
if(!empty($check)) return $this->get_error('directive_snippets_name_error_unique');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment