diff options
author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-29 08:41:15 +0000 |
---|---|---|
committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-29 08:41:15 +0000 |
commit | 131500f24e0298058a33aa79ced9d01111c7b778 (patch) | |
tree | 4a0f898d49b63aa04c783e4a6620fb7256e9f695 | |
parent | 4c6e81cdcb98236655c4612143a2fb74fa28b585 (diff) | |
download | zabbix-131500f24e0298058a33aa79ced9d01111c7b778.tar.gz zabbix-131500f24e0298058a33aa79ced9d01111c7b778.tar.xz zabbix-131500f24e0298058a33aa79ced9d01111c7b778.zip |
- [DEV-158] added standart sorting to screens (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5665 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | frontends/php/actionconf.php | 168 | ||||
-rw-r--r-- | frontends/php/audit.php | 2 | ||||
-rw-r--r-- | frontends/php/discovery.php | 2 | ||||
-rw-r--r-- | frontends/php/discoveryconf.php | 56 | ||||
-rw-r--r-- | frontends/php/exp_imp.php | 2 | ||||
-rw-r--r-- | frontends/php/graphs.php | 2 | ||||
-rw-r--r-- | frontends/php/hostprofiles.php | 2 | ||||
-rw-r--r-- | frontends/php/hosts.php | 2 | ||||
-rw-r--r-- | frontends/php/httpconf.php | 185 | ||||
-rw-r--r-- | frontends/php/httpmon.php | 7 | ||||
-rw-r--r-- | frontends/php/items.php | 248 | ||||
-rw-r--r-- | frontends/php/latest.php | 2 | ||||
-rw-r--r-- | frontends/php/locales.php | 2 | ||||
-rw-r--r-- | frontends/php/media_types.php | 42 | ||||
-rw-r--r-- | frontends/php/screenconf.php | 2 | ||||
-rw-r--r-- | frontends/php/scripts.php | 8 | ||||
-rw-r--r-- | frontends/php/sysmaps.php | 2 | ||||
-rw-r--r-- | frontends/php/tr_status.php | 2 | ||||
-rw-r--r-- | frontends/php/triggers.php | 138 | ||||
-rw-r--r-- | frontends/php/users.php | 2 |
21 files changed, 391 insertions, 486 deletions
@@ -1,5 +1,6 @@ Changes for 1.5.1: + - [DEV-158] added standart sorting to screens (Artem) - [DEV-154] added more flexibility to scripts (Artem) - [DEV-166] fixed problem with node syncing (Sasha) - [DEV-145] added Ldap authentication (Artem) diff --git a/frontends/php/actionconf.php b/frontends/php/actionconf.php index 49065bb6..2ae699b6 100644 --- a/frontends/php/actionconf.php +++ b/frontends/php/actionconf.php @@ -38,54 +38,50 @@ include_once "include/page_header.php"; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields=array( - "actionid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), - "name"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), - "eventsource"=> array(T_ZBX_INT, O_MAND, null, - IN(array(EVENT_SOURCE_TRIGGERS,EVENT_SOURCE_DISCOVERY)), null), - "evaltype"=> array(T_ZBX_INT, O_OPT, null, - IN(array(ACTION_EVAL_TYPE_AND_OR,ACTION_EVAL_TYPE_AND,ACTION_EVAL_TYPE_OR)), 'isset({save})'), - "status"=> array(T_ZBX_INT, O_OPT, null, - IN(array(ACTION_STATUS_ENABLED,ACTION_STATUS_DISABLED)), 'isset({save})'), + "actionid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), + "name"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), + "eventsource"=> array(T_ZBX_INT, O_MAND, null, IN(array(EVENT_SOURCE_TRIGGERS,EVENT_SOURCE_DISCOVERY)), null), + "evaltype"=> array(T_ZBX_INT, O_OPT, null, IN(array(ACTION_EVAL_TYPE_AND_OR,ACTION_EVAL_TYPE_AND,ACTION_EVAL_TYPE_OR)), 'isset({save})'), + "status"=> array(T_ZBX_INT, O_OPT, null, IN(array(ACTION_STATUS_ENABLED,ACTION_STATUS_DISABLED)), 'isset({save})'), - "g_actionid"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + "g_actionid"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), - "conditions"=> array(null, O_OPT, null, null, null), - "g_conditionid"=> array(null, O_OPT, null, null, null), + "conditions"=> array(null, O_OPT, null, null, null), + "g_conditionid"=> array(null, O_OPT, null, null, null), - "new_condition"=> array(null, O_OPT, null, null, 'isset({add_condition})'), + "new_condition"=> array(null, O_OPT, null, null, 'isset({add_condition})'), "operations"=> array(null, O_OPT, null, null, null), "g_operationid"=> array(null, O_OPT, null, null, null), - "edit_operationid"=> array(null, O_OPT, P_ACT, DB_ID, null), + "edit_operationid"=>array(null, O_OPT, P_ACT, DB_ID, null), "new_operation"=> array(null, O_OPT, null, null, 'isset({add_operation})'), /* actions */ - "group_delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "group_enable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "group_disable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "add_condition"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "del_condition"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "group_delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "group_enable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "group_disable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "add_condition"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "del_condition"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), "cancel_new_condition"=>array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "add_operation"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "del_operation"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "add_operation"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "del_operation"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), "cancel_new_operation"=>array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "clone"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), + "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "clone"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), /* other */ - "form"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), + "form"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), "form_refresh"=> array(T_ZBX_INT, O_OPT, null, null, null) ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('a.name',ZBX_SORT_UP); - if(isset($_REQUEST['actionid']) && !action_accessible($_REQUEST['actionid'], PERM_READ_WRITE)) - { + if(isset($_REQUEST['actionid']) && !action_accessible($_REQUEST['actionid'], PERM_READ_WRITE)){ access_deny(); } ?> @@ -93,31 +89,24 @@ include_once "include/page_header.php"; update_profile('web.actionconf.eventsource',$_REQUEST['eventsource']); ?> <?php - if(inarr_isset(array('clone','actionid'))) - { + if(inarr_isset(array('clone','actionid'))){ unset($_REQUEST['actionid']); $_REQUEST['form'] = 'clone'; } - elseif(isset($_REQUEST['cancel_new_condition'])) - { + else if(isset($_REQUEST['cancel_new_condition'])){ unset($_REQUEST['new_condition']); } - elseif(isset($_REQUEST['cancel_new_operation'])) - { + else if(isset($_REQUEST['cancel_new_operation'])){ unset($_REQUEST['new_operation']); } - elseif(isset($_REQUEST['save'])) - { - global $USER_DETAILS; - + else if(isset($_REQUEST['save'])){ if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_MODE_LT,PERM_RES_IDS_ARRAY,get_current_nodeid()))) access_deny(); $conditions = get_request('conditions', array()); $operations = get_request('operations', array()); - if(isset($_REQUEST['actionid'])) - { + if(isset($_REQUEST['actionid'])){ $actionid=$_REQUEST['actionid']; $result = update_action($actionid, $_REQUEST['name'],$_REQUEST['eventsource'], @@ -126,7 +115,8 @@ include_once "include/page_header.php"; ); show_messages($result,S_ACTION_UPDATED,S_CANNOT_UPDATE_ACTION); - } else { + } + else { $actionid=add_action( $_REQUEST['name'],$_REQUEST['eventsource'], $_REQUEST['evaltype'],$_REQUEST['status'], @@ -137,18 +127,14 @@ include_once "include/page_header.php"; show_messages($result,S_ACTION_ADDED,S_CANNOT_ADD_ACTION); } - if($result) // result - OK - { + if($result) // result - OK{ add_audit(!isset($_REQUEST['actionid']) ? AUDIT_ACTION_ADD : AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ACTION, S_NAME.': '.$_REQUEST['name']); unset($_REQUEST['form']); } } - elseif(inarr_isset(array('delete','actionid'))) - { - global $USER_DETAILS; - + else if(inarr_isset(array('delete','actionid'))){ if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_MODE_LT,PERM_RES_IDS_ARRAY,get_current_nodeid()))) access_deny(); @@ -156,20 +142,17 @@ include_once "include/page_header.php"; $result = delete_action($_REQUEST['actionid']); show_messages($result,S_ACTION_DELETED,S_CANNOT_DELETE_ACTION); - if($result) - { + if($result){ add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_ACTION, 'Id ['.$_REQUEST['actionid'].'] '.S_NAME.' ['.$action_data['name'].']'); unset($_REQUEST['form']); unset($_REQUEST['actionid']); } } - elseif(inarr_isset(array('add_condition','new_condition'))) - { + else if(inarr_isset(array('add_condition','new_condition'))){ $new_condition = $_REQUEST['new_condition']; - if( validate_condition($new_condition['type'],$new_condition['value']) ) - { + if( validate_condition($new_condition['type'],$new_condition['value']) ){ $_REQUEST['conditions'] = get_request('conditions',array()); if(!str_in_array($new_condition,$_REQUEST['conditions'])) array_push($_REQUEST['conditions'],$new_condition); @@ -177,30 +160,25 @@ include_once "include/page_header.php"; unset($_REQUEST['new_condition']); } } - elseif(inarr_isset(array('del_condition','g_conditionid'))) - { + else if(inarr_isset(array('del_condition','g_conditionid'))){ $_REQUEST['conditions'] = get_request('conditions',array()); foreach($_REQUEST['g_conditionid'] as $val){ unset($_REQUEST['conditions'][$val]); } } - elseif(inarr_isset(array('add_operation','new_operation'))) - { + else if(inarr_isset(array('add_operation','new_operation'))){ $new_operation = $_REQUEST['new_operation']; - if( validate_operation($new_operation) ) - { + if(validate_operation($new_operation)){ zbx_rksort($new_operation); $_REQUEST['operations'] = get_request('operations',array()); - if(!isset($new_operation['id'])) - { + if(!isset($new_operation['id'])){ if(!str_in_array($new_operation,$_REQUEST['operations'])) array_push($_REQUEST['operations'],$new_operation); } - else - { + else{ $id = $new_operation['id']; unset($new_operation['id']); $_REQUEST['operations'][$id] = $new_operation; @@ -209,29 +187,24 @@ include_once "include/page_header.php"; unset($_REQUEST['new_operation']); } } - elseif(inarr_isset(array('del_operation','g_operationid'))) - { + else if(inarr_isset(array('del_operation','g_operationid'))){ $_REQUEST['operations'] = get_request('operations',array()); foreach($_REQUEST['g_operationid'] as $val){ unset($_REQUEST['operations'][$val]); } } - elseif(inarr_isset(array('edit_operationid'))) - { + else if(inarr_isset(array('edit_operationid'))){ $_REQUEST['edit_operationid'] = array_keys($_REQUEST['edit_operationid']); $edit_operationid = $_REQUEST['edit_operationid'] =array_pop($_REQUEST['edit_operationid']); $_REQUEST['operations'] = get_request('operations',array()); - if(isset($_REQUEST['operations'][$edit_operationid])) - { + + if(isset($_REQUEST['operations'][$edit_operationid])){ $_REQUEST['new_operation'] = $_REQUEST['operations'][$edit_operationid]; $_REQUEST['new_operation']['id'] = $edit_operationid; } } /* GROUP ACTIONS */ - elseif(isset($_REQUEST['group_enable'])&&isset($_REQUEST['g_actionid'])) - { - global $USER_DETAILS; - + else if(isset($_REQUEST['group_enable'])&&isset($_REQUEST['g_actionid'])){ if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,null,PERM_RES_IDS_ARRAY,get_current_nodeid()))) access_deny(); @@ -242,21 +215,18 @@ include_once "include/page_header.php"; $result=DBselect($query); $actionids = array(); - while($row=DBfetch($result)) - { + while($row=DBfetch($result)){ $res = update_action_status($row['actionid'],0); if($res) $actionids[] = $row['actionid']; } - if(isset($res)) - { + + if(isset($res)){ show_messages(true, S_STATUS_UPDATED, S_CANNOT_UPDATE_STATUS); add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ACTION, ' Actions ['.implode(',',$actionids).'] enabled'); } } - elseif(isset($_REQUEST['group_disable'])&&isset($_REQUEST['g_actionid'])) - { - global $USER_DETAILS; + else if(isset($_REQUEST['group_disable'])&&isset($_REQUEST['g_actionid'])){ if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,null,PERM_RES_IDS_ARRAY,get_current_nodeid()))) access_deny(); @@ -268,22 +238,18 @@ include_once "include/page_header.php"; $result=DBselect($query); $actionids = array(); - while($row=DBfetch($result)) - { + while($row=DBfetch($result)){ $res = update_action_status($row['actionid'],1); if($res) $actionids[] = $row['actionid']; } - if(isset($res)) - { + + if(isset($res)){ show_messages(true, S_STATUS_UPDATED, S_CANNOT_UPDATE_STATUS); add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ACTION, ' Actions ['.implode(',',$actionids).'] disabled'); } } - elseif(isset($_REQUEST['group_delete'])&&isset($_REQUEST['g_actionid'])) - { - global $USER_DETAILS; - + else if(isset($_REQUEST['group_delete'])&&isset($_REQUEST['g_actionid'])){ if(!count($nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,null,PERM_RES_IDS_ARRAY,get_current_nodeid()))) access_deny(); @@ -292,20 +258,18 @@ include_once "include/page_header.php"; ' and actionid in ('.implode(',',$_REQUEST['g_actionid']).') ' ); $actionids = array(); - while($row=DBfetch($result)) - { + while($row=DBfetch($result)){ $del_res = delete_action($row['actionid']); if($del_res) $actionids[] = $row['actionid']; } - if(isset($del_res)) - { + + if(isset($del_res)){ show_messages(TRUE, S_ACTIONS_DELETED, S_CANNOT_DELETE_ACTIONS); add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_ACTION, ' Actions ['.implode(',',$actionids).'] deleted'); } } ?> - <?php /* header */ $form = new CForm(); @@ -316,13 +280,11 @@ include_once "include/page_header.php"; show_table_header(S_CONFIGURATION_OF_ACTIONS_BIG, $form); echo SBR; - if(isset($_REQUEST['form'])) - { + if(isset($_REQUEST['form'])){ /* form */ insert_action_form(); } - else - { + else{ $form = new CForm(); $form->SetMethod('get'); @@ -352,15 +314,13 @@ include_once "include/page_header.php"; ' WHERE a.eventsource='.$_REQUEST['eventsource']. ' AND '.DBin_node('actionid'). order_by('a.name,a.status','a.actionid')); - while($action_data = DBfetch($db_actions)) - { + while($action_data = DBfetch($db_actions)){ if(!action_accessible($action_data['actionid'], PERM_READ_WRITE)) continue; $conditions=array(); $db_conditions = DBselect('select * from conditions where actionid='.$action_data['actionid']. ' order by conditiontype,conditionid'); - while($condition_data = DBfetch($db_conditions)) - { + while($condition_data = DBfetch($db_conditions)){ array_push($conditions, array(get_condition_desc( $condition_data['conditiontype'], $condition_data['operator'], @@ -374,14 +334,12 @@ include_once "include/page_header.php"; while($operation_data = DBfetch($db_operations)) array_push($operations,array(get_operation_desc(SHORT_DESCRITION, $operation_data),BR())); - if($action_data['status'] == ACTION_STATUS_DISABLED) - { + if($action_data['status'] == ACTION_STATUS_DISABLED){ $status= new CLink(S_DISABLED, 'actionconf.php?group_enable=1&g_actionid%5B%5D='.$action_data['actionid'].url_param('eventsource'), 'disabled'); } - else - { + else{ $status= new CLink(S_ENABLED, 'actionconf.php?group_disable=1&g_actionid%5B%5D='.$action_data['actionid'].url_param('eventsource'), 'enabled'); diff --git a/frontends/php/audit.php b/frontends/php/audit.php index b49b5628..d7316ae3 100644 --- a/frontends/php/audit.php +++ b/frontends/php/audit.php @@ -69,7 +69,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('a.clock',ZBX_SORT_DOWN); /* AJAX */ if(isset($_REQUEST['favobj'])){ diff --git a/frontends/php/discovery.php b/frontends/php/discovery.php index a0063a20..2e3bbd55 100644 --- a/frontends/php/discovery.php +++ b/frontends/php/discovery.php @@ -34,7 +34,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('dhostid',ZBX_SORT_UP); $r_form = new CForm(); $r_form->SetMethod('get'); diff --git a/frontends/php/discoveryconf.php b/frontends/php/discoveryconf.php index f4950b62..7ddefc61 100644 --- a/frontends/php/discoveryconf.php +++ b/frontends/php/discoveryconf.php @@ -33,45 +33,45 @@ include_once "include/page_header.php"; <?php // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields=array( - "druleid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form})&&{form}=="update"'), - "name"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), + 'druleid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form})&&{form}=="update"'), + 'name'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), 'proxy_hostid'=>array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({save})'), - "iprange"=> array(T_ZBX_IP_RANGE, O_OPT, null, NOT_EMPTY, 'isset({save})'), - "delay"=> array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), - "status"=> array(T_ZBX_INT, O_OPT, null, IN("0,1"), 'isset({save})'), + 'iprange'=> array(T_ZBX_IP_RANGE, O_OPT, null, NOT_EMPTY, 'isset({save})'), + 'delay'=> array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), + 'status'=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), 'isset({save})'), - "g_druleid"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + 'g_druleid'=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), - "dchecks"=> array(null, O_OPT, null, null, null), - "selected_checks"=> array(T_ZBX_INT, O_OPT, null, null, null), + 'dchecks'=> array(null, O_OPT, null, null, null), + 'selected_checks'=> array(T_ZBX_INT, O_OPT, null, null, null), - "new_check_type"=> array(T_ZBX_INT, O_OPT, null, + 'new_check_type'=> array(T_ZBX_INT, O_OPT, null, IN(array(SVC_SSH, SVC_LDAP, SVC_SMTP, SVC_FTP, SVC_HTTP, SVC_POP, SVC_NNTP, SVC_IMAP, SVC_TCP, SVC_AGENT, SVC_SNMPv1, SVC_SNMPv2, SVC_ICMPPING)), 'isset({add_check})'), - "new_check_ports"=> array(T_ZBX_PORTS, O_OPT, null, NOT_EMPTY, 'isset({add_check})'), - "new_check_key"=> array(T_ZBX_STR, O_OPT, null, null, 'isset({add_check})'), - "new_check_snmp_community"=> array(T_ZBX_STR, O_OPT, null, null, 'isset({add_check})'), + 'new_check_ports'=> array(T_ZBX_PORTS, O_OPT, null, NOT_EMPTY, 'isset({add_check})'), + 'new_check_key'=> array(T_ZBX_STR, O_OPT, null, null, 'isset({add_check})'), + 'new_check_snmp_community'=> array(T_ZBX_STR, O_OPT, null, null, 'isset({add_check})'), - "type_changed"=> array(T_ZBX_INT, O_OPT, null, IN(1), null), + 'type_changed'=> array(T_ZBX_INT, O_OPT, null, IN(1), null), /* actions */ - "add_check"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "delete_ckecks"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "group_enable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "group_disable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "group_delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "clone"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), + 'add_check'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'delete_ckecks'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'group_enable'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'group_disable'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'group_delete'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'save'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'clone'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'delete'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'cancel'=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), /* other */ - "form"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), - "form_refresh"=> array(T_ZBX_INT, O_OPT, null, null, null) + 'form'=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), + 'form_refresh'=> array(T_ZBX_INT, O_OPT, null, null, null) ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('d.name',ZBX_SORT_UP); $_REQUEST['dchecks'] = get_request('dchecks', array()); @@ -88,13 +88,11 @@ include_once "include/page_header.php"; if( !str_in_array($new_dcheck, $_REQUEST['dchecks'])) $_REQUEST['dchecks'][] = $new_dcheck; } - else if(inarr_isset(array('delete_ckecks', 'selected_checks'))) - { + else if(inarr_isset(array('delete_ckecks', 'selected_checks'))){ foreach($_REQUEST['selected_checks'] as $chk_id) unset($_REQUEST['dchecks'][$chk_id]); } - else if(inarr_isset('save')) - { + else if(inarr_isset('save')){ if(inarr_isset('druleid')) { /* update */ $msg_ok = S_DISCOVERY_RULE_UPDATED; diff --git a/frontends/php/exp_imp.php b/frontends/php/exp_imp.php index 181b6d7c..028b2d5f 100644 --- a/frontends/php/exp_imp.php +++ b/frontends/php/exp_imp.php @@ -61,7 +61,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('h.host',ZBX_SORT_UP); $preview = isset($_REQUEST['preview']) ? true : false; $config = get_request('config', 0); diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php index ea6f0287..3b5d50f9 100644 --- a/frontends/php/graphs.php +++ b/frontends/php/graphs.php @@ -84,7 +84,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('g.name',ZBX_SORT_UP); $options = array("allow_all_hosts","with_monitored_items","only_current_node","always_select_first_host"); validate_group_with_host(PERM_READ_WRITE,$options,'web.last.conf.groupid', 'web.last.conf.hostid'); diff --git a/frontends/php/hostprofiles.php b/frontends/php/hostprofiles.php index 543370a0..d42db41f 100644 --- a/frontends/php/hostprofiles.php +++ b/frontends/php/hostprofiles.php @@ -38,7 +38,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('h.host',ZBX_SORT_UP); validate_group(PERM_READ_ONLY, array("allow_all_hosts","always_select_first_host","monitored_hosts","with_items")); ?> diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php index 77cff0ba..303a7797 100644 --- a/frontends/php/hosts.php +++ b/frontends/php/hosts.php @@ -117,7 +117,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('h.host',ZBX_SORT_UP); if($_REQUEST["config"]==4) validate_group_with_host(PERM_READ_WRITE,array("always_select_first_host","only_current_node"),'web.last.conf.groupid', 'web.last.conf.hostid'); diff --git a/frontends/php/httpconf.php b/frontends/php/httpconf.php index e506c1fc..95a27cc3 100644 --- a/frontends/php/httpconf.php +++ b/frontends/php/httpconf.php @@ -24,8 +24,8 @@ require_once "include/httptest.inc.php"; require_once "include/forms.inc.php"; - $page["title"] = "S_CONFIGURATION_OF_WEB_MONITORING"; - $page["file"] = "httpconf.php"; + $page["title"] = "S_CONFIGURATION_OF_WEB_MONITORING"; + $page["file"] = "httpconf.php"; $page['hist_arg'] = array('groupid','hostid'); include_once "include/page_header.php"; @@ -76,14 +76,13 @@ include_once "include/page_header.php"; $_REQUEST["showdisabled"] = get_request("showdisabled", get_profile("web.httpconf.showdisabled", 0)); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('wt.name',ZBX_SORT_UP); $showdisabled = get_request("showdisabled", 0); $accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE); - if(isset($_REQUEST['hostid']) && !uint_in_array($_REQUEST['hostid'], explode(',',$accessible_hosts))) - { + if(isset($_REQUEST['hostid']) && !uint_in_array($_REQUEST['hostid'], explode(',',$accessible_hosts))){ unset($_REQUEST['hostid']); } @@ -94,78 +93,62 @@ include_once "include/page_header.php"; <?php $_REQUEST["applications"] = get_request("applications",get_profile("web.httpconf.applications",array()),PROFILE_TYPE_ARRAY); - if(isset($_REQUEST["open"])) - { - if(!isset($_REQUEST["applicationid"])) - { + if(isset($_REQUEST["open"])){ + if(!isset($_REQUEST["applicationid"])){ $_REQUEST["applications"] = array(); $show_all_apps = 1; } - elseif(!uint_in_array($_REQUEST["applicationid"],$_REQUEST["applications"])) - { + else if(!uint_in_array($_REQUEST["applicationid"],$_REQUEST["applications"])){ array_push($_REQUEST["applications"],$_REQUEST["applicationid"]); } - } elseif(isset($_REQUEST["close"])) - { - if(!isset($_REQUEST["applicationid"])) - { + } + else if(isset($_REQUEST["close"])){ + if(!isset($_REQUEST["applicationid"])){ $_REQUEST["applications"] = array(); } - elseif(($i=array_search($_REQUEST["applicationid"], $_REQUEST["applications"])) !== FALSE) - { + else if(($i=array_search($_REQUEST["applicationid"], $_REQUEST["applications"])) !== FALSE){ unset($_REQUEST["applications"][$i]); } } /* limit opened application count */ - while(count($_REQUEST["applications"]) > 25) - { + while(count($_REQUEST["applications"]) > 25){ array_shift($_REQUEST["applications"]); } - update_profile("web.httpconf.applications",$_REQUEST["applications"],PROFILE_TYPE_ARRAY); -?> -<?php - if(isset($_REQUEST['del_sel_step'])&&isset($_REQUEST['sel_step'])&&is_array($_REQUEST['sel_step'])) - { + + if(isset($_REQUEST['del_sel_step'])&&isset($_REQUEST['sel_step'])&&is_array($_REQUEST['sel_step'])){ foreach($_REQUEST['sel_step'] as $sid) if(isset($_REQUEST['steps'][$sid])) unset($_REQUEST['steps'][$sid]); } - else if(isset($_REQUEST['new_httpstep'])) - { + else if(isset($_REQUEST['new_httpstep'])){ $_REQUEST['steps'] = get_request('steps', array()); array_push($_REQUEST['steps'],$_REQUEST['new_httpstep']); } - else if(isset($_REQUEST['move_up']) && isset($_REQUEST['steps'][$_REQUEST['move_up']])) - { + else if(isset($_REQUEST['move_up']) && isset($_REQUEST['steps'][$_REQUEST['move_up']])){ $new_id = $_REQUEST['move_up'] - 1; - if(isset($_REQUEST['steps'][$new_id])) - { + if(isset($_REQUEST['steps'][$new_id])){ $tmp = $_REQUEST['steps'][$new_id]; $_REQUEST['steps'][$new_id] = $_REQUEST['steps'][$_REQUEST['move_up']]; $_REQUEST['steps'][$_REQUEST['move_up']] = $tmp; } } - else if(isset($_REQUEST['move_down']) && isset($_REQUEST['steps'][$_REQUEST['move_down']])) - { + else if(isset($_REQUEST['move_down']) && isset($_REQUEST['steps'][$_REQUEST['move_down']])){ $new_id = $_REQUEST['move_down'] + 1; - if(isset($_REQUEST['steps'][$new_id])) - { + if(isset($_REQUEST['steps'][$new_id])){ $tmp = $_REQUEST['steps'][$new_id]; $_REQUEST['steps'][$new_id] = $_REQUEST['steps'][$_REQUEST['move_down']]; $_REQUEST['steps'][$_REQUEST['move_down']] = $tmp; } } - else if(isset($_REQUEST["delete"])&&isset($_REQUEST["httptestid"])) - { + else if(isset($_REQUEST["delete"])&&isset($_REQUEST["httptestid"])){ $result = false; - if($httptest_data = get_httptest_by_httptestid($_REQUEST["httptestid"])) - { + if($httptest_data = get_httptest_by_httptestid($_REQUEST["httptestid"])){ $result = delete_httptest($_REQUEST["httptestid"]); } show_messages($result, S_SCENARIO_DELETED, S_CANNOT_DELETE_SCENARIO); @@ -178,13 +161,11 @@ include_once "include/page_header.php"; unset($_REQUEST["httptestid"]); unset($_REQUEST["form"]); } - else if(isset($_REQUEST["clone"]) && isset($_REQUEST["httptestid"])) - { + else if(isset($_REQUEST["clone"]) && isset($_REQUEST["httptestid"])){ unset($_REQUEST["httptestid"]); $_REQUEST["form"] = "clone"; } - else if(isset($_REQUEST["save"])) - { + else if(isset($_REQUEST["save"])){ /* $delay_flex = get_request('delay_flex',array()); $db_delay_flex = ""; @@ -193,8 +174,7 @@ include_once "include/page_header.php"; $db_delay_flex = trim($db_delay_flex,";"); // for future use */ - if(isset($_REQUEST["httptestid"])) - { + if(isset($_REQUEST["httptestid"])){ $result = update_httptest($_REQUEST["httptestid"], $_REQUEST['hostid'], $_REQUEST["application"], $_REQUEST["name"],$_REQUEST["delay"],$_REQUEST["status"],$_REQUEST["agent"], $_REQUEST["macros"],$_REQUEST["steps"]); @@ -204,8 +184,7 @@ include_once "include/page_header.php"; show_messages($result, S_SCENARIO_UPDATED, S_CANNOT_UPDATE_SCENARIO); } - else - { + else{ $httptestid = add_httptest($_REQUEST['hostid'],$_REQUEST["application"], $_REQUEST["name"],$_REQUEST["delay"],$_REQUEST["status"],$_REQUEST["agent"], $_REQUEST["macros"],$_REQUEST["steps"]); @@ -224,19 +203,15 @@ include_once "include/page_header.php"; unset($_REQUEST["form"]); } } - elseif(isset($_REQUEST["group_task"])&&isset($_REQUEST["group_httptestid"])) - { - if($_REQUEST["group_task"]=="Delete selected") - { + else if(isset($_REQUEST["group_task"])&&isset($_REQUEST["group_httptestid"])){ + if($_REQUEST["group_task"]=="Delete selected"){ $result = false; $group_httptestid = $_REQUEST["group_httptestid"]; - foreach($group_httptestid as $id) - { + foreach($group_httptestid as $id){ if(!($httptest_data = get_httptest_by_httptestid($id))) continue; /* if($httptest_data["templateid"]<>0) continue; // for future use */ - if(delete_httptest($id)) - { + if(delete_httptest($id)){ $result = true; $host = get_host_by_applicationid($httptest_data["applicationid"]); @@ -247,17 +222,14 @@ include_once "include/page_header.php"; } show_messages($result, S_SCENARIO_DELETED, null); } - else if($_REQUEST["group_task"] == S_ACTIVATE_SELECTED) - { + else if($_REQUEST["group_task"] == S_ACTIVATE_SELECTED){ $result = false; $group_httptestid = $_REQUEST["group_httptestid"]; - foreach($group_httptestid as $id) - { + foreach($group_httptestid as $id){ if(!($httptest_data = get_httptest_by_httptestid($id))) continue; - if(activate_httptest($id)) - { + if(activate_httptest($id)){ $result = true; $host = get_host_by_applicationid($httptest_data["applicationid"]); @@ -269,17 +241,14 @@ include_once "include/page_header.php"; } show_messages($result, S_SCENARIO_ACTIVATED, null); } - elseif($_REQUEST["group_task"]== S_DISABLE_SELECTED) - { + else if($_REQUEST["group_task"]== S_DISABLE_SELECTED){ $result = false; $group_httptestid = $_REQUEST["group_httptestid"]; - foreach($group_httptestid as $id) - { + foreach($group_httptestid as $id){ if(!($httptest_data = get_httptest_by_httptestid($id))) continue; - if(disable_httptest($id)) - { + if(disable_httptest($id)){ $result = true; $host = get_host_by_applicationid($httptest_data["applicationid"]); @@ -291,17 +260,14 @@ include_once "include/page_header.php"; } show_messages($result, S_SCENARIO_DISABLED, null); } - elseif($_REQUEST["group_task"]== S_CLEAN_HISTORY_SELECTED_SCENARIOS) - { + else if($_REQUEST["group_task"]== S_CLEAN_HISTORY_SELECTED_SCENARIOS){ $result = false; $group_httptestid = $_REQUEST["group_httptestid"]; - foreach($group_httptestid as $id) - { + foreach($group_httptestid as $id){ if(!($httptest_data = get_httptest_by_httptestid($id))) continue; - if(delete_history_by_httptestid($id)) - { + if(delete_history_by_httptestid($id)){ $result = true; DBexecute("update httptest set nextcheck=0". /* ",lastvalue=null,lastclock=null,prevvalue=null". // for future use */ @@ -321,12 +287,9 @@ include_once "include/page_header.php"; <?php /* make steps with unique names */ $_REQUEST['steps'] = get_request('steps',array()); - foreach($_REQUEST['steps'] as $s1id => $s1) - { - foreach($_REQUEST['steps'] as $s2id => $s2) - { - if((strcmp($s1['name'],$s2['name'])==0) && $s1id != $s2id) - { + foreach($_REQUEST['steps'] as $s1id => $s1){ + foreach($_REQUEST['steps'] as $s2id => $s2){ + if((strcmp($s1['name'],$s2['name'])==0) && $s1id != $s2id){ $_REQUEST['steps'][$s1id] = $_REQUEST['steps'][$s2id]; unset($_REQUEST['steps'][$s2id]); } @@ -345,11 +308,11 @@ include_once "include/page_header.php"; echo SBR; $db_hosts=DBselect('select hostid from hosts where '.DBin_node('hostid')); - if(isset($_REQUEST["form"])&&isset($_REQUEST["hostid"])&&DBfetch($db_hosts)) - { + if(isset($_REQUEST["form"])&&isset($_REQUEST["hostid"])&&DBfetch($db_hosts)){ // FORM insert_httptest_form(); - } else { + } + else { // Table HEADER $form = new CForm(); @@ -363,30 +326,34 @@ include_once "include/page_header.php"; $cmbGroup = new CComboBox("groupid",$_REQUEST["groupid"],"submit();"); $cmbGroup->AddItem(0,S_ALL_SMALL); - $result=DBselect("select distinct g.groupid,g.name from groups g,hosts_groups hg". - " where g.groupid=hg.groupid and hg.hostid in (".$accessible_hosts.") ". - " order by name"); - while($row=DBfetch($result)) - { + $result=DBselect('select distinct g.groupid,g.name '. + ' from groups g,hosts_groups hg '. + ' where g.groupid=hg.groupid '. + ' and hg.hostid in ('.$accessible_hosts.') '. + ' order by name'); + while($row=DBfetch($result)){ $cmbGroup->AddItem($row["groupid"],$row["name"]); } $form->AddItem(S_GROUP.SPACE); $form->AddItem($cmbGroup); - if(isset($_REQUEST["groupid"]) && $_REQUEST["groupid"]>0) - { - $sql="select distinct h.hostid,h.host from hosts h,hosts_groups hg". - " where hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid ". - ' and h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.','.HOST_STATUS_TEMPLATE.')'. - " and h.hostid in (".$accessible_hosts.") ". - " group by h.hostid,h.host order by h.host"; + if(isset($_REQUEST["groupid"]) && $_REQUEST["groupid"]>0){ + $sql='select distinct h.hostid,h.host '. + ' from hosts h,hosts_groups hg '. + ' where hg.groupid='.$_REQUEST["groupid"]. + ' and hg.hostid=h.hostid '. + ' and h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.','.HOST_STATUS_TEMPLATE.') '. + ' and h.hostid in ('.$accessible_hosts.') '. + ' group by h.hostid,h.host '. + ' order by h.host'; } - else - { - $sql="select distinct h.hostid,h.host from hosts h". - ' where h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.','.HOST_STATUS_TEMPLATE.')'. - " and h.hostid in (".$accessible_hosts.")". - " group by h.hostid,h.host order by h.host"; + else{ + $sql='select distinct h.hostid,h.host '. + ' from hosts h '. + ' where h.status in ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.','.HOST_STATUS_TEMPLATE.') '. + ' and h.hostid in ('.$accessible_hosts.') '. + ' group by h.hostid,h.host '. + ' order by h.host'; } $result=DBselect($sql); @@ -396,8 +363,7 @@ include_once "include/page_header.php"; unset($correct_hostid); $first_hostid = -1; - while($row=DBfetch($result)) - { + while($row=DBfetch($result)){ $cmbHosts->AddItem($row["hostid"],$row["host"]); if($_REQUEST["hostid"]!=0){ @@ -421,13 +387,9 @@ include_once "include/page_header.php"; $form->AddVar('hostid',$_REQUEST["hostid"]); if(isset($show_all_apps)) - $link = new CLink(new CImg("images/general/opened.gif"), - "?close=1". - url_param("groupid").url_param("hostid")); + $link = new CLink(new CImg("images/general/opened.gif"),'?close=1'.url_param("groupid").url_param("hostid")); else - $link = new CLink(new CImg("images/general/closed.gif"), - "?open=1". - url_param("groupid").url_param("hostid")); + $link = new CLink(new CImg("images/general/closed.gif"),'?open=1'.url_param("groupid").url_param("hostid")); $table = new CTableInfo(); $table->setHeader(array( @@ -444,9 +406,9 @@ include_once "include/page_header.php"; ' FROM applications a,hosts h '. ' WHERE a.hostid=h.hostid '. ' AND h.hostid='.$_REQUEST['hostid']. - ' order by a.name,a.applicationid,h.host'); - while($db_app = DBfetch($db_applications)) - { + ' ORDER BY a.name,a.applicationid,h.host'); + + while($db_app = DBfetch($db_applications)){ $db_httptests = DBselect('SELECT wt.*,a.name as application,h.host,h.hostid '. ' FROM httptest wt '. ' LEFT JOIN applications a ON wt.applicationid=a.applicationid '. @@ -457,8 +419,7 @@ include_once "include/page_header.php"; $app_rows = array(); $httptest_cnt = 0; - while($httptest_data = DBfetch($db_httptests)) - { + while($httptest_data = DBfetch($db_httptests)){ ++$httptest_cnt; if(!uint_in_array($db_app["applicationid"],$_REQUEST["applications"]) && !isset($show_all_apps)) continue; diff --git a/frontends/php/httpmon.php b/frontends/php/httpmon.php index 0b163361..ef3bde46 100644 --- a/frontends/php/httpmon.php +++ b/frontends/php/httpmon.php @@ -24,9 +24,10 @@ require_once "include/httptest.inc.php"; require_once "include/forms.inc.php"; - $page["title"] = "S_STATUS_OF_WEB_MONITORING"; - $page["file"] = "httpmon.php"; + $page["title"] = "S_STATUS_OF_WEB_MONITORING"; + $page["file"] = "httpmon.php"; $page['hist_arg'] = array('open','groupid','hostid'); + define('ZBX_PAGE_DO_REFRESH', 1); include_once "include/page_header.php"; @@ -46,7 +47,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('wt.name',ZBX_SORT_DOWN); $options = array('allow_all_hosts','monitored_hosts');//,'always_select_first_host' diff --git a/frontends/php/items.php b/frontends/php/items.php index 730cc7dc..33ed8a85 100644 --- a/frontends/php/items.php +++ b/frontends/php/items.php @@ -24,8 +24,8 @@ require_once "include/items.inc.php"; require_once "include/forms.inc.php"; - $page["title"] = "S_CONFIGURATION_OF_ITEMS"; - $page["file"] = "items.php"; + $page["title"] = "S_CONFIGURATION_OF_ITEMS"; + $page["file"] = "items.php"; $page['hist_arg'] = array(); include_once "include/page_header.php"; @@ -33,146 +33,144 @@ include_once "include/page_header.php"; <?php // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields=array( - "external_filter"=> array(T_ZBX_STR, O_OPT, null, null, null), - "selection_mode"=> array(T_ZBX_INT, O_OPT, null, IN("0,1"), null), - - "type_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "community_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "securityname_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "securitylevel_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "authpassphrase_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "privpassphras_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "port_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "value_type_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "units_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "formula_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "delay_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "delay_flex_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "history_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "trends_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "status_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "logtimefmt_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "delta_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "valuemapid_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "trapper_hosts_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - "applications_visible"=> array(T_ZBX_STR, O_OPT, null, null, null), - - "with_node"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_group"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_host"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_application"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_description"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_type"=> array(T_ZBX_INT, O_OPT, null, + 'external_filter'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'selection_mode'=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), + + 'type_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'community_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'securityname_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'securitylevel_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'authpassphrase_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'privpassphras_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'port_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'value_type_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'units_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'formula_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'delay_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'delay_flex_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'history_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'trends_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'status_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'logtimefmt_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'delta_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'valuemapid_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'trapper_hosts_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + 'applications_visible'=> array(T_ZBX_STR, O_OPT, null, null, null), + + 'with_node'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_group'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_host'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_application'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_description'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_type'=> array(T_ZBX_INT, O_OPT, null, IN(array(-1,ITEM_TYPE_ZABBIX,ITEM_TYPE_SNMPV1,ITEM_TYPE_TRAPPER,ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV2C,ITEM_TYPE_INTERNAL,ITEM_TYPE_SNMPV3,ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_AGGREGATE,ITEM_TYPE_HTTPTEST,ITEM_TYPE_EXTERNAL,ITEM_TYPE_DB_MONITOR)),null), - "with_key"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_snmp_community"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_snmp_oid"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_snmp_port"=> array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0,65535), null), - "with_snmpv3_securityname"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_snmpv3_securitylevel"=> array(T_ZBX_INT, O_OPT, null, IN("-1,0,1,2"), null), - "with_snmpv3_authpassphrase"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_snmpv3_privpassphrase"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_value_type"=> array(T_ZBX_INT, O_OPT, null, IN("-1,0,1,2,3,4"),null), - "with_units"=> array(T_ZBX_STR, O_OPT, null, P_UNSET_EMPTY, null, null), - "with_formula"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_delay"=> array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0,86400),null), - "with_history"=> array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0,65535),null), - "with_trends"=> array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0,65535),null), - "with_status"=> array(T_ZBX_INT, O_OPT, null, IN("-1,0,1,3"),null), - "with_logtimefmt"=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - "with_delta"=> array(T_ZBX_INT, O_OPT, null, IN("-1,0,1,2"), null), - "with_trapper_hosts"=>array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), - - "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,null), - "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,'isset({save})'), - - "add_groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '(isset({register})&&({register}=="go"))'), - "action"=> array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, '(isset({register})&&({register}=="go"))'), - - "copy_type" =>array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), 'isset({copy})'), - "copy_mode" =>array(T_ZBX_INT, O_OPT, P_SYS, IN("0"),null), - - "itemid"=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), - "description"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), - "key"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), - "delay"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,86400),'isset({save})&&(isset({type})&&({type}!=2))'), - "new_delay_flex"=> array(T_ZBX_STR, O_OPT, NOT_EMPTY, "",'isset({add_delay_flex})&&(isset({type})&&({type}!=2))'), - "rem_delay_flex"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,86400),null), - "delay_flex"=> array(T_ZBX_STR, O_OPT, null, "",null), - "history"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535),'isset({save})'), - "status"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535),'isset({save})'), - "type"=> array(T_ZBX_INT, O_OPT, null, + 'with_key'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_snmp_community'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_snmp_oid'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_snmp_port'=> array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0,65535), null), + 'with_snmpv3_securityname'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_snmpv3_securitylevel'=> array(T_ZBX_INT, O_OPT, null, IN('-1,0,1,2'), null), + 'with_snmpv3_authpassphrase'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_snmpv3_privpassphrase'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_value_type'=> array(T_ZBX_INT, O_OPT, null, IN('-1,0,1,2,3,4'),null), + 'with_units'=> array(T_ZBX_STR, O_OPT, null, P_UNSET_EMPTY, null, null), + 'with_formula'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_delay'=> array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0,86400),null), + 'with_history'=> array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0,65535),null), + 'with_trends'=> array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, BETWEEN(0,65535),null), + 'with_status'=> array(T_ZBX_INT, O_OPT, null, IN('-1,0,1,3'),null), + 'with_logtimefmt'=> array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + 'with_delta'=> array(T_ZBX_INT, O_OPT, null, IN('-1,0,1,2'), null), + 'with_trapper_hosts'=>array(T_ZBX_STR, O_OPT, P_UNSET_EMPTY, null, null), + + 'groupid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,null), + 'hostid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,'isset({save})'), + + 'add_groupid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '(isset({register})&&({register}=="go"))'), + 'action'=> array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, '(isset({register})&&({register}=="go"))'), + + 'copy_type' =>array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), 'isset({copy})'), + 'copy_mode' =>array(T_ZBX_INT, O_OPT, P_SYS, IN('0'),null), + + 'itemid'=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), + 'description'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), + 'key'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), + 'delay'=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,86400),'isset({save})&&(isset({type})&&({type}!=2))'), + 'new_delay_flex'=> array(T_ZBX_STR, O_OPT, NOT_EMPTY, '','isset({add_delay_flex})&&(isset({type})&&({type}!=2))'), + 'rem_delay_flex'=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,86400),null), + 'delay_flex'=> array(T_ZBX_STR, O_OPT, null, '',null), + 'history'=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535),'isset({save})'), + 'status'=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535),'isset({save})'), + 'type'=> array(T_ZBX_INT, O_OPT, null, IN(array(-1,ITEM_TYPE_ZABBIX,ITEM_TYPE_SNMPV1,ITEM_TYPE_TRAPPER,ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV2C,ITEM_TYPE_INTERNAL,ITEM_TYPE_SNMPV3,ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_AGGREGATE,ITEM_TYPE_HTTPTEST,ITEM_TYPE_EXTERNAL,ITEM_TYPE_DB_MONITOR)),'isset({save})'), - "trends"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535), 'isset({save})'), - "value_type"=> array(T_ZBX_INT, O_OPT, null, IN("0,1,2,3,4"), 'isset({save})'), - "valuemapid"=> array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({save})'), - "params"=> array(T_ZBX_STR, O_OPT, NULL, NULL,'isset({save})'), - - "snmp_community"=>array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&'.IN("1,4","type")), - "snmp_oid"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&'.IN("1,4,6","type")), - "snmp_port"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535), 'isset({save})&&isset({type})&&'.IN("1,4,6","type")), - - "snmpv3_securitylevel"=>array(T_ZBX_INT, O_OPT, null, IN("0,1,2"), 'isset({save})&&(isset({type})&&({type}==6))'), - "snmpv3_securityname"=>array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==6))'), - "snmpv3_authpassphrase"=>array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==6))'), - "snmpv3_privpassphrase"=>array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==6))'), - - "trapper_hosts"=>array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&({type}==2)'), - "units"=> array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&'.IN("0,3","type")), - "multiplier"=> array(T_ZBX_INT, O_OPT, null, IN("0,1"), 'isset({save})&&isset({type})&&'.IN("0,3","type")), - "delta"=> array(T_ZBX_INT, O_OPT, null, IN("0,1,2"), 'isset({save})&&isset({type})&&'.IN("0,3","type")), - - "formula"=> array(T_ZBX_DBL, O_OPT, null, null, 'isset({save})&&(isset({multiplier})&&({multiplier}==1))'), - "logtimefmt"=> array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({value_type})&&({value_type}==2))'), + 'trends'=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535), 'isset({save})'), + 'value_type'=> array(T_ZBX_INT, O_OPT, null, IN('0,1,2,3,4'), 'isset({save})'), + 'valuemapid'=> array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({save})'), + 'params'=> array(T_ZBX_STR, O_OPT, NULL, NULL,'isset({save})'), + + 'snmp_community'=>array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&'.IN('1,4','type')), + 'snmp_oid'=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})&&isset({type})&&'.IN('1,4,6','type')), + 'snmp_port'=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535), 'isset({save})&&isset({type})&&'.IN('1,4,6','type')), + + 'snmpv3_securitylevel'=>array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({save})&&(isset({type})&&({type}==6))'), + 'snmpv3_securityname'=>array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==6))'), + 'snmpv3_authpassphrase'=>array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==6))'), + 'snmpv3_privpassphrase'=>array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({type})&&({type}==6))'), + + 'trapper_hosts'=>array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&({type}==2)'), + 'units'=> array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&isset({type})&&'.IN('0,3','type')), + 'multiplier'=> array(T_ZBX_INT, O_OPT, null, IN('0,1'), 'isset({save})&&isset({type})&&'.IN('0,3','type')), + 'delta'=> array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), 'isset({save})&&isset({type})&&'.IN('0,3','type')), + + 'formula'=> array(T_ZBX_DBL, O_OPT, null, null, 'isset({save})&&(isset({multiplier})&&({multiplier}==1))'), + 'logtimefmt'=> array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&(isset({value_type})&&({value_type}==2))'), - "group_itemid"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), - "copy_targetid"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), - "filter_groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({copy})&&(isset({copy_type})&&({copy_type}==0))'), - "applications"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + 'group_itemid'=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + 'copy_targetid'=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + 'filter_groupid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({copy})&&(isset({copy_type})&&({copy_type}==0))'), + 'applications'=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), - "showdisabled"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), null), + 'showdisabled'=> array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), - "del_history"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "add_delay_flex"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "del_delay_flex"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - - "register"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "group_task"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "clone"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "update"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "copy"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "select"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), - "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), - "form"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), - "form_copy_to"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), - "form_mass_update"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), - "form_refresh"=> array(T_ZBX_INT, O_OPT, null, null, null) + 'del_history'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'add_delay_flex'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'del_delay_flex'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + + 'register'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'group_task'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'save'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'clone'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'update'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'copy'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'select'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'delete'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null), + 'cancel'=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), + 'form'=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), + 'form_copy_to'=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), + 'form_mass_update'=> array(T_ZBX_STR, O_OPT, P_SYS, null, null), + 'form_refresh'=> array(T_ZBX_INT, O_OPT, null, null, null) ); - $_REQUEST["showdisabled"] = get_request("showdisabled", get_profile("web.items.showdisabled", 0)); + $_REQUEST['showdisabled'] = get_request('showdisabled', get_profile('web.items.showdisabled', 0)); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('i.description',ZBX_SORT_UP); - $showdisabled = get_request("showdisabled", 0); + $showdisabled = get_request('showdisabled', 0); $accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE); - if(isset($_REQUEST['hostid']) && !uint_in_array($_REQUEST['hostid'], explode(',',$accessible_hosts))) - { + if(isset($_REQUEST['hostid']) && !uint_in_array($_REQUEST['hostid'], explode(',',$accessible_hosts))){ unset($_REQUEST['hostid']); } - validate_group_with_host(PERM_READ_WRITE,array("always_select_first_host","only_current_node"), - 'web.last.conf.groupid', 'web.last.conf.hostid'); + validate_group_with_host(PERM_READ_WRITE,array('always_select_first_host','only_current_node'),'web.last.conf.groupid', 'web.last.conf.hostid'); - update_profile("web.items.showdisabled",$showdisabled); + update_profile('web.items.showdisabled',$showdisabled); ?> <?php $result = 0; @@ -186,9 +184,9 @@ include_once "include/page_header.php"; unset($_REQUEST['delay_flex'][$val]); } } - else if(isset($_REQUEST["add_delay_flex"])&&isset($_REQUEST["new_delay_flex"])){ - $_REQUEST['delay_flex'] = get_request("delay_flex", array()); - array_push($_REQUEST['delay_flex'],$_REQUEST["new_delay_flex"]); + else if(isset($_REQUEST['add_delay_flex'])&&isset($_REQUEST['new_delay_flex'])){ + $_REQUEST['delay_flex'] = get_request('delay_flex', array()); + array_push($_REQUEST['delay_flex'],$_REQUEST['new_delay_flex']); } else if(isset($_REQUEST["delete"])&&isset($_REQUEST["itemid"])){ $result = false; @@ -836,4 +834,4 @@ include_once "include/page_header.php"; include_once "include/page_footer.php" -?> +?>
\ No newline at end of file diff --git a/frontends/php/latest.php b/frontends/php/latest.php index 78f9957b..e834efae 100644 --- a/frontends/php/latest.php +++ b/frontends/php/latest.php @@ -47,7 +47,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('i.description',ZBX_SORT_UP); $options = array("allow_all_hosts","monitored_hosts","with_monitored_items");//,"always_select_first_host"); if(!$ZBX_WITH_SUBNODES) array_push($options,"only_current_node"); diff --git a/frontends/php/locales.php b/frontends/php/locales.php index bef17b1b..f3a76774 100644 --- a/frontends/php/locales.php +++ b/frontends/php/locales.php @@ -32,7 +32,7 @@ else{ $page['hist_arg'] = array(''); } -define('ZBX_ALLOW_UNICODE',1); +if(!defined('ZBX_ALLOW_UNICODE')) define('ZBX_ALLOW_UNICODE',1); include_once "include/page_header.php"; diff --git a/frontends/php/media_types.php b/frontends/php/media_types.php index fd6463c0..be2d3aad 100644 --- a/frontends/php/media_types.php +++ b/frontends/php/media_types.php @@ -35,27 +35,16 @@ include_once "include/page_header.php"; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION // media form - "mediatypeid"=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID, - '(isset({form})&&({form}=="update"))'), - "type"=> array(T_ZBX_INT, O_OPT, NULL, IN(implode(',', - array(ALERT_TYPE_EMAIL,ALERT_TYPE_EXEC,ALERT_TYPE_SMS,ALERT_TYPE_JABBER))), - '(isset({save}))'), - "description"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, - '(isset({save}))'), - "smtp_server"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, - 'isset({type})&&({type}=='.ALERT_TYPE_EMAIL.')&&isset({save})'), - "smtp_helo"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, - 'isset({type})&&({type}=='.ALERT_TYPE_EMAIL.')&&isset({save})'), - "smtp_email"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, - 'isset({type})&&({type}=='.ALERT_TYPE_EMAIL.')&&isset({save})'), - "exec_path"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, - 'isset({type})&&({type}=='.ALERT_TYPE_EXEC.')&&isset({save})'), - "gsm_modem"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, - 'isset({type})&&({type}=='.ALERT_TYPE_SMS.')&&isset({save})'), - "username"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, - '(isset({type})&&{type}=='.ALERT_TYPE_JABBER.')&&isset({save})'), - "password"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, - 'isset({type})&&({type}=='.ALERT_TYPE_JABBER.')&&isset({save})'), + "mediatypeid"=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID,'(isset({form})&&({form}=="update"))'), + "type"=> array(T_ZBX_INT, O_OPT, NULL, IN(implode(',',array(ALERT_TYPE_EMAIL,ALERT_TYPE_EXEC,ALERT_TYPE_SMS,ALERT_TYPE_JABBER))),'(isset({save}))'), + "description"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'(isset({save}))'), + "smtp_server"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({type})&&({type}=='.ALERT_TYPE_EMAIL.')&&isset({save})'), + "smtp_helo"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({type})&&({type}=='.ALERT_TYPE_EMAIL.')&&isset({save})'), + "smtp_email"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({type})&&({type}=='.ALERT_TYPE_EMAIL.')&&isset({save})'), + "exec_path"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({type})&&({type}=='.ALERT_TYPE_EXEC.')&&isset({save})'), + "gsm_modem"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({type})&&({type}=='.ALERT_TYPE_SMS.')&&isset({save})'), + "username"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'(isset({type})&&{type}=='.ALERT_TYPE_JABBER.')&&isset({save})'), + "password"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({type})&&({type}=='.ALERT_TYPE_JABBER.')&&isset({save})'), /* actions */ "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), @@ -66,16 +55,14 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('mt.description',ZBX_SORT_UP); ?> <?php /* MEDIATYPE ACTIONS */ $result = 0; - if(isset($_REQUEST["save"])) - { - if(isset($_REQUEST["mediatypeid"])) - { + if(isset($_REQUEST["save"])){ + if(isset($_REQUEST["mediatypeid"])){ /* UPDATE */ $action = AUDIT_ACTION_UPDATE; $result=update_mediatype($_REQUEST["mediatypeid"], @@ -85,8 +72,7 @@ include_once "include/page_header.php"; show_messages($result, S_MEDIA_TYPE_UPDATED, S_MEDIA_TYPE_WAS_NOT_UPDATED); } - else - { + else{ /* ADD */ $action = AUDIT_ACTION_ADD; $result=add_mediatype( diff --git a/frontends/php/screenconf.php b/frontends/php/screenconf.php index bcb05aec..defcb9d1 100644 --- a/frontends/php/screenconf.php +++ b/frontends/php/screenconf.php @@ -67,7 +67,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('s.name',ZBX_SORT_UP); $config = $_REQUEST['config'] = get_request('config', 0); diff --git a/frontends/php/scripts.php b/frontends/php/scripts.php index 95875cf5..e6fa7b1e 100644 --- a/frontends/php/scripts.php +++ b/frontends/php/scripts.php @@ -198,6 +198,8 @@ if(isset($_REQUEST['form'])){ $frmScr->Show(); } else { + validate_sort_and_sortorder('s.name',ZBX_SORT_UP); + $form = new CForm(); $form->SetName('scripts'); $form->AddOption('id','scripts'); @@ -206,8 +208,8 @@ else { $table=new CTableInfo(S_NO_SCRIPTS_DEFINED); $table->setHeader(array( - array(new CCheckBox('all_scripts',null,"CheckAll('".$form->GetName()."','all_scripts');"),S_NAME), - S_COMMAND, + array(new CCheckBox('all_scripts',null,"CheckAll('".$form->GetName()."','all_scripts');"),make_sorting_link(S_NAME,'s.name')), + make_sorting_link(S_COMMAND,'s.command'), S_USER_GROUP, S_HOST_GROUP, S_HOST_ACCESS @@ -217,7 +219,7 @@ else { $sql = 'SELECT s.* '. ' FROM scripts s '. ' WHERE '.DBin_node('s.scriptid'). - ' ORDER BY s.scriptid ASC'; + order_by('s.name,s.command'); $scripts=DBselect($sql); diff --git a/frontends/php/sysmaps.php b/frontends/php/sysmaps.php index abe5a767..b7436d9f 100644 --- a/frontends/php/sysmaps.php +++ b/frontends/php/sysmaps.php @@ -53,7 +53,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('sm.name',ZBX_SORT_UP); if(isset($_REQUEST["sysmapid"])) { diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php index 21f92cc3..6e0ae0cc 100644 --- a/frontends/php/tr_status.php +++ b/frontends/php/tr_status.php @@ -102,7 +102,7 @@ include_once "include/page_header.php"; ); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('t.lastchange',ZBX_SORT_DOWN); $_REQUEST['show_triggers'] = get_request('show_triggers', get_profile('web.tr_status.show_triggers', TRIGGERS_OPTION_ONLYTRUE)); $_REQUEST['show_events'] = get_request('show_events',get_profile('web.tr_status.show_events', EVENTS_OPTION_NOEVENT)); diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php index e636430c..e53b2599 100644 --- a/frontends/php/triggers.php +++ b/frontends/php/triggers.php @@ -36,76 +36,76 @@ include_once "include/page_header.php"; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields=array( - "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,NULL), - "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,'isset({save})'), + 'groupid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,NULL), + 'hostid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,'isset({save})'), - "triggerid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,'(isset({form})&&({form}=="update"))'), + 'triggerid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,'(isset({form})&&({form}=="update"))'), - "copy_type" =>array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"),'isset({copy})'), - "copy_mode" =>array(T_ZBX_INT, O_OPT, P_SYS, IN("0"),NULL), + 'copy_type' =>array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'),'isset({copy})'), + 'copy_mode' =>array(T_ZBX_INT, O_OPT, P_SYS, IN('0'),NULL), 'type'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1'), 'isset({save})'), - "description"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({save})'), - "expression"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({save})'), - "priority"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1,2,3,4,5"),'isset({save})'), - "comments"=> array(T_ZBX_STR, O_OPT, NULL, NULL,'isset({save})'), - "url"=> array(T_ZBX_STR, O_OPT, NULL, NULL,'isset({save})'), - "status"=> array(T_ZBX_STR, O_OPT, NULL, NULL,NULL), - - "dependencies"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), - "new_dependence"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID.'{}>0','isset({add_dependence})'), - "rem_dependence"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), - - "g_triggerid"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), - "copy_targetid"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), - "filter_groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({copy})&&(isset({copy_type})&&({copy_type}==0))'), - - "showdisabled"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), NULL), + 'description'=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({save})'), + 'expression'=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({save})'), + 'priority'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1,2,3,4,5'),'isset({save})'), + 'comments'=> array(T_ZBX_STR, O_OPT, NULL, NULL,'isset({save})'), + 'url'=> array(T_ZBX_STR, O_OPT, NULL, NULL,'isset({save})'), + 'status'=> array(T_ZBX_STR, O_OPT, NULL, NULL,NULL), + + 'dependencies'=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), + 'new_dependence'=> array(T_ZBX_INT, O_OPT, NULL, DB_ID.'{}>0','isset({add_dependence})'), + 'rem_dependence'=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), + + 'g_triggerid'=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), + 'copy_targetid'=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, NULL), + 'filter_groupid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({copy})&&(isset({copy_type})&&({copy_type}==0))'), + + 'showdisabled'=> array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), NULL), /* actions */ - "add_dependence"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "del_dependence"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "group_enable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "group_disable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "group_delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "copy"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "clone"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), - "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), + 'add_dependence'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'del_dependence'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'group_enable'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'group_disable'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'group_delete'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'copy'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'clone'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'save'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'delete'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + 'cancel'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), /* other */ - "form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), - "form_copy_to"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), - "form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL) + 'form'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), + 'form_copy_to'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), + 'form_refresh'=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL) ); - $_REQUEST["showdisabled"] = get_request("showdisabled", get_profile("web.triggers.showdisabled", 0)); + $_REQUEST['showdisabled'] = get_request('showdisabled', get_profile('web.triggers.showdisabled', 0)); check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('t.description',ZBX_SORT_UP); - if(isset($_REQUEST["triggerid"])) - if(!check_right_on_trigger_by_triggerid(PERM_READ_WRITE, $_REQUEST["triggerid"])) + if(isset($_REQUEST['triggerid'])) + if(!check_right_on_trigger_by_triggerid(PERM_READ_WRITE, $_REQUEST['triggerid'])) access_deny(); - $showdisabled = get_request("showdisabled", 0); + $showdisabled = get_request('showdisabled', 0); - validate_group_with_host(PERM_READ_WRITE,array("allow_all_hosts","always_select_first_host","with_items","only_current_node"), + validate_group_with_host(PERM_READ_WRITE,array('allow_all_hosts','always_select_first_host','with_items','only_current_node'), 'web.last.conf.groupid', 'web.last.conf.hostid'); ?> <?php - update_profile("web.triggers.showdisabled",$showdisabled); + update_profile('web.triggers.showdisabled',$showdisabled); $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY); /* FORM ACTIONS */ - if(isset($_REQUEST["clone"]) && isset($_REQUEST["triggerid"])){ - unset($_REQUEST["triggerid"]); - $_REQUEST["form"] = "clone"; + if(isset($_REQUEST['clone']) && isset($_REQUEST['triggerid'])){ + unset($_REQUEST['triggerid']); + $_REQUEST['form'] = 'clone'; } - else if(isset($_REQUEST["save"])){ + else if(isset($_REQUEST['save'])){ show_messages(); - if(!check_right_on_trigger_by_expression(PERM_READ_WRITE, $_REQUEST["expression"])) + if(!check_right_on_trigger_by_expression(PERM_READ_WRITE, $_REQUEST['expression'])) access_deny(); $now=time(); @@ -114,31 +114,31 @@ include_once "include/page_header.php"; $type = $_REQUEST['type']; - $deps = get_request("dependencies",array()); + $deps = get_request('dependencies',array()); - if(isset($_REQUEST["triggerid"])){ - $trigger_data = get_trigger_by_triggerid($_REQUEST["triggerid"]); + if(isset($_REQUEST['triggerid'])){ + $trigger_data = get_trigger_by_triggerid($_REQUEST['triggerid']); if($trigger_data['templateid']){ - $_REQUEST["description"] = $trigger_data["description"]; - $_REQUEST["expression"] = explode_exp($trigger_data["expression"],0); + $_REQUEST['description'] = $trigger_data['description']; + $_REQUEST['expression'] = explode_exp($trigger_data['expression'],0); } DBstart(); - $result=update_trigger($_REQUEST["triggerid"], - $_REQUEST["expression"],$_REQUEST["description"],$type, - $_REQUEST["priority"],$status,$_REQUEST["comments"],$_REQUEST["url"], + $result=update_trigger($_REQUEST['triggerid'], + $_REQUEST['expression'],$_REQUEST['description'],$type, + $_REQUEST['priority'],$status,$_REQUEST['comments'],$_REQUEST['url'], $deps, $trigger_data['templateid']); $result = DBend(); - $triggerid = $_REQUEST["triggerid"]; + $triggerid = $_REQUEST['triggerid']; $audit_action = AUDIT_ACTION_UPDATE; show_messages($result, S_TRIGGER_UPDATED, S_CANNOT_UPDATE_TRIGGER); } else { DBstart(); - $triggerid=add_trigger($_REQUEST["expression"],$_REQUEST["description"],$type, - $_REQUEST["priority"],$status,$_REQUEST["comments"],$_REQUEST["url"], + $triggerid=add_trigger($_REQUEST['expression'],$_REQUEST['description'],$type, + $_REQUEST['priority'],$status,$_REQUEST['comments'],$_REQUEST['url'], $deps); $result = DBend(); @@ -147,11 +147,11 @@ include_once "include/page_header.php"; } if($result){ - add_audit($audit_action, AUDIT_RESOURCE_TRIGGER,S_TRIGGER." [".$triggerid."] [".expand_trigger_description($triggerid)."] "); - unset($_REQUEST["form"]); + add_audit($audit_action, AUDIT_RESOURCE_TRIGGER,S_TRIGGER.' ['.$triggerid.'] ['.expand_trigger_description($triggerid).'] '); + unset($_REQUEST['form']); } } - else if(isset($_REQUEST["delete"])&&isset($_REQUEST["triggerid"])){ + else if(isset($_REQUEST['delete'])&&isset($_REQUEST['triggerid'])){ $result = false; if($trigger_data = DBfetch( @@ -173,13 +173,13 @@ include_once "include/page_header.php"; if($result){ add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_TRIGGER, - S_TRIGGER." [".$_REQUEST["triggerid"]."] [".expand_trigger_description_by_data($trigger_data)."] "); + S_TRIGGER.' ['.$_REQUEST['triggerid'].'] ['.expand_trigger_description_by_data($trigger_data).'] '); - unset($_REQUEST["form"]); - unset($_REQUEST["triggerid"]); + unset($_REQUEST['form']); + unset($_REQUEST['triggerid']); } } - else if(isset($_REQUEST["copy"])&&isset($_REQUEST["g_triggerid"])&&isset($_REQUEST["form_copy_to"])){ + else if(isset($_REQUEST['copy'])&&isset($_REQUEST['g_triggerid'])&&isset($_REQUEST['form_copy_to'])){ if(isset($_REQUEST['copy_targetid']) && $_REQUEST['copy_targetid'] > 0 && isset($_REQUEST['copy_type'])){ if(0 == $_REQUEST['copy_type']){ /* hosts */ $hosts_ids = $_REQUEST['copy_targetid']; @@ -201,11 +201,11 @@ include_once "include/page_header.php"; } } - foreach($_REQUEST["g_triggerid"] as $trigger_id) + foreach($_REQUEST['g_triggerid'] as $trigger_id) foreach($hosts_ids as $host_id){ copy_trigger_to_host($trigger_id, $host_id, true); } - unset($_REQUEST["form_copy_to"]); + unset($_REQUEST['form_copy_to']); } else{ error('No target selection.'); @@ -213,9 +213,9 @@ include_once "include/page_header.php"; show_messages(); } /* DEPENDENCE ACTIONS */ - else if(isset($_REQUEST["add_dependence"])&&isset($_REQUEST["new_dependence"])){ - if(!isset($_REQUEST["dependencies"])) - $_REQUEST["dependencies"] = array(); + else if(isset($_REQUEST['add_dependence'])&&isset($_REQUEST['new_dependence'])){ + if(!isset($_REQUEST['dependencies'])) + $_REQUEST['dependencies'] = array(); if(!uint_in_array($_REQUEST["new_dependence"], $_REQUEST["dependencies"])) array_push($_REQUEST["dependencies"], $_REQUEST["new_dependence"]); diff --git a/frontends/php/users.php b/frontends/php/users.php index d67bef1f..6749fa36 100644 --- a/frontends/php/users.php +++ b/frontends/php/users.php @@ -123,7 +123,7 @@ include_once "include/page_header.php"; check_fields($fields); - validate_sort_and_sortorder(); + validate_sort_and_sortorder('u.alias',ZBX_SORT_UP); ?> <?php if($_REQUEST['config']==0){ |