Skip to content

Commit 5fe318f

Browse files
author
Till Brehm
committed
Update validate_server_directive_snippets.inc.php
1 parent 5ffe9d8 commit 5fe318f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

interface/lib/classes/validate_server_directive_snippets.inc.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ function get_error($errmsg) {
4242

4343
function validate_snippet($field_name, $field_value, $validator) {
4444
global $app;
45-
$check = $app->db->queryAllRecords('SELECT * FROM directive_snippets WHERE name = ? AND type = ?', $field_value, trim($_POST['type']));
45+
$type=(isset($app->remoting_lib->dataRecord['type']))?$app->remoting_lib->dataRecord['type']:$_POST['type'];
46+
$types = array('apache','nginx','php','proxy');
47+
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);
4649
if(!empty($check)) return $this->get_error('directive_snippets_name_error_unique');
4750
}
4851

0 commit comments

Comments
 (0)