diff --git a/html/forms/update-config-item.inc.php b/html/forms/update-config-item.inc.php new file mode 100644 index 000000000..1671d2f27 --- /dev/null +++ b/html/forms/update-config-item.inc.php @@ -0,0 +1,42 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if(is_admin() === false) { + die('ERROR: You need to be admin'); +} + +$status = 'error'; + +if (!is_numeric($_POST['config_id'])) { + $message = 'ERROR: No alert selected'; + exit; +} else { + if($_POST['config_value'] === true) { + $state = TRUE; + } else { + $state = FALSE; + } + $state = $_POST['config_value']; + $update = dbUpdate(array('config_value' => $state), 'config', '`config_id`=?', array($_POST['config_id'])); + if(!empty($update) || $update == '0') + { + $message = 'Alert rule has been updated.'; + $status = 'ok'; + } else { + $message = 'ERROR: Alert rule has not been updated.'; + } +} + +$response = array('status'=>$status,'message'=>$message); +echo _json_encode($response); \ No newline at end of file diff --git a/html/images/pd_connect_button.png b/html/images/pd_connect_button.png new file mode 100644 index 000000000..a03220b83 Binary files /dev/null and b/html/images/pd_connect_button.png differ diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 9c37be97b..2a86aa055 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -786,4 +786,35 @@ function add_config_item($new_conf_name,$new_conf_value,$new_conf_type,$new_conf return($db_inserted); } +function get_config_by_group($group) { + $group = array($group); + foreach (dbFetchRows("SELECT * FROM `config` WHERE `config_group` = '?'", array($group)) as $config_item) { + $items[] = $config_item; + } + return $items; +} + +function get_config_by_name($name) { + $name = array($name); + foreach (dbFetchRows("SELECT * FROM `config` WHERE `config_name` = '?'", array($name)) as $config_item) { + $items[] = $config_item; + } + return $items; +} + +function set_config_name($name,$config_value) { + return dbUpdate(array('config_value' => $config_value), 'config', '`config_name`=?', array($name)); +} + +function get_url() { + // http://stackoverflow.com/questions/2820723/how-to-get-base-url-with-php + // http://stackoverflow.com/users/184600/ma%C4%8Dek + return sprintf( + "%s://%s%s", + isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', + $_SERVER['SERVER_NAME'], + $_SERVER['REQUEST_URI'] + ); +} + ?> diff --git a/html/pages/settings.inc.php b/html/pages/settings.inc.php index 85c69e96e..3dac71da6 100644 --- a/html/pages/settings.inc.php +++ b/html/pages/settings.inc.php @@ -23,9 +23,21 @@ * @subpackage Page */ +?> + +