diff --git a/config.php.default b/config.php.default index 4a795422cf..e898225854 100755 --- a/config.php.default +++ b/config.php.default @@ -104,6 +104,8 @@ $config['enable_pseudowires'] = 1; # Enable Pseudowires $config['enable_ports_etherlike'] = 0; # Enable Polling EtherLike-MIB (doubles interface processing time) #$config['rancid_configs'] = '/var/lib/rancid/network/configs/'; +$config['rancid_ignorecomments'] = 0; # Ignore lines starting with # + #$config['collectd_dir'] = '/var/lib/collectd/rrd'; ## If a syslog entry contails these strings it is deleted from the database diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php index d703e2de54..a4b7368059 100644 --- a/html/pages/device/showconfig.inc.php +++ b/html/pages/device/showconfig.inc.php @@ -2,10 +2,19 @@ include("includes/geshi/geshi.php"); -if($_SESSION[userlevel] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) { +if($_SESSION['userlevel'] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) { $file = $config['rancid_configs'] . $device['hostname']; $fh = fopen($file, 'r') or die("Can't open file"); $text = fread($fh, filesize($file)); + if ($config['rancid_ignorecomments']) + { + $lines = split("\n",$text); + for ($i = 0;$i < count($lines);$i++) + { + if ($lines[$i][0] == "#") { unset($lines[$i]); } + } + $text = join("\n",$lines); + } $language = "ios"; $geshi = new GeSHi($text, $language); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);