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

Update validate_server_directive_snippets.inc.php

parent 5ffe9d88
No related branches found
No related tags found
1 merge request!1016allow the same name for every directive snippets type (Implemets #5631)
...@@ -42,7 +42,10 @@ class validate_server_directive_snippets { ...@@ -42,7 +42,10 @@ class validate_server_directive_snippets {
function validate_snippet($field_name, $field_value, $validator) { function validate_snippet($field_name, $field_value, $validator) {
global $app; global $app;
$check = $app->db->queryAllRecords('SELECT * FROM directive_snippets WHERE name = ? AND type = ?', $field_value, trim($_POST['type'])); $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);
if(!empty($check)) return $this->get_error('directive_snippets_name_error_unique'); 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