Qual: Removed errors and warnings reported by codesniffer
This commit is contained in:
parent
93dada968d
commit
ddcf5965fd
@ -25,7 +25,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/user/class/user.class.php
|
* \file htdocs/user/class/user.class.php
|
||||||
* \brief Fichier de la classe utilisateur
|
* \brief Fichier de la classe utilisateur
|
||||||
* \version $Id: user.class.php,v 1.44 2011/07/04 11:41:02 eldy Exp $
|
* \version $Id: user.class.php,v 1.45 2011/07/08 18:49:16 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
|
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
|
||||||
@ -99,8 +99,8 @@ class User extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur de la classe
|
* Constructor de la classe
|
||||||
* @param DB Handler acces base de donnees
|
* @param DoliDb $DB Database handler
|
||||||
*/
|
*/
|
||||||
function User($DB)
|
function User($DB)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
* \file htdocs/user/class/usergroup.class.php
|
* \file htdocs/user/class/usergroup.class.php
|
||||||
* \brief Fichier de la classe des groupes d'utilisateur
|
* \brief Fichier de la classe des groupes d'utilisateur
|
||||||
* \author Rodolphe Qiedeville
|
* \author Rodolphe Qiedeville
|
||||||
* \version $Id: usergroup.class.php,v 1.10 2011/07/04 11:41:04 eldy Exp $
|
* \version $Id: usergroup.class.php,v 1.11 2011/07/08 18:49:16 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||||
@ -55,8 +55,8 @@ class UserGroup extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor de la classe
|
||||||
* @param DB Handler acces base de donnees
|
* @param DoliDb $DB Database handler
|
||||||
*/
|
*/
|
||||||
function UserGroup($DB)
|
function UserGroup($DB)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/user/fiche.php
|
* \file htdocs/user/fiche.php
|
||||||
* \brief Tab of user card
|
* \brief Tab of user card
|
||||||
* \version $Id: fiche.php,v 1.273 2011/06/29 10:23:33 eldy Exp $
|
* \version $Id: fiche.php,v 1.274 2011/07/08 18:49:17 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
@ -215,7 +215,7 @@ if ($_POST["action"] == 'add' && $canadduser)
|
|||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
if (is_array($edituser->errors) && sizeof($edituser->errors)) $message='<div class="error">'.join('<br>',$langs->trans($edituser->errors)).'</div>';
|
if (is_array($edituser->errors) && count($edituser->errors)) $message='<div class="error">'.join('<br>',$langs->trans($edituser->errors)).'</div>';
|
||||||
else $message='<div class="error">'.$langs->trans($edituser->error).'</div>';
|
else $message='<div class="error">'.$langs->trans($edituser->error).'</div>';
|
||||||
$action="create"; // Go back to create page
|
$action="create"; // Go back to create page
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ret >=0 && ! sizeof($edituser->errors))
|
if ($ret >=0 && ! count($edituser->errors))
|
||||||
{
|
{
|
||||||
if (GETPOST('deletephoto') && $edituser->photo)
|
if (GETPOST('deletephoto') && $edituser->photo)
|
||||||
{
|
{
|
||||||
@ -347,7 +347,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ret >= 0 && ! sizeof($edituser->errors))
|
if ($ret >= 0 && ! count($edituser->errors))
|
||||||
{
|
{
|
||||||
$message.='<div class="ok">'.$langs->trans("UserModified").'</div>';
|
$message.='<div class="ok">'.$langs->trans("UserModified").'</div>';
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -825,7 +825,7 @@ else
|
|||||||
$statutUACF = '';
|
$statutUACF = '';
|
||||||
|
|
||||||
//On verifie les options du compte
|
//On verifie les options du compte
|
||||||
if (sizeof($ldap->uacf) > 0)
|
if (count($ldap->uacf) > 0)
|
||||||
{
|
{
|
||||||
foreach ($ldap->uacf as $key => $statut)
|
foreach ($ldap->uacf as $key => $statut)
|
||||||
{
|
{
|
||||||
@ -1609,7 +1609,7 @@ else
|
|||||||
{
|
{
|
||||||
$contact = new Contact($db);
|
$contact = new Contact($db);
|
||||||
$contact->fetch($fuser->contact_id);
|
$contact->fetch($fuser->contact_id);
|
||||||
print ' / '.'<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$fuser->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).'</a>';
|
print ' / <a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$fuser->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1660,9 +1660,18 @@ else
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
function dolValidElement($element) {
|
llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.274 $');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if var element is ok
|
||||||
|
* @param string $element Variable to check
|
||||||
|
* @return boolean Return true of variable is not empty
|
||||||
|
*/
|
||||||
|
function dolValidElement($element)
|
||||||
|
{
|
||||||
return (trim($element) != '');
|
return (trim($element) != '');
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter('$Date: 2011/06/29 10:23:33 $ - $Revision: 1.273 $');
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/user/group/fiche.php
|
* \file htdocs/user/group/fiche.php
|
||||||
* \brief Onglet groupes utilisateurs
|
* \brief Onglet groupes utilisateurs
|
||||||
* \version $Id$
|
* \version $Id: fiche.php,v 1.68 2011/07/08 18:49:17 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
@ -35,9 +35,9 @@ $candisableperms=($user->admin || $user->rights->user->user->supprimer);
|
|||||||
// Advanced permissions
|
// Advanced permissions
|
||||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||||
{
|
{
|
||||||
$canreadperms=($user->admin || $user->rights->user->group_advance->read);
|
$canreadperms=($user->admin || $user->rights->user->group_advance->read);
|
||||||
$caneditperms=($user->admin || $user->rights->user->group_advance->write);
|
$caneditperms=($user->admin || $user->rights->user->group_advance->write);
|
||||||
$candisableperms=($user->admin || $user->rights->user->group_advance->delete);
|
$candisableperms=($user->admin || $user->rights->user->group_advance->delete);
|
||||||
}
|
}
|
||||||
|
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
@ -58,17 +58,17 @@ $object = new Usergroup($db);
|
|||||||
*/
|
*/
|
||||||
if ($action == 'confirm_delete' && $confirm == "yes")
|
if ($action == 'confirm_delete' && $confirm == "yes")
|
||||||
{
|
{
|
||||||
if ($caneditperms)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
$object->fetch($_GET["id"]);
|
$object->fetch($_GET["id"]);
|
||||||
$object->delete();
|
$object->delete();
|
||||||
Header("Location: index.php");
|
Header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,114 +76,114 @@ if ($action == 'confirm_delete' && $confirm == "yes")
|
|||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'add')
|
if ($_POST["action"] == 'add')
|
||||||
{
|
{
|
||||||
if($caneditperms)
|
if($caneditperms)
|
||||||
{
|
{
|
||||||
$message="";
|
$message="";
|
||||||
if (! $_POST["nom"])
|
if (! $_POST["nom"])
|
||||||
{
|
{
|
||||||
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
|
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
|
||||||
$action="create"; // Go back to create page
|
$action="create"; // Go back to create page
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $message)
|
if (! $message)
|
||||||
{
|
{
|
||||||
$object->nom = trim($_POST["nom"]);
|
$object->nom = trim($_POST["nom"]);
|
||||||
$object->globalgroup = $_POST["globalgroup"];
|
$object->globalgroup = $_POST["globalgroup"];
|
||||||
$object->note = trim($_POST["note"]);
|
$object->note = trim($_POST["note"]);
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$id = $object->create();
|
$id = $object->create();
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
Header("Location: fiche.php?id=".$object->id);
|
Header("Location: fiche.php?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'</div>';
|
$message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'</div>';
|
||||||
$action="create"; // Go back to create page
|
$action="create"; // Go back to create page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add/Remove user into group
|
// Add/Remove user into group
|
||||||
if ($action == 'adduser' || $action =='removeuser')
|
if ($action == 'adduser' || $action =='removeuser')
|
||||||
{
|
{
|
||||||
if ($caneditperms)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
if ($userid)
|
if ($userid)
|
||||||
{
|
{
|
||||||
$object->fetch($_GET["id"]);
|
$object->fetch($_GET["id"]);
|
||||||
$object->oldcopy=dol_clone($object);
|
$object->oldcopy=dol_clone($object);
|
||||||
|
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
$edituser->fetch($userid);
|
$edituser->fetch($userid);
|
||||||
if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,GETPOST('entity'));
|
if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,GETPOST('entity'));
|
||||||
if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,GETPOST('entity'));
|
if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,GETPOST('entity'));
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: fiche.php?id=".$object->id);
|
header("Location: fiche.php?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message.=$edituser->error;
|
$message.=$edituser->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'update')
|
if ($_POST["action"] == 'update')
|
||||||
{
|
{
|
||||||
if($caneditperms)
|
if($caneditperms)
|
||||||
{
|
{
|
||||||
$message="";
|
$message="";
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$object->fetch($_GET["id"]);
|
$object->fetch($_GET["id"]);
|
||||||
|
|
||||||
$object->oldcopy=dol_clone($object);
|
$object->oldcopy=dol_clone($object);
|
||||||
|
|
||||||
$object->nom = trim($_POST["group"]);
|
$object->nom = trim($_POST["group"]);
|
||||||
$object->globalgroup = $_POST["globalgroup"];
|
$object->globalgroup = $_POST["globalgroup"];
|
||||||
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
||||||
|
|
||||||
$ret=$object->update();
|
$ret=$object->update();
|
||||||
|
|
||||||
if ($ret >= 0 && ! sizeof($object->errors))
|
if ($ret >= 0 && ! count($object->errors))
|
||||||
{
|
{
|
||||||
$message.='<div class="ok">'.$langs->trans("GroupModified").'</div>';
|
$message.='<div class="ok">'.$langs->trans("GroupModified").'</div>';
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message.='<div class="error">'.$object->error.'</div>';
|
$message.='<div class="error">'.$object->error.'</div>';
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,51 +199,51 @@ $fuserstatic = new User($db);
|
|||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("NewGroup"));
|
print_fiche_titre($langs->trans("NewGroup"));
|
||||||
|
|
||||||
if ($message) { print $message."<br>"; }
|
if ($message) { print $message."<br>"; }
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print "<tr>".'<td valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
|
print "<tr>".'<td valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
|
||||||
print '<td class="valeur"><input size="30" type="text" name="nom" value=""></td></tr>';
|
print '<td class="valeur"><input size="30" type="text" name="nom" value=""></td></tr>';
|
||||||
|
|
||||||
// Global group
|
|
||||||
if ($conf->multicompany->enabled)
|
|
||||||
{
|
|
||||||
if ($conf->entity == 1)
|
|
||||||
{
|
|
||||||
print "<tr>".'<td valign="top">'.$langs->trans("GlobalGroup").'</td>';
|
|
||||||
$checked=(empty($_POST['globalgroup']) ? '' : ' checked');
|
|
||||||
print '<td><input type="checkbox" name="globalgroup" value="1"'.$checked.' /></td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<input type="hidden" name="globalgroup" value="0" />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
// Global group
|
||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
|
if ($conf->multicompany->enabled)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
if ($conf->entity == 1)
|
||||||
$doleditor=new DolEditor('note','','',240,'dolibarr_notes','',false);
|
{
|
||||||
$doleditor->Create();
|
print "<tr>".'<td valign="top">'.$langs->trans("GlobalGroup").'</td>';
|
||||||
}
|
$checked=(empty($_POST['globalgroup']) ? '' : ' checked');
|
||||||
else
|
print '<td><input type="checkbox" name="globalgroup" value="1"'.$checked.' /></td>';
|
||||||
{
|
}
|
||||||
print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
|
else
|
||||||
print '</textarea>';
|
{
|
||||||
}
|
print '<input type="hidden" name="globalgroup" value="0" />';
|
||||||
print "</textarea></td></tr>\n";
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "<tr>".'<td align="center" colspan="2"><input class="button" value="'.$langs->trans("CreateGroup").'" type="submit"></td></tr>';
|
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
||||||
print "</table>\n";
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
|
||||||
print "</form>";
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
|
$doleditor=new DolEditor('note','','',240,'dolibarr_notes','',false);
|
||||||
|
$doleditor->Create();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
|
||||||
|
print '</textarea>';
|
||||||
|
}
|
||||||
|
print "</textarea></td></tr>\n";
|
||||||
|
|
||||||
|
print "<tr>".'<td align="center" colspan="2"><input class="button" value="'.$langs->trans("CreateGroup").'" type="submit"></td></tr>';
|
||||||
|
print "</table>\n";
|
||||||
|
print "</form>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,78 +254,78 @@ if ($action == 'create')
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($_GET["id"] )
|
if ($_GET["id"] )
|
||||||
{
|
{
|
||||||
$object->fetch($_GET["id"]);
|
$object->fetch($_GET["id"]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
$head = group_prepare_head($object);
|
$head = group_prepare_head($object);
|
||||||
$title = $langs->trans("Group");
|
$title = $langs->trans("Group");
|
||||||
dol_fiche_head($head, 'group', $title, 0, 'group');
|
dol_fiche_head($head, 'group', $title, 0, 'group');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation suppression
|
* Confirmation suppression
|
||||||
*/
|
*/
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$object->name),"confirm_delete", '',0,1);
|
$ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$object->name),"confirm_delete", '',0,1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fiche en mode visu
|
* Fiche en mode visu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action != 'edit')
|
if ($action != 'edit')
|
||||||
{
|
{
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
|
print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
||||||
print '<td width="75%" class="valeur">'.$object->nom;
|
print '<td width="75%" class="valeur">'.$object->nom;
|
||||||
if (empty($object->entity))
|
if (empty($object->entity))
|
||||||
{
|
{
|
||||||
print img_redstar($langs->trans("GlobalGroup"));
|
print img_redstar($langs->trans("GlobalGroup"));
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||||
print '<td class="valeur">'.dol_htmlentitiesbr($object->note).' </td>';
|
print '<td class="valeur">'.dol_htmlentitiesbr($object->note).' </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Barre d'actions
|
* Barre d'actions
|
||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($caneditperms)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($candisableperms)
|
if ($candisableperms)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans("DeleteGroup").'</a>';
|
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans("DeleteGroup").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
dol_htmloutput_errors($message);
|
dol_htmloutput_errors($message);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Liste des utilisateurs dans le groupe
|
* Liste des utilisateurs dans le groupe
|
||||||
@ -335,17 +335,17 @@ else
|
|||||||
|
|
||||||
// On selectionne les users qui ne sont pas deja dans le groupe
|
// On selectionne les users qui ne sont pas deja dans le groupe
|
||||||
$exclude = array();
|
$exclude = array();
|
||||||
|
|
||||||
$userslist = $object->listUsersForGroup();
|
$userslist = $object->listUsersForGroup();
|
||||||
|
|
||||||
if (! empty($userslist))
|
if (! empty($userslist))
|
||||||
{
|
{
|
||||||
foreach($userslist as $useringroup)
|
foreach($userslist as $useringroup)
|
||||||
{
|
{
|
||||||
$exclude[]=$useringroup->id;
|
$exclude[]=$useringroup->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($caneditperms)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
|
||||||
@ -378,38 +378,38 @@ else
|
|||||||
|
|
||||||
if (! empty($userslist))
|
if (! empty($userslist))
|
||||||
{
|
{
|
||||||
$var=True;
|
$var=True;
|
||||||
|
|
||||||
foreach($userslist as $useringroup)
|
foreach($userslist as $useringroup)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$useringroup->id.'">'.img_object($langs->trans("ShowUser"),"user").' '.$useringroup->login.'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$useringroup->id.'">'.img_object($langs->trans("ShowUser"),"user").' '.$useringroup->login.'</a>';
|
||||||
if ($useringroup->admin && ! $useringroup->entity) print img_redstar($langs->trans("SuperAdministrator"));
|
if ($useringroup->admin && ! $useringroup->entity) print img_redstar($langs->trans("SuperAdministrator"));
|
||||||
else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star');
|
else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.ucfirst(stripslashes($useringroup->lastname)).'</td>';
|
print '<td>'.ucfirst(stripslashes($useringroup->lastname)).'</td>';
|
||||||
print '<td>'.ucfirst(stripslashes($useringroup->firstname)).'</td>';
|
print '<td>'.ucfirst(stripslashes($useringroup->firstname)).'</td>';
|
||||||
print '<td align="right">'.$useringroup->getLibStatut(5).'</td>';
|
print '<td align="right">'.$useringroup->getLibStatut(5).'</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($user->admin)
|
if ($user->admin)
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&user='.$useringroup->id.'&entity='.$useringroup->usergroup_entity.'">';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&user='.$useringroup->id.'&entity='.$useringroup->usergroup_entity.'">';
|
||||||
print img_delete($langs->trans("RemoveFromGroup"));
|
print img_delete($langs->trans("RemoveFromGroup"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "-";
|
print "-";
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td colspan=2>'.$langs->trans("None").'</td></tr>';
|
print '<tr><td colspan=2>'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "<br>";
|
print "<br>";
|
||||||
@ -428,51 +428,51 @@ else
|
|||||||
print '<tr><td width="25%" valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
|
print '<tr><td width="25%" valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
|
||||||
print '<td width="75%" class="valeur"><input size="15" type="text" name="group" value="'.$object->nom.'">';
|
print '<td width="75%" class="valeur"><input size="15" type="text" name="group" value="'.$object->nom.'">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
// Global group
|
// Global group
|
||||||
if ($conf->multicompany->enabled)
|
if ($conf->multicompany->enabled)
|
||||||
{
|
{
|
||||||
if ($conf->entity == 1)
|
if ($conf->entity == 1)
|
||||||
{
|
{
|
||||||
print "<tr>".'<td valign="top">'.$langs->trans("GlobalGroup").'</td>';
|
print "<tr>".'<td valign="top">'.$langs->trans("GlobalGroup").'</td>';
|
||||||
$checked=(empty($object->entity) ? ' checked' : '');
|
$checked=(empty($object->entity) ? ' checked' : '');
|
||||||
print '<td><input type="checkbox" name="globalgroup" value="1"'.$checked.' /></td>';
|
print '<td><input type="checkbox" name="globalgroup" value="1"'.$checked.' /></td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$value=(empty($object->entity) ? 1 : 0);
|
$value=(empty($object->entity) ? 1 : 0);
|
||||||
print '<input type="hidden" name="globalgroup" value="'.$value.'" />';
|
print '<input type="hidden" name="globalgroup" value="'.$value.'" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||||
print '<td class="valeur">';
|
print '<td class="valeur">';
|
||||||
|
|
||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','',true);
|
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','',true);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
|
print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
|
||||||
print dol_htmlentitiesbr_decode($object->note);
|
print dol_htmlentitiesbr_decode($object->note);
|
||||||
print '</textarea>';
|
print '</textarea>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print '<tr><td align="center" colspan="2"><input class="button" value="'.$langs->trans("Save").'" type="submit"></td></tr>';
|
print '<tr><td align="center" colspan="2"><input class="button" value="'.$langs->trans("Save").'" type="submit"></td></tr>';
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.68 $');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
* \file htdocs/user/group/ldap.php
|
* \file htdocs/user/group/ldap.php
|
||||||
* \ingroup ldap
|
* \ingroup ldap
|
||||||
* \brief Page fiche LDAP groupe
|
* \brief Page fiche LDAP groupe
|
||||||
* \version $Id$
|
* \version $Id: ldap.php,v 1.25 2011/07/08 18:49:17 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
@ -186,7 +186,7 @@ if ($result > 0)
|
|||||||
//var_dump($records);
|
//var_dump($records);
|
||||||
|
|
||||||
// Affichage arbre
|
// Affichage arbre
|
||||||
if (sizeof($records) && (! isset($records['count']) || $records['count'] > 0))
|
if (count($records) && (! isset($records['count']) || $records['count'] > 0))
|
||||||
{
|
{
|
||||||
if (! is_array($records))
|
if (! is_array($records))
|
||||||
{
|
{
|
||||||
@ -216,5 +216,5 @@ print '</table>';
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.25 $');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
* \file htdocs/user/ldap.php
|
* \file htdocs/user/ldap.php
|
||||||
* \ingroup ldap
|
* \ingroup ldap
|
||||||
* \brief Page fiche LDAP utilisateur
|
* \brief Page fiche LDAP utilisateur
|
||||||
* \version $Id$
|
* \version $Id: ldap.php,v 1.30 2011/07/08 18:49:17 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
@ -43,7 +43,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
|
|||||||
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
||||||
if ($user->id == $_GET["id"]) // A user can always read its own card
|
if ($user->id == $_GET["id"]) // A user can always read its own card
|
||||||
{
|
{
|
||||||
$feature2='';
|
$feature2='';
|
||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
|
$result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
|
||||||
|
|
||||||
@ -53,34 +53,34 @@ $fuser->getrights();
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_GET["action"] == 'dolibarr2ldap')
|
if ($_GET["action"] == 'dolibarr2ldap')
|
||||||
{
|
{
|
||||||
$message="";
|
$message="";
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
|
|
||||||
$info=$fuser->_load_ldap_info();
|
$info=$fuser->_load_ldap_info();
|
||||||
$dn=$fuser->_load_ldap_dn($info);
|
$dn=$fuser->_load_ldap_dn($info);
|
||||||
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$message.='<div class="ok">'.$langs->trans("UserSynchronized").'</div>';
|
$message.='<div class="ok">'.$langs->trans("UserSynchronized").'</div>';
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message.='<div class="error">'.$ldap->error.'</div>';
|
$message.='<div class="error">'.$ldap->error.'</div>';
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,25 +120,25 @@ print "</tr>\n";
|
|||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Login").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Login").'</td>';
|
||||||
if ($fuser->ldap_sid)
|
if ($fuser->ldap_sid)
|
||||||
{
|
{
|
||||||
print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
|
print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td>'.$fuser->login.'</td>';
|
print '<td>'.$fuser->login.'</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
|
if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
|
||||||
{
|
{
|
||||||
$ldap = new Ldap();
|
$ldap = new Ldap();
|
||||||
$result = $ldap->connect_bind();
|
$result = $ldap->connect_bind();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$userSID = $ldap->getObjectSid($fuser->login);
|
$userSID = $ldap->getObjectSid($fuser->login);
|
||||||
}
|
}
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("SID").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("SID").'</td>';
|
||||||
print '<td>'.$userSID.'</td>';
|
print '<td>'.$userSID.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// LDAP DN
|
// LDAP DN
|
||||||
@ -170,7 +170,7 @@ print '<div class="tabsAction">';
|
|||||||
|
|
||||||
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
|
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fuser->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fuser->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
@ -194,36 +194,36 @@ $ldap=new Ldap();
|
|||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$info=$fuser->_load_ldap_info();
|
$info=$fuser->_load_ldap_info();
|
||||||
$dn=$fuser->_load_ldap_dn($info,1);
|
$dn=$fuser->_load_ldap_dn($info,1);
|
||||||
$search = "(".$fuser->_load_ldap_dn($info,2).")";
|
$search = "(".$fuser->_load_ldap_dn($info,2).")";
|
||||||
$records=$ldap->getAttribute($dn,$search);
|
$records=$ldap->getAttribute($dn,$search);
|
||||||
|
|
||||||
//print_r($records);
|
//print_r($records);
|
||||||
|
|
||||||
// Affichage arbre
|
// Affichage arbre
|
||||||
if (sizeof($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
|
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
|
||||||
{
|
{
|
||||||
if (! is_array($records))
|
if (! is_array($records))
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
|
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result=show_ldap_content($records,0,$records['count'],true);
|
$result=show_ldap_content($records,0,$records['count'],true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
|
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$ldap->unbind();
|
$ldap->unbind();
|
||||||
$ldap->close();
|
$ldap->close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error('',$ldap->error);
|
dol_print_error('',$ldap->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -233,5 +233,5 @@ print '</table>';
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.30 $');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/user/param_ihm.php
|
* \file htdocs/user/param_ihm.php
|
||||||
* \brief Page to show user setup for display
|
* \brief Page to show user setup for display
|
||||||
* \version $Id$
|
* \version $Id: param_ihm.php,v 1.52 2011/07/08 18:49:17 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
@ -39,9 +39,9 @@ $canreaduser=($user->admin || $user->rights->user->user->lire);
|
|||||||
|
|
||||||
if ($_REQUEST["id"])
|
if ($_REQUEST["id"])
|
||||||
{
|
{
|
||||||
// $user est le user qui edite, $_REQUEST["id"] est l'id de l'utilisateur edite
|
// $user est le user qui edite, $_REQUEST["id"] est l'id de l'utilisateur edite
|
||||||
$caneditfield=( (($user->id == $_REQUEST["id"]) && $user->rights->user->self->creer)
|
$caneditfield=( (($user->id == $_REQUEST["id"]) && $user->rights->user->self->creer)
|
||||||
|| (($user->id != $_REQUEST["id"]) && $user->rights->user->user->creer));
|
|| (($user->id != $_REQUEST["id"]) && $user->rights->user->user->creer));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -50,8 +50,8 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
|
|||||||
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
|
||||||
if ($user->id == $_REQUEST["id"]) // A user can always read its own card
|
if ($user->id == $_REQUEST["id"]) // A user can always read its own card
|
||||||
{
|
{
|
||||||
$feature2='';
|
$feature2='';
|
||||||
$canreaduser=1;
|
$canreaduser=1;
|
||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'user', $_REQUEST["id"], '', $feature2);
|
$result = restrictedArea($user, 'user', $_REQUEST["id"], '', $feature2);
|
||||||
if ($user->id <> $_REQUEST["id"] && ! $canreaduser) accessforbidden();
|
if ($user->id <> $_REQUEST["id"] && ! $canreaduser) accessforbidden();
|
||||||
@ -237,21 +237,21 @@ else
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
if (! empty($dolibarr_main_demo))
|
if (! empty($dolibarr_main_demo))
|
||||||
{
|
{
|
||||||
print "<a class=\"butActionRefused\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>";
|
print "<a class=\"butActionRefused\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($user->id == $fuser->id || $user->admin) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
|
if ($user->id == $fuser->id || $user->admin) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$fuser->id.'">'.$langs->trans("Modify").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$fuser->id.'">'.$langs->trans("Modify").'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<a class=\"butActionRefused\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify")."</a>";
|
print "<a class=\"butActionRefused\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify")."</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -259,5 +259,5 @@ else
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.52 $');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/user/passwordforgotten.php
|
* \file htdocs/user/passwordforgotten.php
|
||||||
* \brief Page to ask a new password
|
* \brief Page to ask a new password
|
||||||
* \version $Id: passwordforgotten.php,v 1.74 2011/07/08 15:52:24 eldy Exp $
|
* \version $Id: passwordforgotten.php,v 1.75 2011/07/08 18:49:17 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
@ -38,8 +38,8 @@ $langs->load("ldap");
|
|||||||
// Security check
|
// Security check
|
||||||
if ($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)
|
if ($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)
|
||||||
{
|
{
|
||||||
header("Location: ".DOL_URL_ROOT.'/');
|
header("Location: ".DOL_URL_ROOT.'/');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action=GETPOST('action');
|
$action=GETPOST('action');
|
||||||
@ -60,82 +60,82 @@ if ($action == 'validatenewpassword' && $username && $passwordmd5)
|
|||||||
{
|
{
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
$result=$edituser->fetch('',$_GET["username"]);
|
$result=$edituser->fetch('',$_GET["username"]);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$username).'</div>';
|
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$username).'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (md5($edituser->pass_temp) == $passwordmd5)
|
if (md5($edituser->pass_temp) == $passwordmd5)
|
||||||
{
|
{
|
||||||
$newpassword=$edituser->setPassword($user,$edituser->pass_temp,0);
|
$newpassword=$edituser->setPassword($user,$edituser->pass_temp,0);
|
||||||
dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
|
dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
|
||||||
//session_start();
|
//session_start();
|
||||||
//$_SESSION["loginmesg"]=$langs->trans("PasswordChanged");
|
//$_SESSION["loginmesg"]=$langs->trans("PasswordChanged");
|
||||||
header("Location: ".DOL_URL_ROOT.'/');
|
header("Location: ".DOL_URL_ROOT.'/');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePassword").'</div>';
|
$message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePassword").'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Action modif mot de passe
|
// Action modif mot de passe
|
||||||
if ($action == 'buildnewpassword' && $username)
|
if ($action == 'buildnewpassword' && $username)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
|
||||||
require_once ARTICHOW."/AntiSpam.class.php";
|
require_once ARTICHOW."/AntiSpam.class.php";
|
||||||
|
|
||||||
// We create anti-spam object
|
// We create anti-spam object
|
||||||
$object = new AntiSpam();
|
$object = new AntiSpam();
|
||||||
|
|
||||||
// Verify code
|
// Verify code
|
||||||
if (! $object->check('dol_antispam_value',$_POST['code'],true))
|
if (! $object->check('dol_antispam_value',$_POST['code'],true))
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
|
$message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
$result=$edituser->fetch('',$username,'',1);
|
$result=$edituser->fetch('',$username,'',1);
|
||||||
if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
|
if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$username).'</div>';
|
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$username).'</div>';
|
||||||
$username='';
|
$username='';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (! $edituser->email)
|
if (! $edituser->email)
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans("ErrorLoginHasNoEmail").'</div>';
|
$message = '<div class="error">'.$langs->trans("ErrorLoginHasNoEmail").'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$newpassword=$edituser->setPassword($user,'',1);
|
$newpassword=$edituser->setPassword($user,'',1);
|
||||||
if ($newpassword < 0)
|
if ($newpassword < 0)
|
||||||
{
|
{
|
||||||
// Failed
|
// Failed
|
||||||
$message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
|
$message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Success
|
// Success
|
||||||
if ($edituser->send_password($user,$newpassword,1) > 0)
|
if ($edituser->send_password($user,$newpassword,1) > 0)
|
||||||
{
|
{
|
||||||
$message = '<div class="ok">'.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'</div>';
|
$message = '<div class="ok">'.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'</div>';
|
||||||
//$message.=$newpassword;
|
//$message.=$newpassword;
|
||||||
$username='';
|
$username='';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//$message = '<div class="ok">'.$langs->trans("PasswordChangedTo",$newpassword).'</div>';
|
//$message = '<div class="ok">'.$langs->trans("PasswordChangedTo",$newpassword).'</div>';
|
||||||
$message.= '<div class="error">'.$edituser->error.'</div>';
|
$message.= '<div class="error">'.$edituser->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -155,18 +155,18 @@ if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_A
|
|||||||
// Select templates
|
// Select templates
|
||||||
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
|
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
|
||||||
{
|
{
|
||||||
$template_dir = DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/';
|
$template_dir = DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php"))
|
if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php"))
|
||||||
{
|
{
|
||||||
$template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
|
$template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
|
$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$conf->css = "/theme/".$conf->theme."/style.css.php?lang=".$langs->defaultlang;
|
$conf->css = "/theme/".$conf->theme."/style.css.php?lang=".$langs->defaultlang;
|
||||||
@ -174,11 +174,11 @@ $conf_css = DOL_URL_ROOT.$conf->css;
|
|||||||
|
|
||||||
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
|
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
|
||||||
{
|
{
|
||||||
$login_background = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png';
|
$login_background = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$login_background = DOL_URL_ROOT.'/theme/login_background.png';
|
$login_background = DOL_URL_ROOT.'/theme/login_background.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $username) $focus_element = 'username';
|
if (! $username) $focus_element = 'username';
|
||||||
@ -196,55 +196,55 @@ $urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
|
|||||||
|
|
||||||
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
||||||
{
|
{
|
||||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small);
|
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small);
|
||||||
}
|
}
|
||||||
elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
|
elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
|
||||||
{
|
{
|
||||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo);
|
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo);
|
||||||
$width=128;
|
$width=128;
|
||||||
}
|
}
|
||||||
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
|
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
|
||||||
{
|
{
|
||||||
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
|
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entity combobox
|
// Entity combobox
|
||||||
$select_entity='';
|
$select_entity='';
|
||||||
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX) && ! $disabled)
|
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX) && ! $disabled)
|
||||||
{
|
{
|
||||||
$rowspan++;
|
$rowspan++;
|
||||||
$lastuser='';
|
$lastuser='';
|
||||||
$lastentity = GETPOST('entity');
|
$lastentity = GETPOST('entity');
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
|
if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
|
||||||
{
|
{
|
||||||
$prefix=dol_getprefix();
|
$prefix=dol_getprefix();
|
||||||
$entityCookieName = 'DOLENTITYID_'.$prefix;
|
$entityCookieName = 'DOLENTITYID_'.$prefix;
|
||||||
if (isset($_COOKIE[$entityCookieName]))
|
if (isset($_COOKIE[$entityCookieName]))
|
||||||
{
|
{
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/cookie.class.php");
|
include_once(DOL_DOCUMENT_ROOT . "/core/class/cookie.class.php");
|
||||||
|
|
||||||
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
|
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
|
||||||
|
|
||||||
$entityCookie = new DolCookie($cryptkey);
|
$entityCookie = new DolCookie($cryptkey);
|
||||||
$cookieValue = $entityCookie->_getCookie($entityCookieName);
|
$cookieValue = $entityCookie->_getCookie($entityCookieName);
|
||||||
list($lastuser, $lastentity) = explode('|', $cookieValue);
|
list($lastuser, $lastentity) = explode('|', $cookieValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$res=dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
$res=dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
$mc = new ActionsMulticompany($db);
|
$mc = new ActionsMulticompany($db);
|
||||||
$select_entity = $mc->select_entities($lastentity,'tabindex="2"');
|
$select_entity = $mc->select_entities($lastentity,'tabindex="2"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Security graphical code
|
// Security graphical code
|
||||||
if (function_exists("imagecreatefrompng") && ! $disabled)
|
if (function_exists("imagecreatefrompng") && ! $disabled)
|
||||||
{
|
{
|
||||||
$captcha = 1;
|
$captcha = 1;
|
||||||
$captcha_refresh = img_refresh();
|
$captcha_refresh = img_refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
include($template_dir.'passwordforgotten.tpl.php'); // To use native PHP
|
include($template_dir.'passwordforgotten.tpl.php'); // To use native PHP
|
||||||
|
|||||||
@ -176,7 +176,10 @@
|
|||||||
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
|
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
|
||||||
|
|
||||||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace" />
|
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace" />
|
||||||
|
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace.Line">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<!-- Already found as a Generic rule -->
|
<!-- Already found as a Generic rule -->
|
||||||
<!-- <rule ref="PEAR.WhiteSpace.ScopeIndent" /> -->
|
<!-- <rule ref="PEAR.WhiteSpace.ScopeIndent" /> -->
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user