Exemplo n.º 1
0
 /**
  * @return bool
  */
 public function Connect()
 {
     $bResult = false;
     if (parent::Connect()) {
         $bResult = $this->CheckResponse($this->GetNextLine());
     }
     return $bResult;
 }
Exemplo n.º 2
0
 /**
  * @return bool
  */
 public function Connect()
 {
     $bResult = false;
     if (parent::Connect()) {
         $bResult = $this->CheckResponse('*', $this->GetResponse('*'));
     }
     return $bResult;
 }
Exemplo n.º 3
0
 /**
  * @return bool
  */
 public function Connect()
 {
     $sLine = '';
     $bResult = false;
     if (parent::Connect()) {
         $sLine = $this->GetNextLine();
         $aTokens = $this->parseLine($sLine);
         if ($aTokens && isset($aTokens[0], $aTokens[1]) && 'IMPLEMENTATION' === $aTokens[0]) {
             while (true) {
                 if (false === $sLine || !isset($aTokens[0]) || in_array(substr($sLine, 0, 2), array('OK', 'NO'))) {
                     break;
                 }
                 $sLine = trim($sLine);
                 if (in_array($aTokens[0], array('IMPLEMENTATION', 'VERSION'))) {
                     $this->aData[$aTokens[0]] = $aTokens[1];
                 } else {
                     if ('STARTTLS' === $aTokens[0]) {
                         $this->aData['STARTTLS'] = true;
                     } else {
                         if (isset($aTokens[1]) && in_array($aTokens[0], array('SIEVE', 'SASL'))) {
                             $this->aData['TYPE'] = 'SASL' === $aTokens[0] ? 'AUTH' : 'MODULES';
                             $this->aData[$this->aData['TYPE']] = explode(' ', $aTokens[1]);
                         } else {
                             $this->aData['UNDEFINED'] = isset($this->aData['UNDEFINED']) ? $this->aData['UNDEFINED'] : array();
                             $this->aData['UNDEFINED'][] = $sLine;
                         }
                     }
                 }
                 $sLine = $this->GetNextLine();
                 $aTokens = $this->parseLine($sLine);
             }
         }
     }
     if ('OK' === substr($sLine, 0, 2)) {
         $bResult = true;
     }
     if (CApi::GetConf('labs.sieve.use-starttls', false) && $bResult && isset($this->aData['STARTTLS']) && $this->aData['STARTTLS']) {
         $rConnect = $this->GetConnectResource();
         if (is_resource($rConnect) && function_exists('stream_socket_enable_crypto')) {
             if ($this->SendLine('STARTTLS') && $this->CheckResponse($this->GetResponse())) {
                 @stream_socket_enable_crypto($rConnect, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
                 $this->CheckResponse($this->GetResponse());
             }
         }
     }
     return $bResult;
 }