From: Stefan S. <cen...@us...> - 2002-07-19 22:20:22
|
Update of /cvsroot/squirrelmail/squirrelmail/functions In directory usw-pr-cvs1:/tmp/cvs-serv6158 Modified Files: imap_general.php Log Message: integrated patch 403567 (from januar 2001 !!) it enables sysadmins to specify a function in $imap_server_address. This function gets the users imapserver. There is an example function map_yp_alias that gets the server from yellowpages (NIS) thanks to ka...@cc.... Index: imap_general.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/imap_general.php,v retrieving revision 1.109 retrieving revision 1.110 diff -u -w -r1.109 -r1.110 --- imap_general.php 14 Jul 2002 02:02:10 -0000 1.109 +++ imap_general.php 19 Jul 2002 22:20:17 -0000 1.110 @@ -155,6 +155,8 @@ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $hide) { global $color, $squirrelmail_language, $HTTP_ACCEPT_LANGUAGE, $onetimepad; + $imap_server_address = sqimap_get_user_server($imap_server_address, $username); + $imap_stream = fsockopen ( $imap_server_address, $imap_port, $error_number, $error_string, 15); if ( !$imap_stream ) { return false; @@ -395,5 +397,25 @@ fputs ($imap_stream, "\r\n"); $tmp = fgets ($imap_stream, 1024); } + +function sqimap_get_user_server ($imap_server, $username) { + + if (substr($imap_server, 0, 4) != "map:") { + return $imap_server; + } + + $function = substr($imap_server, 4); + return $function($username); +} + +/* This is an example that gets imapservers from yellowpages (NIS). + * you can simple put map:map_yp_alias in your $imap_server_address + * in config.php use your own function instead map_yp_alias to map your + * LDAP whatever way to find the users imapserver. */ + +function map_yp_alias($username) { + $yp = `ypmatch $username aliases`; + return chop(substr($yp, strlen($username)+1)); +} ?> |