PHP 클래스 Horde\ManageSieve

저자: Richard Heyes ([email protected])
저자: Damian Fernandez Sosa ([email protected])
저자: Anish Mistry ([email protected])
저자: Jan Schneider ([email protected])
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$supportedAuthMethods array Can be overwritten if having problems with certain methods.
$supportedSASLAuthMethods array SASL authentication methods that require Auth_SASL.

보호된 프로퍼티들

프로퍼티 타입 설명
$_logger string | array Logging handler.
$_maxReferralCount array Maximum number of referral loops
$_params array Parameters and connection information.
$_sock Horde\Socket\Client The socket client.
$_state integer One of the STATE_* constants.

공개 메소드들

메소드 설명
__construct ( array $params = [] ) Constructor.
connect ( string $host = null, string $port = null, array $context = null, boolean $secure = null ) Handles connecting to the server and checks the response validity.
disconnect ( boolean $sendLogoutCMD = true ) Disconnect from the Sieve server.
getActive ( ) : string Returns the active script.
getAuthMechs ( ) : array Returns the list of authentication methods the server supports.
getExtensions ( ) : array Returns the list of extensions the server supports.
getScript ( string $scriptname ) : string Retrieves a script.
hasAuthMech ( string $method ) : boolean Returns whether the server supports an authentication method.
hasExtension ( string $extension ) : boolean Returns whether the server supports an extension.
hasSpace ( string $scriptname, integer $size ) : boolean Checks if the server has space to store the script by the server.
installScript ( string $scriptname, string $script, boolean $makeactive = false ) Adds a script to the server.
listScripts ( ) : array Returns an indexed array of scripts currently on the server.
login ( string $user = null, string $password = null, string $authmethod = null, string $euser = null ) Logs into server.
removeScript ( string $scriptname ) Removes a script from the server.
setActive ( string $scriptname ) Sets the active script.
setLogger ( object $logger ) Passes a logger for debug logging.

보호된 메소드들

메소드 설명
_authCRAMMD5 ( string $user, string $pass, string $euser ) Authenticates the user using the CRAM-MD5 method.
_authDigestMD5 ( string $user, string $pass, string $euser ) Authenticates the user using the DIGEST-MD5 method.
_authEXTERNAL ( string $user, string $pass, string $euser ) Authenticates the user using the EXTERNAL method.
_authLOGIN ( string $user, string $pass, string $euser ) Authenticates the user using the LOGIN method.
_authPLAIN ( string $user, string $pass, string $euser ) Authenticates the user using the PLAIN method.
_checkAuthenticated ( ) Asserts that the client is in authenticated state.
_checkConnected ( ) Asserts that the client is in disconnected state.
_cmdAuthenticate ( string $uid, string $pwd, string $authmethod = null, string $euser = '' ) Handles the authentication using any known method.
_cmdCapability ( ) Sends the CAPABILITY command
_cmdDeleteScript ( string $scriptname ) Removes a script from the server.
_cmdGetScript ( string $scriptname ) : string Retrieves the contents of the named script.
_cmdListScripts ( ) : array Returns the list of scripts on the server.
_cmdLogout ( boolean $sendLogoutCMD = true ) Logs out of the server and terminates the connection.
_cmdPutScript ( string $scriptname, string $scriptdata ) Adds a script to the server.
_cmdSetActive ( string $scriptname ) Sets the active script, i.e. the one that gets run on new mail by the server.
_debug ( string $message ) Write debug text to the current log handler.
_doCmd ( string $cmd = '', boolean $auth = false ) : string Send a command and retrieves a response from the server.
_escape ( string $string ) : string Converts strings into RFC's quoted-string or literal-c2s form.
_getBestAuthMethod ( string $authmethod = null ) : string Returns the name of the best authentication method that the server has advertised.
_handleConnectAndLogin ( ) Connects to the server and logs in.
_parseCapability ( string $data ) Parses the response from the CAPABILITY command and stores the result in $_capability.
_recvBytes ( integer $length ) : string Receives a number of bytes from the server.
_recvLn ( ) : string Receives a single line from the server.
_sendCmd ( string $cmd ) Sends a command to the server
_sendStringResponse ( string $str ) Sends a string response to the server.

메소드 상세

__construct() 공개 메소드

If username and password are provided connects to the server and logs in too.
public __construct ( array $params = [] )
$params array A hash of connection parameters: - host: Hostname of server (DEFAULT: localhost). Optionally prefixed with protocol scheme. - port: Port of server (DEFAULT: 4190). - user: Login username (optional). - password: Login password (optional). - authmethod: Type of login to perform (see $supportedAuthMethods) (DEFAULT: AUTH_AUTOMATIC). - euser: Effective user. If authenticating as an administrator, login as this user. - bypassauth: Skip the authentication phase. Useful if passing an already open socket. - secure: Security layer requested. One of: - true: (TLS if available/necessary) [DEFAULT] - false: (No encryption) - 'ssl': (Auto-detect SSL version) - 'sslv2': (Force SSL version 3) - 'sslv3': (Force SSL version 2) - 'tls': (TLS; started via protocol-level negotation over unencrypted channel) - 'tlsv1': (TLS version 1.x connection) - context: Additional options for stream_context_create(). - logger: A log handler, must implement debug().

_authCRAMMD5() 보호된 메소드

Authenticates the user using the CRAM-MD5 method.
protected _authCRAMMD5 ( string $user, string $pass, string $euser )
$user string The userid to authenticate as.
$pass string The password to authenticate with.
$euser string The effective uid to authenticate as. Not used.

_authDigestMD5() 보호된 메소드

Authenticates the user using the DIGEST-MD5 method.
protected _authDigestMD5 ( string $user, string $pass, string $euser )
$user string The userid to authenticate as.
$pass string The password to authenticate with.
$euser string The effective uid to authenticate as.

_authEXTERNAL() 보호된 메소드

Authenticates the user using the EXTERNAL method.
protected _authEXTERNAL ( string $user, string $pass, string $euser )
$user string The userid to authenticate as.
$pass string The password to authenticate with.
$euser string The effective uid to authenticate as.

_authLOGIN() 보호된 메소드

Authenticates the user using the LOGIN method.
protected _authLOGIN ( string $user, string $pass, string $euser )
$user string The userid to authenticate as.
$pass string The password to authenticate with.
$euser string The effective uid to authenticate as. Not used.

_authPLAIN() 보호된 메소드

Authenticates the user using the PLAIN method.
protected _authPLAIN ( string $user, string $pass, string $euser )
$user string The userid to authenticate as.
$pass string The password to authenticate with.
$euser string The effective uid to authenticate as.

_checkAuthenticated() 보호된 메소드

Asserts that the client is in authenticated state.
protected _checkAuthenticated ( )

_checkConnected() 보호된 메소드

Asserts that the client is in disconnected state.
protected _checkConnected ( )

_cmdAuthenticate() 보호된 메소드

Handles the authentication using any known method.
protected _cmdAuthenticate ( string $uid, string $pwd, string $authmethod = null, string $euser = '' )
$uid string The userid to authenticate as.
$pwd string The password to authenticate with.
$authmethod string The method to use. If empty, the class chooses the best (strongest) available method.
$euser string The effective uid to authenticate as.

_cmdCapability() 보호된 메소드

Sends the CAPABILITY command
protected _cmdCapability ( )

_cmdDeleteScript() 보호된 메소드

Removes a script from the server.
protected _cmdDeleteScript ( string $scriptname )
$scriptname string Name of the script to delete.

_cmdGetScript() 보호된 메소드

Retrieves the contents of the named script.
protected _cmdGetScript ( string $scriptname ) : string
$scriptname string Name of the script to retrieve.
리턴 string The script.

_cmdListScripts() 보호된 메소드

Returns the list of scripts on the server.
protected _cmdListScripts ( ) : array
리턴 array An array with the list of scripts in the first element and the active script in the second element.

_cmdLogout() 보호된 메소드

Logs out of the server and terminates the connection.
protected _cmdLogout ( boolean $sendLogoutCMD = true )
$sendLogoutCMD boolean Whether to send LOGOUT command before disconnecting.

_cmdPutScript() 보호된 메소드

Adds a script to the server.
protected _cmdPutScript ( string $scriptname, string $scriptdata )
$scriptname string Name of the new script.
$scriptdata string The new script.

_cmdSetActive() 보호된 메소드

Sets the active script, i.e. the one that gets run on new mail by the server.
protected _cmdSetActive ( string $scriptname )
$scriptname string The name of the script to mark as active.

_debug() 보호된 메소드

Write debug text to the current log handler.
protected _debug ( string $message )
$message string Debug message text.

_doCmd() 보호된 메소드

Send a command and retrieves a response from the server.
protected _doCmd ( string $cmd = '', boolean $auth = false ) : string
$cmd string The command to send.
$auth boolean Whether this is an authentication command.
리턴 string Reponse string if an OK response.

_escape() 보호된 메소드

Converts strings into RFC's quoted-string or literal-c2s form.
protected _escape ( string $string ) : string
$string string The string to convert.
리턴 string Result string.

_getBestAuthMethod() 보호된 메소드

Returns the name of the best authentication method that the server has advertised.
protected _getBestAuthMethod ( string $authmethod = null ) : string
$authmethod string Only consider this method as available.
리턴 string The name of the best supported authentication method.

_handleConnectAndLogin() 보호된 메소드

Connects to the server and logs in.
protected _handleConnectAndLogin ( )

_parseCapability() 보호된 메소드

Parses the response from the CAPABILITY command and stores the result in $_capability.
protected _parseCapability ( string $data )
$data string The response from the capability command.

_recvBytes() 보호된 메소드

Receives a number of bytes from the server.
protected _recvBytes ( integer $length ) : string
$length integer Number of bytes to read.
리턴 string The server response.

_recvLn() 보호된 메소드

Receives a single line from the server.
protected _recvLn ( ) : string
리턴 string The server response line.

_sendCmd() 보호된 메소드

Sends a command to the server
protected _sendCmd ( string $cmd )
$cmd string The command to send.

_sendStringResponse() 보호된 메소드

Sends a string response to the server.
protected _sendStringResponse ( string $str )
$str string The string to send.

connect() 공개 메소드

Defaults from the constructor are used for missing parameters.
public connect ( string $host = null, string $port = null, array $context = null, boolean $secure = null )
$host string Hostname of server.
$port string Port of server.
$context array List of options to pass to stream_context_create().
$secure boolean Security layer requested. @see __construct().

disconnect() 공개 메소드

Disconnect from the Sieve server.
public disconnect ( boolean $sendLogoutCMD = true )
$sendLogoutCMD boolean Whether to send LOGOUT command before disconnecting.

getActive() 공개 메소드

Returns the active script.
public getActive ( ) : string
리턴 string The active scriptname.

getAuthMechs() 공개 메소드

Returns the list of authentication methods the server supports.
public getAuthMechs ( ) : array
리턴 array List of authentication methods.

getExtensions() 공개 메소드

Returns the list of extensions the server supports.
public getExtensions ( ) : array
리턴 array List of extensions.

getScript() 공개 메소드

Retrieves a script.
public getScript ( string $scriptname ) : string
$scriptname string The name of the script to be retrieved.
리턴 string The script.

hasAuthMech() 공개 메소드

Returns whether the server supports an authentication method.
public hasAuthMech ( string $method ) : boolean
$method string The method to check.
리턴 boolean Whether the method is supported.

hasExtension() 공개 메소드

Returns whether the server supports an extension.
public hasExtension ( string $extension ) : boolean
$extension string The extension to check.
리턴 boolean Whether the extension is supported.

hasSpace() 공개 메소드

Checks if the server has space to store the script by the server.
public hasSpace ( string $scriptname, integer $size ) : boolean
$scriptname string The name of the script to mark as active.
$size integer The size of the script.
리턴 boolean True if there is space.

installScript() 공개 메소드

Adds a script to the server.
public installScript ( string $scriptname, string $script, boolean $makeactive = false )
$scriptname string Name of the script.
$script string The script content.
$makeactive boolean Whether to make this the active script.

listScripts() 공개 메소드

Returns an indexed array of scripts currently on the server.
public listScripts ( ) : array
리턴 array Indexed array of scriptnames.

login() 공개 메소드

Defaults from the constructor are used for missing parameters.
public login ( string $user = null, string $password = null, string $authmethod = null, string $euser = null )
$user string Login username.
$password string Login password.
$authmethod string Type of login method to use.
$euser string Effective UID (perform on behalf of $euser).

removeScript() 공개 메소드

Removes a script from the server.
public removeScript ( string $scriptname )
$scriptname string Name of the script.

setActive() 공개 메소드

Sets the active script.
public setActive ( string $scriptname )
$scriptname string The name of the script to be set as active.

setLogger() 공개 메소드

Passes a logger for debug logging.
public setLogger ( object $logger )
$logger object A log handler, must implement debug().

프로퍼티 상세

$_logger 보호되어 있는 프로퍼티

Logging handler.
protected string|array $_logger
리턴 string | array

$_maxReferralCount 보호되어 있는 프로퍼티

Maximum number of referral loops
protected array $_maxReferralCount
리턴 array

$_params 보호되어 있는 프로퍼티

Parameters and connection information.
protected array $_params
리턴 array

$_sock 보호되어 있는 프로퍼티

The socket client.
protected Client,Horde\Socket $_sock
리턴 Horde\Socket\Client

$_state 보호되어 있는 프로퍼티

One of the STATE_* constants.
protected int $_state
리턴 integer

$supportedAuthMethods 공개적으로 프로퍼티

Can be overwritten if having problems with certain methods.
public array $supportedAuthMethods
리턴 array

$supportedSASLAuthMethods 공개적으로 프로퍼티

SASL authentication methods that require Auth_SASL.
public array $supportedSASLAuthMethods
리턴 array