diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php
index 175aa66ee..3b349e9a2 100644
--- a/html/pages/device/showconfig.inc.php
+++ b/html/pages/device/showconfig.inc.php
@@ -4,6 +4,7 @@ include("includes/geshi/geshi.php");
if ($_SESSION['userlevel'] >= "7")
{
+
if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); }
foreach ($config['rancid_configs'] as $configs)
@@ -11,10 +12,59 @@ if ($_SESSION['userlevel'] >= "7")
if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; }
if (is_file($configs . $device['hostname'])) { $file = $configs . $device['hostname']; }
}
+
+ echo('
');
- $fh = fopen($file, 'r') or die("Can't open file");
- $text = fread($fh, filesize($file));
- fclose($fh);
+ print_optionbar_start('', '');
+
+ echo("
Config » ");
+
+ if (!$_GET['opta']) {
+ echo('");
+ } else {
+ echo("
Latest");
+ }
+
+ if (function_exists('svn_log')) {
+
+ $sep = " | ";
+ $svnlogs = svn_log($file, SVN_REVISION_HEAD, NULL, 10);
+ $revlist = array();
+
+ foreach ($svnlogs as $svnlog) {
+
+ echo($sep);
+ $revlist[] = $svnlog["rev"];
+
+ if ($_GET['opta'] == $svnlog["rev"]) { echo('"); }
+
+ $sep = " | ";
+ }
+ }
+
+ print_optionbar_end();
+
+ if (function_exists('svn_log') && in_array($_GET['opta'], $revlist)) {
+ list($diff, $errors) = svn_diff($file, $_GET['opta']-1, $file, $_GET['opta']);
+ if (!$diff) {
+ $text = "No Difference";
+ } else {
+ $text = "";
+ while (!feof($diff)) { $text .= fread($diff, 8192); }
+ fclose($diff);
+ fclose($errors);
+ }
+
+ } else {
+ $fh = fopen($file, 'r') or die("Can't open file");
+ $text = fread($fh, filesize($file));
+ fclose($fh);
+ }
if ($config['rancid_ignorecomments'])
{
@@ -33,5 +83,4 @@ if ($_SESSION['userlevel'] >= "7")
#$geshi->set_line_style('color: #999999');
echo($geshi->parse_code());
}
-
?>
\ No newline at end of file