PHP Class Vilma_Driver_Sql, horde

See the enclosed file LICENSE for license information (BSD). If you did did not receive this file, see http://www.horde.org/licenses/bsd.
Author: Marko Djukic ([email protected])
Inheritance: extends Vilma_Driver
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_db Horde_Db

Public Methods

Method Description
__construct ( array $params ) Constructor.
deleteUser ( integer $user_id ) Deletes a user.
deleteVirtual ( integer $virtual_id ) Deletes a virtual email.
getDomain ( integer $domain_id ) : array Returns the specified domain information from the backend.
getDomainByName ( $domain_name ) : array Given a domain name returns the information from the backend.
getDomainNumUsers ( string $domain_name ) : integer Returns the current number of users for a domain.
getDomains ( ) : array Returns the list of domains from the backend.
getUser ( integer $user_id ) : array Returns the user information for a given user id.
getUsers ( string $domain = null ) : array Returns all available users, if a domain name is passed then limit the list of users only to those users.
getVirtual ( integer $virtual_id ) : array Returns information for a virtual id.
getVirtuals ( string $filter ) : array Returns available virtual emails.
saveVirtual ( array $info, string $domain ) Saves virtual email address to the backend.

Protected Methods

Method Description
_deleteDomain ( integer $domain_id ) Deletes a domain.
_getAddresses ( string $domain, string $type = 'all' ) : array Returns a list of all users, aliases, or groups and forwards for a domain.
_getTableField ( $table, $field ) : string Returns the real name of a field from a specific table for SQL statements.
_getTableFields ( $table ) : string Returns the list of fields from a specific table for SQL statements.
_initialize ( ) Initializes this backend, connects to the SQL database.
_prepareRecord ( $table, $record ) : array
_saveDomain ( array $info ) Saves a domain with the provided information.
_saveUser ( array $info ) : string Saves a user to the backend.

Method Details

__construct() public method

Constructor.
public __construct ( array $params )
$params array Any parameters needed for this driver.

_deleteDomain() protected method

Deletes a domain.
protected _deleteDomain ( integer $domain_id )
$domain_id integer The id of the domain to delete.

_getAddresses() protected method

Returns a list of all users, aliases, or groups and forwards for a domain.
protected _getAddresses ( string $domain, string $type = 'all' ) : array
$domain string Domain on which to search.
$type string Only return a specific type. One of 'all', 'user', 'alias','forward', or 'group'.
return array Account information for this domain

_getTableField() protected method

Returns the real name of a field from a specific table for SQL statements.
protected _getTableField ( $table, $field ) : string
return string

_getTableFields() protected method

Returns the list of fields from a specific table for SQL statements.
protected _getTableFields ( $table ) : string
return string

_initialize() protected method

Initializes this backend, connects to the SQL database.
protected _initialize ( )

_prepareRecord() protected method

protected _prepareRecord ( $table, $record ) : array
return array

_saveDomain() protected method

Saves a domain with the provided information.
protected _saveDomain ( array $info )
$info array Array of details to save the domain.

_saveUser() protected method

Saves a user to the backend.
protected _saveUser ( array $info ) : string
$info array The user information to save.
return string The user ID.

deleteUser() public method

Deletes a user.
public deleteUser ( integer $user_id )
$user_id integer The id of the user to delete.

deleteVirtual() public method

Deletes a virtual email.
public deleteVirtual ( integer $virtual_id )
$virtual_id integer The id of the virtual email to delete.

getDomain() public method

Returns the specified domain information from the backend.
public getDomain ( integer $domain_id ) : array
$domain_id integer The id of the domain to fetch.
return array The domain's information in an array.

getDomainByName() public method

Given a domain name returns the information from the backend.
public getDomainByName ( $domain_name ) : array
return array The domain's information in an array.

getDomainNumUsers() public method

Returns the current number of users for a domain.
public getDomainNumUsers ( string $domain_name ) : integer
$domain_name string The name of the domain for which to get the current number of users.
return integer The current number of users.

getDomains() public method

Returns the list of domains from the backend.
public getDomains ( ) : array
return array All the domains and their data in an array.

getUser() public method

Returns the user information for a given user id.
public getUser ( integer $user_id ) : array
$user_id integer The id of the user for which to fetch information.
return array The user information.

getUsers() public method

Returns all available users, if a domain name is passed then limit the list of users only to those users.
public getUsers ( string $domain = null ) : array
$domain string The name of the domain for which to fetch the users.
return array The available users and their stored information.

getVirtual() public method

Returns information for a virtual id.
public getVirtual ( integer $virtual_id ) : array
$virtual_id integer The virtual id for which to return information.
return array The virtual email information.

getVirtuals() public method

Returns available virtual emails.
public getVirtuals ( string $filter ) : array
$filter string If passed a domain then return all virtual emails for the domain, otherwise if passed a user name return all virtual emails for that user.
return array The available virtual emails.

saveVirtual() public method

Saves virtual email address to the backend.
public saveVirtual ( array $info, string $domain )
$info array The virtual email data.
$domain string The name of the domain for this virtual email.

Property Details

$_db protected property

protected Horde_Db $_db
return Horde_Db