Make configuration tool show the SquirrelMail version
[squirrelmail.git] / config / conf.pl
index a4a3f6e0742720ccaa57141a39c3cc620a241c29..33ebb038af82093c87f898c5e285bc63a8ccf598 100755 (executable)
@@ -43,7 +43,23 @@ $dir = cwd();
 
 
 ############################################################
-# First, lets read in the data already in there...
+# Try to determine what the version of SquirrelMail is
+############################################################
+$sm_version = 'unknown';
+if ( -e "../include/constants.php" && -r "../include/constants.php") {
+    open( FILE, "../include/constants.php" );
+    while ( $line = <FILE> ) {
+        if ($line =~ m/^define\('SM_VERSION', ?'(\d+\.\d+\.\d+( ?\[\w+]|))'/) {
+            $sm_version = $1;
+            last;
+        }
+    }
+    close(FILE);
+}
+
+
+############################################################
+# First, let's read in the data already in there...
 ############################################################
 if ( -e "config.php" ) {
     # Make sure that file is readable
@@ -583,7 +599,7 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) {
     print $WHT. "SquirrelMail Configuration : " . $NRM;
     if    ( $config == 1 ) { print "Read: config.php"; }
     elsif ( $config == 2 ) { print "Read: config_default.php"; }
-    print " ($print_config_version)\n";
+    print "\nConfig version $print_config_version; SquirrelMail version $sm_version\n";
     print "---------------------------------------------------------\n";
 
     if ( $menu == 0 ) {