From e86c87d23b787156a62d0ba7dbacc174eeb903ff Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 21 Jun 2017 13:50:05 +0200 Subject: [PATCH] Added refresh by user --- pandora_console/general/header.php | 6 ++++-- pandora_console/include/config_process.php | 2 +- pandora_console/include/functions_config.php | 3 --- pandora_console/operation/users/user_edit.php | 12 ++++++------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 971ca50465..b5b3479dd9 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -191,7 +191,9 @@ config_check(); $_GET['refr'] = null; } - if ($config['autorefresh_white_list'] !== null && array_search($_GET['sec2'], $config['autorefresh_white_list']) !== false) { + $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); + $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); + if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { $autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh'))); if ($_GET['refr']) { @@ -354,7 +356,7 @@ config_check(); var new_chat = ; $(document).ready (function () { $("a.autorefresh_txt").toggle (); $("#combo_refr").toggle (); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4398f0c3e5..d9a6294d17 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -252,7 +252,7 @@ if (isset($_POST['vc_refr'])) { //======= Autorefresh code ============================================= -$select = db_process_sql("SELECT value FROM tconfig WHERE token='autorefresh_white_list'"); +$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); $autorefresh_list = json_decode($select[0]['value']); $config['autorefresh_white_list'] = array(); $config['autorefresh_white_list'] = $autorefresh_list; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index c6828ffd1b..08bd6f7aac 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -855,9 +855,6 @@ function config_process_config () { config_update_value ('status_images_set', 'default'); } - if(!isset ($config['autorefresh_white_list'])){ - config_update_value ('autorefresh_white_list', ''); - } // Load user session if (isset ($_SESSION['id_usuario'])) $config["id_user"] = $_SESSION["id_usuario"]; diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index b2f3c91874..4e76d32899 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -94,11 +94,11 @@ if (isset ($_GET["modified"]) && !$view_mode) { //save autorefresh list $autorefresh_list = get_parameter_post ("autorefresh_list"); if(($autorefresh_list[0] === '') || ($autorefresh_list[0] === '0')){ - db_process_sql("UPDATE tconfig SET value ='' WHERE token='autorefresh_white_list'"); - }else{ - db_process_sql("UPDATE tconfig SET value ='".json_encode($autorefresh_list)."' WHERE token='autorefresh_white_list'"); + $upd_info['autorefresh_white_list'] = ""; + } + else{ + $upd_info['autorefresh_white_list'] = json_encode($autorefresh_list); } - $is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $id); @@ -382,8 +382,8 @@ $autorefresh_list_out['operation/visual_console/render_view'] = "render_view"; $autorefresh_list_out['operation/events/events'] = "events"; if(!isset($autorefresh_list)){ - $select = db_process_sql("SELECT value FROM tconfig WHERE token='autorefresh_white_list'"); - $autorefresh_list = json_decode($select[0]['value']); + $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); + $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); if($autorefresh_list === null){ $autorefresh_list[0] = __('None'); }else{