This file is indexed.

/usr/share/zabbix/popup_link_tr.php is in zabbix-frontend-php 1:1.8.11-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
/*
** ZABBIX
** Copyright (C) 2000-2010 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
?>
<?php
require_once('include/config.inc.php');
require_once('include/maps.inc.php');
require_once('include/forms.inc.php');

$page['title'] = 'S_LINK_STATUS_INDICATORS';
$page['file'] = 'popup_link_tr.php';

define('ZBX_PAGE_NO_MENU', 1);

include_once('include/page_header.php');
?>
<?php
//			VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
	$fields = array(
		'mapid'=>				array(T_ZBX_INT, O_MAND, P_SYS,	DB_ID,		null),
		'linktriggers'=>		array(T_ZBX_INT, O_OPT,  P_SYS, DB_ID, 			'isset({save})'),
		'new_linktriggers'=>	array(T_ZBX_INT, O_OPT,  P_SYS, DB_ID, 			null),
		'del_linktriggers'=>	array(T_ZBX_INT, O_OPT,  NULL, 	DB_ID, 			null),
		'drawtype'=>			array(T_ZBX_INT, O_OPT,  NULL, 	IN('0,1,2,3,4'),'isset({save})'),
		'color'=>				array(T_ZBX_STR, O_OPT,  NULL, 	NOT_EMPTY,		'isset({save})'),
// actions
		'save'=>				array(T_ZBX_STR, O_OPT, P_SYS|P_ACT,	null,	null),
		'remove'=>				array(T_ZBX_STR, O_OPT, P_SYS|P_ACT,	null,	null),
// other
		'form'=>				array(T_ZBX_STR, O_OPT, P_SYS,	null,	null),
	);

	check_fields($fields);
?>
<?php
	$_REQUEST['linktriggers'] = get_request('linktriggers', array());

	if(isset($_REQUEST['save']) && isset($_REQUEST['linktriggers'])){

		if(!empty($_REQUEST['linktriggers'])){
			$triggers = array();
			$options = array(
					'nodeids' => get_current_nodeid(true),
					'triggerids'=> $_REQUEST['linktriggers'],
					'editable'=> 1,
					'select_hosts' => array('hostid', 'host'),
					'output' => API_OUTPUT_EXTEND
				);

			$dbTriggers = CTrigger::get($options);
			order_result($dbTriggers, 'description');

			foreach($dbTriggers as $tnum => $trigger){
				$host = reset($trigger['hosts']);

				$triggers[$trigger['triggerid']] = $host['host'].':'.expand_trigger_description_by_data($trigger);
			}
		}

		$json = new CJSON();
		$script = 'addLinkTriggers('.zbx_jsvalue($_REQUEST['mapid']).','.
								$json->encode($triggers).','.
								zbx_jsvalue($_REQUEST['drawtype']).','.
								zbx_jsvalue($_REQUEST['color']).');';

		zbx_add_post_js($script);
	}
	else if(isset($_REQUEST['new_linktriggers'])){
		$_REQUEST['linktriggers'] = array_merge($_REQUEST['linktriggers'], $_REQUEST['new_linktriggers']);
		array_unique($_REQUEST['linktriggers']);

		unset($_REQUEST['new_linktriggers']);
	}
	else if(isset($_REQUEST['remove']) && isset($_REQUEST['del_linktriggers'])){
		$_REQUEST['linktriggers'] = array_diff($_REQUEST['linktriggers'], $_REQUEST['del_linktriggers']);
		array_unique($_REQUEST['linktriggers']);

		unset($_REQUEST['new_linktriggers']);
	}


	if(isset($_REQUEST['form'])){
		echo SBR;

		$frmCnct = new CFormTable(S_NEW_INDICATORS, 'popup_link_tr.php');
		$frmCnct->setName('connector_form');

		$triggers = array();
		if(!empty($_REQUEST['linktriggers'])){
			$options = array(
					'nodeids' => get_current_nodeid(true),
					'triggerids'=> $_REQUEST['linktriggers'],
					'editable'=> 1,
					'select_hosts' => array('hostid', 'host'),
					'output' => API_OUTPUT_EXTEND
				);

			$triggers = CTrigger::get($options);
			order_result($triggers, 'description');
		}
		$triggerids = zbx_objectValues($triggers, 'triggerid');
		$frmCnct->addVar('linktriggers', $triggerids);

		$triggerid = get_request('triggerid', 0);
		$drawtype = get_request('drawtype', 0);
		$color = get_request('color', 'DD0000');

		$frmCnct->addVar('mapid', $_REQUEST['mapid']);
		$frmCnct->addVar('triggerid', $triggerid);

// START comboboxes preparations
		$cmbType = new CComboBox('drawtype', $drawtype);

		$drawtypes = map_link_drawtypes();
		foreach($drawtypes as $num => $i){
			$value = map_link_drawtype2str($i);
			$cmbType->addItem($i, $value);
		}
//---
		$btnSelect = new CButton('btn1', S_SELECT,
			"return PopUp('popup.php?srctbl=triggers".
				'&srcfld1=triggerid'.
				'&real_hosts=1'.
				'&reference=linktrigger'.
				'&multiselect=1'.
				"&writeonly=1');",
				'T');
		$btnSelect->setType('button');

		$btnRemove = new CButton('remove', S_REMOVE);

// END preparation

		$trList = new CListBox('del_linktriggers[]', null, 15);
		if(empty($triggers)) $trList->setAttribute('style', 'width: 300px;');

		foreach($triggers as $tnum => $trigger){
			$dbTriggers = CTrigger::get($options);
			order_result($dbTriggers, 'description');

			$host = reset($trigger['hosts']);
			$trList->addItem($trigger['triggerid'], $host['host'].':'.expand_trigger_description_by_data($trigger));
		}

		$frmCnct->addRow(S_TRIGGERS, array($trList, BR(), $btnSelect, $btnRemove));
		$frmCnct->addRow(S_TYPE.' ('.S_PROBLEM_BIG.')', $cmbType);
		$frmCnct->addRow(S_COLOR.' ('.S_PROBLEM_BIG.')', new CColor('color', $color));

		$frmCnct->addItemToBottomRow(new CButton('save', (isset($_REQUEST['triggerid'])) ? S_SAVE : S_ADD));
		$frmCnct->addItemToBottomRow(SPACE);
		$frmCnct->addItemToBottomRow(new CButton('cancel', S_CANCEL, 'javascript: window.close();'));

		$frmCnct->show();
	}

?>
<script type="text/javascript">
//<!--<![CDATA[
function addPopupValues(list){
	if(!isset('object', list)) return false;

	if(list.object == 'linktrigger'){
		for(var i=0; i < list.values.length; i++){
			create_var('connector_form', 'new_linktriggers['+i+']', list.values[i], false);
		}

		create_var('connector_form','add_dependence', 1, true);
	}
}

function addLinkTriggers(mapid,triggers,drawtype,color){
	var parent = window.opener.document;

	if(typeof(parent) == 'undefined'){
		close_window();
		return false;
	}

	for(var triggerid in triggers){
		if(!isset(triggerid, triggers)) continue;

		var linktrigger = {
			'triggerid': triggerid,
			'desc_exp': triggers[triggerid],
			'drawtype': drawtype,
			'color': color
		};

		window.opener.ZBX_SYSMAPS[mapid].map.linkForm_addLinktrigger(linktrigger);
	}
	
	window.close();

return true;
}
//]]> -->
</script>
<?php

require_once('include/page_footer.php');

?>