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.4 2004/03/28 23:19:50 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.4 $
  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.             else {
  68.                 if (strstr($server':')) {
  69.                     $serverparts explode(':'trim($server));
  70.                     $this->server = $serverparts[0];
  71.                     $this->port = $serverparts[1];
  72.                 else {
  73.                     $this->server = $server;
  74.                 }
  75.             }
  76.         }
  77.     }
  78.  
  79.     // }}}
  80.     // {{{ fetchData()
  81.  
  82.     /**
  83.      * Try to login to the POP3 server
  84.      *
  85.      * @param   string Username
  86.      * @param   string Password
  87.      * @return  boolean 
  88.      */
  89.     function fetchData($username$password)
  90.     {
  91.         $pop3 =new Net_POP3();
  92.         $res $pop3->connect($this->server$this->port);
  93.         if (!$res{
  94.             return $res;
  95.         }
  96.         $result $pop3->login($username$password);
  97.         $pop3->disconnect();
  98.         return $result;
  99.     }
  100.  
  101.     // }}}
  102. }
  103. ?>

Documentation generated on Mon, 11 Mar 2019 13:52:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.