[ Index ]
 

Code source de Claroline 188

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/claroline/inc/lib/pear/File/Passwd/ -> Common.php (sommaire)

Baseclass for File_Passwd_* classes.

Author: Michael Wallner <mike@php.net>
Poids: 381 lignes (10 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

File_Passwd_Common:: (13 méthodes):
  __construct()
  parse()
  save()
  _open()
  _close()
  load()
  _save()
  setFile()
  getFile()
  userExists()
  delUser()
  listUser()
  _auth()


Classe: File_Passwd_Common  - X-Ref

Baseclass for File_Passwd_* classes.

<kbd><u>
Provides basic operations:
</u></kbd>
o opening & closing
o locking & unlocking
o loading & saving
o check if user exist
o delete a certain user
o list users

__construct($file = 'passwd')   X-Ref
Constructor (ZE2)

param: string    $file   path to passwd file

parse()   X-Ref
Parse the content of the file

You must overwrite this method in your File_Passwd_* class.

return: object    PEAR_Error

save()   X-Ref
Apply changes and rewrite passwd file

You must overwrite this method in your File_Passwd_* class.

return: object    PEAR_Error

_open($mode, $file = null)   X-Ref
Opens a file, locks it exclusively and returns the filehandle

Returns a PEAR_Error if:
o directory in which the file should reside couldn't be created
o file couldn't be opened in the desired mode
o file couldn't be locked exclusively

param: string    $mode   the mode to open the file with
return: mixed resource of type file handle or PEAR_Error

_close(&$file_handle)   X-Ref
Closes a prior opened and locked file handle

Returns a PEAR_Error if:
o file couldn't be unlocked
o file couldn't be closed

param: resource  $file_handle    the file handle to operate on
return: mixed true on success or PEAR_Error

load()   X-Ref
Loads the file

Returns a PEAR_Error if:
o directory in which the file should reside couldn't be created
o file couldn't be opened in read mode
o file couldn't be locked exclusively
o file couldn't be unlocked
o file couldn't be closed

return: mixed true on success or PEAR_Error

_save($content)   X-Ref
Save the modified content to the passwd file

Returns a PEAR_Error if:
o directory in which the file should reside couldn't be created
o file couldn't be opened in write mode
o file couldn't be locked exclusively
o file couldn't be unlocked
o file couldn't be closed

return: mixed true on success or PEAR_Error

setFile($file)   X-Ref
Set path to passwd file

return: void

getFile()   X-Ref
Get path of passwd file

return: string

userExists($user)   X-Ref
Check if a certain user already exists

param: string    $user   the name of the user to check if already exists
return: bool

delUser($user)   X-Ref
Delete a certain user

Returns a PEAR_Error if user doesn't exist.

param: string    
return: mixed true on success or PEAR_Error

listUser($user = '')   X-Ref
List user

Returns a PEAR_Error if <var>$user</var> doesn't exist.

param: string    $user   the user to list or all users if empty
return: mixed array of a/all user(s) or PEAR_Error

_auth($file, $id, $sep = ':')   X-Ref
Base method for File_Passwd::staticAuth()

Returns a PEAR_Error if:
o file doesn't exist
o file couldn't be opened in read mode
o file couldn't be locked exclusively
o file couldn't be unlocked (only if auth fails)
o file couldn't be closed (only if auth fails)

param: string      $file   path to passwd file
param: string      $id     user_id to search for
param: string      $sep    field separator
return: mixed       line of passwd file containing <var>$id</var>,



Généré le : Thu Nov 29 14:38:42 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics