Merge branch 'develop' of git://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
029b83780e
@ -1,5 +1,5 @@
|
||||
<?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 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -25,8 +25,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class FormActions
|
||||
* \brief Class to manage building of HTML components
|
||||
* Class to manage building of HTML components
|
||||
*/
|
||||
class FormActions
|
||||
{
|
||||
@ -37,23 +36,23 @@ class FormActions
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show list of action status
|
||||
* Show list of action status
|
||||
*
|
||||
* @param formname Name of form where select in included
|
||||
* @param selected Preselected value
|
||||
* @param canedit 1=can edit, 0=read only
|
||||
* @param htmlname Name of html prefix for html fields (selectX and valX)
|
||||
* @param string $formname Name of form where select in included
|
||||
* @param string $selected Preselected value
|
||||
* @param int $canedit 1=can edit, 0=read only
|
||||
* @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')
|
||||
{
|
||||
@ -101,11 +100,12 @@ class FormActions
|
||||
|
||||
|
||||
/**
|
||||
* Show list of actions for element
|
||||
* @param object Object
|
||||
* @param typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
|
||||
* @param socid socid of user
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
* Show list of actions for element
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
|
||||
* @param int $socid socid of user
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function showactions($object,$typeelement,$socid=0)
|
||||
{
|
||||
@ -159,9 +159,11 @@ class FormActions
|
||||
|
||||
|
||||
/**
|
||||
* Output list of type of event
|
||||
* @param selected Type pre-selectionne
|
||||
* @param htmlname Nom champ formulaire
|
||||
* Output list of type of event
|
||||
*
|
||||
* @param string $selected Type pre-selectionne
|
||||
* @param string $htmlname Nom champ formulaire
|
||||
* @return void
|
||||
*/
|
||||
function select_type_actions($selected='',$htmlname='actioncode')
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
*
|
||||
@ -25,8 +25,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class FormAdmin
|
||||
* \brief Class to generate html code for admin pages
|
||||
* Class to generate html code for admin pages
|
||||
*/
|
||||
class FormAdmin
|
||||
{
|
||||
@ -42,7 +41,6 @@ class FormAdmin
|
||||
function FormAdmin($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
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 $htmlname Nom de la zone select
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -24,8 +24,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class Form
|
||||
* \brief Classe permettant la generation de composants html
|
||||
* Class to manage barcode HTML
|
||||
*/
|
||||
class FormBarCode
|
||||
{
|
||||
@ -41,7 +40,6 @@ class FormBarCode
|
||||
function FormBarCode($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,9 +23,8 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class FormCompany
|
||||
* \brief Class to build HTML component for third parties management
|
||||
* \remarks Only common components must be here.
|
||||
* Class to build HTML component for third parties management
|
||||
* Only common components are here.
|
||||
*/
|
||||
class FormCompany
|
||||
{
|
||||
|
||||
@ -25,8 +25,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class FormFile
|
||||
* \brief Class to offer components to list and upload files
|
||||
* Class to offer components to list and upload files
|
||||
*/
|
||||
class FormFile
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -25,11 +25,11 @@
|
||||
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
|
||||
* \remarks Utilisation: $formail = new FormMail($db)
|
||||
* \remarks $formmail->proprietes=1 ou chaine ou tableau de valeurs
|
||||
* \remarks $formmail->show_form() affiche le formulaire
|
||||
/**
|
||||
* Classe permettant la generation du formulaire html d'envoi de mail unitaire
|
||||
* Usage: $formail = new FormMail($db)
|
||||
* $formmail->proprietes=1 ou chaine ou tableau de valeurs
|
||||
* $formmail->show_form() affiche le formulaire
|
||||
*/
|
||||
class FormMail
|
||||
{
|
||||
@ -69,12 +69,13 @@ class FormMail
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param DB handler d'acces base de donnee
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
*/
|
||||
function FormMail($DB)
|
||||
function FormMail($db)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->db = $db;
|
||||
|
||||
$this->withform=1;
|
||||
|
||||
@ -103,6 +104,8 @@ class FormMail
|
||||
|
||||
/**
|
||||
* Clear list of attached files in send mail form (stored in session)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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 $file Only filename
|
||||
* @param string $type Mime type
|
||||
* @return void
|
||||
*/
|
||||
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)
|
||||
*
|
||||
* @param $keytodelete Key in file array
|
||||
* @param string $keytodelete Key in file array
|
||||
* @return void
|
||||
*/
|
||||
function remove_attached_files($keytodelete)
|
||||
{
|
||||
@ -190,8 +195,9 @@ class FormMail
|
||||
* Show the form to input an email
|
||||
* 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 removefileaction Name of action when removing file attachments
|
||||
* @param string $addfileaction Name of action when posting file attachments
|
||||
* @param string $removefileaction Name of action when removing file attachments
|
||||
* @return void
|
||||
*/
|
||||
function show_form($addfileaction='addfile',$removefileaction='removefile')
|
||||
{
|
||||
@ -202,8 +208,9 @@ class FormMail
|
||||
* Get the form to input an email
|
||||
* 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 removefileaction Name of action when removing file attachments
|
||||
* @param string $addfileaction Name of action when posting file attachments
|
||||
* @param string $removefileaction Name of action when removing file attachments
|
||||
* @return string Form to show
|
||||
*/
|
||||
function get_form($addfileaction='addfile',$removefileaction='removefile')
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,9 +23,8 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class FormOrder
|
||||
* \brief Classe permettant la generation de composants html
|
||||
* \remarks Only common components must be here.
|
||||
* Classe permettant la generation de composants html
|
||||
* Only common components are here.
|
||||
*/
|
||||
class FormOrder
|
||||
{
|
||||
@ -35,24 +34,24 @@ class FormOrder
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param DB handler d'acces base de donnee
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function FormOrder($DB)
|
||||
function FormOrder($db)
|
||||
{
|
||||
$this->db = $DB;
|
||||
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie la liste des sources de commandes
|
||||
* Return list of way to order
|
||||
*
|
||||
* @param selected Id de la source pre-selectionnee
|
||||
* @param htmlname Nom de la liste deroulante
|
||||
* @param addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
||||
* @return array Tableau des sources de commandes
|
||||
* @param string $selected Id of preselected order origin
|
||||
* @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 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)
|
||||
{
|
||||
@ -89,7 +92,7 @@ class FormOrder
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_input_method";
|
||||
$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);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
@ -32,9 +32,8 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class FormOther
|
||||
* \brief Classe permettant la generation de composants html autre
|
||||
* \remarks Only common components must be here.
|
||||
* Classe permettant la generation de composants html autre
|
||||
* Only common components are here.
|
||||
*/
|
||||
class FormOther
|
||||
{
|
||||
@ -210,12 +209,12 @@ class FormOther
|
||||
/**
|
||||
* Return a HTML select list to select a percent
|
||||
*
|
||||
* @param selected pourcentage pre-selectionne
|
||||
* @param htmlname nom de la liste deroulante
|
||||
* @param increment increment value
|
||||
* @param start start value
|
||||
* @param end end value
|
||||
* @return return combo
|
||||
* @param string $selected pourcentage pre-selectionne
|
||||
* @param string $htmlname nom de la liste deroulante
|
||||
* @param int $increment increment value
|
||||
* @param int $start start value
|
||||
* @param int $end end value
|
||||
* @return string HTML select string
|
||||
*/
|
||||
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)
|
||||
*
|
||||
* @param type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
|
||||
* @param selected Preselected value
|
||||
* @param htmlname Name of combo list
|
||||
* @return return Html combo list code
|
||||
* @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
|
||||
* @param string $selected Preselected value
|
||||
* @param string $htmlname Name of combo list
|
||||
* @return string Html combo list code
|
||||
*/
|
||||
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)
|
||||
*
|
||||
* @param selected Preselected value
|
||||
* @param htmlname Name of combo list
|
||||
* @param user Object user
|
||||
* @return return Html combo list code
|
||||
* @param string $selected Preselected value
|
||||
* @param string $htmlname Name of combo list
|
||||
* @param User $user Object user
|
||||
* @return string Html combo list code
|
||||
*/
|
||||
function select_salesrepresentatives($selected=0,$htmlname='search_sale',$user)
|
||||
{
|
||||
@ -373,11 +372,11 @@ class FormOther
|
||||
/**
|
||||
* Output a HTML code to select a color
|
||||
*
|
||||
* @param set_color Pre-selected color
|
||||
* @param prefix Name of HTML field
|
||||
* @param form_name Name of form
|
||||
* @param 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 string $set_color Pre-selected color
|
||||
* @param string $prefix Name of HTML field
|
||||
* @param string $form_name Name of form
|
||||
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
|
||||
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
|
||||
* @return void
|
||||
*/
|
||||
function select_color($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='')
|
||||
|
||||
@ -24,11 +24,11 @@
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");
|
||||
|
||||
|
||||
/** \class FormSms
|
||||
* \brief Classe permettant la generation du formulaire d'envoi de Sms
|
||||
* \remarks Utilisation: $formsms = new FormSms($db)
|
||||
* \remarks $formsms->proprietes=1 ou chaine ou tableau de valeurs
|
||||
* \remarks $formsms->show_form() affiche le formulaire
|
||||
/**
|
||||
* Classe permettant la generation du formulaire d'envoi de Sms
|
||||
* Usage: $formsms = new FormSms($db)
|
||||
* $formsms->proprietes=1 ou chaine ou tableau de valeurs
|
||||
* $formsms->show_form() affiche le formulaire
|
||||
*/
|
||||
class FormSms
|
||||
{
|
||||
@ -62,11 +62,11 @@ class FormSms
|
||||
/**
|
||||
* 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->withto=1;
|
||||
|
||||
@ -25,8 +25,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class Interfaces
|
||||
* \brief Classe de la gestion des triggers
|
||||
* Class to manage triggers
|
||||
*/
|
||||
|
||||
class Interfaces
|
||||
@ -45,26 +44,27 @@ class Interfaces
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelee lors du declenchement d'un evenement Dolibarr.
|
||||
* Cette fonction declenche tous les triggers trouves actifs.
|
||||
* \param action Trigger event code
|
||||
* \param object Objet concern
|
||||
* \param user Objet user
|
||||
* \param lang Objet lang
|
||||
* \param conf Objet conf
|
||||
* \return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise.
|
||||
* Function called when a Dolibarr business event occurs
|
||||
* This function call all qualified triggers.
|
||||
*
|
||||
* @param string $action Trigger event code
|
||||
* @param Object $object Objet concern
|
||||
* @param User $user Objet user
|
||||
* @param Lang $lang Objet lang
|
||||
* @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)
|
||||
{
|
||||
// Check parameters
|
||||
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;
|
||||
}
|
||||
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)
|
||||
@ -175,9 +175,10 @@ class Interfaces
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Return list of triggers. Function used by admin page htdoc/admin/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)
|
||||
{
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*/
|
||||
class Ldap
|
||||
{
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
|
||||
// 1.2 Private properties ----------------------------------------------------
|
||||
/**
|
||||
* 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
|
||||
* 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,
|
||||
* it tries the next and so on.
|
||||
* \deprecated Utiliser connect_bind a la place
|
||||
*
|
||||
* @deprecated Utiliser connect_bind a la place
|
||||
*/
|
||||
function connect()
|
||||
{
|
||||
@ -181,10 +180,11 @@ class Ldap
|
||||
|
||||
|
||||
/**
|
||||
* \brief Connect and bind
|
||||
* \return <0 si KO, 1 si bind anonymous, 2 si bind auth
|
||||
* \remarks Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword
|
||||
* After return, this->connection and $this->bind are defined
|
||||
* Connect and bind
|
||||
* Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword
|
||||
* 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()
|
||||
{
|
||||
@ -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.
|
||||
*
|
||||
* @return boolean true or false
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @return boolean true or false
|
||||
*/
|
||||
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
|
||||
* "cn=Directory Manager" under iPlanet. For a user, it will be something
|
||||
* 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)
|
||||
{
|
||||
@ -339,9 +347,9 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Unbind du serveur ldap.
|
||||
* \param ds
|
||||
* \return bool
|
||||
* Unbind du serveur ldap.
|
||||
*
|
||||
* @return boolean true or false
|
||||
*/
|
||||
function unbind()
|
||||
{
|
||||
@ -355,9 +363,9 @@ class Ldap
|
||||
|
||||
|
||||
/**
|
||||
* \brief verification de la version du serveur ldap.
|
||||
* \param ds
|
||||
* \return version
|
||||
* Verification de la version du serveur ldap.
|
||||
*
|
||||
* @return string version
|
||||
*/
|
||||
function getVersion()
|
||||
{
|
||||
@ -367,8 +375,9 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief changement de la version du serveur ldap.
|
||||
* \return version
|
||||
* Change ldap protocol version to use.
|
||||
*
|
||||
* @return string version
|
||||
*/
|
||||
function setVersion() {
|
||||
// LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17
|
||||
@ -377,8 +386,9 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief changement du referrals.
|
||||
* \return referrals
|
||||
* changement du referrals.
|
||||
*
|
||||
* @return string referrals
|
||||
*/
|
||||
function setReferrals() {
|
||||
// LDAP_OPT_REFERRALS est une constante qui vaut ?
|
||||
@ -388,12 +398,13 @@ class Ldap
|
||||
|
||||
|
||||
/**
|
||||
* \brief Add a LDAP entry
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \param user Objet user that create
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* \remarks Ldap object connect and bind must have been done
|
||||
* Add a LDAP entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $info Attributes array
|
||||
* @param User $user Objet user that create
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function add($dn, $info, $user)
|
||||
{
|
||||
@ -439,12 +450,13 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Modify a LDAP entry
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \param user Objet user that modify
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* \remarks Ldap object connect and bind must have been done
|
||||
* Modify a LDAP entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $info Attributes array
|
||||
* @param string $user Objet user that modify
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function modify($dn, $info, $user)
|
||||
{
|
||||
@ -490,13 +502,14 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Modify a LDAP entry (to use if dn != olddn)
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \param user Objet user that delete
|
||||
* \param olddn Old DN entry key (before update)
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* \remarks Ldap object connect and bind must have been done
|
||||
* Modify a LDAP entry (to use if dn != olddn)
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $info Attributes array
|
||||
* @param User $user Objet user that delete
|
||||
* @param string $olddn Old DN entry key (before update)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($dn,$info,$user,$olddn)
|
||||
{
|
||||
@ -544,10 +557,11 @@ class Ldap
|
||||
|
||||
|
||||
/**
|
||||
* \brief Delete a LDAP entry
|
||||
* \param dn DN entry key
|
||||
* \return int <0 si KO, >0 si OK
|
||||
* \remarks Ldap object connect and bind must have been done
|
||||
* Delete a LDAP entry
|
||||
* 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)
|
||||
{
|
||||
@ -577,10 +591,11 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Build a LDAP message
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \return string Content of file
|
||||
* Build a LDAP message
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $info Attributes array
|
||||
* @return string Content of file
|
||||
*/
|
||||
function dump_content($dn, $info)
|
||||
{
|
||||
@ -618,10 +633,11 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Dump a LDAP message to ldapinput.in file
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* Dump a LDAP message to ldapinput.in file
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $info Attributes array
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function dump($dn, $info)
|
||||
{
|
||||
@ -650,15 +666,16 @@ class Ldap
|
||||
}
|
||||
|
||||
|
||||
// 2.4 Attribute methods -----------------------------------------------------
|
||||
// Attribute methods -----------------------------------------------------
|
||||
|
||||
/**
|
||||
* \brief Add a LDAP attribute in entry
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \param user Objet user that create
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* \remarks Ldap object connect and bind must have been done
|
||||
* Add a LDAP attribute in entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $info Attributes array
|
||||
* @param User $user Objet user that create
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function addAttribute($dn, $info, $user)
|
||||
{
|
||||
@ -704,12 +721,13 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Update a LDAP attribute in entry
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \param user Objet user that create
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* \remarks Ldap object connect and bind must have been done
|
||||
* Update a LDAP attribute in entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $info Attributes array
|
||||
* @param User $user Objet user that create
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function updateAttribute($dn, $info, $user)
|
||||
{
|
||||
@ -755,12 +773,13 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Delete a LDAP attribute in entry
|
||||
* \param dn DN entry key
|
||||
* \param info Attributes array
|
||||
* \param user Objet user that create
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* \remarks Ldap object connect and bind must have been done
|
||||
* Delete a LDAP attribute in entry
|
||||
* Ldap object connect and bind must have been done
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $info Attributes array
|
||||
* @param User $user Objet user that create
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function deleteAttribute($dn, $info, $user)
|
||||
{
|
||||
@ -807,6 +826,10 @@ class Ldap
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
@ -848,6 +871,10 @@ class Ldap
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
@ -882,14 +909,15 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns an array containing a details of elements
|
||||
* \param $search Valeur champ cle recherche, sinon '*' pour tous.
|
||||
* \param $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
|
||||
* \param $useridentifier Nom du champ cle (Ex: uid)
|
||||
* \param $attributeArray Array of fields required (Ex: sn,userPassword)
|
||||
* \param $activefilter 1=utilise le champ this->filter comme filtre
|
||||
* \return array Array of [id_record][ldap_field]=value
|
||||
* \remarks ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
|
||||
* Returns an array containing a details of elements
|
||||
* ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
|
||||
*
|
||||
* @param string $search Valeur champ cle recherche, sinon '*' pour tous.
|
||||
* @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
|
||||
* @param string $useridentifier Name of key field (Ex: uid)
|
||||
* @param array $attributeArray Array of fields required (Ex: sn,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)
|
||||
{
|
||||
@ -980,9 +1008,12 @@ class Ldap
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
$result .= substr($hex,$x,2);
|
||||
}
|
||||
@ -991,9 +1022,10 @@ class Ldap
|
||||
|
||||
|
||||
/**
|
||||
* Recupere le SID de l'utilisateur
|
||||
* ldapuser. le login de l'utilisateur
|
||||
* Indispensable pour Active Directory
|
||||
* Recupere le SID de l'utilisateur
|
||||
* Required by Active Directory
|
||||
*
|
||||
* @param string $ldapuser Login de l'utilisateur
|
||||
*/
|
||||
function getObjectSid($ldapUser)
|
||||
{
|
||||
@ -1050,8 +1082,12 @@ class Ldap
|
||||
/**
|
||||
* Returns the textual SID
|
||||
* Indispensable pour Active Directory
|
||||
*
|
||||
* @param string $binsid Binary SID
|
||||
* @return string Textual SID
|
||||
*/
|
||||
function binSIDtoText($binsid) {
|
||||
function binSIDtoText($binsid)
|
||||
{
|
||||
$hex_sid=bin2hex($binsid);
|
||||
$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
|
||||
@ -1066,14 +1102,15 @@ class Ldap
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction de recherche avec filtre
|
||||
* \remarks 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)
|
||||
* \param filter Filtre de recherche (ex: (sn=nom_personne) )
|
||||
* \return array Tableau des reponses (cle en minuscule-valeur)
|
||||
* \remarks Ne pas utiliser pour recherche d'une liste donnee de proprietes
|
||||
* car conflit majuscule-minuscule. A n'utiliser que pour les pages
|
||||
* 'Fiche LDAP' qui affiche champ lisibles par defaut.
|
||||
* Fonction de recherche avec filtre
|
||||
* this->connection doit etre defini donc la methode bind ou bindauth doit avoir deja ete appelee
|
||||
* Ne pas utiliser pour recherche d'une liste donnee de proprietes
|
||||
* car conflit majuscule-minuscule. A n'utiliser que pour les pages
|
||||
* 'Fiche LDAP' qui affiche champ lisibles par defaut.
|
||||
*
|
||||
* @param checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
|
||||
* @param filter Filtre de recherche (ex: (sn=nom_personne) )
|
||||
* @return array Tableau des reponses (cle en minuscule-valeur)
|
||||
*/
|
||||
function search($checkDn, $filter)
|
||||
{
|
||||
@ -1105,10 +1142,11 @@ class Ldap
|
||||
|
||||
/**
|
||||
* 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 &.
|
||||
* Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com)
|
||||
* @return int >0 if ok, <0 if ko
|
||||
*
|
||||
* @param User $user User to search for. Not used if a filter is provided.
|
||||
* @param string $filter Filter for search. Must start with &.
|
||||
* 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)
|
||||
{
|
||||
@ -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") {
|
||||
return $this->attr_sambalogin;
|
||||
} 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
|
||||
$flags = array( "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
|
||||
"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",
|
||||
805306369 => "WORKSTATION_TRUST",
|
||||
805306370 => "INTERDOMAIN_TRUST",
|
||||
@ -1275,9 +1322,10 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Convertit le temps ActiveDirectory en Unix timestamp
|
||||
* \param string AD time to convert
|
||||
* \return string Unix timestamp
|
||||
* Convertit le temps ActiveDirectory en Unix timestamp
|
||||
*
|
||||
* @param string $value AD time to convert
|
||||
* @return string Unix timestamp
|
||||
*/
|
||||
function convert_time($value)
|
||||
{
|
||||
@ -1292,9 +1340,9 @@ class Ldap
|
||||
/**
|
||||
* Convert a string into output/memory charset
|
||||
*
|
||||
* @param str String to convert
|
||||
* @param pagecodefrom Page code of src string
|
||||
* @return string Converted string
|
||||
* @param string $str String to convert
|
||||
* @param string $pagecodefrom Page code of src string
|
||||
* @return string Converted string
|
||||
*/
|
||||
private function convToOutputCharset($str,$pagecodefrom='UTF-8')
|
||||
{
|
||||
@ -1307,21 +1355,22 @@ class Ldap
|
||||
/**
|
||||
* Convert a string from output/memory charset
|
||||
*
|
||||
* @param str String to convert
|
||||
* @param pagecodeto Page code for result string
|
||||
* @return string Converted string
|
||||
* @param string $str String to convert
|
||||
* @param string $pagecodeto Page code for result string
|
||||
* @return string Converted string
|
||||
*/
|
||||
function convFromOutputCharset($str,$pagecodeto='UTF-8')
|
||||
{
|
||||
global $conf;
|
||||
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 == '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);
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return available value of group GID
|
||||
*
|
||||
* @return int gid number
|
||||
*/
|
||||
function getNextGroupGid()
|
||||
|
||||
@ -24,8 +24,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class Menu
|
||||
* \brief Class to manage left menus
|
||||
* Class to manage left menus
|
||||
*/
|
||||
class Menu
|
||||
{
|
||||
|
||||
@ -24,8 +24,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class Menubase
|
||||
* \brief Class to manage menu entries
|
||||
* Class to manage menu entries
|
||||
*/
|
||||
class Menubase
|
||||
{
|
||||
|
||||
@ -25,8 +25,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/CMailFile.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* \class Notify
|
||||
* \brief Classe de gestion des notifications
|
||||
* Class to manage notifications
|
||||
*/
|
||||
class Notify
|
||||
{
|
||||
|
||||
@ -27,8 +27,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class Translate
|
||||
* \brief Class to manage translations
|
||||
* Class to manage translations
|
||||
*/
|
||||
class Translate
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user