Skip to content

Commit

Permalink
Feature #3965, Add a value check if the input field is textbox in set…
Browse files Browse the repository at this point in the history
…tings (#3966)

* feature 3965, Add a value check if the input field is textbox in settings

* feature 3965, revert

* feature 3965, Add a value check if the input field is textbox in settings.

* feature 3965, update Changelog file

Co-authored-by: yboliu <[email protected]>
  • Loading branch information
YongBoLiu and yboliu authored Nov 30, 2020
1 parent 4d049b0 commit c30c299
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Cacti CHANGELOG
-issue#3963: Plugin table creation function misses the table collation setting
-feature#3923: Added ability to Hide the Graph Drilldowns icons from the graph_view.php and graph.php pages
-feature#3943: Add hooks for plugins to show custom Graph Source and custom Template URL (List View)
-feature#3965: Add a value check if the input field is textbox in settings
-feature: Update c3.js to version 0.7.20
-feature: Update Chart.js to version 2.9.4
-feature: Update phpseclib to version 2.0.29
Expand Down
13 changes: 13 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@
array($field_name));
}
} elseif (isset_request_var($field_name)) {
if ($field_array['method'] == 'textbox' && isset($field_array['filter'])) {
if (isset($field_array['options'])) {
$value = filter_var(get_nfilter_request_var($field_name), $field_array['filter'], $field_array['options']);
} else {
$value = filter_var(get_nfilter_request_var($field_name), $field_array['filter']);
}
if ($value === false) {
$_SESSION['sess_error_fields'][$field_name] = $field_name;
$_SESSION['sess_field_values'][$field_name] = get_nfilter_request_var($field_name);
$errors[3] = 3;
continue;
}
}
if (is_array(get_nfilter_request_var($field_name))) {
$inserts[] = '(' . db_qstr($field_name) . ', ' . db_qstr(implode(',', get_nfilter_request_var($field_name))) . ')';
db_execute_prepared('REPLACE INTO settings
Expand Down

0 comments on commit c30c299

Please sign in to comment.