
/********************************************************************************
  VLOGIN 2.4

   IMPORTANT WARNING: Make sure your config.php file contains NO linefeeds
   (blank lines) after the last ?> in the file!  Otherwise you'll get a
   nasty bug where all message attachments are corrupted!


   A plugin for squirrelmail for installations that require user@host.com so that
   to login you only have to enter 'user'.  Additionally, there is support to
   show a different image on the login page (as well as set the titlebar text, 
   and other attributes) on a per-domain basis.

   This plugin should help those who want to have multiple sites pointing to the
   same source.

   All configuration options are located in the file config.php, but please
   read below to understand how they work.

   To determine the correct user login, the plugin resolves the host by the
   php variable $HTTP_HOST, and strips off a given number of dot-separated chunks
   and/or chunks known not to be part of the domain name, for example,
   
   with $numberOfDotSections set to 2:
       webmail.foo.com            becomes user@foo.com
       server.webmail.foo.com     becomes user@foo.com
       server.webmail.foo.bar.com becomes user@bar.com
   
   with $numberOfDotSections set to 3:
       webmail.foo.com            becomes user@webmail.foo.com
       server.webmail.foo.com     becomes user@webmail.foo.com
       server.webmail.foo.bar.com becomes user@foo.bar.com
   
   with $checkByExcludeList set to true:
       www.foo.com          becomes user@foo.com
       www.mail.foo.com     becomes user@foo.com
       www.mail.foo.bar.com becomes user@foo.bar.com

   with $checkByExcludeList set to true and $numberOfDotSections set to 3:
       www.foo.com          becomes user@foo.com
       www.mail.foo.com     becomes user@foo.com
       www.mail.foo.bar.com becomes user@foo.bar.com
   (The host is reduced to the number of desired dot sections, then if 
   the result begins with "www" or "mail", etc., it is further reduced;
   this behavior can be changed if people think it doesn't make sense...)

   By default, $numberOfDotSections is 2 and $checkByExcludeList is true.
   Turn off $numberOfDotSections by setting it to 0.
   Turn off $checkByExcludeList by setting it to false.
   The list of "chunks known not to be part of the domain name" is currently
   set to "www", "mail", "email", and "webmail", but can be expanded by 
   adding to the $notPartOfDomainName array.

   Also there are some of you out there with mail servers that require diff
   seperators other than '@' and '.' which can be conviently change in the 
   config.php file.

   Finally, any of the attributes you see when you run SquirrelMail's
   config/conf.pl configuration script and select Organization Preferences
   (#1), Server Settings (#2), or Folder Defaults (#3) can be overridden 
   on a per-domain basis.  To do so, simply add a unique string that 
   identifies each domain (which must be part of the actual domain's URL), 
   and any of those attributes you need to override in the $virtualDomains 
   array.  Any attributes not specified there will use the defaults you set 
   up when you ran config/conf.pl.  There are several examples in config.php, 
   the third of which lists all of the attributes available at this time.
   Of course, you must uncomment the lines in that array you plan to use.

   Even more goodies -- in addition to these per-domain settings, you can
   also specify different behavior for how user names are constructed for
   each domain.  The $numberOfDotSections, $checkByExcludeList, $at, $dot
   and $dontUseHostName settings described here can also be set in the 
   $virtualDomains array.  Just like the other items in that array, if
   not specified, the default behavior is followed.

   If you need the functionality of this plugin that displays different 
   graphics or similar settings for each domain, but do not want usernames
   to have the host name appended to them, you can set the $dontUseHostName
   flag to 1 in the config.php file.  Most users of this plugin can ignore 
   this setting (leave it at 0).  If you do use this functionality, you'll
   probably want to use $smHostIsDomainThatUserLoggedInWith = 1 to ensure
   that your users' domain settings match the domain they used to log in.

   Please note that only newer versions of SM are able to handle user@host.com
   in $username without barfing.

   I have tested this plugin with password_forget and all seems to work.

   Code inspired heavly by login_alias plugin by Jay Guerette.
   
   Have Fun,
   Ryan Orth <snubber-sm@seahat.com>
   
   Expanded by pdontthink <pdontthink@angrynerds.com>

   Minor change for use with register_globals off by chilts@birdbrained.org

   Grant Stern <grant@grantstern.com> came up with the idea and code 
   for keeping the domain name correct even when using $dontUseHostName = 1

 ********************************************************************************/

