Tweaks to resolve various path issues.
authorebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 2 Feb 2003 06:25:17 +0000 (06:25 +0000)
committerebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 2 Feb 2003 06:25:17 +0000 (06:25 +0000)
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

index 92daefc16d22d73b48beb90024781d99aa786b32..dd576216109b9f3cb0757c00b9bcf5fa4c8a0f23 100755 (executable)
@@ -40,6 +40,10 @@ if ( defined( $ENV{'PATH_INFO'} )
 ############################################################
 use Cwd;
 $dir = cwd();
 ############################################################
 use Cwd;
 $dir = cwd();
+if ( $dir =~ /:/ ) {
+  $dir = substr($dir, index($dir, ':') + 1);
+}
+  
 
 ############################################################              
 # First, lets read in the data already in there...
 
 ############################################################              
 # 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";
 # 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 = <STDIN>;
     print "\n";
     print "[$WHT$org_logo$NRM]: $WHT";
     $new_org_logo = <STDIN>;
@@ -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 "\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 = <STDIN>;
     print "\n";
     print "[$WHT$theme_css$NRM]: $WHT";
     $new_theme_css = <STDIN>;
@@ -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)/ );
     # 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)/);
     
     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);
     # 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;
         foreach $subdir (@rel_path) {
             if ($subdir eq '') {
                 pop @abs_path;
@@ -3005,21 +3024,22 @@ sub change_to_SM_path() {
                 push @abs_path, $subdir;
             }
         }
                 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 . \'/;
     } 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 . "\'";
     }
     } 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;
 }
 
   return $new_path;
 }