diff options
author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-01-16 14:28:28 +0000 |
---|---|---|
committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-01-16 14:28:28 +0000 |
commit | 819114c84816786fa5bd16c933e0ea8d6d09f9d9 (patch) | |
tree | 6f5188b3404ffafd72c5aaee61386c285f692771 /frontends/php | |
parent | 32e5c61ed67fadf2cf7670a1f5bfa55bf4831c9c (diff) | |
download | zabbix-819114c84816786fa5bd16c933e0ea8d6d09f9d9.tar.gz zabbix-819114c84816786fa5bd16c933e0ea8d6d09f9d9.tar.xz zabbix-819114c84816786fa5bd16c933e0ea8d6d09f9d9.zip |
- [ZBX-253] fixes problem in frontend with long int values (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5259 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
35 files changed, 149 insertions, 130 deletions
diff --git a/frontends/php/actionconf.php b/frontends/php/actionconf.php index dcc5263e..06f9b9ad 100644 --- a/frontends/php/actionconf.php +++ b/frontends/php/actionconf.php @@ -171,7 +171,7 @@ include_once "include/page_header.php"; if( validate_condition($new_condition['type'],$new_condition['value']) ) { $_REQUEST['conditions'] = get_request('conditions',array()); - if(!in_array($new_condition,$_REQUEST['conditions'])) + if(!str_in_array($new_condition,$_REQUEST['conditions'])) array_push($_REQUEST['conditions'],$new_condition); unset($_REQUEST['new_condition']); @@ -196,7 +196,7 @@ include_once "include/page_header.php"; if(!isset($new_operation['id'])) { - if(!in_array($new_operation,$_REQUEST['operations'])) + if(!str_in_array($new_operation,$_REQUEST['operations'])) array_push($_REQUEST['operations'],$new_operation); } else diff --git a/frontends/php/chart3.php b/frontends/php/chart3.php index daefa86d..5152fabc 100644 --- a/frontends/php/chart3.php +++ b/frontends/php/chart3.php @@ -63,7 +63,7 @@ include_once "include/page_header.php"; { fatal_error(S_NO_ITEM_DEFINED); } - if(in_array($host['hostid'], $denyed_hosts)) + if(uint_in_array($host['hostid'], $denyed_hosts)) { access_deny(); } diff --git a/frontends/php/chart7.php b/frontends/php/chart7.php index 50433b1a..78ff629d 100644 --- a/frontends/php/chart7.php +++ b/frontends/php/chart7.php @@ -61,7 +61,7 @@ include_once "include/page_header.php"; { fatal_error(S_NO_ITEM_DEFINED); } - if(in_array($host['hostid'], $denyed_hosts)) + if(uint_in_array($host['hostid'], $denyed_hosts)) { access_deny(); } diff --git a/frontends/php/config.php b/frontends/php/config.php index 64678471..d4705340 100644 --- a/frontends/php/config.php +++ b/frontends/php/config.php @@ -158,7 +158,7 @@ include_once "include/page_header.php"; add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ZABBIX_CONFIG,implode('; ',$msg)); } } - elseif(isset($_REQUEST["save"])&&in_array($_REQUEST["config"],array(0,5,7))) + elseif(isset($_REQUEST["save"])&&uint_in_array($_REQUEST["config"],array(0,5,7))) { if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_MODE_LT,PERM_RES_IDS_ARRAY,get_current_nodeid()))) diff --git a/frontends/php/discoveryconf.php b/frontends/php/discoveryconf.php index cbc295ba..56f6d22d 100644 --- a/frontends/php/discoveryconf.php +++ b/frontends/php/discoveryconf.php @@ -84,7 +84,7 @@ include_once "include/page_header.php"; 'key'=> $_REQUEST['new_check_key'], 'snmp_community'=> $_REQUEST['new_check_snmp_community'] ); - if( !in_array($new_dcheck, $_REQUEST['dchecks'])) + if( !str_in_array($new_dcheck, $_REQUEST['dchecks'])) $_REQUEST['dchecks'][] = $new_dcheck; } else if(inarr_isset(array('delete_ckecks', 'selected_checks'))) diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php index c1b8795c..270d4db8 100644 --- a/frontends/php/graphs.php +++ b/frontends/php/graphs.php @@ -111,7 +111,7 @@ include_once "include/page_header.php"; foreach($items as $gitem) { $host = DBfetch(DBselect('SELECT h.* FROM hosts h,items i WHERE h.hostid=i.hostid AND i.itemid='.$gitem['itemid'])); - if(in_array($host['hostid'], explode(',',$denyed_hosts))) + if(uint_in_array($host['hostid'], explode(',',$denyed_hosts))) { access_deny(); } diff --git a/frontends/php/history.php b/frontends/php/history.php index 51be475a..be770792 100644 --- a/frontends/php/history.php +++ b/frontends/php/history.php @@ -209,7 +209,7 @@ include_once "include/page_header.php"; $cmbAction = new CComboBox("action",$_REQUEST["action"],"submit()"); - if(in_array($item_type,array(ITEM_VALUE_TYPE_FLOAT,ITEM_VALUE_TYPE_UINT64))) + if(str_in_array($item_type,array(ITEM_VALUE_TYPE_FLOAT,ITEM_VALUE_TYPE_UINT64))) { $cmbAction->AddItem("showgraph",S_GRAPH_OF_SPECIFIED_PERIOD); } @@ -278,7 +278,7 @@ include_once "include/page_header.php"; new CTextBox("filter",$filter,25), $cmbFTask,SPACE)); - if(in_array($filter_task,array(FILTER_TAST_MARK,FILTER_TAST_INVERT_MARK))) + if(str_in_array($filter_task,array(FILTER_TAST_MARK,FILTER_TAST_INVERT_MARK))) { $cmbColor = new CComboBox("mark_color",$mark_color); $cmbColor->AddItem(MARK_COLOR_RED,S_AS_RED); @@ -490,7 +490,7 @@ COpt::profiling_start("history"); $value = $row["value"]; $new_row = array(date("Y.M.d H:i:s",$row["clock"])); - if(in_array($item_type,array(ITEM_VALUE_TYPE_FLOAT,ITEM_VALUE_TYPE_UINT64))) + if(str_in_array($item_type,array(ITEM_VALUE_TYPE_FLOAT,ITEM_VALUE_TYPE_UINT64))) { array_push($new_row,$value); } @@ -521,7 +521,7 @@ COpt::profiling_stop("history"); if(!isset($_REQUEST["plaintext"])) { - if(in_array($_REQUEST["action"],array("showvalues","showgraph"))){ + if(str_in_array($_REQUEST["action"],array("showvalues","showgraph"))){ $stime = get_min_itemclock_by_itemid($_REQUEST["itemid"]); $stime = (is_null($stime))?0:$stime; diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php index ebb1d2ed..e1dca557 100644 --- a/frontends/php/hosts.php +++ b/frontends/php/hosts.php @@ -32,11 +32,11 @@ include_once "include/page_header.php"; $_REQUEST["config"] = get_request("config",get_profile("web.hosts.config",0)); $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,null,PERM_RES_IDS_ARRAY,get_current_nodeid()); - if(isset($_REQUEST["hostid"]) && $_REQUEST["hostid"] > 0 && !in_array($_REQUEST["hostid"], $available_hosts)) + if(isset($_REQUEST["hostid"]) && $_REQUEST["hostid"] > 0 && !uint_in_array($_REQUEST["hostid"], $available_hosts)) { access_deny(); } - if(isset($_REQUEST["apphostid"]) && $_REQUEST["apphostid"] > 0 && !in_array($_REQUEST["apphostid"], $available_hosts)) + if(isset($_REQUEST["apphostid"]) && $_REQUEST["apphostid"] > 0 && !uint_in_array($_REQUEST["apphostid"], $available_hosts)) { access_deny(); } @@ -45,7 +45,7 @@ include_once "include/page_header.php"; $available_hosts = implode(',', $available_hosts); if(isset($_REQUEST["groupid"]) && $_REQUEST["groupid"] > 0){ - if(!in_array($_REQUEST["groupid"], get_accessible_groups_by_user($USER_DETAILS,PERM_READ_WRITE,null, + if(!uint_in_array($_REQUEST["groupid"], get_accessible_groups_by_user($USER_DETAILS,PERM_READ_WRITE,null, PERM_RES_IDS_ARRAY,get_current_nodeid()))) { access_deny(); @@ -265,7 +265,7 @@ include_once "include/page_header.php"; { $host=get_host_by_hostid($db_host["hostid"]); - if(!in_array($db_host["hostid"],$hosts)) continue; + if(!uint_in_array($db_host["hostid"],$hosts)) continue; if(!delete_host($db_host["hostid"], $unlink_mode)) continue; $result = 1; @@ -281,7 +281,7 @@ include_once "include/page_header.php"; { global $USER_DETAILS; - if(!in_array($_REQUEST['add_to_group'], get_accessible_groups_by_user($USER_DETAILS,PERM_READ_WRITE,null, + if(!uint_in_array($_REQUEST['add_to_group'], get_accessible_groups_by_user($USER_DETAILS,PERM_READ_WRITE,null, PERM_RES_IDS_ARRAY,get_current_nodeid()))) { access_deny(); @@ -296,7 +296,7 @@ include_once "include/page_header.php"; { global $USER_DETAILS; - if(!in_array($_REQUEST['delete_from_group'], get_accessible_groups_by_user($USER_DETAILS,PERM_READ_WRITE,null, + if(!uint_in_array($_REQUEST['delete_from_group'], get_accessible_groups_by_user($USER_DETAILS,PERM_READ_WRITE,null, PERM_RES_IDS_ARRAY,get_current_nodeid()))) { access_deny(); @@ -316,7 +316,7 @@ include_once "include/page_header.php"; $db_hosts=DBselect('select hostid from hosts where '.DBin_node('hostid')); while($db_host=DBfetch($db_hosts)) { - if(!in_array($db_host["hostid"],$hosts)) continue; + if(!uint_in_array($db_host["hostid"],$hosts)) continue; $host=get_host_by_hostid($db_host["hostid"]); $res=update_host_status($db_host["hostid"],$status); @@ -402,7 +402,7 @@ include_once "include/page_header.php"; $db_groups=DBselect('select groupid, name from groups where '.DBin_node('groupid')); while($db_group=DBfetch($db_groups)) { - if(!in_array($db_group["groupid"],$groups)) continue; + if(!uint_in_array($db_group["groupid"],$groups)) continue; if(!($group = get_hostgroup_by_groupid($db_group["groupid"]))) continue; @@ -428,7 +428,7 @@ include_once "include/page_header.php"; ' and '.DBin_node('h.hostid')); while($db_host=DBfetch($db_hosts)) { - if(!in_array($db_host["groupid"],$groups)) continue; + if(!uint_in_array($db_host["groupid"],$groups)) continue; $host=get_host_by_hostid($db_host["hostid"]); if(!update_host_status($db_host["hostid"],$status)) continue; @@ -492,7 +492,7 @@ include_once "include/page_header.php"; while($db_app = DBfetch($db_applications)) { - if(!in_array($db_app["applicationid"],$applications)) continue; + if(!uint_in_array($db_app["applicationid"],$applications)) continue; if(!delete_application($db_app["applicationid"])) continue; $result = 1; diff --git a/frontends/php/httpconf.php b/frontends/php/httpconf.php index 23a8594f..5b6111d7 100644 --- a/frontends/php/httpconf.php +++ b/frontends/php/httpconf.php @@ -82,7 +82,7 @@ include_once "include/page_header.php"; $accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,null,null,get_current_nodeid()); - if(isset($_REQUEST['hostid']) && !in_array($_REQUEST['hostid'], explode(',',$accessible_hosts))) + if(isset($_REQUEST['hostid']) && !uint_in_array($_REQUEST['hostid'], explode(',',$accessible_hosts))) { unset($_REQUEST['hostid']); } @@ -101,7 +101,7 @@ include_once "include/page_header.php"; $_REQUEST["applications"] = array(); $show_all_apps = 1; } - elseif(!in_array($_REQUEST["applicationid"],$_REQUEST["applications"])) + elseif(!uint_in_array($_REQUEST["applicationid"],$_REQUEST["applications"])) { array_push($_REQUEST["applications"],$_REQUEST["applicationid"]); } @@ -458,7 +458,7 @@ include_once "include/page_header.php"; while($httptest_data = DBfetch($db_httptests)) { ++$httptest_cnt; - if(!in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue; + if(!uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue; $name = array(); @@ -500,7 +500,7 @@ include_once "include/page_header.php"; } if($httptest_cnt > 0) { - if(in_array($db_app["applicationid"],$_REQUEST["applications"]) || isset($show_all_apps)) + if(uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) || isset($show_all_apps)) $link = new CLink(new CImg("images/general/opened.gif"), "?close=1&applicationid=".$db_app["applicationid"]. url_param("groupid").url_param("hostid").url_param("applications"). diff --git a/frontends/php/httpdetails.php b/frontends/php/httpdetails.php index 753226a6..58504e40 100644 --- a/frontends/php/httpdetails.php +++ b/frontends/php/httpdetails.php @@ -150,7 +150,7 @@ include_once "include/page_header.php"; $httpstep_data['item_data'][$item_data['httpitem_type']] = $item_data; - if (!in_array($item_data['httpitem_type'], array(HTTPSTEP_ITEM_TYPE_IN, HTTPSTEP_ITEM_TYPE_TIME))) continue; + if (!str_in_array($item_data['httpitem_type'], array(HTTPSTEP_ITEM_TYPE_IN, HTTPSTEP_ITEM_TYPE_TIME))) continue; if(isset($total_data[$item_data['httpitem_type']])) { diff --git a/frontends/php/httpmon.php b/frontends/php/httpmon.php index 2671a2eb..e2e1fee4 100644 --- a/frontends/php/httpmon.php +++ b/frontends/php/httpmon.php @@ -60,7 +60,7 @@ include_once "include/page_header.php"; $_REQUEST["applications"] = array(); $show_all_apps = 1; } - elseif(!in_array($_REQUEST["applicationid"],$_REQUEST["applications"])) + elseif(!uint_in_array($_REQUEST["applicationid"],$_REQUEST["applications"])) { array_push($_REQUEST["applications"],$_REQUEST["applicationid"]); } @@ -198,7 +198,7 @@ include_once "include/page_header.php"; while($httptest_data = DBfetch($db_httptests)) { ++$httptest_cnt; - if(!in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue; + if(!uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue; $name = array(); @@ -257,7 +257,7 @@ include_once "include/page_header.php"; } if($httptest_cnt > 0) { - if(in_array($db_app["applicationid"],$_REQUEST["applications"]) || isset($show_all_apps)) + if(uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) || isset($show_all_apps)) $link = new CLink(new CImg("images/general/opened.gif"), "?close=1&applicationid=".$db_app["applicationid"]. url_param("groupid").url_param("hostid").url_param("applications"). diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php index 70d3b5d4..4875ba9a 100644 --- a/frontends/php/include/actions.inc.php +++ b/frontends/php/include/actions.inc.php @@ -44,13 +44,13 @@ include_once 'include/discovery.inc.php'; switch($ac_data['conditiontype']) { case CONDITION_TYPE_HOST_GROUP: - if(in_array($ac_data['value'],explode(',',$denyed_groups))) + if(uint_in_array($ac_data['value'],explode(',',$denyed_groups))) { $result = false; } break; case CONDITION_TYPE_HOST: - if(in_array($ac_data['value'],explode(',',$denyed_hosts))) + if(uint_in_array($ac_data['value'],explode(',',$denyed_hosts))) { $result = false; } @@ -86,14 +86,14 @@ include_once 'include/discovery.inc.php'; switch($ac_data['type']) { case CONDITION_TYPE_HOST_GROUP: - if(in_array($ac_data['value'],explode(',',$denyed_groups))) + if(uint_in_array($ac_data['value'],explode(',',$denyed_groups))) { error(S_INCORRECT_GROUP); $result = false; } break; case CONDITION_TYPE_HOST: - if(in_array($ac_data['value'],explode(',',$denyed_hosts))) + if(uint_in_array($ac_data['value'],explode(',',$denyed_hosts))) { error(S_INCORRECT_HOST); $result = false; @@ -612,7 +612,7 @@ include_once 'include/discovery.inc.php'; switch($conditiontype) { case CONDITION_TYPE_HOST_GROUP: - if(!in_array($value, + if(!uint_in_array($value, get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY,null, PERM_RES_IDS_ARRAY))) { @@ -629,7 +629,7 @@ include_once 'include/discovery.inc.php'; } break; case CONDITION_TYPE_HOST: - if(!in_array($value, + if(!uint_in_array($value, get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,null, PERM_RES_IDS_ARRAY))) { @@ -721,7 +721,7 @@ include_once 'include/discovery.inc.php'; break; case OPERATION_TYPE_GROUP_ADD: case OPERATION_TYPE_GROUP_REMOVE: - if(!in_array($operation['objectid'], + if(!uint_in_array($operation['objectid'], get_accessible_groups_by_user($USER_DETAILS,PERM_READ_WRITE,null, PERM_RES_IDS_ARRAY))) { @@ -731,7 +731,7 @@ include_once 'include/discovery.inc.php'; break; case OPERATION_TYPE_TEMPLATE_ADD: case OPERATION_TYPE_TEMPLATE_REMOVE: - if(!in_array($operation['objectid'], + if(!uint_in_array($operation['objectid'], get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,null, PERM_RES_IDS_ARRAY))) { diff --git a/frontends/php/include/classes/ccombobox.inc.php b/frontends/php/include/classes/ccombobox.inc.php index 08f426a3..e0a7775c 100644 --- a/frontends/php/include/classes/ccombobox.inc.php +++ b/frontends/php/include/classes/ccombobox.inc.php @@ -87,7 +87,7 @@ // if($enabled=='no') return; /* disable item method 1 */ if(is_null($selected)){ $selected = 'no'; - if((strcmp($value,$this->value) == 0) || (is_array($this->value) && in_array($value, $this->value))) + if((strcmp($value,$this->value) == 0) || (is_array($this->value) && str_in_array($value, $this->value))) $selected = 'yes'; } @@ -183,7 +183,7 @@ { if(is_null($selected)) { - if((strcmp($value,$this->value) == 0) || (is_array($this->value) && in_array($value, $this->value))) + if((strcmp($value,$this->value) == 0) || (is_array($this->value) && str_in_array($value, $this->value))) $this->value_exist = 1; } diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 3071b048..fdf6e4ac 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -296,6 +296,27 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! include_once "include/page_footer.php"; } + function uint_in_array($needle,$haystack){ + foreach($haystack as $id => $value) + if(bccomp($needle,$value) == 0) return true; + return false; + } + + function str_in_array($needle,$haystack,$strict=false){ + if(is_array($needle)){ + return in_array($needle,$haystack,$strict); + } + else if($strict){ + foreach($haystack as $id => $value) + if($needle === $value) return true; + } + else{ + foreach($haystack as $id => $value) + if(strcmp($needle,$value) == 0) return true; + } + return false; + } + function zbx_stripslashes($value){ if(is_array($value)){ foreach($value as $id => $data) @@ -346,7 +367,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! $key = htmlspecialchars($key); uasort($array, create_function('$a,$b', 'return $a[\''.$key.'\'] - $b[\''.$key.'\'];')); - return $array; + return $array; } function fatal_error($msg){ @@ -1006,7 +1027,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! } } else if(is_object($obj)){ - if(in_array(strtolower(get_class($obj)),array('cform','ccheckbox','cselect','cbutton','cbuttonqmessage','cbuttondelete','cbuttoncancel'))){ + if(str_in_array(strtolower(get_class($obj)),array('cform','ccheckbox','cselect','cbutton','cbuttonqmessage','cbuttondelete','cbuttoncancel'))){ $obj=SPACE; } if(isset($obj->items) && !empty($obj->items)){ @@ -1748,7 +1769,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! update_profile('web.'.$page["file"].'.sort', $_REQUEST['sort']); } - if(!in_array($_REQUEST['sortorder'],array(ZBX_SORT_DOWN,ZBX_SORT_UP))) + if(!str_in_array($_REQUEST['sortorder'],array(ZBX_SORT_DOWN,ZBX_SORT_UP))) $_REQUEST['sortorder'] = ZBX_SORT_UP; update_profile('web.'.$page["file"].'.sortorder', $_REQUEST['sortorder']); @@ -1808,7 +1829,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! $tabfield = get_request('sort',get_profile('web.'.$page["file"].'.sort',null)); if(is_null($tabfield)) return ' ORDER BY '.$def.$allways; - if(!in_array($tabfield,$sortable)) return ' ORDER BY '.$def.$allways; + if(!str_in_array($tabfield,$sortable)) return ' ORDER BY '.$def.$allways; $sortorder = get_request('sortorder',get_profile('web.'.$page["file"].'.sortorder',ZBX_SORT_UP)); diff --git a/frontends/php/include/copt.lib.php b/frontends/php/include/copt.lib.php index 0cb65aad..a9e67217 100644 --- a/frontends/php/include/copt.lib.php +++ b/frontends/php/include/copt.lib.php @@ -268,13 +268,13 @@ if(defined('USE_PROFILING')){ if($sub_pages['url'] == $file){ array_push($list, $menu_path); } - if(!in_array($sub_pages['url'], $files_list)) + if(!str_in_array($sub_pages['url'], $files_list)) $result['error'][$sub_pages['url']] = array($menu_path); if(isset($sub_pages['sub_pages'])) foreach($sub_pages['sub_pages'] as $page){ $menu_path = $sub['label'].'->'.$sub_pages['label'].'->sub_pages'; - if(!in_array($page, $files_list)) + if(!str_in_array($page, $files_list)) $result['error'][$page] = array($menu_path); if($page != $file) continue; diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index 86e76167..201f951b 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -550,7 +550,7 @@ else { fatal_error('Incorrect type of "nodes" for "in_node". Passed ['.gettype($nodes).']'); } - return in_array(id2nodeid($id_var), $nodes); + return uint_in_array(id2nodeid($id_var), $nodes); } function get_dbid($table,$field) diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index 6306ad2e..a6794f1a 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -2213,7 +2213,7 @@ { array_push($target_list,array( new CCheckBox('copy_targetid[]', - in_array($target['target_id'], $copy_targetid), + uint_in_array($target['target_id'], $copy_targetid), null, $target['target_id']), SPACE, @@ -2308,7 +2308,7 @@ " WHERE t.triggerid=d.triggerid_up AND d.triggerid_down=".$_REQUEST["triggerid"]); while($trig=DBfetch($trigs)) { - if(in_array($trig["triggerid"],$dependences)) continue; + if(uint_in_array($trig["triggerid"],$dependences)) continue; array_push($dependences,$trig["triggerid"]); } } @@ -2906,7 +2906,7 @@ include_once 'include/discovery.inc.php'; 'operator' => $condition_data['operator'], 'value' => $condition_data['value']); - if(in_array($condition_data, $conditions)) continue; + if(str_in_array($condition_data, $conditions)) continue; array_push($conditions, $condition_data); } unset($condition_data, $db_conditions); @@ -2924,7 +2924,7 @@ include_once 'include/discovery.inc.php'; 'shortdata' => $operation_data['shortdata'], 'longdata' => $operation_data['longdata']); - if(in_array($operation_data, $operations)) continue; + if(str_in_array($operation_data, $operations)) continue; array_push($operations, $operation_data); } unset($db_operations, $operation_data); @@ -2948,7 +2948,7 @@ include_once 'include/discovery.inc.php'; if( !isset($new_condition['operator'])) $new_condition['operator'] = CONDITION_OPERATOR_LIKE; if( !isset($new_condition['value']) ) $new_condition['value'] = ''; - if( !in_array($new_condition['type'], $allowed_conditions) ) + if( !str_in_array($new_condition['type'], $allowed_conditions) ) $new_condition['type'] = $allowed_conditions[0]; /* init new_operation variable */ @@ -2982,7 +2982,7 @@ include_once 'include/discovery.inc.php'; if( !isset($val['operator']) ) $val['operator'] = 0; if( !isset($val['value']) ) $val['value'] = 0; - if( !in_array($val["type"], $allowed_conditions) ) continue; + if( !str_in_array($val["type"], $allowed_conditions) ) continue; $label = chr(ord('A') + $i); $cond_el->AddRow(array('('.$label.')',array( @@ -3173,7 +3173,7 @@ include_once 'include/discovery.inc.php'; $oper_el = new CTable(S_NO_OPERATIONS_DEFINED); foreach($operations as $id => $val) { - if( !in_array($val['operationtype'], $allowed_operations) ) continue; + if( !str_in_array($val['operationtype'], $allowed_operations) ) continue; $oper_details = new CSpan(get_operation_desc(SHORT_DESCRITION, $val)); $oper_details->SetHint(nl2br(get_operation_desc(LONG_DESCRITION, $val))); @@ -3806,7 +3806,7 @@ include_once 'include/discovery.inc.php'; $form->AddRow(S_SHOW_LINES, new CNumericBox('elements',$elements,2)); $form->AddVar('resourceid',0); } - elseif(in_array($resourcetype,array(SCREEN_RESOURCE_TRIGGERS_OVERVIEW,SCREEN_RESOURCE_DATA_OVERVIEW))){ + elseif(uint_in_array($resourcetype,array(SCREEN_RESOURCE_TRIGGERS_OVERVIEW,SCREEN_RESOURCE_DATA_OVERVIEW))){ // Overiews $caption = ''; $id=0; @@ -3909,14 +3909,14 @@ include_once 'include/discovery.inc.php'; $form->AddVar("resourceid",0); } - if(in_array($resourcetype,array(SCREEN_RESOURCE_HOSTS_INFO,SCREEN_RESOURCE_TRIGGERS_INFO))) + if(uint_in_array($resourcetype,array(SCREEN_RESOURCE_HOSTS_INFO,SCREEN_RESOURCE_TRIGGERS_INFO))) { $cmbStyle = new CComboBox("style", $style); $cmbStyle->AddItem(STYLE_HORISONTAL, S_HORISONTAL); $cmbStyle->AddItem(STYLE_VERTICAL, S_VERTICAL); $form->AddRow(S_STYLE, $cmbStyle); } - else if(in_array($resourcetype,array(SCREEN_RESOURCE_TRIGGERS_OVERVIEW,SCREEN_RESOURCE_DATA_OVERVIEW))) + else if(uint_in_array($resourcetype,array(SCREEN_RESOURCE_TRIGGERS_OVERVIEW,SCREEN_RESOURCE_DATA_OVERVIEW))) { $cmbStyle = new CComboBox('style', $style); $cmbStyle->AddItem(STYLE_LEFT, S_LEFT); @@ -3935,7 +3935,7 @@ include_once 'include/discovery.inc.php'; $form->AddVar("style", 0); } - if(in_array($resourcetype,array(SCREEN_RESOURCE_URL))) + if(uint_in_array($resourcetype,array(SCREEN_RESOURCE_URL))) { $form->AddRow(S_URL, new CTextBox("url",$url,60)); } @@ -3944,7 +3944,7 @@ include_once 'include/discovery.inc.php'; $form->AddVar("url", ""); } - if(in_array($resourcetype,array(SCREEN_RESOURCE_GRAPH,SCREEN_RESOURCE_SIMPLE_GRAPH,SCREEN_RESOURCE_CLOCK,SCREEN_RESOURCE_URL))) + if(uint_in_array($resourcetype,array(SCREEN_RESOURCE_GRAPH,SCREEN_RESOURCE_SIMPLE_GRAPH,SCREEN_RESOURCE_CLOCK,SCREEN_RESOURCE_URL))) { $form->AddRow(S_WIDTH, new CNumericBox("width",$width,5)); $form->AddRow(S_HEIGHT, new CNumericBox("height",$height,5)); @@ -3955,7 +3955,7 @@ include_once 'include/discovery.inc.php'; $form->AddVar("height", 0); } - if(in_array($resourcetype,array(SCREEN_RESOURCE_GRAPH,SCREEN_RESOURCE_SIMPLE_GRAPH,SCREEN_RESOURCE_MAP, + if(uint_in_array($resourcetype,array(SCREEN_RESOURCE_GRAPH,SCREEN_RESOURCE_SIMPLE_GRAPH,SCREEN_RESOURCE_MAP, SCREEN_RESOURCE_CLOCK,SCREEN_RESOURCE_URL))) { $cmbHalign = new CComboBox("halign",$halign); @@ -3979,7 +3979,7 @@ include_once 'include/discovery.inc.php'; $form->AddRow(S_ROW_SPAN, new CNumericBox("rowspan",$rowspan,2)); // dynamic AddOn - if(in_array($resourcetype,array(SCREEN_RESOURCE_GRAPH,SCREEN_RESOURCE_SIMPLE_GRAPH,SCREEN_RESOURCE_PLAIN_TEXT))){ + if(uint_in_array($resourcetype,array(SCREEN_RESOURCE_GRAPH,SCREEN_RESOURCE_SIMPLE_GRAPH,SCREEN_RESOURCE_PLAIN_TEXT))){ $form->AddRow(S_DYNAMIC_ITEM, new CCheckBox("dynamic",$dynamic,null,1)); } @@ -4031,7 +4031,7 @@ include_once 'include/discovery.inc.php'; array( new CCheckBox( "severity[]", - in_array($i,$severity)?'yes':'no', + str_in_array($i,$severity)?'yes':'no', null, /* action */ $i), /* value */ get_severity_description($i) @@ -4199,7 +4199,7 @@ include_once 'include/discovery.inc.php'; get_accessible_groups_by_user($USER_DETAILS,PERM_READ_LIST,null,null,get_current_nodeid()). ") "); while($db_group=DBfetch($db_groups)){ - if(in_array($db_group["groupid"],$groups)) continue; + if(uint_in_array($db_group["groupid"],$groups)) continue; array_push($groups, $db_group["groupid"]); } // read profile @@ -4253,7 +4253,7 @@ include_once 'include/discovery.inc.php'; array_push($frm_row, array( new CCheckBox("groups[]", - in_array($db_group["groupid"],$groups) ? 'yes' : 'no', + uint_in_array($db_group["groupid"],$groups) ? 'yes' : 'no', null, $db_group["groupid"] ), @@ -4424,7 +4424,7 @@ include_once 'include/discovery.inc.php'; " order by host"); while($db_host=DBfetch($db_hosts)) { - if(in_array($db_host["hostid"],$hosts)) continue; + if(uint_in_array($db_host["hostid"],$hosts)) continue; array_push($hosts, $db_host["hostid"]); } } diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php index 98255cfb..c348b59c 100644 --- a/frontends/php/include/graphs.inc.php +++ b/frontends/php/include/graphs.inc.php @@ -654,7 +654,7 @@ $tmp_host = DBfetch(get_hosts_by_graphid($db_graph['templateid'])); - if( !in_array($tmp_host['hostid'], $templateid)) + if( !uint_in_array($tmp_host['hostid'], $templateid)) continue; } @@ -844,7 +844,7 @@ $period = get_request('period',ZBX_PERIOD_DEFAULT); - if(in_array($period,array(3600,2*3600,4*3600,8*3600,12*3600,24*3600,7*24*3600,31*24*3600,365*24*3600))) + if(uint_in_array($period,array(3600,2*3600,4*3600,8*3600,12*3600,24*3600,7*24*3600,31*24*3600,365*24*3600))) $custom_per = ZBX_MIN_PERIOD; else $custom_per = $period; diff --git a/frontends/php/include/hosts.inc.php b/frontends/php/include/hosts.inc.php index fd6c30c9..0c8b47d8 100644 --- a/frontends/php/include/hosts.inc.php +++ b/frontends/php/include/hosts.inc.php @@ -603,7 +603,7 @@ require_once "include/items.inc.php"; } } - if(in_array("always_select_first_host",$options) && $_REQUEST["hostid"] == 0 && $_REQUEST["groupid"] != 0) + if(str_in_array("always_select_first_host",$options) && $_REQUEST["hostid"] == 0 && $_REQUEST["groupid"] != 0) $_REQUEST["hostid"] = -1; $result = get_correct_group_and_host($_REQUEST["groupid"],$_REQUEST["hostid"], $perm, $options); @@ -638,22 +638,22 @@ require_once "include/items.inc.php"; $first_hostid_in_group = 0; - $allow_all_hosts = (in_array("allow_all_hosts",$options)) ? 1 : 0; - $always_select_first_host = in_array("always_select_first_host",$options) ? 1 : 0; - $only_current_node = in_array("only_current_node",$options) ? 1 : 0; + $allow_all_hosts = (str_in_array("allow_all_hosts",$options)) ? 1 : 0; + $always_select_first_host = str_in_array("always_select_first_host",$options) ? 1 : 0; + $only_current_node = str_in_array("only_current_node",$options) ? 1 : 0; - if(in_array("monitored_hosts",$options)) + if(str_in_array("monitored_hosts",$options)) $with_host_status = " and h.status=".HOST_STATUS_MONITORED; - elseif(in_array('real_hosts',$options)) + elseif(str_in_array('real_hosts',$options)) $with_host_status = " and h.status<>".HOST_STATUS_TEMPLATE; - elseif(in_array('templated_hosts',$options)) + elseif(str_in_array('templated_hosts',$options)) $with_host_status = " and h.status=".HOST_STATUS_TEMPLATE; else $with_host_status = ""; - if(in_array("with_monitored_items",$options)){ + if(str_in_array("with_monitored_items",$options)){ $item_table = ",items i"; $with_items = " and h.hostid=i.hostid and i.status=".ITEM_STATUS_ACTIVE; - }else if(in_array("with_items",$options)){ + }else if(str_in_array("with_items",$options)){ $item_table = ",items i"; $with_items = " and h.hostid=i.hostid"; } else { $item_table = ""; @@ -791,7 +791,7 @@ require_once "include/items.inc.php"; } } - if(in_array("always_select_first_host",$options) && $_REQUEST["hostid"] == 0 && $_REQUEST["groupid"] != 0) + if(uint_in_array("always_select_first_host",$options) && $_REQUEST["hostid"] == 0 && $_REQUEST["groupid"] != 0) $_REQUEST["hostid"] = -1; $result = get_correct_group_and_host($_REQUEST["groupid"],$_REQUEST["hostid"], $perm, $options); @@ -1081,7 +1081,7 @@ require_once "include/items.inc.php"; unset($skip); if( ($tmp_app_data = get_application_by_applicationid($db_app["templateid"])) ) { - if( !in_array($tmp_app_data["hostid"], $templateid) ) + if( !uint_in_array($tmp_app_data["hostid"], $templateid) ) { $skip = true; break; diff --git a/frontends/php/include/import.inc.php b/frontends/php/include/import.inc.php index d3d6a3c3..ce47a503 100644 --- a/frontends/php/include/import.inc.php +++ b/frontends/php/include/import.inc.php @@ -100,7 +100,7 @@ info('Host ['.$data['name'].'] skipped - user rule'); break; // case } - if(!in_array($host_data['hostid'], $this->accessible_hosts)){ + if(!uint_in_array($host_data['hostid'], $this->accessible_hosts)){ error('Host ['.$data['name'].'] skipped - Access deny.'); break; // case } @@ -118,7 +118,7 @@ } // if( count($this->accessible_nodes) > 0 ){ - if(!in_array(get_current_nodeid(),$this->accessible_nodes)){ + if(!uint_in_array(get_current_nodeid(),$this->accessible_nodes)){ error('Host ['.$data['name'].'] skipped - Access deny.'); break; // case } @@ -213,7 +213,7 @@ break; // case } - if(!in_array($group["groupid"], $this->accessible_groups)) + if(!uint_in_array($group["groupid"], $this->accessible_groups)) { error('Group ['.$this->element_data.'] skipped - Access deny.'); break; // case @@ -257,7 +257,7 @@ break; // case } - if(!in_array($template["hostid"], $this->accessible_hosts)) + if(!uint_in_array($template["hostid"], $this->accessible_hosts)) { error('Template ['.$this->element_data.'] skipped - Access deny.'); break; // case diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index e1da2c2e..260df4ff 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -232,7 +232,7 @@ if(eregi('^((.)*)(\[\"((.)*)\"\,\"((.)*)\"\,\"((.)*)\"\,\"([0-9]+)\"\])$', $key, $arr)) { $g=$arr[1]; - if(!in_array($g,array("grpmax","grpmin","grpsum","grpavg"))) + if(!str_in_array($g,array("grpmax","grpmin","grpsum","grpavg"))) { error("Group function [$g] is not one of [grpmax,grpmin,grpsum,grpavg]"); return FALSE; @@ -243,7 +243,7 @@ $g=$arr[6]; // Item function $g=$arr[8]; - if(!in_array($g,array("last", "min", "max", "avg", "sum","count"))) + if(!str_in_array($g,array("last", "min", "max", "avg", "sum","count"))) { error("Item function [$g] is not one of [last, min, max, avg, sum,count]"); return FALSE; @@ -553,7 +553,7 @@ $db_tmp_item = get_item_by_itemid($db_item["templateid"]); - if ( !in_array($db_tmp_item["hostid"], $templateid) ) + if ( !uint_in_array($db_tmp_item["hostid"], $templateid) ) continue; } diff --git a/frontends/php/include/maps.inc.php b/frontends/php/include/maps.inc.php index a3db20bb..dc1874e4 100644 --- a/frontends/php/include/maps.inc.php +++ b/frontends/php/include/maps.inc.php @@ -95,7 +95,7 @@ switch($se_data['elementtype']) { case SYSMAP_ELEMENT_TYPE_HOST: - if(in_array($se_data['elementid'],explode(',',$denyed_hosts))) + if(uint_in_array($se_data['elementid'],explode(',',$denyed_hosts))) { $result = false; } @@ -115,7 +115,7 @@ break; case SYSMAP_ELEMENT_TYPE_HOST_GROUP: if( DBfetch(DBselect('select groupid from groups where groupid='.$se_data['elementid'])) && - in_array($se_data['elementid'], + uint_in_array($se_data['elementid'], get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_MODE_LT, PERM_RES_IDS_ARRAY))) { $result = false; diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php index a2e3e640..993091f6 100644 --- a/frontends/php/include/page_header.php +++ b/frontends/php/include/page_header.php @@ -282,7 +282,7 @@ COpt::profiling_start("page"); $sub['pages'][$id]['active'] = true; /* mark as active */ } else if(isset($sub_pages['sub_pages'])){ - if(in_array($page['file'], $sub_pages['sub_pages'])){ + if(str_in_array($page['file'], $sub_pages['sub_pages'])){ if(isset($sub_pages['label'])){ $menu_url = $sub_pages['url']; } diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php index df137f8b..d1fd3212 100644 --- a/frontends/php/include/perm.inc.php +++ b/frontends/php/include/perm.inc.php @@ -352,7 +352,7 @@ COpt::counter_up('perm'); $do_break = true; - if(is_array($nodeid) && !in_array($node_data['nodeid'],$nodeid)) continue; + if(is_array($nodeid) && !uint_in_array($node_data['nodeid'],$nodeid)) continue; else if(!is_array($nodeid) && (bccomp($node_data['nodeid'] ,$nodeid) != 0)) continue; } else @@ -614,7 +614,7 @@ COpt::counter_up('perm'); $do_break = true; - if(is_array($nodeid) && !in_array($node_data['nodeid'],$nodeid)) continue; + if(is_array($nodeid) && !uint_in_array($node_data['nodeid'],$nodeid)) continue; else if(isset($nodeid) and (bccomp($node_data['nodeid'] ,$nodeid) != 0)) continue; } else diff --git a/frontends/php/include/scripts.inc.php b/frontends/php/include/scripts.inc.php index c5ab93ff..3b53b932 100644 --- a/frontends/php/include/scripts.inc.php +++ b/frontends/php/include/scripts.inc.php @@ -129,12 +129,12 @@ function get_accessible_scripts_by_hosts($hosts){ while($script = DBfetch($res)){ foreach($hosts as $id => $hostid){ if($script['host_access'] == SCRIPT_HOST_ACCESS_WRITE){ - if(in_array($hostid,$hosts_read_write)){ + if(uint_in_array($hostid,$hosts_read_write)){ $scripts_by_host[$hostid][] = $script; } } else{ - if(in_array($hostid,$hosts_read_only)){ + if(uint_in_array($hostid,$hosts_read_only)){ $scripts_by_host[$hostid][] = $script; } } diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php index 65b26696..f9cfb630 100644 --- a/frontends/php/include/triggers.inc.php +++ b/frontends/php/include/triggers.inc.php @@ -593,7 +593,7 @@ $fnc_valid = &$ZBX_TR_EXPR_ALLOWED_FUNCTIONS[$function]; if ( is_array($fnc_valid['item_types']) && - !in_array($item['value_type'], $fnc_valid['item_types'])) + !uint_in_array($item['value_type'], $fnc_valid['item_types'])) { $allowed_types = array(); foreach($fnc_valid['item_types'] as $type) @@ -1531,7 +1531,7 @@ $db_hosts = get_hosts_by_expression($expression); while($host_data = DBfetch($db_hosts)) { - if(!in_array($host_data['hostid'], $accessible_hosts)) return false; + if(!uint_in_array($host_data['hostid'], $accessible_hosts)) return false; } return true; @@ -1707,7 +1707,7 @@ $db_tmp_hosts = get_hosts_by_triggerid($trigger["templateid"]); $tmp_host = DBfetch($db_tmp_hosts); - if( !in_array($tmp_host["hostid"], $templateid) ) + if( !uint_in_array($tmp_host["hostid"], $templateid) ) continue; } diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php index 80a923ef..740974d0 100644 --- a/frontends/php/include/validate.inc.php +++ b/frontends/php/include/validate.inc.php @@ -60,7 +60,7 @@ { if(is_array($array)) $array = implode(',', $array); - return "in_array({".$var."},array(".$array."))&&"; + return "str_in_array({".$var."},array(".$array."))&&"; } function HEX($var=NULL) { @@ -222,7 +222,6 @@ } $expression = trim($expression,"& "); $exec = "return (".$expression.") ? 1 : 0;"; - $ret = eval($exec); //echo $debug; //echo "$field - result: ".$ret." exec: $exec".SBR.SBR; @@ -232,8 +231,6 @@ function calc_exp($fields,$field,$expression) { - global $_REQUEST; - //SDI("$field - expression: ".$expression); if(strstr($expression,"{}") && !isset($_REQUEST[$field])) diff --git a/frontends/php/items.php b/frontends/php/items.php index a064fca8..22e34fc7 100644 --- a/frontends/php/items.php +++ b/frontends/php/items.php @@ -164,7 +164,7 @@ include_once "include/page_header.php"; $accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,null,null,get_current_nodeid()); - if(isset($_REQUEST['hostid']) && !in_array($_REQUEST['hostid'], explode(',',$accessible_hosts))) + if(isset($_REQUEST['hostid']) && !uint_in_array($_REQUEST['hostid'], explode(',',$accessible_hosts))) { unset($_REQUEST['hostid']); } @@ -535,7 +535,7 @@ include_once "include/page_header.php"; { echo SBR; insert_copy_elements_to_forms("group_itemid"); - } elseif (!isset($_REQUEST["form"]) || !in_array($_REQUEST["form"],array(S_CREATE_ITEM,"update","clone"))) { + } elseif (!isset($_REQUEST["form"]) || !str_in_array($_REQUEST["form"],array(S_CREATE_ITEM,"update","clone"))) { echo SBR; // Table HEADER $form = new CForm(); @@ -838,7 +838,7 @@ include_once "include/page_header.php"; } - if(isset($_REQUEST["form"]) && (in_array($_REQUEST["form"],array(S_CREATE_ITEM,"update","clone")) || + if(isset($_REQUEST["form"]) && (str_in_array($_REQUEST["form"],array(S_CREATE_ITEM,"update","clone")) || ($_REQUEST["form"]=="mass_update" && isset($_REQUEST['group_itemid'])))) { // FORM diff --git a/frontends/php/latest.php b/frontends/php/latest.php index a6f7a68e..0fc93758 100644 --- a/frontends/php/latest.php +++ b/frontends/php/latest.php @@ -68,7 +68,7 @@ include_once "include/page_header.php"; $_REQUEST["applications"] = array(); $show_all_apps = 1; } - else if(!in_array($_REQUEST["applicationid"],$_REQUEST["applications"])){ + else if(!uint_in_array($_REQUEST["applicationid"],$_REQUEST["applications"])){ array_push($_REQUEST["applications"],$_REQUEST["applicationid"]); } @@ -219,7 +219,7 @@ include_once "include/page_header.php"; if( '' != $_REQUEST["select"] && !stristr($description, $_REQUEST["select"]) ) continue; ++$item_cnt; - if(!in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue; + if(!uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue; if(isset($db_item["lastclock"])) $lastclock=date(S_DATE_FORMAT_YMDHMS,$db_item["lastclock"]); @@ -260,7 +260,7 @@ include_once "include/page_header.php"; } if($item_cnt > 0){ - if(in_array($db_app["applicationid"],$_REQUEST["applications"]) || isset($show_all_apps)){ + if(uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) || isset($show_all_apps)){ $link = new CLink(new CImg("images/general/opened.gif"), "?close=1&applicationid=".$db_app["applicationid"]. url_param("groupid").url_param("hostid").url_param("applications"). @@ -327,7 +327,7 @@ include_once "include/page_header.php"; if( '' != $_REQUEST["select"] && !stristr($description, $_REQUEST["select"]) ) continue; ++$item_cnt; - if(!in_array(0,$_REQUEST["applications"]) && $any_app_exist && !isset($show_all_apps)) continue; + if(!uint_in_array(0,$_REQUEST["applications"]) && $any_app_exist && !isset($show_all_apps)) continue; if(isset($db_item["lastclock"])) $lastclock=zbx_date2str(S_DATE_FORMAT_YMDHMS,$db_item["lastclock"]); @@ -373,7 +373,7 @@ include_once "include/page_header.php"; if($item_cnt > 0){ if($any_app_exist){ - if(in_array(0,$_REQUEST["applications"]) || isset($show_all_apps)){ + if(uint_in_array(0,$_REQUEST["applications"]) || isset($show_all_apps)){ $link = new CLink(new CImg("images/general/opened.gif"), "?close=1&applicationid=0". url_param("groupid").url_param("hostid").url_param("applications"). diff --git a/frontends/php/popup.php b/frontends/php/popup.php index 7213ca68..f6d525aa 100644 --- a/frontends/php/popup.php +++ b/frontends/php/popup.php @@ -156,7 +156,7 @@ include_once "include/page_header.php"; $allowed_item_types = array(ITEM_TYPE_ZABBIX,ITEM_TYPE_SIMPLE,ITEM_TYPE_INTERNAL,ITEM_TYPE_AGGREGATE); - if(isset($_REQUEST['itemtype']) && !in_array($_REQUEST['itemtype'], $allowed_item_types)) + if(isset($_REQUEST['itemtype']) && !str_in_array($_REQUEST['itemtype'], $allowed_item_types)) unset($_REQUEST['itemtype']); check_fields($fields); @@ -224,12 +224,12 @@ include_once "include/page_header.php"; if($real_hosts) array_push($validation_param, "real_hosts"); - if(in_array($srctbl,array("triggers","logitems","items"))) + if(str_in_array($srctbl,array("triggers","logitems","items"))) { array_push($validation_param, "always_select_first_host"); validate_group_with_host(PERM_READ_LIST,$validation_param); } - elseif(in_array($srctbl,array('hosts','templates','host_templates'))) + elseif(str_in_array($srctbl,array('hosts','templates','host_templates'))) { validate_group(PERM_READ_LIST,$validation_param); } @@ -246,7 +246,7 @@ include_once "include/page_header.php"; } else { - if(in_array($srctbl,array('hosts','host_group','triggers','logitems','items', + if(str_in_array($srctbl,array('hosts','host_group','triggers','logitems','items', 'applications','screens','graphs','simple_graph', 'sysmaps','plain_text','screens2','overview','host_group_scr'))) { @@ -266,7 +266,7 @@ include_once "include/page_header.php"; if(!isset($ok)) $nodeid = get_current_nodeid(); unset($ok); - if(in_array($srctbl,array('hosts','templates','triggers','logitems','items','applications','host_templates','graphs','simple_graph','plain_text'))) + if(str_in_array($srctbl,array('hosts','templates','triggers','logitems','items','applications','host_templates','graphs','simple_graph','plain_text'))) { $groupid = get_request('groupid',get_profile('web.popup.groupid',0)); @@ -289,7 +289,7 @@ include_once "include/page_header.php"; if(!isset($ok) || $groupid == 0) unset($groupid); unset($ok); } - if(in_array($srctbl,array("help_items"))) + if(str_in_array($srctbl,array("help_items"))) { $itemtype = get_request("itemtype",get_profile("web.popup.itemtype",0)); $cmbTypes = new CComboBox("itemtype",$itemtype,"submit()"); @@ -297,7 +297,7 @@ include_once "include/page_header.php"; $cmbTypes->AddItem($type, item_type2str($type)); $frmTitle->AddItem(array(S_TYPE,SPACE,$cmbTypes)); } - if(in_array($srctbl,array("triggers","logitems","items",'applications','graphs','simple_graph','plain_text'))) + if(str_in_array($srctbl,array("triggers","logitems","items",'applications','graphs','simple_graph','plain_text'))) { $hostid = get_request("hostid",get_profile("web.popup.hostid",0)); $cmbHosts = new CComboBox("hostid",$hostid,"submit()"); @@ -332,7 +332,7 @@ include_once "include/page_header.php"; unset($ok); } - if(in_array($srctbl,array("triggers","hosts"))) + if(str_in_array($srctbl,array("triggers","hosts"))) { $btnEmpty = new CButton("empty",S_EMPTY, get_window_opener($dstfrm, $dstfld1, 0). @@ -513,7 +513,7 @@ include_once "include/page_header.php"; $form->AddItem($table); $form->Show(); } - elseif(in_array($srctbl,array("host_group"))) + elseif(str_in_array($srctbl,array("host_group"))) { $accessible_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY); @@ -536,7 +536,7 @@ include_once "include/page_header.php"; } $table->Show(); } - elseif(in_array($srctbl,array('host_templates'))) + elseif(str_in_array($srctbl,array('host_templates'))) { $table = new CTableInfo(S_NO_TEMPLATES_DEFINED); $table->SetHeader(array(S_NAME)); diff --git a/frontends/php/popup_trexpr.php b/frontends/php/popup_trexpr.php index bbc8a70a..53d0af5b 100644 --- a/frontends/php/popup_trexpr.php +++ b/frontends/php/popup_trexpr.php @@ -203,13 +203,13 @@ include_once "include/page_header.php"; $function = $expr_res[1]; $operator = $expr_res[2]; - if(!in_array($function, array_keys($functions))) unset($function); + if(!str_in_array($function, array_keys($functions))) unset($function); } unset($expr_res); if(!isset($function)) $function = 'last'; - if(!in_array($operator, array_keys($functions[$function]['operators']))) unset($operator); + if(!str_in_array($operator, array_keys($functions[$function]['operators']))) unset($operator); if(!isset($operator)) $operator = '='; $expr_type = $function.'['.$operator.']'; diff --git a/frontends/php/scripts_exec.php b/frontends/php/scripts_exec.php index 4c01f23d..c20f0ac5 100644 --- a/frontends/php/scripts_exec.php +++ b/frontends/php/scripts_exec.php @@ -48,7 +48,7 @@ if(isset($_REQUEST['execute'])){ if($script['host_access'] == SCRIPT_HOST_ACCESS_WRITE){ $hosts_read_write = explode(',',get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,null,null,null,$_REQUEST['hostid'])); - if(in_array($_REQUEST['hostid'],$hosts_read_write)){ + if(uint_in_array($_REQUEST['hostid'],$hosts_read_write)){ //SDI('WRITE: '.$_REQUEST['scriptid'].' : '.$_REQUEST['hostid']); // $result = execute_script($_REQUEST['scriptid'],$_REQUEST['hostid']); // insert_command_result_form($result["flag"],$result["message"]); @@ -58,7 +58,7 @@ if(isset($_REQUEST['execute'])){ } else { $hosts_read_only = explode(',',get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,null,null,null,$_REQUEST['hostid'])); - if(in_array($_REQUEST['hostid'],$hosts_read_only)){ + if(uint_in_array($_REQUEST['hostid'],$hosts_read_only)){ //SDI('READ: '.$_REQUEST['scriptid'].' : '.$_REQUEST['hostid']); // $result = execute_script($_REQUEST['scriptid'],$_REQUEST['hostid']); // insert_command_result_form($result["flag"],$result["message"]); diff --git a/frontends/php/services_form.php b/frontends/php/services_form.php index d9c3780a..78a5d7c5 100644 --- a/frontends/php/services_form.php +++ b/frontends/php/services_form.php @@ -361,7 +361,7 @@ if(isset($_REQUEST['sform'])){ while($new_service_time['to'] && ($new_service_time['to'] <= $new_service_time['from'])) $new_service_time['to'] += 7*24*3600; - if($new_service_time['to'] && !in_array($_REQUEST['service_times'], $new_service_time)) + if($new_service_time['to'] && !str_in_array($_REQUEST['service_times'], $new_service_time)) array_push($_REQUEST['service_times'],$new_service_time); } elseif(isset($_REQUEST["del_service_times"]) && isset($_REQUEST["rem_service_times"])){ $_REQUEST["service_times"] = get_request("service_times",array()); @@ -396,7 +396,7 @@ if(isset($_REQUEST['sform'])){ 'to'=> $db_stime['ts_to'], 'note'=> $db_stime['note'] ); - if(in_array($stime, $service_times)){ + if(str_in_array($stime, $service_times)){ continue; } array_push($service_times, $stime); @@ -441,7 +441,7 @@ if(isset($_REQUEST['sform'])){ 'triggerid' => $db_service_data["triggerid"], 'soft' => $db_service_data['soft'] ); - if(in_array($child, $childs)){ + if(str_in_array($child, $childs)){ continue; } array_push($childs,$child); diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php index 6bdd0c47..f266a5d4 100644 --- a/frontends/php/triggers.php +++ b/frontends/php/triggers.php @@ -225,7 +225,7 @@ include_once "include/page_header.php"; if(!isset($_REQUEST["dependences"])) $_REQUEST["dependences"] = array(); - if(!in_array($_REQUEST["new_dependence"], $_REQUEST["dependences"])) + if(!uint_in_array($_REQUEST["new_dependence"], $_REQUEST["dependences"])) array_push($_REQUEST["dependences"], $_REQUEST["new_dependence"]); } elseif(isset($_REQUEST["del_dependence"])&&isset($_REQUEST["rem_dependence"])) @@ -233,7 +233,7 @@ include_once "include/page_header.php"; if(isset($_REQUEST["dependences"])){ foreach($_REQUEST["dependences"]as $key => $val) { - if(!in_array($val, $_REQUEST["rem_dependence"])) continue; + if(!uint_in_array($val, $_REQUEST["rem_dependence"])) continue; unset($_REQUEST["dependences"][$key]); } } diff --git a/frontends/php/users.php b/frontends/php/users.php index 7ef0d184..99c57be7 100644 --- a/frontends/php/users.php +++ b/frontends/php/users.php @@ -419,11 +419,12 @@ include_once "include/page_header.php"; order_by('u.alias,u.name,u.surname,u.type','u.userid')); while($db_user=DBfetch($db_users)) { - $db_sessions = DBselect('select count(*) as count, max(s.lastaccess) as lastaccess'. - ' from sessions s, users u'. - ' where s.userid='.$db_user['userid'].' and s.userid=u.userid '. - ' and ((s.lastaccess+u.autologout)>='.time(). - ' or u.autologout=0)'); + $db_sessions = DBselect('SELECT count(*) as count, max(s.lastaccess) as lastaccess'. + ' FROM sessions s, users u'. + ' WHERE s.userid='.$db_user['userid']. + ' AND s.userid=u.userid '. + ' AND ((s.lastaccess+u.autologout)>='.time().' OR u.autologout=0)'); +//Log Out 10min $db_ses_cnt=DBfetch($db_sessions); if($db_ses_cnt["count"]>0) |