59 if (!is_string($username) || !strlen($username)) {
63 $this->_username = $username;
80 if (empty($this->_url)) {
82 'No URL set via ' . get_class($this) .
'->getServiceUrl($url).' 105 'Cannot set the URL, stream already opened.' 108 if (!is_string(
$url) || !strlen(
$url)) {
134 'Cannot set the mailbox, stream already opened.' 137 if (!is_string($mailbox) || !strlen($mailbox)) {
141 $this->_mailbox = $mailbox;
164 'Cannot set options, stream already opened.' 196 if (empty($this->_mailbox)) {
198 'You must specify a mailbox via ' . get_class($this)
199 .
'->setMailbox($mailbox)' 207 phpCAS::trace(
'opening IMAP mailbox `' . $this->_mailbox .
'\'...
'); 208 $this->_stream = @imap_open( 211 $this->getProxyTicket(), 214 if ($this->_stream) { 217 phpCAS::trace('could not
open mailbox
'); 218 // @todo add localization integration. 219 $message = 'IMAP Error:
' . $this->_url . ' ' . var_export(imap_errors(), true); 220 phpCAS::trace($message); 221 throw new CAS_ProxiedService_Exception($message); 225 return $this->_stream; 233 protected function hasBeenOpened() 235 return !empty($this->_stream); 238 /********************************************************* 239 * 3. Access the result 240 *********************************************************/ 253 public function getStream() 255 if (!$this->hasBeenOpened()) { 256 throw new CAS_OutOfSequenceException( 257 'Cannot access stream, not opened yet.
' 260 return $this->_stream; 271 public function getImapProxyTicket() 273 if (!$this->hasBeenOpened()) { 274 throw new CAS_OutOfSequenceException( 275 'Cannot access errors, stream not opened yet.
' 278 return $this->getProxyTicket(); setServiceUrl($url)
Set the URL of the service to pass to CAS for proxy-ticket retrieval.
$_url
The target service url.
initializeProxyTicket()
Fetch our proxy ticket.
setOptions($options)
Set the options for opening the stream.
An Exception for problems communicating with a proxied service.
This class implements common methods for ProxiedService implementations included with phpCAS...
$_username
The username to send via imap_open.
__construct($username)
Constructor.
static trace($str)
This method is used to log something in debug mode.
$_options
A bit mask of options to pass to imap_open() as the $options parameter.
Provides access to a proxy-authenticated IMAP stream.
This class defines Exceptions that should be thrown when the sequence of operations is invalid...
hasBeenOpened()
Answer true if our request has been sent yet.
Exception that denotes invalid arguments were passed.
setMailbox($mailbox)
Set the mailbox to open.
getServiceUrl()
Answer a service identifier (URL) for whom we should fetch a proxy ticket.
open()
Open the IMAP stream (similar to imap_open()).
$_mailbox
The mailbox to open.
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...