Skip to content

Commit 34f460b

Browse files
author
Till Brehm
committed
Update interface/lib/classes/validate_server_directive_snippets.inc.php
1 parent f2698dd commit 34f460b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

interface/lib/classes/validate_server_directive_snippets.inc.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ function get_error($errmsg) {
4242

4343
function validate_snippet($field_name, $field_value, $validator) {
4444
global $app;
45-
$type=(isset($app->remoting_lib->dataRecord['type']))?$app->remoting_lib->dataRecord['type']:$_POST['type'];
45+
$id = (isset($app->remoting_lib->dataRecord['directive_snippets_id']))?$app->remoting_lib->dataRecord['directive_snippets_id']:$_POST['id'];
46+
$type=(isset($app->remoting_lib->dataRecord['type']))?$app->remoting_lib->dataRecord['type']:$_POST['type'];
4647
$types = array('apache','nginx','php','proxy');
4748
if(!in_array($type,$types)) return $this->get_error('directive_snippets_invalid_type');
48-
$check = $app->db->queryAllRecords('SELECT * FROM directive_snippets WHERE name = ? AND type = ?', $field_value, $type);
49+
$check = $app->db->queryAllRecords('SELECT * FROM directive_snippets WHERE name = ? AND type = ? AND directive_snippets_id != ?', $field_value, $type, $id);
4950
if(!empty($check)) return $this->get_error('directive_snippets_name_error_unique');
5051
}
5152

0 commit comments

Comments
 (0)