Ignore:
Timestamp:
Nov 5, 2010 8:24:52 AM (3 years ago)
Author:
alec
Message:
  • CS fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_imap_generic.php

    r4173 r4187  
    322322    } 
    323323 
    324     private function set_error($code, $msg='') 
     324    private function setError($code, $msg='') 
    325325    { 
    326326        $this->errornum = $code; 
     
    399399        if ($type == 'CRAM-MD5' || $type == 'DIGEST-MD5') { 
    400400            if ($type == 'DIGEST-MD5' && !class_exists('Auth_SASL')) { 
    401                 $this->set_error(self::ERROR_BYE, 
     401                $this->setError(self::ERROR_BYE, 
    402402                    "The Auth_SASL package is required for DIGEST-MD5 authentication"); 
    403403                            return self::ERROR_BAD; 
    404404            } 
    405405 
    406                     $this->putLine($this->next_tag() . " AUTHENTICATE $type"); 
     406                    $this->putLine($this->nextTag() . " AUTHENTICATE $type"); 
    407407                    $line = trim($this->readLine(1024)); 
    408408 
     
    467467                $challenge = base64_decode($challenge); 
    468468                if (strpos($challenge, 'rspauth=') === false) { 
    469                     $this->set_error(self::ERROR_BAD, 
     469                    $this->setError(self::ERROR_BAD, 
    470470                        "Unexpected response from server to DIGEST-MD5 response"); 
    471471                    return self::ERROR_BAD; 
     
    496496            } 
    497497            else { 
    498                     $this->putLine($this->next_tag() . " AUTHENTICATE PLAIN"); 
     498                    $this->putLine($this->nextTag() . " AUTHENTICATE PLAIN"); 
    499499                    $line = trim($this->readLine(1024)); 
    500500 
     
    518518        } 
    519519        else { 
    520             $this->set_error($result, "Unable to authenticate user ($type): $line"); 
     520            $this->setError($result, "Unable to authenticate user ($type): $line"); 
    521521        } 
    522522 
     
    693693            // check input 
    694694            if (empty($host)) { 
    695                     $this->set_error(self::ERROR_BAD, "Empty host"); 
     695                    $this->setError(self::ERROR_BAD, "Empty host"); 
    696696                    return false; 
    697697            } 
    698698        if (empty($user)) { 
    699                 $this->set_error(self::ERROR_NO, "Empty user"); 
     699                $this->setError(self::ERROR_NO, "Empty user"); 
    700700                return false; 
    701701            } 
    702702            if (empty($password)) { 
    703                 $this->set_error(self::ERROR_NO, "Empty password"); 
     703                $this->setError(self::ERROR_NO, "Empty password"); 
    704704                    return false; 
    705705            } 
     
    720720 
    721721            if (!$this->fp) { 
    722                 $this->set_error(self::ERROR_BAD, sprintf("Could not connect to %s:%d: %s", $host, $this->prefs['port'], $errstr)); 
     722                $this->setError(self::ERROR_BAD, sprintf("Could not connect to %s:%d: %s", $host, $this->prefs['port'], $errstr)); 
    723723                    return false; 
    724724            } 
     
    740740                            $error = sprintf("Empty startup greeting (%s:%d)", $host, $this->prefs['port']); 
    741741 
    742                 $this->set_error(self::ERROR_BAD, $error); 
     742                $this->setError(self::ERROR_BAD, $error); 
    743743            $this->close(); 
    744744                return false; 
     
    763763 
    764764                            if (!stream_socket_enable_crypto($this->fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { 
    765                                     $this->set_error(self::ERROR_BAD, "Unable to negotiate TLS"); 
     765                                    $this->setError(self::ERROR_BAD, "Unable to negotiate TLS"); 
    766766                    $this->close(); 
    767767                                    return false; 
     
    795795            // Prevent from sending credentials in plain text when connection is not secure 
    796796                    if ($auth_method == 'LOGIN' && $this->getCapability('LOGINDISABLED')) { 
    797                             $this->set_error(self::ERROR_BAD, "Login disabled by IMAP server"); 
     797                            $this->setError(self::ERROR_BAD, "Login disabled by IMAP server"); 
    798798                $this->close(); 
    799799                            return false; 
     
    818818                break; 
    819819            default: 
    820                 $this->set_error(self::ERROR_BAD, "Configuration error. Unknown auth method: $method"); 
     820                $this->setError(self::ERROR_BAD, "Configuration error. Unknown auth method: $method"); 
    821821            } 
    822822 
     
    850850    function close() 
    851851    { 
    852             if ($this->putLine($this->next_tag() . ' LOGOUT')) { 
     852            if ($this->putLine($this->nextTag() . ' LOGOUT')) { 
    853853            $this->readReply(); 
    854854        } 
     
    10871087 
    10881088        // build FETCH command string 
    1089             $key     = $this->next_tag(); 
     1089            $key     = $this->nextTag(); 
    10901090            $cmd     = $uidfetch ? 'UID FETCH' : 'FETCH'; 
    10911091            $deleted = $skip_deleted ? ' FLAGS' : ''; 
     
    11081108 
    11091109            if (!$this->putLine($request)) { 
    1110             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $request"); 
     1110            $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 
    11111111                    return false; 
    11121112        } 
     
    13121312 
    13131313            /* FETCH uid, size, flags and headers */ 
    1314             $key          = $this->next_tag(); 
     1314            $key          = $this->nextTag(); 
    13151315            $request  = $key . ($uidfetch ? ' UID' : '') . " FETCH $message_set "; 
    13161316            $request .= "(UID RFC822.SIZE FLAGS INTERNALDATE "; 
     
    13211321 
    13221322            if (!$this->putLine($request)) { 
    1323             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $request"); 
     1323            $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 
    13241324                    return false; 
    13251325            } 
     
    17061706            // Clear internal status cache 
    17071707            unset($this->data['STATUS:'.$from]); 
    1708          
     1708 
    17091709            return $this->delete($from, $messages); 
    17101710        } 
     
    18491849 
    18501850            if ($esearch) { 
    1851                 // Skip prefix: ... (TAG "A285") UID ...       
     1851                // Skip prefix: ... (TAG "A285") UID ... 
    18521852                $this->tokenizeResponse($response, $return_uid ? 2 : 1); 
    18531853 
     
    18781878                        $result['ALL'] = $this->compressMessageSet($response, true); 
    18791879 
    1880                     return $result;                     
     1880                    return $result; 
    18811881                } 
    18821882                else { 
     
    20182018        $result = false; 
    20192019            $parts  = (array) $parts; 
    2020         $key    = $this->next_tag(); 
     2020        $key    = $this->nextTag(); 
    20212021            $peeks  = ''; 
    20222022        $idx    = 0; 
     
    20312031            // send request 
    20322032            if (!$this->putLine($request)) { 
    2033             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $request"); 
     2033            $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 
    20342034                return false; 
    20352035            } 
     
    20822082        // format request 
    20832083                $reply_key = '* ' . $id; 
    2084                 $key       = $this->next_tag(); 
     2084                $key       = $this->nextTag(); 
    20852085                $request   = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])"; 
    20862086 
    20872087        // send request 
    20882088                if (!$this->putLine($request)) { 
    2089             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $request"); 
     2089            $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 
    20902090                    return false; 
    20912091                } 
     
    22742274            } 
    22752275 
    2276         $key = $this->next_tag(); 
     2276        $key = $this->nextTag(); 
    22772277            $request = sprintf("$key APPEND %s (\\Seen) {%d%s}", $this->escape($mailbox), 
    22782278            $len, ($this->prefs['literal+'] ? '+' : '')); 
     
    23032303            } 
    23042304        else { 
    2305             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $request"); 
     2305            $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 
    23062306        } 
    23072307 
     
    23212321            } 
    23222322            if (!$in_fp) { 
    2323                     $this->set_error(self::ERROR_UNKNOWN, "Couldn't open $path for reading"); 
     2323                    $this->setError(self::ERROR_UNKNOWN, "Couldn't open $path for reading"); 
    23242324                    return false; 
    23252325            } 
     
    23382338 
    23392339        // send APPEND command 
    2340         $key = $this->next_tag(); 
     2340        $key = $this->nextTag(); 
    23412341            $request = sprintf("$key APPEND %s (\\Seen) {%d%s}", $this->escape($mailbox), 
    23422342            $len, ($this->prefs['literal+'] ? '+' : '')); 
     
    23802380            } 
    23812381        else { 
    2382             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $request"); 
     2382            $this->setError(self::ERROR_COMMAND, "Unable to send command: $request"); 
    23832383        } 
    23842384 
     
    23922392        } 
    23932393 
    2394                 $key = $this->next_tag(); 
     2394                $key = $this->nextTag(); 
    23952395        $result = false; 
    23962396        $command = $key . ($is_uid ? ' UID' : '') ." FETCH $id (BODYSTRUCTURE)"; 
     
    24072407                } 
    24082408        else { 
    2409             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $command"); 
     2409            $this->setError(self::ERROR_COMMAND, "Unable to send command: $command"); 
    24102410        } 
    24112411 
     
    24232423            $result      = false; 
    24242424            $quota_lines = array(); 
    2425             $key         = $this->next_tag(); 
     2425            $key         = $this->nextTag(); 
    24262426        $command     = $key . ' GETQUOTAROOT INBOX'; 
    24272427 
     
    24362436            } 
    24372437        else { 
    2438             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $command"); 
     2438            $this->setError(self::ERROR_COMMAND, "Unable to send command: $command"); 
    24392439        } 
    24402440 
     
    25442544            } 
    25452545 
    2546             $this->set_error(self::ERROR_COMMAND, "Incomplete ACL response"); 
     2546            $this->setError(self::ERROR_COMMAND, "Incomplete ACL response"); 
    25472547            return NULL; 
    25482548        } 
     
    26232623    { 
    26242624        if (!is_array($entries) || empty($entries)) { 
    2625             $this->set_error(self::ERROR_COMMAND, "Wrong argument for SETMETADATA command"); 
     2625            $this->setError(self::ERROR_COMMAND, "Wrong argument for SETMETADATA command"); 
    26262626            return false; 
    26272627        } 
     
    26612661 
    26622662        if (empty($entries)) { 
    2663             $this->set_error(self::ERROR_COMMAND, "Wrong argument for SETMETADATA command"); 
     2663            $this->setError(self::ERROR_COMMAND, "Wrong argument for SETMETADATA command"); 
    26642664            return false; 
    26652665        } 
     
    27662766    { 
    27672767        if (!is_array($data) || empty($data)) { 
    2768             $this->set_error(self::ERROR_COMMAND, "Wrong argument for SETANNOTATION command"); 
     2768            $this->setError(self::ERROR_COMMAND, "Wrong argument for SETANNOTATION command"); 
    27692769            return false; 
    27702770        } 
     
    28062806    { 
    28072807        if (!is_array($data) || empty($data)) { 
    2808             $this->set_error(self::ERROR_COMMAND, "Wrong argument for SETANNOTATION command"); 
     2808            $this->setError(self::ERROR_COMMAND, "Wrong argument for SETANNOTATION command"); 
    28092809            return false; 
    28102810        } 
     
    28952895     * @since 0.5-beta 
    28962896     */ 
    2897     function next_tag() 
     2897    function nextTag() 
    28982898    { 
    28992899        $this->cmd_num++; 
     
    29162916    function execute($command, $arguments=array(), $options=0) 
    29172917    { 
    2918         $tag      = $this->next_tag(); 
     2918        $tag      = $this->nextTag(); 
    29192919        $query    = $tag . ' ' . $command; 
    29202920        $noresp   = ($options & self::COMMAND_NORESPONSE); 
     
    29262926        // Send command 
    29272927            if (!$this->putLineC($query)) { 
    2928             $this->set_error(self::ERROR_COMMAND, "Unable to send command: $query"); 
     2928            $this->setError(self::ERROR_COMMAND, "Unable to send command: $query"); 
    29292929                    return $noresp ? self::ERROR_COMMAND : array(self::ERROR_COMMAND, ''); 
    29302930            } 
     
    30793079    } 
    30803080 
    3081     private function SplitHeaderLine($string) 
     3081    private function splitHeaderLine($string) 
    30823082    { 
    30833083            $pos = strpos($string, ':'); 
Note: See TracChangeset for help on using the changeset viewer.