Merge branch 'develop' of git://github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
simnandez 2012-01-27 17:38:16 +01:00
commit 029b83780e
15 changed files with 287 additions and 236 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (c) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* *
@ -25,8 +25,7 @@
/** /**
* \class FormActions * Class to manage building of HTML components
* \brief Class to manage building of HTML components
*/ */
class FormActions class FormActions
{ {
@ -37,23 +36,23 @@ class FormActions
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function FormActions($DB) function FormActions($db)
{ {
$this->db = $DB; $this->db = $db;
return 1; return 1;
} }
/** /**
* Show list of action status * Show list of action status
* *
* @param formname Name of form where select in included * @param string $formname Name of form where select in included
* @param selected Preselected value * @param string $selected Preselected value
* @param canedit 1=can edit, 0=read only * @param int $canedit 1=can edit, 0=read only
* @param htmlname Name of html prefix for html fields (selectX and valX) * @param string $htmlname Name of html prefix for html fields (selectX and valX)
* @return void
*/ */
function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete') function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete')
{ {
@ -101,11 +100,12 @@ class FormActions
/** /**
* Show list of actions for element * Show list of actions for element
* @param object Object *
* @param typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter' * @param Object $object Object
* @param socid socid of user * @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
* @return int <0 if KO, >=0 if OK * @param int $socid socid of user
* @return int <0 if KO, >=0 if OK
*/ */
function showactions($object,$typeelement,$socid=0) function showactions($object,$typeelement,$socid=0)
{ {
@ -159,9 +159,11 @@ class FormActions
/** /**
* Output list of type of event * Output list of type of event
* @param selected Type pre-selectionne *
* @param htmlname Nom champ formulaire * @param string $selected Type pre-selectionne
* @param string $htmlname Nom champ formulaire
* @return void
*/ */
function select_type_actions($selected='',$htmlname='actioncode') function select_type_actions($selected='',$htmlname='actioncode')
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* *
@ -25,8 +25,7 @@
/** /**
* \class FormAdmin * Class to generate html code for admin pages
* \brief Class to generate html code for admin pages
*/ */
class FormAdmin class FormAdmin
{ {
@ -42,7 +41,6 @@ class FormAdmin
function FormAdmin($db) function FormAdmin($db)
{ {
$this->db = $db; $this->db = $db;
return 1; return 1;
} }
@ -279,7 +277,7 @@ class FormAdmin
/** /**
* Retourne la liste deroulante des menus disponibles (eldy) * Return a HTML select list of timezones
* *
* @param string $selected Menu pre-selectionnee * @param string $selected Menu pre-selectionnee
* @param string $htmlname Nom de la zone select * @param string $htmlname Nom de la zone select

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2011 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2007-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -24,8 +24,7 @@
/** /**
* \class Form * Class to manage barcode HTML
* \brief Classe permettant la generation de composants html
*/ */
class FormBarCode class FormBarCode
{ {
@ -41,7 +40,6 @@ class FormBarCode
function FormBarCode($db) function FormBarCode($db)
{ {
$this->db = $db; $this->db = $db;
return 1; return 1;
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -23,9 +23,8 @@
/** /**
* \class FormCompany * Class to build HTML component for third parties management
* \brief Class to build HTML component for third parties management * Only common components are here.
* \remarks Only common components must be here.
*/ */
class FormCompany class FormCompany
{ {

View File

@ -25,8 +25,7 @@
/** /**
* \class FormFile * Class to offer components to list and upload files
* \brief Class to offer components to list and upload files
*/ */
class FormFile class FormFile
{ {

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* *
@ -25,11 +25,11 @@
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");
/** \class FormMail /**
* \brief Classe permettant la generation du formulaire html d'envoi de mail unitaire * Classe permettant la generation du formulaire html d'envoi de mail unitaire
* \remarks Utilisation: $formail = new FormMail($db) * Usage: $formail = new FormMail($db)
* \remarks $formmail->proprietes=1 ou chaine ou tableau de valeurs * $formmail->proprietes=1 ou chaine ou tableau de valeurs
* \remarks $formmail->show_form() affiche le formulaire * $formmail->show_form() affiche le formulaire
*/ */
class FormMail class FormMail
{ {
@ -69,12 +69,13 @@ class FormMail
/** /**
* \brief Constructeur * Constructor
* \param DB handler d'acces base de donnee *
* @param DoliDB $DB Database handler
*/ */
function FormMail($DB) function FormMail($db)
{ {
$this->db = $DB; $this->db = $db;
$this->withform=1; $this->withform=1;
@ -103,6 +104,8 @@ class FormMail
/** /**
* Clear list of attached files in send mail form (stored in session) * Clear list of attached files in send mail form (stored in session)
*
* @return void
*/ */
function clear_attached_files() function clear_attached_files()
{ {
@ -125,6 +128,7 @@ class FormMail
* @param string $path Full absolute path on filesystem of file, including file name * @param string $path Full absolute path on filesystem of file, including file name
* @param string $file Only filename * @param string $file Only filename
* @param string $type Mime type * @param string $type Mime type
* @return void
*/ */
function add_attached_files($path,$file,$type) function add_attached_files($path,$file,$type)
{ {
@ -148,7 +152,8 @@ class FormMail
/** /**
* Remove a file from the list of attached files (stored in SECTION array) * Remove a file from the list of attached files (stored in SECTION array)
* *
* @param $keytodelete Key in file array * @param string $keytodelete Key in file array
* @return void
*/ */
function remove_attached_files($keytodelete) function remove_attached_files($keytodelete)
{ {
@ -190,8 +195,9 @@ class FormMail
* Show the form to input an email * Show the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
* *
* @param addfileaction Name of action when posting file attachments * @param string $addfileaction Name of action when posting file attachments
* @param removefileaction Name of action when removing file attachments * @param string $removefileaction Name of action when removing file attachments
* @return void
*/ */
function show_form($addfileaction='addfile',$removefileaction='removefile') function show_form($addfileaction='addfile',$removefileaction='removefile')
{ {
@ -202,8 +208,9 @@ class FormMail
* Get the form to input an email * Get the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
* *
* @param addfileaction Name of action when posting file attachments * @param string $addfileaction Name of action when posting file attachments
* @param removefileaction Name of action when removing file attachments * @param string $removefileaction Name of action when removing file attachments
* @return string Form to show
*/ */
function get_form($addfileaction='addfile',$removefileaction='removefile') function get_form($addfileaction='addfile',$removefileaction='removefile')
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -23,9 +23,8 @@
/** /**
* \class FormOrder * Classe permettant la generation de composants html
* \brief Classe permettant la generation de composants html * Only common components are here.
* \remarks Only common components must be here.
*/ */
class FormOrder class FormOrder
{ {
@ -35,24 +34,24 @@ class FormOrder
/** /**
* \brief Constructeur * Constructor
* \param DB handler d'acces base de donnee *
* @param DoliDB $db Database handler
*/ */
function FormOrder($DB) function FormOrder($db)
{ {
$this->db = $DB; $this->db = $db;
return 1; return 1;
} }
/** /**
* Renvoie la liste des sources de commandes * Return list of way to order
* *
* @param selected Id de la source pre-selectionnee * @param string $selected Id of preselected order origin
* @param htmlname Nom de la liste deroulante * @param string $htmlname Name of HTML select list
* @param addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue * @param int $addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @return array Tableau des sources de commandes * @return array Tableau des sources de commandes
*/ */
function selectSourcesCommande($selected='',$htmlname='source_id',$addempty=0) function selectSourcesCommande($selected='',$htmlname='source_id',$addempty=0)
{ {
@ -74,8 +73,12 @@ class FormOrder
/** /**
* Return list of way to order
* *
* * @param string $selected Id of preselected input method
* @param string $htmlname Name of HTML select list
* @param int $addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @return array Tableau des sources de commandes
*/ */
function select_methodes_commande($selected='',$htmlname='source_id',$addempty=0) function select_methodes_commande($selected='',$htmlname='source_id',$addempty=0)
{ {
@ -89,7 +92,7 @@ class FormOrder
$sql.= " FROM ".MAIN_DB_PREFIX."c_input_method"; $sql.= " FROM ".MAIN_DB_PREFIX."c_input_method";
$sql.= " WHERE active = 1"; $sql.= " WHERE active = 1";
dol_syslog("Form::select_methodes_commande sql=".$sql); dol_syslog(get_class($this)."::select_methodes_commande sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
@ -32,9 +32,8 @@
/** /**
* \class FormOther * Classe permettant la generation de composants html autre
* \brief Classe permettant la generation de composants html autre * Only common components are here.
* \remarks Only common components must be here.
*/ */
class FormOther class FormOther
{ {
@ -210,12 +209,12 @@ class FormOther
/** /**
* Return a HTML select list to select a percent * Return a HTML select list to select a percent
* *
* @param selected pourcentage pre-selectionne * @param string $selected pourcentage pre-selectionne
* @param htmlname nom de la liste deroulante * @param string $htmlname nom de la liste deroulante
* @param increment increment value * @param int $increment increment value
* @param start start value * @param int $start start value
* @param end end value * @param int $end end value
* @return return combo * @return string HTML select string
*/ */
function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100) function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100)
{ {
@ -243,10 +242,10 @@ class FormOther
/** /**
* Return select list for categories (to use in form search selectors) * Return select list for categories (to use in form search selectors)
* *
* @param type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) * @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
* @param selected Preselected value * @param string $selected Preselected value
* @param htmlname Name of combo list * @param string $htmlname Name of combo list
* @return return Html combo list code * @return string Html combo list code
*/ */
function select_categories($type,$selected=0,$htmlname='search_categ') function select_categories($type,$selected=0,$htmlname='search_categ')
{ {
@ -279,10 +278,10 @@ class FormOther
/** /**
* Return select list for categories (to use in form search selectors) * Return select list for categories (to use in form search selectors)
* *
* @param selected Preselected value * @param string $selected Preselected value
* @param htmlname Name of combo list * @param string $htmlname Name of combo list
* @param user Object user * @param User $user Object user
* @return return Html combo list code * @return string Html combo list code
*/ */
function select_salesrepresentatives($selected=0,$htmlname='search_sale',$user) function select_salesrepresentatives($selected=0,$htmlname='search_sale',$user)
{ {
@ -373,11 +372,11 @@ class FormOther
/** /**
* Output a HTML code to select a color * Output a HTML code to select a color
* *
* @param set_color Pre-selected color * @param string $set_color Pre-selected color
* @param prefix Name of HTML field * @param string $prefix Name of HTML field
* @param form_name Name of form * @param string $form_name Name of form
* @param showcolorbox 1=Show color code and color box, 0=Show only color code * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
* @param arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
* @return void * @return void
*/ */
function select_color($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='') function select_color($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='')

View File

@ -24,11 +24,11 @@
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");
/** \class FormSms /**
* \brief Classe permettant la generation du formulaire d'envoi de Sms * Classe permettant la generation du formulaire d'envoi de Sms
* \remarks Utilisation: $formsms = new FormSms($db) * Usage: $formsms = new FormSms($db)
* \remarks $formsms->proprietes=1 ou chaine ou tableau de valeurs * $formsms->proprietes=1 ou chaine ou tableau de valeurs
* \remarks $formsms->show_form() affiche le formulaire * $formsms->show_form() affiche le formulaire
*/ */
class FormSms class FormSms
{ {
@ -62,11 +62,11 @@ class FormSms
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function FormSms($DB) function FormSms($db)
{ {
$this->db = $DB; $this->db = $db;
$this->withfrom=1; $this->withfrom=1;
$this->withto=1; $this->withto=1;

View File

@ -25,8 +25,7 @@
/** /**
* \class Interfaces * Class to manage triggers
* \brief Classe de la gestion des triggers
*/ */
class Interfaces class Interfaces
@ -45,26 +44,27 @@ class Interfaces
} }
/** /**
* \brief Fonction appelee lors du declenchement d'un evenement Dolibarr. * Function called when a Dolibarr business event occurs
* Cette fonction declenche tous les triggers trouves actifs. * This function call all qualified triggers.
* \param action Trigger event code *
* \param object Objet concern * @param string $action Trigger event code
* \param user Objet user * @param Object $object Objet concern
* \param lang Objet lang * @param User $user Objet user
* \param conf Objet conf * @param Lang $lang Objet lang
* \return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise. * @param Conf $conf Objet conf
* @return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise.
*/ */
function run_triggers($action,$object,$user,$langs,$conf) function run_triggers($action,$object,$user,$langs,$conf)
{ {
// Check parameters // Check parameters
if (! is_object($object) || ! is_object($conf)) // Error if (! is_object($object) || ! is_object($conf)) // Error
{ {
dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_ERR); dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_ERR);
return -1; return -1;
} }
if (! is_object($user) || ! is_object($langs)) // Warning if (! is_object($user) || ! is_object($langs)) // Warning
{ {
dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING); dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING);
} }
foreach($conf->triggers_modules as $reldir) foreach($conf->triggers_modules as $reldir)
@ -175,9 +175,10 @@ class Interfaces
} }
/** /**
* Return list of triggers. Function used by admin page htdoc/admin/triggers * Return list of triggers. Function used by admin page htdoc/admin/triggers
* @param workflow 0=Return all triggers, 1=Return only triggers not disabled if workflow module activated *
* @return array Array list of triggers * @param int $workflow 0=Return all triggers, 1=Return only triggers not disabled if workflow module activated
* @return array Array list of triggers
*/ */
function getTriggersList($workflow=0) function getTriggersList($workflow=0)
{ {

View File

@ -30,7 +30,6 @@
*/ */
class Ldap class Ldap
{ {
/** /**
* Tableau des serveurs (IP addresses ou nom d'hotes) * Tableau des serveurs (IP addresses ou nom d'hotes)
*/ */
@ -90,7 +89,6 @@ class Ldap
var $ldapcharset='UTF-8'; // LDAP should be UTF-8 encoded var $ldapcharset='UTF-8'; // LDAP should be UTF-8 encoded
// 1.2 Private properties ----------------------------------------------------
/** /**
* The internal LDAP connection handle * The internal LDAP connection handle
*/ */
@ -135,15 +133,16 @@ class Ldap
// 2.1 Connection handling methods ------------------------------------------- // Connection handling methods -------------------------------------------
/** /**
* 2.1.1 : Connects to the server. Just creates a connection which is used * Connects to the server. Just creates a connection which is used
* in all later access to the LDAP server. If it can't connect and bind * in all later access to the LDAP server. If it can't connect and bind
* anonymously, it creates an error code of -1. Returns true if connected, * anonymously, it creates an error code of -1. Returns true if connected,
* false if failed. Takes an array of possible servers - if one doesn't work, * false if failed. Takes an array of possible servers - if one doesn't work,
* it tries the next and so on. * it tries the next and so on.
* \deprecated Utiliser connect_bind a la place *
* @deprecated Utiliser connect_bind a la place
*/ */
function connect() function connect()
{ {
@ -181,10 +180,11 @@ class Ldap
/** /**
* \brief Connect and bind * Connect and bind
* \return <0 si KO, 1 si bind anonymous, 2 si bind auth * Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword
* \remarks Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword * After return, this->connection and $this->bind are defined
* After return, this->connection and $this->bind are defined *
* @return int <0 si KO, 1 si bind anonymous, 2 si bind auth
*/ */
function connect_bind() function connect_bind()
{ {
@ -283,8 +283,10 @@ class Ldap
/** /**
* 2.1.2 : Simply closes the connection set up earlier. * Simply closes the connection set up earlier.
* Returns true if OK, false if there was an error. * Returns true if OK, false if there was an error.
*
* @return boolean true or false
*/ */
function close() function close()
{ {
@ -299,8 +301,10 @@ class Ldap
} }
/** /**
* 2.1.3 : Anonymously binds to the connection. After this is done, * Anonymously binds to the connection. After this is done,
* queries and searches can be done - but read-only. * queries and searches can be done - but read-only.
*
* @return boolean true or false
*/ */
function bind() function bind()
{ {
@ -318,10 +322,14 @@ class Ldap
} }
/** /**
* 2.1.4 : Binds as an authenticated user, which usually allows for write * Binds as an authenticated user, which usually allows for write
* access. The FULL dn must be passed. For a directory manager, this is * access. The FULL dn must be passed. For a directory manager, this is
* "cn=Directory Manager" under iPlanet. For a user, it will be something * "cn=Directory Manager" under iPlanet. For a user, it will be something
* like "uid=jbloggs,ou=People,dc=foo,dc=com". * like "uid=jbloggs,ou=People,dc=foo,dc=com".
*
* @param string $bindDn DN
* @param string $pass Password
* @return boolean true or false
*/ */
function bindauth($bindDn,$pass) function bindauth($bindDn,$pass)
{ {
@ -339,9 +347,9 @@ class Ldap
} }
/** /**
* \brief Unbind du serveur ldap. * Unbind du serveur ldap.
* \param ds *
* \return bool * @return boolean true or false
*/ */
function unbind() function unbind()
{ {
@ -355,9 +363,9 @@ class Ldap
/** /**
* \brief verification de la version du serveur ldap. * Verification de la version du serveur ldap.
* \param ds *
* \return version * @return string version
*/ */
function getVersion() function getVersion()
{ {
@ -367,8 +375,9 @@ class Ldap
} }
/** /**
* \brief changement de la version du serveur ldap. * Change ldap protocol version to use.
* \return version *
* @return string version
*/ */
function setVersion() { function setVersion() {
// LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17 // LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17
@ -377,8 +386,9 @@ class Ldap
} }
/** /**
* \brief changement du referrals. * changement du referrals.
* \return referrals *
* @return string referrals
*/ */
function setReferrals() { function setReferrals() {
// LDAP_OPT_REFERRALS est une constante qui vaut ? // LDAP_OPT_REFERRALS est une constante qui vaut ?
@ -388,12 +398,13 @@ class Ldap
/** /**
* \brief Add a LDAP entry * Add a LDAP entry
* \param dn DN entry key * Ldap object connect and bind must have been done
* \param info Attributes array *
* \param user Objet user that create * @param string $dn DN entry key
* \return int <0 if KO, >0 if OK * @param string $info Attributes array
* \remarks Ldap object connect and bind must have been done * @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/ */
function add($dn, $info, $user) function add($dn, $info, $user)
{ {
@ -439,12 +450,13 @@ class Ldap
} }
/** /**
* \brief Modify a LDAP entry * Modify a LDAP entry
* \param dn DN entry key * Ldap object connect and bind must have been done
* \param info Attributes array *
* \param user Objet user that modify * @param string $dn DN entry key
* \return int <0 if KO, >0 if OK * @param string $info Attributes array
* \remarks Ldap object connect and bind must have been done * @param string $user Objet user that modify
* @return int <0 if KO, >0 if OK
*/ */
function modify($dn, $info, $user) function modify($dn, $info, $user)
{ {
@ -490,13 +502,14 @@ class Ldap
} }
/** /**
* \brief Modify a LDAP entry (to use if dn != olddn) * Modify a LDAP entry (to use if dn != olddn)
* \param dn DN entry key * Ldap object connect and bind must have been done
* \param info Attributes array *
* \param user Objet user that delete * @param string $dn DN entry key
* \param olddn Old DN entry key (before update) * @param string $info Attributes array
* \return int <0 if KO, >0 if OK * @param User $user Objet user that delete
* \remarks Ldap object connect and bind must have been done * @param string $olddn Old DN entry key (before update)
* @return int <0 if KO, >0 if OK
*/ */
function update($dn,$info,$user,$olddn) function update($dn,$info,$user,$olddn)
{ {
@ -544,10 +557,11 @@ class Ldap
/** /**
* \brief Delete a LDAP entry * Delete a LDAP entry
* \param dn DN entry key * Ldap object connect and bind must have been done
* \return int <0 si KO, >0 si OK *
* \remarks Ldap object connect and bind must have been done * @param string $dn DN entry key
* @return int <0 if KO, >0 if OK
*/ */
function delete($dn) function delete($dn)
{ {
@ -577,10 +591,11 @@ class Ldap
} }
/** /**
* \brief Build a LDAP message * Build a LDAP message
* \param dn DN entry key *
* \param info Attributes array * @param string $dn DN entry key
* \return string Content of file * @param string $info Attributes array
* @return string Content of file
*/ */
function dump_content($dn, $info) function dump_content($dn, $info)
{ {
@ -618,10 +633,11 @@ class Ldap
} }
/** /**
* \brief Dump a LDAP message to ldapinput.in file * Dump a LDAP message to ldapinput.in file
* \param dn DN entry key *
* \param info Attributes array * @param string $dn DN entry key
* \return int <0 if KO, >0 if OK * @param string $info Attributes array
* @return int <0 if KO, >0 if OK
*/ */
function dump($dn, $info) function dump($dn, $info)
{ {
@ -650,15 +666,16 @@ class Ldap
} }
// 2.4 Attribute methods ----------------------------------------------------- // Attribute methods -----------------------------------------------------
/** /**
* \brief Add a LDAP attribute in entry * Add a LDAP attribute in entry
* \param dn DN entry key * Ldap object connect and bind must have been done
* \param info Attributes array *
* \param user Objet user that create * @param string $dn DN entry key
* \return int <0 if KO, >0 if OK * @param string $info Attributes array
* \remarks Ldap object connect and bind must have been done * @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/ */
function addAttribute($dn, $info, $user) function addAttribute($dn, $info, $user)
{ {
@ -704,12 +721,13 @@ class Ldap
} }
/** /**
* \brief Update a LDAP attribute in entry * Update a LDAP attribute in entry
* \param dn DN entry key * Ldap object connect and bind must have been done
* \param info Attributes array *
* \param user Objet user that create * @param string $dn DN entry key
* \return int <0 if KO, >0 if OK * @param string $info Attributes array
* \remarks Ldap object connect and bind must have been done * @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/ */
function updateAttribute($dn, $info, $user) function updateAttribute($dn, $info, $user)
{ {
@ -755,12 +773,13 @@ class Ldap
} }
/** /**
* \brief Delete a LDAP attribute in entry * Delete a LDAP attribute in entry
* \param dn DN entry key * Ldap object connect and bind must have been done
* \param info Attributes array *
* \param user Objet user that create * @param string $dn DN entry key
* \return int <0 if KO, >0 if OK * @param string $info Attributes array
* \remarks Ldap object connect and bind must have been done * @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/ */
function deleteAttribute($dn, $info, $user) function deleteAttribute($dn, $info, $user)
{ {
@ -807,6 +826,10 @@ class Ldap
/** /**
* Returns an array containing attributes and values for first record * Returns an array containing attributes and values for first record
*
* @param string $dn DN entry key
* @param string $filter Filter
* @return int <0 if KO, >0 if OK
*/ */
function getAttribute($dn,$filter) function getAttribute($dn,$filter)
{ {
@ -848,6 +871,10 @@ class Ldap
/** /**
* Returns an array containing values for an attribute and for first record matching filterrecord * Returns an array containing values for an attribute and for first record matching filterrecord
*
* @param string $filterrecord Record
* @param string $attribute Attributes
* @return void
*/ */
function getAttributeValues($filterrecord,$attribute) function getAttributeValues($filterrecord,$attribute)
{ {
@ -882,14 +909,15 @@ class Ldap
} }
/** /**
* \brief Returns an array containing a details of elements * Returns an array containing a details of elements
* \param $search Valeur champ cle recherche, sinon '*' pour tous. * ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
* \param $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org) *
* \param $useridentifier Nom du champ cle (Ex: uid) * @param string $search Valeur champ cle recherche, sinon '*' pour tous.
* \param $attributeArray Array of fields required (Ex: sn,userPassword) * @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
* \param $activefilter 1=utilise le champ this->filter comme filtre * @param string $useridentifier Name of key field (Ex: uid)
* \return array Array of [id_record][ldap_field]=value * @param array $attributeArray Array of fields required (Ex: sn,userPassword)
* \remarks ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword * @param int $activefilter 1=utilise le champ this->filter comme filtre
* @return array Array of [id_record][ldap_field]=value
*/ */
function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter=0) function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter=0)
{ {
@ -980,9 +1008,12 @@ class Ldap
/** /**
* Converts a little-endian hex-number to one, that 'hexdec' can convert * Converts a little-endian hex-number to one, that 'hexdec' can convert
* Indispensable pour Active Directory * Required by Active Directory
*
* @param string $hex
*/ */
function littleEndian($hex) { function littleEndian($hex)
{
for ($x=dol_strlen($hex)-2; $x >= 0; $x=$x-2) { for ($x=dol_strlen($hex)-2; $x >= 0; $x=$x-2) {
$result .= substr($hex,$x,2); $result .= substr($hex,$x,2);
} }
@ -991,9 +1022,10 @@ class Ldap
/** /**
* Recupere le SID de l'utilisateur * Recupere le SID de l'utilisateur
* ldapuser. le login de l'utilisateur * Required by Active Directory
* Indispensable pour Active Directory *
* @param string $ldapuser Login de l'utilisateur
*/ */
function getObjectSid($ldapUser) function getObjectSid($ldapUser)
{ {
@ -1050,8 +1082,12 @@ class Ldap
/** /**
* Returns the textual SID * Returns the textual SID
* Indispensable pour Active Directory * Indispensable pour Active Directory
*
* @param string $binsid Binary SID
* @return string Textual SID
*/ */
function binSIDtoText($binsid) { function binSIDtoText($binsid)
{
$hex_sid=bin2hex($binsid); $hex_sid=bin2hex($binsid);
$rev = hexdec(substr($hex_sid,0,2)); // Get revision-part of SID $rev = hexdec(substr($hex_sid,0,2)); // Get revision-part of SID
$subcount = hexdec(substr($hex_sid,2,2)); // Get count of sub-auth entries $subcount = hexdec(substr($hex_sid,2,2)); // Get count of sub-auth entries
@ -1066,14 +1102,15 @@ class Ldap
/** /**
* \brief Fonction de recherche avec filtre * Fonction de recherche avec filtre
* \remarks this->connection doit etre defini donc la methode bind ou bindauth doit avoir deja ete appelee * this->connection doit etre defini donc la methode bind ou bindauth doit avoir deja ete appelee
* \param checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com) * Ne pas utiliser pour recherche d'une liste donnee de proprietes
* \param filter Filtre de recherche (ex: (sn=nom_personne) ) * car conflit majuscule-minuscule. A n'utiliser que pour les pages
* \return array Tableau des reponses (cle en minuscule-valeur) * 'Fiche LDAP' qui affiche champ lisibles par defaut.
* \remarks Ne pas utiliser pour recherche d'une liste donnee de proprietes *
* car conflit majuscule-minuscule. A n'utiliser que pour les pages * @param checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
* 'Fiche LDAP' qui affiche champ lisibles par defaut. * @param filter Filtre de recherche (ex: (sn=nom_personne) )
* @return array Tableau des reponses (cle en minuscule-valeur)
*/ */
function search($checkDn, $filter) function search($checkDn, $filter)
{ {
@ -1105,10 +1142,11 @@ class Ldap
/** /**
* Load all attribute of a LDAP user * Load all attribute of a LDAP user
* @param $user User to search for. Not used if a filter is provided. *
* @param filter Filter for search. Must start with &. * @param User $user User to search for. Not used if a filter is provided.
* Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) * @param string $filter Filter for search. Must start with &.
* @return int >0 if ok, <0 if ko * Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com)
* @return int >0 if OK, <0 if KO
*/ */
function fetch($user,$filter) function fetch($user,$filter)
{ {
@ -1195,12 +1233,15 @@ class Ldap
} }
// 2.6 helper methods // helper methods
/** /**
* Returns the correct user identifier to use, based on the ldap server type * Returns the correct user identifier to use, based on the ldap server type
*
* @return string Login
*/ */
function getUserIdentifier() { function getUserIdentifier()
{
if ($this->serverType == "activedirectory") { if ($this->serverType == "activedirectory") {
return $this->attr_sambalogin; return $this->attr_sambalogin;
} else { } else {
@ -1209,10 +1250,13 @@ class Ldap
} }
/** /**
* \brief UserAccountControl Flgs to more human understandable form... * UserAccountControl Flgs to more human understandable form...
* *
* @param string $uacf UACF
* @return void
*/ */
function parseUACF($uacf) { function parseUACF($uacf)
{
//All flags array //All flags array
$flags = array( "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216, $flags = array( "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
"PASSWORD_EXPIRED" => 8388608, "PASSWORD_EXPIRED" => 8388608,
@ -1250,10 +1294,13 @@ class Ldap
} }
/** /**
* \brief SamAccountType value to text * SamAccountType value to text
* *
* @param string $samtype SamType
* @return string Sam string
*/ */
function parseSAT($samtype) { function parseSAT($samtype)
{
$stypes = array( 805306368 => "NORMAL_ACCOUNT", $stypes = array( 805306368 => "NORMAL_ACCOUNT",
805306369 => "WORKSTATION_TRUST", 805306369 => "WORKSTATION_TRUST",
805306370 => "INTERDOMAIN_TRUST", 805306370 => "INTERDOMAIN_TRUST",
@ -1275,9 +1322,10 @@ class Ldap
} }
/** /**
* \brief Convertit le temps ActiveDirectory en Unix timestamp * Convertit le temps ActiveDirectory en Unix timestamp
* \param string AD time to convert *
* \return string Unix timestamp * @param string $value AD time to convert
* @return string Unix timestamp
*/ */
function convert_time($value) function convert_time($value)
{ {
@ -1292,9 +1340,9 @@ class Ldap
/** /**
* Convert a string into output/memory charset * Convert a string into output/memory charset
* *
* @param str String to convert * @param string $str String to convert
* @param pagecodefrom Page code of src string * @param string $pagecodefrom Page code of src string
* @return string Converted string * @return string Converted string
*/ */
private function convToOutputCharset($str,$pagecodefrom='UTF-8') private function convToOutputCharset($str,$pagecodefrom='UTF-8')
{ {
@ -1307,21 +1355,22 @@ class Ldap
/** /**
* Convert a string from output/memory charset * Convert a string from output/memory charset
* *
* @param str String to convert * @param string $str String to convert
* @param pagecodeto Page code for result string * @param string $pagecodeto Page code for result string
* @return string Converted string * @return string Converted string
*/ */
function convFromOutputCharset($str,$pagecodeto='UTF-8') function convFromOutputCharset($str,$pagecodeto='UTF-8')
{ {
global $conf; global $conf;
if ($pagecodeto == 'ISO-8859-1' && $conf->file->character_set_client == 'UTF-8') $str=utf8_decode($str); if ($pagecodeto == 'ISO-8859-1' && $conf->file->character_set_client == 'UTF-8') $str=utf8_decode($str);
if ($pagecodeto == 'UTF-8' && $conf->file->character_set_client == 'ISO-8859-1') $str=utf8_encode($str); if ($pagecodeto == 'UTF-8' && $conf->file->character_set_client == 'ISO-8859-1') $str=utf8_encode($str);
return $str; return $str;
} }
/** /**
* Return available value of group GID * Return available value of group GID
*
* @return int gid number * @return int gid number
*/ */
function getNextGroupGid() function getNextGroupGid()

View File

@ -24,8 +24,7 @@
/** /**
* \class Menu * Class to manage left menus
* \brief Class to manage left menus
*/ */
class Menu class Menu
{ {

View File

@ -24,8 +24,7 @@
/** /**
* \class Menubase * Class to manage menu entries
* \brief Class to manage menu entries
*/ */
class Menubase class Menubase
{ {

View File

@ -25,8 +25,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/CMailFile.class.php");
/** /**
* \class Notify * Class to manage notifications
* \brief Classe de gestion des notifications
*/ */
class Notify class Notify
{ {

View File

@ -27,8 +27,7 @@
/** /**
* \class Translate * Class to manage translations
* \brief Class to manage translations
*/ */
class Translate class Translate
{ {