Skip to content
Snippets Groups Projects

Resolve "Can't change Directives Snippes"

Merged Till Brehm requested to merge 5780-can-t-change-directives-snippes into develop
1 file
+ 3
2
Compare changes
  • Side-by-side
  • Inline
@@ -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');
}
Loading