Auth
[ class tree: Auth ] [ index: Auth ] [ all elements ]

Source for file POP3.php

Documentation is available at POP3.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2002 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Stefan Ekman <stekman@sedata.org>                           |
  17. // |          Martin Jansen <mj@php.net>                                  |
  18. // |          Mika Tuupola <tuupola@appelsiini.net>                       |
  19. // +----------------------------------------------------------------------+
  20. //
  21. // $Id: POP3.php,v 1.3 2003/07/28 21:39:39 yavo Exp $
  22. //
  23.  
  24.  
  25. require_once('Auth/Container.php');
  26. require_once('PEAR.php');
  27. require_once('Net/POP3.php');
  28.  
  29. /**
  30.  * Storage driver for Authentication on a POP3 server.
  31.  *
  32.  * @author   Yavor Shahpasov <yavo@netsmart.com.cy>
  33.  * @package  Auth
  34.  * @version  $Revision: 1.3 $
  35.  */
  36. {
  37.     /**
  38.      * POP3 Server
  39.      * @var string 
  40.      */
  41.     var $server='localhost';
  42.  
  43.     /**
  44.      * POP3 Server port
  45.      * @var string 
  46.      */
  47.     var $port='110';
  48.  
  49.     // {{{ Constructor
  50.  
  51.     /**
  52.      * Constructor of the container class
  53.      *
  54.      * @param  $server string server or server:port combination
  55.      * @return object Returns an error object if something went wrong
  56.      */
  57.     function Auth_Container_POP3($server=null)
  58.     {
  59.         if(isset($server)){
  60.             if(is_array($server)){
  61.                 if(isset($server['host'])){
  62.                     $this->server = $server['host'];
  63.                 }
  64.                 if(isset($server['port'])){
  65.                     $this->port = $server['port'];
  66.                 }
  67.             }
  68.             else{
  69.                 if(strstr($server':')){
  70.                     $serverparts explode(':'trim($server));
  71.                     $this->server = $serverparts[0];
  72.                     $this->port = $serverparts[1];
  73.                 }
  74.                 else
  75.                 {
  76.                     $this->server = $server;
  77.                 }
  78.             }
  79.         }
  80.     }
  81.  
  82.     // }}}
  83.     // {{{ fetchData()
  84.  
  85.     /**
  86.      * Try to login to the POP3 server
  87.      *
  88.      * @param   string Username
  89.      * @param   string Password
  90.      * @return  boolean 
  91.      */
  92.     function fetchData($username$password)
  93.     {
  94.         $pop3 =new Net_POP3();
  95.         $res $pop3->connect($this->server$this->port);
  96.         if(!$res){
  97.             return($res);
  98.         }
  99.         $result $pop3->login($username$password);
  100.         $pop3->disconnect();
  101.         return $result;
  102.     }
  103.  
  104.     // }}}
  105. }
  106. ?>

Documentation generated on Mon, 11 Mar 2019 14:36:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.