ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
NetVPOPMaild.php
Go to the documentation of this file.
1 <?php
2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
3 
31 require_once 'Auth/Container.php';
35 require_once 'PEAR.php';
39 require_once 'Net/Vpopmaild.php';
40 
56 {
57 
62  var $server = 'localhost';
63 
68  var $port = 89;
69 
77  {
78  if (isset($server) && !is_null($server)) {
79  if (is_array($server)) {
80  if (isset($server['host'])) {
81  $this->server = $server['host'];
82  }
83  if (isset($server['port'])) {
84  $this->port = $server['port'];
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 
108  function fetchData($username, $password)
109  {
110  $this->log('Auth_Container_Vpopmaild::fetchData() called.', AUTH_LOG_DEBUG);
111  $vpopmaild =& new Net_Vpopmaild();
112  // Connect
113  try {
114  $res = $vpopmaild->connect($this->server, $this->port, $this->method);
115  } catch (Net_Vpopmaild_FatalException $e) {
116  $this->log('Connection to Vpopmaild server failed.', AUTH_LOG_DEBUG);
117  return PEAR::raiseError($e->getMessage(), $e->getCode());
118  }
119  // Authenticate
120  try {
121  $result = $vpopmaild->clogin($username, $password);
122  $vpopmaild->quit();
123  } catch (Net_Vpopmaild_Exception $e) {
124  return PEAR::raiseError($e->getMessage(), $e->getCode());
125  }
126  return $result;
127  }
128 }
129 ?>