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

Merge branch '5780-can-t-change-directives-snippes' into 'develop'

Resolve "Can't change Directives Snippes"

Closes #5780

See merge request ispconfig/ispconfig3!1226
parents f2698ddc 34f460bc
No related branches found
No related tags found
No related merge requests found
......@@ -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