close(FILE);
if ( $config_version ne $conf_pl_version ) {
- system "clear";
+ clear_screen();
print $WHT. "WARNING:\n" . $NRM;
print " The file \"config/config.php\" was found, but it is for\n";
print " an older version of SquirrelMail. It is possible to still\n";
close(FILE);
if ( $config_version ne $conf_pl_version ) {
- system "clear";
+ clear_screen();
print $WHT. "WARNING:\n" . $NRM;
print " You are trying to use a 'config_default.php' from an older\n";
print " version of SquirrelMail. This is HIGHLY unrecommended. You\n";
}
while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
- system "clear";
+ clear_screen();
print $WHT. "SquirrelMail Configuration : " . $NRM;
if ( $config == 1 ) { print "Read: config.php"; }
elsif ( $config == 2 ) { print "Read: config_default.php"; }
}
sub set_defaults {
- system "clear";
+ clear_screen();
print $WHT. "SquirrelMail Configuration : " . $NRM;
if ( $config == 1 ) { print "Read: config.php"; }
elsif ( $config == 2 ) { print "Read: config_default.php"; }
# prepended to the path, if not, then the path will be
# converted to an absolute path, e.g.
# '../images/logo.gif' --> SM_PATH . 'images/logo.gif'
+# '../../someplace/data' --> '/absolute/path/someplace/data'
# 'images/logo.gif' --> SM_PATH . 'config/images/logo.gif'
# '/absolute/path/logo.gif' --> '/absolute/path/logo.gif'
# 'http://whatever/' --> 'http://whatever'
if ( $#rel_path > 1 ) {
# more than two levels away. Make it absolute.
+ @abs_path = split(/\//, $dir);
+
+ # Lop off the relative pieces of the absolute path..
+ for ( $i = 0; $i <= $#rel_path; $i++ ) {
+ pop @abs_path;
+ shift @rel_path;
+ }
+ push @abs_path, @rel_path;
$new_path = "\'" . join('/', @abs_path) . "\'";
} elsif ( $#rel_path > 0 ) {
# it's within the SM tree, prepend SM_PATH
close $sock;
return 'YES';
}
+
+sub clear_screen() {
+ if ( $^O =~ /^mswin/i) {
+ system "cls";
+ } else {
+ system "clear";
+ }
+}