PHP Class Folks_Driver_sql, horde

Required values for $params:
     'phptype'       The database type (e.g. 'pgsql', 'mysql', etc.).
     'table'         The name of the foo table in 'database'.
     'charset'       The database's internal charset.
Required by some database implementations:
     'database'      The name of the database.
     'hostspec'      The hostname of the database server.
     'protocol'      The communication protocol ('tcp', 'unix', etc.).
     'username'      The username with which to connect to the database.
     'password'      The password associated with 'username'.
     'options'       Additional options to pass to the database.
     'tty'           The TTY on which to connect to the database.
     'port'          The port on which to connect to the database.
The table structure can be created by the scripts/sql/folks_foo.sql script. Copyright 2008-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Author: Duck ([email protected])
Inheritance: extends Folks_Driver
Exibir arquivo Open project: horde/horde

Public Methods

Method Description
__construct ( array $params = [] ) Constructs a new SQL storage object.
addUser ( $user, array $credentials ) : boolean Adds a set of authentication credentials.
countUsers ( $criteria = [] ) Count users by attributes
deleteOnlineUser ( $user ) Remove user if is online
getUsers ( $criteria = [], $from, $count ) Get users by attributes
getViews ( ) Get user groups
updateComments ( string $user, $reset = false ) Update user comments count
userExists ( string $user ) : boolean Check if user exist

Protected Methods

Method Description
_deleteActivity ( string $scope, integer $date, string $user ) : true Delete users activity
_deleteImage ( string $user ) Delete user image
_deleteOnlineStatus ( $to ) Delete users online
_deleteSavedSearch ( string $name ) Delete saved search
_deleteUser ( string $user ) : boolean Delete user
_getActivity ( string $user, $limit ) : array Get user's activity
_getCryptedPassword ( string $user ) : string Formats a password using the current encryption.
_getOnlineUsers ( ) Get usersnames online
_getProfile ( string $user ) Get user profile
_getRandomUsers ( integer $limit = 10, boolean $online = false ) : array Get random users
_getRecentVisitors ( integer $limit = 10 ) : array Get last visitors
_getSavedSearch ( ) : array Get saved search
_getSearchCriteria ( string $name ) : array Get saved search criteria
_logActivity ( string $message, string $scope, string $user ) : true Log users actions
_logView ( $id ) Log user view
_saveProfile ( array $data, string $user ) Save basic user profile
_saveSearch ( string $criteria, string $name ) Save search criteria
_updateOnlineStatus ( ) Get usersnames online

Private Methods

Method Description
_buildWhere ( $criteria = [] ) : array Build attributes query
_connect ( ) : boolean Attempts to open a persistent connection to the SQL server.

Method Details

__construct() public method

Constructs a new SQL storage object.
public __construct ( array $params = [] )
$params array A hash containing connection parameters.

_deleteActivity() protected method

Delete users activity
protected _deleteActivity ( string $scope, integer $date, string $user ) : true
$scope string Scope
$date integer Date
$user string Username
return true on success

_deleteImage() protected method

Delete user image
protected _deleteImage ( string $user )
$user string Username

_deleteOnlineStatus() protected method

Delete users online
protected _deleteOnlineStatus ( $to )

_deleteSavedSearch() protected method

Delete saved search
protected _deleteSavedSearch ( string $name )
$name string Username

_deleteUser() protected method

Delete user
protected _deleteUser ( string $user ) : boolean
$user string Username
return boolean

_getActivity() protected method

Get user's activity
protected _getActivity ( string $user, $limit ) : array
$user string Username
return array Activity log

_getCryptedPassword() protected method

Formats a password using the current encryption.
protected _getCryptedPassword ( string $user ) : string
$user string User we are getting password for
return string The encrypted password.

_getOnlineUsers() protected method

Get usersnames online
protected _getOnlineUsers ( )

_getProfile() protected method

Get user profile
protected _getProfile ( string $user )
$user string Username

_getRandomUsers() protected method

Get random users
protected _getRandomUsers ( integer $limit = 10, boolean $online = false ) : array
$limit integer Username to check
$online boolean User is online?
return array users

_getRecentVisitors() protected method

Get last visitors
protected _getRecentVisitors ( integer $limit = 10 ) : array
$limit integer Username to check
return array users

_getSavedSearch() protected method

Get saved search
protected _getSavedSearch ( ) : array
return array saved searches

_getSearchCriteria() protected method

Get saved search criteria
protected _getSearchCriteria ( string $name ) : array
$name string Username
return array search criteria

_logActivity() protected method

Log users actions
protected _logActivity ( string $message, string $scope, string $user ) : true
$message string Log message
$scope string Scope
$user string Username
return true on success

_logView() protected method

Log user view
protected _logView ( $id )

_saveProfile() protected method

Save basic user profile
protected _saveProfile ( array $data, string $user )
$data array A hash containing profile data
$user string Username

_saveSearch() protected method

Save search criteria
protected _saveSearch ( string $criteria, string $name )
$criteria string Search criteria
$name string Search name

_updateOnlineStatus() protected method

Get usersnames online
protected _updateOnlineStatus ( )

addUser() public method

Adds a set of authentication credentials.
public addUser ( $user, array $credentials ) : boolean
$credentials array The credentials to use.
return boolean true|PEAR_Error

countUsers() public method

Count users by attributes
public countUsers ( $criteria = [] )

deleteOnlineUser() public method

Remove user if is online
public deleteOnlineUser ( $user )

getUsers() public method

Get users by attributes
public getUsers ( $criteria = [], $from, $count )

getViews() public method

Get user groups
public getViews ( )

updateComments() public method

Update user comments count
public updateComments ( string $user, $reset = false )
$user string Username

userExists() public method

Check if user exist
public userExists ( string $user ) : boolean
$user string Username
return boolean