Allow OS to define config highlighting (pfSense) (#10392)

* Update showconfig.inc.php

Fix display for pfsense config files.

* Update showconfig.inc.php

Change from else if to elseif

* Update showconfig.inc.php

Decode special chars before syntax highlighting.

* Update pfsense.yaml

* Add config_highlighting device property

Add config_highlighting to device definition
Update showconfig.inc.php to use config_highlighting to set language.

* Update showconfig.inc.php

Fix incorrect code. Chose correct variable where config_highlighting is set.

* Update os_schema.json

Add property config_highlighting to schema
 - used for language highlighting when displaying the config file

* Update showconfig.inc.php
This commit is contained in:
brownowski
2019-09-25 16:42:45 +10:00
committed by Tony Murray
parent 31eced4875
commit c4569a620b
3 changed files with 7 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ type: firewall
group: unix
text: pfSense
processor_stacked: true
config_highlighting: xml
over:
- { graph: device_processor, text: 'Processor Usage' }
- { graph: device_ucd_memory, text: 'Memory Usage' }

View File

@@ -316,18 +316,14 @@ if (Auth::user()->hasGlobalAdmin()) {
</div>';
}
if (!empty($text)) {
if (isset($previous_config)) {
$language = 'diff';
} else {
$language = 'ios';
}
$geshi = new GeSHi($text, $language);
$language = isset($previous_config) ? 'diff' : Config::getOsSetting($device['os'], 'config_highlighting', 'ios');
$geshi = new GeSHi(htmlspecialchars_decode($text), $language);
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
$geshi->set_overall_style('color: black;');
// $geshi->set_line_style('color: #999999');
echo '<div class="config">';
echo '<input id="linenumbers" class="btn btn-primary" type="submit" value="Hide line numbers"/>';
echo htmlspecialchars_decode($geshi->parse_code());
echo $geshi->parse_code();
echo '</div>';
}
}//end if