From 25be56ab4a6a6a21bbfbea3ec585c6af64eff6f9 Mon Sep 17 00:00:00 2001 From: ebullient Date: Sun, 2 Feb 2003 06:25:17 +0000 Subject: [PATCH] Tweaks to resolve various path issues. I think this solves problems with images/css specifications (more updates to directions than changes of behavior). The one piece I'm not sure is completely fixed is the Windows issues (i.e. c:\path\to). Will post to list for person to test. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4489 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/conf.pl | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/config/conf.pl b/config/conf.pl index 92daefc1..dd576216 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -40,6 +40,10 @@ if ( defined( $ENV{'PATH_INFO'} ) ############################################################ use Cwd; $dir = cwd(); +if ( $dir =~ /:/ ) { + $dir = substr($dir, index($dir, ':') + 1); +} + ############################################################ # First, lets read in the data already in there... @@ -769,11 +773,14 @@ sub command1 { # org_logo sub command2 { print "Your organization's logo is an image that will be displayed at\n"; - print "different times throughout SquirrelMail. This is asking for the\n"; - print "literal (/usr/local/squirrelmail/images/logo.png) or relative\n"; - print "(../images/logo.png) path from the config directory to your logo.\n"; - print "Relative paths to files outside the SquirrelMail distribution\n"; - print "will be converted to their absolute path equivalents in config.php.\n"; + print "different times throughout SquirrelMail. "; + print "\n"; + print "Please be aware of the following: \n"; + print " - Relative URLs are relative to the config dir\n"; + print " to use the default logo, use ../images/sm_logo.png\n"; + print " - To specify a logo defined outside the SquirrelMail source tree\n"; + print " use the absolute URL the webserver would use to include the file\n"; + print " e.g. http://some.host.com/images/mylogo.gif or /images/mylogo.jpg\n"; print "\n"; print "[$WHT$org_logo$NRM]: $WHT"; $new_org_logo = ; @@ -2305,8 +2312,12 @@ sub command42 { print "\n"; print "To clear out an existing value, just type a space for the input.\n"; print "\n"; - print "Relative links to files outside the SquirrelMail distribution\n"; - print "will be converted to their absolute path equivalents in config.php.\n"; + print "Please be aware of the following: \n"; + print " - Relative URLs are relative to the config dir\n"; + print " to use the themes directory, use ../themes/css/newdefault.css\n"; + print " - To specify a css file defined outside the SquirrelMail source tree\n"; + print " use the absolute URL the webserver would use to include the file\n"; + print " e.g. http://some.host.com/css/mystyle.css or /css/mystyle.css\n"; print "\n"; print "[$WHT$theme_css$NRM]: $WHT"; $new_theme_css = ; @@ -2990,14 +3001,22 @@ sub change_to_SM_path() { # If the path is absolute, don't bother. return "\'" . $old_path . "\'" if ( $old_path eq ''); return "\'" . $old_path . "\'" if ( $old_path =~ /^(\/|http)/ ); + return $old_path if ( $old_path =~ /^\'(\/|http)/ ); return $old_path if ( $old_path =~ /^(\$|SM_PATH)/); + # Remove remaining ' + $old_path =~ s/\'//g; + # For relative paths, split on '../' @rel_path = split(/\.\.\//, $old_path); if ( $#rel_path > 1 ) { # more than two levels away. Make it absolute. @abs_path = split(/\//, $dir); + + # account for leading slash + shift @abs_path; + foreach $subdir (@rel_path) { if ($subdir eq '') { pop @abs_path; @@ -3005,21 +3024,22 @@ sub change_to_SM_path() { push @abs_path, $subdir; } } - foreach $subdir (@abs_path) { - $new_path .= $subdir . '/'; + $new_path = "\'"; + foreach $subdir (@abs_path) { + $new_path .= '/' . $subdir; } + $new_path .= "\'"; } elsif ( $#rel_path > 0 ) { # it's within the SM tree, prepend SM_PATH $new_path = $old_path; $new_path =~ s/^\.\.\//SM_PATH . \'/; - $new_path .= '\''; + $new_path .= "\'"; } else { # Last, it's a relative path without any leading '.' # Prepend SM_PATH and config, since the paths are # relative to the config directory $new_path = "SM_PATH . \'config/" . $old_path . "\'"; } - return $new_path; } -- 2.25.1