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.6 2006/02/28 02:19:22 aashley Exp $
  22. //
  23.  
  24. require_once 'Auth/Container.php';
  25. require_once 'PEAR.php';
  26. require_once 'Net/POP3.php';
  27.  
  28. /**
  29.  * Storage driver for Authentication on a POP3 server.
  30.  *
  31.  * @author   Yavor Shahpasov <yavo@netsmart.com.cy>
  32.  * @package  Auth
  33.  * @version  $Revision: 1.6 $
  34.  */
  35. {
  36.  
  37.     // {{{ properties
  38.  
  39.     /**
  40.      * POP3 Server
  41.      * @var string 
  42.      */
  43.     var $server='localhost';
  44.  
  45.     /**
  46.      * POP3 Server port
  47.      * @var string 
  48.      */
  49.     var $port='110';
  50.  
  51.     /**
  52.      * POP3 Authentication method
  53.      *
  54.      * Prefered POP3 authentication method. Acceptable values:
  55.      *      Boolean TRUE    - Use Net_POP3's autodetection
  56.      *      String 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'
  57.      *                      - Attempt this authentication style first
  58.      *                        then fallback to autodetection.
  59.      * @var mixed 
  60.      */
  61.     var $method=true;
  62.  
  63.     // }}}
  64.  
  65.     // {{{ Auth_Container_POP3() [constructor]
  66.  
  67.     /**
  68.      * Constructor of the container class
  69.      *
  70.      * @param  $server string server or server:port combination
  71.      * @return object Returns an error object if something went wrong
  72.      */
  73.     function Auth_Container_POP3($server=null)
  74.     {
  75.         if (isset($server)) {
  76.             if (is_array($server)) {
  77.                 if (isset($server['host'])) {
  78.                     $this->server = $server['host'];
  79.                 }
  80.                 if (isset($server['port'])) {
  81.                     $this->port = $server['port'];
  82.                 }
  83.                 if (isset($server['method'])) {
  84.                     $this->method = $server['method'];
  85.                 }
  86.             else {
  87.                 if (strstr($server':')) {
  88.                     $serverparts explode(':'trim($server));
  89.                     $this->server = $serverparts[0];
  90.                     $this->port = $serverparts[1];
  91.                 else {
  92.                     $this->server = $server;
  93.                 }
  94.             }
  95.         }
  96.     }
  97.  
  98.     // }}}
  99.     // {{{ fetchData()
  100.  
  101.     /**
  102.      * Try to login to the POP3 server
  103.      *
  104.      * @param   string Username
  105.      * @param   string Password
  106.      * @return  boolean 
  107.      */
  108.     function fetchData($username$password)
  109.     {
  110.         $pop3 =new Net_POP3();
  111.         $res $pop3->connect($this->server$this->port$this->method);
  112.         if (!$res{
  113.             return $res;
  114.         }
  115.         $result $pop3->login($username$password);
  116.         $pop3->disconnect();
  117.         return $result;
  118.     }
  119.  
  120.     // }}}
  121.  
  122. }
  123. ?>

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