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.5 2006/02/21 05:26:31 aashley 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.5 $
  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.     /**
  50.      * POP3 Authentication method
  51.      *
  52.      * Prefered POP3 authentication method. Acceptable values:
  53.      *      Boolean TRUE    - Use Net_POP3's autodetection
  54.      *      String 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'
  55.      *                      - Attempt this authentication style first
  56.      *                        then fallback to autodetection.
  57.      * @var mixed 
  58.      */
  59.     var $method=true;
  60.  
  61.     // {{{ Constructor
  62.  
  63.     /**
  64.      * Constructor of the container class
  65.      *
  66.      * @param  $server string server or server:port combination
  67.      * @return object Returns an error object if something went wrong
  68.      */
  69.     function Auth_Container_POP3($server=null)
  70.     {
  71.         if (isset($server)) {
  72.             if (is_array($server)) {
  73.                 if (isset($server['host'])) {
  74.                     $this->server = $server['host'];
  75.                 }
  76.                 if (isset($server['port'])) {
  77.                     $this->port = $server['port'];
  78.                 }
  79.                 if (isset($server['method'])) {
  80.                     $this->method = $server['method'];
  81.                 }
  82.             else {
  83.                 if (strstr($server':')) {
  84.                     $serverparts explode(':'trim($server));
  85.                     $this->server = $serverparts[0];
  86.                     $this->port = $serverparts[1];
  87.                 else {
  88.                     $this->server = $server;
  89.                 }
  90.             }
  91.         }
  92.     }
  93.  
  94.     // }}}
  95.     // {{{ fetchData()
  96.  
  97.     /**
  98.      * Try to login to the POP3 server
  99.      *
  100.      * @param   string Username
  101.      * @param   string Password
  102.      * @return  boolean 
  103.      */
  104.     function fetchData($username$password)
  105.     {
  106.         $pop3 =new Net_POP3();
  107.         $res $pop3->connect($this->server$this->port$this->method);
  108.         if (!$res{
  109.             return $res;
  110.         }
  111.         $result $pop3->login($username$password);
  112.         $pop3->disconnect();
  113.         return $result;
  114.     }
  115.  
  116.     // }}}
  117. }
  118. ?>

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