[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare API - Auth from Mail server * 4 * This file written by Dan Kuykendall <seek3r@phpgroupware.org> * 5 * Authentication based on mail server * 6 * Copyright (C) 2000, 2001 Dan Kuykendall * 7 * ------------------------------------------------------------------------ * 8 * This library is part of the eGroupWare API * 9 * http://www.egroupware.org/api * 10 * ------------------------------------------------------------------------ * 11 * This library is free software; you can redistribute it and/or modify it * 12 * under the terms of the GNU Lesser General Public License as published by * 13 * the Free Software Foundation; either version 2.1 of the License, * 14 * or any later version. * 15 * This library is distributed in the hope that it will be useful, but * 16 * WITHOUT ANY WARRANTY; without even the implied warranty of * 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * 18 * See the GNU Lesser General Public License for more details. * 19 * You should have received a copy of the GNU Lesser General Public License * 20 * along with this library; if not, write to the Free Software Foundation, * 21 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 22 \**************************************************************************/ 23 24 /* $Id: class.auth_mail.inc.php 21732 2006-06-07 06:50:26Z ralfbecker $ */ 25 26 class auth_ 27 { 28 var $previous_login = -1; 29 30 function authenticate($username, $passwd) 31 { 32 $notls = '/notls'; 33 if ($GLOBALS['egw_info']['server']['mail_login_type'] == 'vmailmgr') 34 { 35 $username = $username . '@' . $GLOBALS['egw_info']['server']['mail_suffix']; 36 } 37 if ($GLOBALS['egw_info']['server']['mail_server_type']=='imap') 38 { 39 $GLOBALS['egw_info']['server']['mail_port'] = '143'; 40 } 41 elseif ($GLOBALS['egw_info']['server']['mail_server_type']=='pop3') 42 { 43 $GLOBALS['egw_info']['server']['mail_port'] = '110'; 44 } 45 elseif ($GLOBALS['egw_info']['server']['mail_server_type']=='imaps') 46 { 47 $GLOBALS['egw_info']['server']['mail_port'] = '993'; 48 $notls = ''; 49 } 50 elseif ($GLOBALS['egw_info']['server']['mail_server_type']=='pop3s') 51 { 52 $GLOBALS['egw_info']['server']['mail_port'] = '995'; 53 } 54 55 if( $GLOBALS['egw_info']['server']['mail_server_type']=='pop3') 56 { 57 $mailauth = imap_open('{'.$GLOBALS['egw_info']['server']['mail_server'].'/pop3' 58 .':'.$GLOBALS['egw_info']['server']['mail_port'].'}INBOX', $username , $passwd); 59 } 60 elseif ( $GLOBALS['egw_info']['server']['mail_server_type']=='imaps' ) 61 { 62 // IMAPS support: 63 $mailauth = imap_open('{'.$GLOBALS['egw_info']['server']['mail_server']."/ssl/novalidate-cert" 64 .':993}INBOX', $username , $passwd); 65 } 66 elseif ( $GLOBALS['egw_info']['server']['mail_server_type']=='pop3s' ) 67 { 68 // POP3S support: 69 $mailauth = imap_open('{'.$GLOBALS['egw_info']['server']['mail_server']."/ssl/novalidate-cert" 70 .':995}INBOX', $username , $passwd); 71 } 72 else 73 { 74 /* assume imap */ 75 $mailauth = imap_open('{'.$GLOBALS['egw_info']['server']['mail_server'] 76 .':'.$GLOBALS['egw_info']['server']['mail_port'].$notls.'}INBOX', $username , $passwd); 77 } 78 79 if ($mailauth == False) 80 { 81 return False; 82 } 83 imap_close($mailauth); 84 85 return True; 86 } 87 88 function change_password($old_passwd, $new_passwd) 89 { 90 return False; 91 } 92 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |