CVE-2018-20725 (PHP, published 2019-01-16T16:29Z)
Description: value: A cross-site scripting (XSS) vulnerability exists in graph_templates.php in Cacti before 1.2.0 due to lack of escaping of unintended characters in the Graph Vertical Label.
Severity: LOW (CVSS v3 base score: 4.8)
Weakness: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Repository: https://github.com/Cacti/cacti
Files changed:
CHANGELOG
aggregate_graphs.php
aggregate_templates.php
automation_networks.php
automation_tree_rules.php
cdef.php
color_templates.php
data_debug.php
data_input.php
data_queries.php
data_source_profiles.php
data_sources.php
data_templates.php
gprint_presets.php
graph_templates.php
graph_view.php
graphs.php
host_templates.php
lib/html_reports.php
lib/html_utility.php
links.php
managers.php
sites.php
tree.php
user_admin.php
user_domains.php
user_group_admin.php
utilities.php
vdef.php
Commit message: Resolving Issues #2213, #2214, #2215 and Additional

Multiple XSS vectors associated with un-escaped strings.  Introduce new
function, audit all calls, remove inline styles for classes, some i18n
missed.


Vulnerable code:
				form_selectable_cell(get_request_var('rfilter') != '' ? aggregate_format_text(html_escape($graph['title_cache']), get_request_var('rfilter')) : html_escape($graph['title_cache']), $graph['local_graph_id']);
			form_selectable_cell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id'], '', 'right');
			form_selectable_cell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id'], '', 'right');
			form_selectable_cell($disabled ? 'No':'Yes', $template['id'], '', 'text-align:right');
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape('aggregate_graphs.php?reset=true&template_id=' . $template['id']) . '">' . number_format_i18n($template['graphs'], '-1') . '</a>', $template['id'], '', 'text-align:right;');
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape('automation_networks.php?action=edit&id=' . $network['id']) . '">' . $network['name'] . '</a>', $network['id']);
			form_selectable_cell($network['data_collector'], $network['id']);
			form_selectable_cell(number_format_i18n($network['total_ips']), $network['id'], '', 'text-align:right;');
			form_selectable_cell($mystat, $network['id'], '', 'text-align:right;');
			form_selectable_cell($progress, $network['id'], '', 'text-align:right;');
			form_selectable_cell(number_format_i18n($updown['up']) . '/' . number_format_i18n($updown['snmp']), $network['id'], '', 'text-align:right;');
			form_selectable_cell(number_format_i18n($network['threads']), $network['id'], '', 'text-align:right;');
			form_selectable_cell(round($network['last_runtime'],2), $network['id'], '', 'text-align:right;');
			form_selectable_cell($network['enabled'] == '' || $network['sched_type'] == '1' ? __('N/A'):($network['next_start'] == '0000-00-00 00:00:00' ? substr($network['start_at'],0,16):substr($network['next_start'],0,16)), $network['id'], '', 'text-align:right;');
			form_selectable_cell($network['last_started'] == '0000-00-00 00:00:00' ? 'Never':substr($network['last_started'],0,16), $network['id'], '', 'text-align:right;');
			$subtree_name = ((empty($automation_tree_rule['subtree_name'])) ? '<em>' . __('ROOT') . '</em>' : $automation_tree_rule['subtree_name']);
			form_selectable_cell($automation_tree_rule['tree_name'], $automation_tree_rule['id']);
			<pre>cdef=<?php print get_cdef($cdef_id, true);?></pre>
	form_start('cdef.php', 'form_cdef');
			form_selectable_cell($disabled ? __('No') : __('Yes'), $cdef['id'], '', 'text-align:right');
			form_selectable_cell(number_format_i18n($cdef['graphs'], '-1'), $cdef['id'], '', 'text-align:right');
			form_selectable_cell(number_format_i18n($cdef['templates'], '-1'), $cdef['id'], '', 'text-align:right');
			form_selectable_cell($disabled ? __('No') : __('Yes'), $template['color_template_id'], '', 'text-align:right');
            form_selectable_cell(number_format_i18n($template['graphs']), $template['color_template_id'], '', 'text-align:right;');
            form_selectable_cell(number_format_i18n($template['templates']), $template['color_template_id'], '', 'text-align:right;');
			form_selectable_cell('<a class="linkEditMain" title="' . $title .'" href="' . htmlspecialchars('data_debug.php?action=view&id=' . $check['id']) . '">' . $name . '</a>', $check['id']);
			form_selectable_cell($user, $check['id']);
			form_selectable_cell($check['datasource'], $check['id']);
			form_selectable_cell(debug_icon(($check['done'] ? (strlen($issue_line) ? 'off' : 'on' ) : '')), $check['id'], '', 'text-align: center;');
			form_selectable_cell(debug_icon($info['rrd_writable']), $check['id'], '', 'text-align: center;');
			form_selectable_cell(debug_icon($info['rrd_exists']), $check['id'], '', 'text-align: center;');
			form_selectable_cell(debug_icon($info['active']), $check['id'], '', 'text-align: center;');
			form_selectable_cell(debug_icon($info['rrd_match']), $check['id'], '', 'text-align: center;');
			form_selectable_cell(debug_icon($info['valid_data']), $check['id'], '', 'text-align: center;');
			form_selectable_cell(debug_icon(($info['rra_timestamp2'] != '' ? 1 : '')), $check['id'], '', 'text-align: center;');
			form_selectable_cell('<a class=\'linkEditMain\' href=\'#\' title="' . html_escape($issue_title) . '">' . html_escape(strlen(trim($issue_line)) ? $issue_line : '<none>') . '</a>', $check['id']);
		form_selectable_cell($field['title'], $i);
		$value = '<not set>';
		form_selectable_cell($value, $i, '', '', $value_title);

/*
	print "<pre>";
	if (isset($check) && is_array($check)) {
		print_r($check);
	}
	print "</pre>";
*/

			form_selectable_cell($disabled ? __('No'): __('Yes'), $data_input['id'],'', 'text-align:right');
			form_selectable_cell(number_format_i18n($data_input['data_sources'], '-1'), $data_input['id'],'', 'text-align:right');
			form_selectable_cell(number_format_i18n($data_input['templates'], '-1'), $data_input['id'],'', 'text-align:right');
			form_selectable_cell($snmp_query['id'], $snmp_query['id'], '', 'text-align:right;');
			form_selectable_cell($disabled ? __('No') : __('Yes'), $snmp_query['id'], '', 'text-align:right');
			form_selectable_cell(number_format_i18n($snmp_query['graphs'], '-1'), $snmp_query['id'], '', 'text-align:right');
			form_selectable_cell(number_format_i18n($snmp_query['templates'], '-1'), $snmp_query['id'], '', 'text-align:right');
			form_selectable_cell($profile['default'] == 'on' ? __('Yes'):'', $profile['id'], '', 'text-align:right');
			form_selectable_cell($disabled ? __('No') : __('Yes'), $profile['id'], '', 'text-align:right');
			form_selectable_cell($readonly ? __('Yes') : __('No'), $profile['id'], '', 'text-align:right');
			form_selectable_cell($sampling_intervals[$profile['step']], $profile['id'], '', 'text-align:right');
			form_selectable_cell($heartbeats[$profile['heartbeat']], $profile['id'], '', 'text-align:right');
			form_selectable_cell($ds, $profile['id'], '', 'text-align:right');
			form_selectable_cell($dt, $profile['id'], '', 'text-align:right');
			form_selectable_cell($data_source['local_data_id'], $data_source['local_data_id'], '', 'text-align:right');
			form_selectable_cell(($data_source['active'] == 'on' ? __('Yes') : __('No')), $data_source['local_data_id']);
			form_selectable_cell($template['id'], $template['id'], '', 'text-align:right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $template['id'], '', 'text-align:right');
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape('data_sources.php?reset=true&template_id=' . $template['id']) . '">' . number_format_i18n($template['data_sources']) . '</a>', $template['id'], '', 'text-align:right');
            form_selectable_cell($gp['gprint_text'], $gp['id'], '', 'text-align:right');
            form_selectable_cell($disabled ? __('No'):__('Yes'), $gp['id'], '', 'text-align:right');
            form_selectable_cell(number_format_i18n($gp['graphs'], '-1'), $gp['id'], '', 'text-align:right');
            form_selectable_cell(number_format_i18n($gp['templates'], '-1'), $gp['id'], '', 'text-align:right');
			form_selectable_cell($template['id'], $template['id'], '', 'text-align:right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $template['id'], '', 'text-align:right');
			form_selectable_cell(number_format_i18n($template['graphs'], '-1'), $template['id'], '', 'text-align:right');
			form_selectable_cell($template['size'], $template['id'], '', 'text-align:right');
			form_selectable_cell($image_types[$template['image_format_id']], $template['id'], '', 'text-align:right');
			form_selectable_cell($template['vertical_label'], $template['id'], '', 'text-align:right');
			form_selectable_cell($graph['description'], $graph['local_graph_id']);
			form_selectable_cell($graph['template_name'], $graph['local_graph_id']);
			form_selectable_cell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id']);
			form_selectable_cell($graph['local_graph_id'], $graph['local_graph_id'], '', 'text-align:right');
			form_selectable_cell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id'], '', 'right');
			form_selectable_cell($template['id'], $template['id'], '', 'text-align:right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $template['id'], '', 'text-align:right');
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape('host.php?reset=true&host_template_id=' . $template['id']) . '">' . number_format_i18n($template['hosts'], '-1') . '</a>', $template['id'], '', 'text-align:right');
					form_selectable_cell($report['full_name'], $report['id']);
			form_selectable_cell($report['from_name'], $report['id']);
			form_selectable_cell((substr_count($report['email'], ',') ? __('Multiple'): $report['email']), $report['id']);
			form_selectable_cell($report['enabled'] ? __('Enabled'): __('Disabled'), $report['id']);
			form_selectable_cell(html_escape($page['contentfile']), $page['id']);
			form_selectable_cell(html_escape($page['title']), $page['id']);
			form_selectable_cell(html_escape($style_translate[$page['style']]) . ($page['style'] == 'CONSOLE' ? ' ( ' . ($page['extendedstyle'] == '' ? 'External Links':$page['extendedstyle']) . ' )':''), $page['id']);
			form_selectable_cell(($page['enabled'] == 'on' ? 'Yes':'No'), $page['id']);
	global $manager_actions, $item_rows;
			form_selectable_cell('<a class="linkEditMain" href="managers.php?action=edit&id=' . $item['id'] . '">' . $description . '</a>', $item['id']);
			form_selectable_cell($hostname, $item['id']);
			form_selectable_cell('<a class="linkEditMain" href="managers.php?action=edit&tab=notifications&id=' . $item['id'] . '">' . ($item['count_notify'] ? $item['count_notify'] : 0) . '</a>' , $item['id']);
			form_selectable_cell('<a class="linkEditMain" href="managers.php?action=edit&tab=logs&id=' . $item['id'] . '">' . ($item['count_log'] ? $item['count_log'] : 0 ) . '</a>', $item['id']);
			form_selectable_cell(((isset($notifications[$item['mib']]) && isset($notifications[$item['mib']][$item['name']])) ? '<span class="deviceUp">' .__('Enabled') : '<span class="deviceDown">' .  __('Disabled')) . '</span>', $row_id);
			$devices_url = $config['url_path'] . 'host.php?reset=1&site_id=' . $site['id'];
			form_selectable_cell($site['city'], $site['id'], '', 'left');
			form_selectable_cell($site['state'], $site['id'], '', 'left');
			form_selectable_cell($site['country'], $site['id'], '', 'left');
			form_selectable_cell($tree['id'], $tree['id'], '', 'text-align:right');
			form_selectable_cell(substr($tree['last_modified'],0,16), $tree['id'], '', 'text-align:right');
			form_selectable_cell(get_username($tree['modified_by']), $tree['id'], '', 'text-align:right');
			form_selectable_cell($tree['sites'] > 0 ? number_format_i18n($tree['sites'], '-1'):'-', $tree['id'], '', 'text-align:right');
			form_selectable_cell($tree['branches'] > 0 ? number_format_i18n($tree['branches'], '-1'):'-', $tree['id'], '', 'text-align:right');
			form_selectable_cell($tree['hosts'] > 0 ? number_format_i18n($tree['hosts'], '-1'):'-', $tree['id'], '', 'text-align:right');
			form_selectable_cell($tree['graphs'] > 0 ? number_format_i18n($tree['graphs'], '-1'):'-', $tree['id'], '', 'text-align:right');
				form_selectable_cell(round(($host['id']), 2), $host['id']);
			form_selectable_cell(($domain['user_id'] == '0' ? __('None Selected') : db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($domain['user_id']))), $domain['domain_id']);
			form_selectable_cell(db_fetch_cell_prepared('SELECT cn_full_name FROM user_domains_ldap WHERE domain_id = ?', array($domain['domain_id'])), $domain['domain_id']);
			form_selectable_cell(db_fetch_cell_prepared('SELECT cn_email FROM user_domains_ldap WHERE domain_id = ?', array($domain['domain_id'])), $domain['domain_id']);
			form_selectable_cell(($g['enabled'] == 'on' ? __('Enabled'): __('Disabled') ), $g['id']);
				form_selectable_cell(round(($host['id']), 2), $host['id']);
			form_selectable_cell( $oid, $item['oid']);
			form_selectable_cell((in_array($item['kind'], array(__('Scalar'), __('Column Data'))) ? $item['value'] : __('N/A')), $item['oid']);
			<pre>vdef=<?php print get_vdef($vdef_id, true);?></pre>
	form_start('vdef.php', 'form_vdef');
            form_selectable_cell($disabled ? __('No'):__('Yes'), $vdef['id'], '', 'text-align:right');
            form_selectable_cell(number_format_i18n($vdef['graphs'], '-1'), $vdef['id'], '', 'text-align:right');
            form_selectable_cell(number_format_i18n($vdef['templates'], '-1'), $vdef['id'], '', 'text-align:right');

Fixed code:
-issue#2213: Stored XSS in "Website Hostname" field - Devices
-issue#2214: Stored XSS in "Vertical Label" field - Graph
-issue#2215: Stored XSS in "Name" field - Color 
				form_selectable_ecell(get_request_var('rfilter') != '' ? aggregate_format_text($graph['title_cache'], get_request_var('rfilter')) : $graph['title_cache'], $graph['local_graph_id']);
			form_selectable_ecell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id'], '', 'right');
			form_selectable_ecell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id'], '', 'right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $template['id'], '', 'right');
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape('aggregate_graphs.php?reset=true&template_id=' . $template['id']) . '">' . number_format_i18n($template['graphs'], '-1') . '</a>', $template['id'], '', 'right');
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape('automation_networks.php?action=edit&id=' . $network['id']) . '">' . html_escape($network['name']) . '</a>', $network['id']);
			form_selectable_ecell($network['data_collector'], $network['id']);
			form_selectable_cell(number_format_i18n($network['total_ips']), $network['id'], '', 'right');
			form_selectable_cell($mystat, $network['id'], '', 'right');
			form_selectable_cell($progress, $network['id'], '', 'right');
			form_selectable_cell(number_format_i18n($updown['up']) . '/' . number_format_i18n($updown['snmp']), $network['id'], '', 'right');
			form_selectable_cell(number_format_i18n($network['threads']), $network['id'], '', 'right');
			form_selectable_cell(round($network['last_runtime'],2), $network['id'], '', 'right');
			form_selectable_cell($network['enabled'] == '' || $network['sched_type'] == '1' ? __('N/A'):($network['next_start'] == '0000-00-00 00:00:00' ? substr($network['start_at'],0,16):substr($network['next_start'],0,16)), $network['id'], '', 'right');
			form_selectable_cell($network['last_started'] == '0000-00-00 00:00:00' ? __('Never'):substr($network['last_started'],0,16), $network['id'], '', 'right');
			$subtree_name = ((empty($automation_tree_rule['subtree_name'])) ? '<em>' . __('ROOT') . '</em>' : html_escape($automation_tree_rule['subtree_name']));
			form_selectable_ecell($automation_tree_rule['tree_name'], $automation_tree_rule['id']);
			<pre>cdef=<?php print html_escape(get_cdef($cdef_id, true));?></pre>
	form_start('cdef.php', 'chk');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $cdef['id'], '', 'right');
			form_selectable_cell(number_format_i18n($cdef['graphs'], '-1'), $cdef['id'], '', 'right');
			form_selectable_cell(number_format_i18n($cdef['templates'], '-1'), $cdef['id'], '', 'right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $template['color_template_id'], '', 'right');
			form_selectable_cell(number_format_i18n($template['graphs']), $template['color_template_id'], '', 'right');
			form_selectable_cell(number_format_i18n($template['templates']), $template['color_template_id'], '', 'right');
			form_selectable_cell('<a class="linkEditMain" title="' . $title .'" href="' . html_escape('data_debug.php?action=view&id=' . $check['id']) . '">' . html_escape($name) . '</a>', $check['id']);
			form_selectable_ecell($user, $check['id']);
			form_selectable_ecell($check['datasource'], $check['id']);
			form_selectable_cell(debug_icon(($check['done'] ? (strlen($issue_line) ? 'off' : 'on' ) : '')), $check['id'], '', 'center');
			form_selectable_cell(debug_icon($info['rrd_writable']), $check['id'], '', 'center');
			form_selectable_cell(debug_icon($info['rrd_exists']), $check['id'], '', 'center');
			form_selectable_cell(debug_icon($info['active']), $check['id'], '', 'center');
			form_selectable_cell(debug_icon($info['rrd_match']), $check['id'], '', 'center');
			form_selectable_cell(debug_icon($info['valid_data']), $check['id'], '', 'center');
			form_selectable_cell(debug_icon(($info['rra_timestamp2'] != '' ? 1 : '')), $check['id'], '', 'center');
			form_selectable_cell('<a class=\'linkEditMain\' href=\'#\' title="' . html_escape($issue_title) . '">' . html_escape(strlen(trim($issue_line)) ? $issue_line : __('<none>')) . '</a>', $check['id']);
		form_selectable_ecell($field['title'], $i);
		$value = __('<not set>');
		form_selectable_ecell($value, $i, '', '', $value_title);
			form_selectable_cell($disabled ? __('No'):__('Yes'), $data_input['id'],'', 'right');
			form_selectable_cell(number_format_i18n($data_input['data_sources'], '-1'), $data_input['id'],'', 'right');
			form_selectable_cell(number_format_i18n($data_input['templates'], '-1'), $data_input['id'],'', 'right');
			form_selectable_cell($snmp_query['id'], $snmp_query['id'], '', 'right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $snmp_query['id'], '', 'right');
			form_selectable_cell(number_format_i18n($snmp_query['graphs'], '-1'), $snmp_query['id'], '', 'right');
			form_selectable_cell(number_format_i18n($snmp_query['templates'], '-1'), $snmp_query['id'], '', 'right');
			form_selectable_cell($profile['default'] == 'on' ? __('Yes'):'', $profile['id'], '', 'right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $profile['id'], '', 'right');
			form_selectable_cell($readonly ? __('Yes'):__('No'), $profile['id'], '', 'right');
			form_selectable_cell($sampling_intervals[$profile['step']], $profile['id'], '', 'right');
			form_selectable_cell($heartbeats[$profile['heartbeat']], $profile['id'], '', 'right');
			form_selectable_cell($ds, $profile['id'], '', 'right');
			form_selectable_cell($dt, $profile['id'], '', 'right');
			form_selectable_cell($data_source['local_data_id'], $data_source['local_data_id'], '', 'right');
			form_selectable_cell(($data_source['active'] == 'on' ? __('Yes'):__('No')), $data_source['local_data_id']);
			form_selectable_cell($template['id'], $template['id'], '', 'right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $template['id'], '', 'right');
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape('data_sources.php?reset=true&template_id=' . $template['id']) . '">' . number_format_i18n($template['data_sources']) . '</a>', $template['id'], '', 'right');
            form_selectable_cell($gp['gprint_text'], $gp['id'], '', 'right');
            form_selectable_cell($disabled ? __('No'):__('Yes'), $gp['id'], '', 'right');
            form_selectable_cell(number_format_i18n($gp['graphs'], '-1'), $gp['id'], '', 'right');
            form_selectable_cell(number_format_i18n($gp['templates'], '-1'), $gp['id'], '', 'right');
			form_selectable_cell($template['id'], $template['id'], '', 'right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $template['id'], '', 'right');
			form_selectable_cell(number_format_i18n($template['graphs'], '-1'), $template['id'], '', 'right');
			form_selectable_ecell($template['size'], $template['id'], '', 'right');
			form_selectable_cell($image_types[$template['image_format_id']], $template['id'], '', 'right');
			form_selectable_ecell($template['vertical_label'], $template['id'], '', 'right');
			form_selectable_ecell($graph['description'], $graph['local_graph_id']);
			form_selectable_ecell($graph['template_name'], $graph['local_graph_id']);
			form_selectable_ecell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id']);
			form_selectable_cell($graph['local_graph_id'], $graph['local_graph_id'], '', 'right');
			form_selectable_ecell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id'], '', 'right');
			form_selectable_cell($template['id'], $template['id'], '', 'right');
			form_selectable_cell($disabled ? __('No'):__('Yes'), $template['id'], '', 'right');
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape('host.php?reset=true&host_template_id=' . $template['id']) . '">' . number_format_i18n($template['hosts'], '-1') . '</a>', $template['id'], '', 'right');
					form_selectable_ecell($report['full_name'], $report['id']);
			form_selectable_ecell($report['from_name'], $report['id']);
			form_selectable_ecell((substr_count($report['email'], ',') ? __('Multiple'): $report['email']), $report['id']);
			form_selectable_cell($report['enabled'] ? __('Enabled'):__('Disabled'), $report['id']);
/* form_selectable_ecell - a wrapper to form_selectable_cell that escapes the contents
   @arg $contents - the readable portion of the
   @arg $id - the id of the object that will be highlighted
   @arg $width - the width of the table element
   @arg $style_or_class - the style or class to apply to the table element
   @arg $title - optional title for the column */
function form_selectable_ecell($contents, $id, $width = '', $style_or_class = '', $title = '') {
	form_selectable_cell(html_escape($contents), $id, $width, $style_or_class, $title);
}

			form_selectable_ecell($page['contentfile'], $page['id']);
			form_selectable_ecell($page['title'], $page['id']);
			form_selectable_ecell($style_translate[$page['style']] . ($page['style'] == 'CONSOLE' ? ' ( ' . ($page['extendedstyle'] == '' ? __('External Links'):$page['extendedstyle']) . ' )':''), $page['id']);
			form_selectable_cell(($page['enabled'] == 'on' ? __('Yes'):__('No')), $page['id']);
	global $config, $manager_actions, $item_rows;
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape($config['url_path'] . 'managers.php?action=edit&id=' . $item['id']) . '">' . html_escape($description) . '</a>', $item['id']);
			form_selectable_ecell($hostname, $item['id']);
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape($config['url_path'] . 'managers.php?action=edit&tab=notifications&id=' . $item['id']) . '">' . ($item['count_notify'] ? $item['count_notify'] : 0) . '</a>' , $item['id']);
			form_selectable_cell('<a class="linkEditMain" href="' . html_escape($config['url_path'] . 'managers.php?action=edit&tab=logs&id=' . $item['id']) . '">' . ($item['count_log'] ? $item['count_log'] : 0 ) . '</a>', $item['id']);
			form_selectable_cell(((isset($notifications[$item['mib']]) && isset($notifications[$item['mib']][$item['name']])) ? '<span class="deviceUp">' . __('Enabled'):'<span class="deviceDown">' . __('Disabled')) . '</span>', $row_id);
			$devices_url = html_escape($config['url_path'] . 'host.php?reset=1&site_id=' . $site['id']);
			form_selectable_ecell($site['city'], $site['id'], '', 'left');
			form_selectable_ecell($site['state'], $site['id'], '', 'left');
			form_selectable_ecell($site['country'], $site['id'], '', 'left');
			form_selectable_cell($tree['id'], $tree['id'], '', 'right');
			form_selectable_cell(substr($tree['last_modified'],0,16), $tree['id'], '', 'right');
			form_selectable_cell(get_username($tree['modified_by']), $tree['id'], '', 'right');
			form_selectable_cell($tree['sites'] > 0 ? number_format_i18n($tree['sites'], '-1'):'-', $tree['id'], '', 'right');
			form_selectable_cell($tree['branches'] > 0 ? number_format_i18n($tree['branches'], '-1'):'-', $tree['id'], '', 'right');
			form_selectable_cell($tree['hosts'] > 0 ? number_format_i18n($tree['hosts'], '-1'):'-', $tree['id'], '', 'right');
			form_selectable_cell($tree['graphs'] > 0 ? number_format_i18n($tree['graphs'], '-1'):'-', $tree['id'], '', 'right');
				form_selectable_cell($host['id'], $host['id']);
			form_selectable_ecell(($domain['user_id'] == '0' ? __('None Selected') : db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($domain['user_id']))), $domain['domain_id']);
			form_selectable_ecell(db_fetch_cell_prepared('SELECT cn_full_name FROM user_domains_ldap WHERE domain_id = ?', array($domain['domain_id'])), $domain['domain_id']);
			form_selectable_ecell(db_fetch_cell_prepared('SELECT cn_email FROM user_domains_ldap WHERE domain_id = ?', array($domain['domain_id'])), $domain['domain_id']);
			form_selectable_cell(($g['enabled'] == 'on' ? __('Enabled'):__('Disabled') ), $g['id']);
				form_selectable_cell($host['id'], $host['id']);
			form_selectable_cell($oid, $item['oid']);
			form_selectable_ecell((in_array($item['kind'], array(__('Scalar'), __('Column Data'))) ? $item['value'] : __('N/A')), $item['oid']);
			<pre>vdef=<?php print html_escape(get_vdef($vdef_id, true));?></pre>
	form_start('vdef.php', 'chk');
            form_selectable_cell($disabled ? __('No'):__('Yes'), $vdef['id'], '', 'right');
            form_selectable_cell(number_format_i18n($vdef['graphs'], '-1'), $vdef['id'], '', 'right');
            form_selectable_cell(number_format_i18n($vdef['templates'], '-1'), $vdef['id'], '', 'right');