From: Frank B. <pa...@st...> - 2003-01-30 22:01:40
|
I just downloaded squirrelmail-1.4.0-rc2a, and discovered a bug in the conf= .pl perl script. I don't know what the change_to_SM_path subroutine does, I didn't feel like= looking it up, but I discovered that if you apply the following diff, you = can use=20 relative paths from the mail squirel mail directory --- config/conf.pl~ Sat Jan 4 01:01:21 2003 +++ config/conf.pl Thu Jan 30 16:54:04 2003 @@ -2625,7 +2625,7 @@ # string print CF "\$org_name =3D \"$org_name\";\n"; # string - print CF "\$org_logo =3D " . &change_to_SM_path($org_logo) . ";\n"; + print CF "\$org_logo =3D \"$org_logo\";\n"; $org_logo_width |=3D 0; $org_logo_height |=3D 0; # string --=20 Frank Barton Starwolf.biz Systems Administrator |
From: Erin S. <ebu...@sq...> - 2003-01-30 22:40:15
|
Frank Barton wrote: > I just downloaded squirrelmail-1.4.0-rc2a, and discovered a bug in the conf.pl perl script. > > I don't know what the change_to_SM_path subroutine does, I didn't feel like looking it up, but I discovered that if you apply the following diff, you can use > relative paths from the mail squirel mail directory > > --- config/conf.pl~ Sat Jan 4 01:01:21 2003 > +++ config/conf.pl Thu Jan 30 16:54:04 2003 > @@ -2625,7 +2625,7 @@ > # string > print CF "\$org_name = \"$org_name\";\n"; > # string > - print CF "\$org_logo = " . &change_to_SM_path($org_logo) . ";\n"; > + print CF "\$org_logo = \"$org_logo\";\n"; > $org_logo_width |= 0; > $org_logo_height |= 0; > # string > Ok. SM_PATH has been discussed off and on at length. PHP calculates relative paths based on the "calling" script, rather than the location of the running script. SM_PATH and it's ilk are common solutions to solve that problem - i.e. making it so that an included script doesn't have to worry about where it was called from, it just uses the defined variable, and trusts that it was set properly. I made the SM_PATH changes in several places inside conf.pl. True, what you changed allows relative paths to be used to define the org logo, BUT - you may not always get to where you wanted to go (based on where the scripts that use it are called from, etc. etc. The SM_PATH conversion stuff behaves as follows - if your relative path falls within the SM tree, SM_PATH is prepended in it's place (assuming you realize that the path you're defining is relative to the config dir where conf.pl lives). If your relative path backs itself OUT of the SM tree, it's replaced with an absolute reference (which won't work with images, incidentally). If your absolute reference begins with http: it's left alone. So. The better fix for your problem is not to make the change you did, but to either: make a symlink to the image in the images dir within the SM tree (../images is changed to SM_PATH . 'images.. and will work fine). Or, put in the full URL to the image you want to include: http://some.domain.net/path/to/image.png. Either will work, and will prevent a broken link should someone pick up the org_logo var from an unexpected location. Erin (ebullient) -- 'Waste of a good apple.' - Samwise Gamgee ICQ: 38670353 |