diff --git a/interface/lib/classes/validate_server_directive_snippets.inc.php b/interface/lib/classes/validate_server_directive_snippets.inc.php
new file mode 100755
index 0000000000000000000000000000000000000000..751400766cfd78a0d8d67e7016dc81b04ad7d723
--- /dev/null
+++ b/interface/lib/classes/validate_server_directive_snippets.inc.php
@@ -0,0 +1,52 @@
+tform->wordbook[$errmsg])) {
+ return $app->tform->wordbook[$errmsg]."
\r\n";
+ } else {
+ return $errmsg."
\r\n";
+ }
+ }
+
+ function validate_snippet($field_name, $field_value, $validator) {
+ global $app;
+ $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');
+ }
+
+}
diff --git a/interface/web/admin/form/directive_snippets.tform.php b/interface/web/admin/form/directive_snippets.tform.php
index d451a5079594eb41fe5ba10bbdee36b90324e387..bd9466c310ca87737154c16b251a8de4ca492398 100644
--- a/interface/web/admin/form/directive_snippets.tform.php
+++ b/interface/web/admin/form/directive_snippets.tform.php
@@ -66,10 +66,9 @@ $form["tabs"]['directive_snippets'] = array (
'name' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
- 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
- 'errmsg'=> 'directive_snippets_name_empty'),
- 1 => array ( 'type' => 'UNIQUE',
- 'errmsg'=> 'directive_snippets_name_error_unique'),
+ 'validators' => array (
+ 0 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'directive_snippets_name_empty'),
+ 1 => array ( 'type' => 'CUSTOM', 'class' => 'validate_server_directive_snippets', 'function' => 'validate_snippet'),
),
'filters' => array(
0 => array( 'event' => 'SAVE',