60 if (!is_string($username) || !strlen($username)) {
64 $this->_username = $username;
81 if (empty($this->_url)) {
83 'No URL set via '.get_class($this).
'->getServiceUrl($url).' 106 'Cannot set the URL, stream already opened.' 109 if (!is_string(
$url) || !strlen(
$url)) {
135 'Cannot set the mailbox, stream already opened.' 138 if (!is_string($mailbox) || !strlen($mailbox)) {
142 $this->_mailbox = $mailbox;
165 'Cannot set options, stream already opened.' 197 if (empty($this->_mailbox)) {
199 'You must specify a mailbox via '.get_class($this)
200 .
'->setMailbox($mailbox)' 208 phpCAS::trace(
'opening IMAP mailbox `'.$this->_mailbox.
'\'...
'); 209 $this->_stream = @imap_open( 210 $this->_mailbox, $this->_username, $this->getProxyTicket(), 213 if ($this->_stream) { 216 phpCAS::trace('could not
open mailbox
'); 217 // @todo add localization integration. 218 $message = 'IMAP Error:
'.$this->_url.' '. var_export(imap_errors(), true); 219 phpCAS::trace($message); 220 throw new CAS_ProxiedService_Exception($message); 224 return $this->_stream; 232 protected function hasBeenOpened () 234 return !empty($this->_stream); 237 /********************************************************* 238 * 3. Access the result 239 *********************************************************/ 252 public function getStream () 254 if (!$this->hasBeenOpened()) { 255 throw new CAS_OutOfSequenceException( 256 'Cannot access stream, not opened yet.
' 259 return $this->_stream; 270 public function getImapProxyTicket () 272 if (!$this->hasBeenOpened()) { 273 throw new CAS_OutOfSequenceException( 274 'Cannot access errors, stream not opened yet.
' 277 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...
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options