refactor: Moved ifLabel -> cleanPort and updated the usage (#6288)

* refactor: Moved ifLabel -> cleanPort and updated the usage

* added list of tags allowed

* few updates as per comments from @murrant

* Added simple unit tests

* double display for javascript popover

* Remove ifNameDescr() function
Fix realtime port page

* remove accidental temp code

* Remove double display calls in ajax tables
This commit is contained in:
Neil Lathwood
2017-04-04 08:08:23 +01:00
committed by GitHub
parent b1c2ea2194
commit 1bbbaff58b
54 changed files with 137 additions and 69 deletions

View File

@@ -17,7 +17,7 @@ if (defined('SHOW_SETTINGS') || empty($widget_settings)) {
<form class="form-horizontal" onsubmit="widget_settings(this); return false;">
<div class="form-group">
<div class="col-sm-12">
html is supported here. If you want just text then wrap in &lt;pre&gt;&lt;/pre&gt;
The following html tags are supported: &lt;b&gt;, &lt;iframe&gt;, &lt;i&gt;, &lt;ul&gt;, &lt;li&gt;, &lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt;, &lt;h4&gt;, &lt;br&gt;, &lt;p&gt;. If you want just text then wrap in &lt;pre&gt;&lt;/pre&gt;
</div>
</div>
<div class="form-group">
@@ -33,5 +33,11 @@ if (defined('SHOW_SETTINGS') || empty($widget_settings)) {
</div>
</form>';
} else {
$common_output[] = nl2br(display($widget_settings['notes']));
$tmp_config = array(
'HTML.Allowed' => 'b,iframe,i,ul,li,h1,h2,h3,h4,br,p',
'HTML.Trusted' => true,
'HTML.SafeIframe' => true,
);
$common_output[] = display(nl2br($widget_settings['notes']), $tmp_config);
unset($tmp_config);
}

View File

@@ -142,6 +142,7 @@ $(function() {
';
foreach (dbFetchRows($query, $params) as $result) {
$result = cleanPort($result);
$common_output[] = '
<tr>
<td class="text-left">'.generate_device_link($result, shorthost($result['hostname'])).'</td>