diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 97901def506..9719223b407 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -25,7 +25,7 @@
/**
* \file htdocs/user/class/user.class.php
* \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");
@@ -99,8 +99,8 @@ class User extends CommonObject
/**
- * Constructeur de la classe
- * @param DB Handler acces base de donnees
+ * Constructor de la classe
+ * @param DoliDb $DB Database handler
*/
function User($DB)
{
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index 51ba9f3efab..95ff706a916 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -22,7 +22,7 @@
* \file htdocs/user/class/usergroup.class.php
* \brief Fichier de la classe des groupes d'utilisateur
* \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");
@@ -55,8 +55,8 @@ class UserGroup extends CommonObject
/**
- * Constructor
- * @param DB Handler acces base de donnees
+ * Constructor de la classe
+ * @param DoliDb $DB Database handler
*/
function UserGroup($DB)
{
diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php
index 956c98924f0..7ca187da7a7 100644
--- a/htdocs/user/fiche.php
+++ b/htdocs/user/fiche.php
@@ -24,7 +24,7 @@
/**
* \file htdocs/user/fiche.php
* \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");
@@ -215,7 +215,7 @@ if ($_POST["action"] == 'add' && $canadduser)
{
$langs->load("errors");
$db->rollback();
- if (is_array($edituser->errors) && sizeof($edituser->errors)) $message='
'.join('
',$langs->trans($edituser->errors)).'
';
+ if (is_array($edituser->errors) && count($edituser->errors)) $message=''.join('
',$langs->trans($edituser->errors)).'
';
else $message=''.$langs->trans($edituser->error).'
';
$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)
{
@@ -347,7 +347,7 @@ if ($action == 'update' && ! $_POST["cancel"])
}
}
- if ($ret >= 0 && ! sizeof($edituser->errors))
+ if ($ret >= 0 && ! count($edituser->errors))
{
$message.=''.$langs->trans("UserModified").'
';
$db->commit();
@@ -825,7 +825,7 @@ else
$statutUACF = '';
//On verifie les options du compte
- if (sizeof($ldap->uacf) > 0)
+ if (count($ldap->uacf) > 0)
{
foreach ($ldap->uacf as $key => $statut)
{
@@ -1609,7 +1609,7 @@ else
{
$contact = new Contact($db);
$contact->fetch($fuser->contact_id);
- print ' / '.''.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).'';
+ print ' / '.img_object($langs->trans("ShowContact"),'contact').' '.dol_trunc($contact->getFullName($langs),32).'';
}
}
else
@@ -1660,9 +1660,18 @@ else
$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) != '');
}
-llxFooter('$Date: 2011/06/29 10:23:33 $ - $Revision: 1.273 $');
?>
diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php
index eb159fd4a80..61c873a23b5 100644
--- a/htdocs/user/group/fiche.php
+++ b/htdocs/user/group/fiche.php
@@ -21,7 +21,7 @@
/**
* \file htdocs/user/group/fiche.php
* \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");
@@ -35,9 +35,9 @@ $candisableperms=($user->admin || $user->rights->user->user->supprimer);
// Advanced permissions
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
- $canreadperms=($user->admin || $user->rights->user->group_advance->read);
- $caneditperms=($user->admin || $user->rights->user->group_advance->write);
- $candisableperms=($user->admin || $user->rights->user->group_advance->delete);
+ $canreadperms=($user->admin || $user->rights->user->group_advance->read);
+ $caneditperms=($user->admin || $user->rights->user->group_advance->write);
+ $candisableperms=($user->admin || $user->rights->user->group_advance->delete);
}
$langs->load("users");
@@ -58,17 +58,17 @@ $object = new Usergroup($db);
*/
if ($action == 'confirm_delete' && $confirm == "yes")
{
- if ($caneditperms)
- {
- $object->fetch($_GET["id"]);
- $object->delete();
- Header("Location: index.php");
- exit;
- }
- else
- {
- $message = ''.$langs->trans('ErrorForbidden').'
';
- }
+ if ($caneditperms)
+ {
+ $object->fetch($_GET["id"]);
+ $object->delete();
+ Header("Location: index.php");
+ exit;
+ }
+ else
+ {
+ $message = ''.$langs->trans('ErrorForbidden').'
';
+ }
}
/**
@@ -76,114 +76,114 @@ if ($action == 'confirm_delete' && $confirm == "yes")
*/
if ($_POST["action"] == 'add')
{
- if($caneditperms)
- {
- $message="";
- if (! $_POST["nom"])
- {
- $message=''.$langs->trans("NameNotDefined").'
';
- $action="create"; // Go back to create page
- }
+ if($caneditperms)
+ {
+ $message="";
+ if (! $_POST["nom"])
+ {
+ $message=''.$langs->trans("NameNotDefined").'
';
+ $action="create"; // Go back to create page
+ }
- if (! $message)
- {
- $object->nom = trim($_POST["nom"]);
- $object->globalgroup = $_POST["globalgroup"];
- $object->note = trim($_POST["note"]);
+ if (! $message)
+ {
+ $object->nom = trim($_POST["nom"]);
+ $object->globalgroup = $_POST["globalgroup"];
+ $object->note = trim($_POST["note"]);
- $db->begin();
+ $db->begin();
- $id = $object->create();
+ $id = $object->create();
- if ($id > 0)
- {
- $db->commit();
+ if ($id > 0)
+ {
+ $db->commit();
- Header("Location: fiche.php?id=".$object->id);
- exit;
- }
- else
- {
- $db->rollback();
+ Header("Location: fiche.php?id=".$object->id);
+ exit;
+ }
+ else
+ {
+ $db->rollback();
- $langs->load("errors");
- $message=''.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'
';
- $action="create"; // Go back to create page
- }
- }
- }
- else
- {
- $message = ''.$langs->trans('ErrorForbidden').'
';
- }
+ $langs->load("errors");
+ $message=''.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'
';
+ $action="create"; // Go back to create page
+ }
+ }
+ }
+ else
+ {
+ $message = ''.$langs->trans('ErrorForbidden').'
';
+ }
}
// Add/Remove user into group
if ($action == 'adduser' || $action =='removeuser')
{
- if ($caneditperms)
- {
- if ($userid)
- {
- $object->fetch($_GET["id"]);
- $object->oldcopy=dol_clone($object);
+ if ($caneditperms)
+ {
+ if ($userid)
+ {
+ $object->fetch($_GET["id"]);
+ $object->oldcopy=dol_clone($object);
- $edituser = new User($db);
- $edituser->fetch($userid);
- if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,GETPOST('entity'));
- if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,GETPOST('entity'));
+ $edituser = new User($db);
+ $edituser->fetch($userid);
+ if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,GETPOST('entity'));
+ if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,GETPOST('entity'));
- if ($result > 0)
- {
- header("Location: fiche.php?id=".$object->id);
- exit;
- }
- else
- {
- $message.=$edituser->error;
- }
- }
- }
- else
- {
- $message = ''.$langs->trans('ErrorForbidden').'
';
- }
+ if ($result > 0)
+ {
+ header("Location: fiche.php?id=".$object->id);
+ exit;
+ }
+ else
+ {
+ $message.=$edituser->error;
+ }
+ }
+ }
+ else
+ {
+ $message = ''.$langs->trans('ErrorForbidden').'
';
+ }
}
if ($_POST["action"] == 'update')
{
- if($caneditperms)
- {
- $message="";
+ if($caneditperms)
+ {
+ $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->globalgroup = $_POST["globalgroup"];
- $object->note = dol_htmlcleanlastbr($_POST["note"]);
+ $object->nom = trim($_POST["group"]);
+ $object->globalgroup = $_POST["globalgroup"];
+ $object->note = dol_htmlcleanlastbr($_POST["note"]);
- $ret=$object->update();
+ $ret=$object->update();
- if ($ret >= 0 && ! sizeof($object->errors))
- {
- $message.=''.$langs->trans("GroupModified").'
';
- $db->commit();
- }
- else
- {
- $message.=''.$object->error.'
';
- $db->rollback();
- }
- }
- else
- {
- $message = ''.$langs->trans('ErrorForbidden').'
';
- }
+ if ($ret >= 0 && ! count($object->errors))
+ {
+ $message.=''.$langs->trans("GroupModified").'
';
+ $db->commit();
+ }
+ else
+ {
+ $message.=''.$object->error.'
';
+ $db->rollback();
+ }
+ }
+ else
+ {
+ $message = ''.$langs->trans('ErrorForbidden').'
';
+ }
}
@@ -199,51 +199,51 @@ $fuserstatic = new User($db);
if ($action == 'create')
{
- print_fiche_titre($langs->trans("NewGroup"));
+ print_fiche_titre($langs->trans("NewGroup"));
- if ($message) { print $message."
"; }
+ if ($message) { print $message."
"; }
- print '";
}
@@ -254,78 +254,78 @@ if ($action == 'create')
/* ************************************************************************** */
else
{
- if ($_GET["id"] )
- {
- $object->fetch($_GET["id"]);
+ if ($_GET["id"] )
+ {
+ $object->fetch($_GET["id"]);
- /*
- * Affichage onglets
- */
- $head = group_prepare_head($object);
- $title = $langs->trans("Group");
- dol_fiche_head($head, 'group', $title, 0, 'group');
+ /*
+ * Affichage onglets
+ */
+ $head = group_prepare_head($object);
+ $title = $langs->trans("Group");
+ dol_fiche_head($head, 'group', $title, 0, 'group');
- /*
- * Confirmation suppression
- */
- 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);
- if ($ret == 'html') print '
';
- }
+ /*
+ * Confirmation suppression
+ */
+ 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);
+ if ($ret == 'html') print '
';
+ }
- /*
- * Fiche en mode visu
- */
+ /*
+ * Fiche en mode visu
+ */
- if ($action != 'edit')
- {
- print '';
+ if ($action != 'edit')
+ {
+ print '';
- // Ref
- print '| '.$langs->trans("Ref").' | ';
- print '';
- print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
- print ' | ';
- print '
';
+ // Ref
+ print '| '.$langs->trans("Ref").' | ';
+ print '';
+ print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
+ print ' | ';
+ print '
';
- // Name
- print '| '.$langs->trans("Name").' | ';
- print ''.$object->nom;
- if (empty($object->entity))
- {
- print img_redstar($langs->trans("GlobalGroup"));
- }
- print " |
\n";
+ // Name
+ print '| '.$langs->trans("Name").' | ';
+ print ''.$object->nom;
+ if (empty($object->entity))
+ {
+ print img_redstar($langs->trans("GlobalGroup"));
+ }
+ print " |
\n";
- // Note
- print '| '.$langs->trans("Note").' | ';
- print ''.dol_htmlentitiesbr($object->note).' | ';
- print "
\n";
- print "
\n";
+ // Note
+ print '| '.$langs->trans("Note").' | ';
+ print ''.dol_htmlentitiesbr($object->note).' | ';
+ print "
\n";
+ print "
\n";
- print '';
+ print '';
- /*
- * Barre d'actions
- */
- print '';
+ /*
+ * Barre d'actions
+ */
+ print '
\n";
- print "
\n";
+ print "
\n";
+ print "
\n";
- dol_htmloutput_errors($message);
+ dol_htmloutput_errors($message);
/*
* Liste des utilisateurs dans le groupe
@@ -335,17 +335,17 @@ else
// On selectionne les users qui ne sont pas deja dans le groupe
$exclude = array();
-
+
$userslist = $object->listUsersForGroup();
-
+
if (! empty($userslist))
{
- foreach($userslist as $useringroup)
- {
- $exclude[]=$useringroup->id;
- }
+ foreach($userslist as $useringroup)
+ {
+ $exclude[]=$useringroup->id;
+ }
}
-
+
if ($caneditperms)
{
print '';
+ if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
+ {
+ require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+ $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','',true);
+ $doleditor->Create();
+ }
+ else
+ {
+ print '';
+ }
+ print '';
+ print "\n";
+ print ' |
';
+ print "\n";
+ print '';
- print '';
- }
+ print '';
+ }
- }
+ }
}
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.68 $');
?>
diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php
index 0d6079fe313..3f72932b347 100644
--- a/htdocs/user/group/ldap.php
+++ b/htdocs/user/group/ldap.php
@@ -21,7 +21,7 @@
* \file htdocs/user/group/ldap.php
* \ingroup ldap
* \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");
@@ -186,7 +186,7 @@ if ($result > 0)
//var_dump($records);
// Affichage arbre
- if (sizeof($records) && (! isset($records['count']) || $records['count'] > 0))
+ if (count($records) && (! isset($records['count']) || $records['count'] > 0))
{
if (! is_array($records))
{
@@ -216,5 +216,5 @@ print '';
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.25 $');
?>
diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php
index a456ee96954..4c037fb17ee 100644
--- a/htdocs/user/ldap.php
+++ b/htdocs/user/ldap.php
@@ -21,7 +21,7 @@
* \file htdocs/user/ldap.php
* \ingroup ldap
* \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");
@@ -43,7 +43,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
if ($user->id == $_GET["id"]) // A user can always read its own card
{
- $feature2='';
+ $feature2='';
}
$result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
@@ -53,34 +53,34 @@ $fuser->getrights();
/*
-* Actions
-*/
+ * Actions
+ */
if ($_GET["action"] == 'dolibarr2ldap')
{
- $message="";
+ $message="";
- $db->begin();
+ $db->begin();
- $ldap=new Ldap();
- $result=$ldap->connect_bind();
+ $ldap=new Ldap();
+ $result=$ldap->connect_bind();
- $info=$fuser->_load_ldap_info();
- $dn=$fuser->_load_ldap_dn($info);
- $olddn=$dn; // We can say that old dn = dn as we force synchro
+ $info=$fuser->_load_ldap_info();
+ $dn=$fuser->_load_ldap_dn($info);
+ $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)
- {
- $message.=''.$langs->trans("UserSynchronized").'
';
- $db->commit();
- }
- else
- {
- $message.=''.$ldap->error.'
';
- $db->rollback();
- }
+ if ($result >= 0)
+ {
+ $message.=''.$langs->trans("UserSynchronized").'
';
+ $db->commit();
+ }
+ else
+ {
+ $message.=''.$ldap->error.'
';
+ $db->rollback();
+ }
}
@@ -120,25 +120,25 @@ print "\n";
print '| '.$langs->trans("Login").' | ';
if ($fuser->ldap_sid)
{
- print ''.$langs->trans("LoginAccountDisableInDolibarr").' | ';
+ print ''.$langs->trans("LoginAccountDisableInDolibarr").' | ';
}
else
{
- print ''.$fuser->login.' | ';
+ print ''.$fuser->login.' | ';
}
print '
';
if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
{
- $ldap = new Ldap();
- $result = $ldap->connect_bind();
- if ($result > 0)
- {
- $userSID = $ldap->getObjectSid($fuser->login);
- }
- print '| '.$langs->trans("SID").' | ';
- print ''.$userSID.' | ';
- print "
\n";
+ $ldap = new Ldap();
+ $result = $ldap->connect_bind();
+ if ($result > 0)
+ {
+ $userSID = $ldap->getObjectSid($fuser->login);
+ }
+ print '| '.$langs->trans("SID").' | ';
+ print ''.$userSID.' | ';
+ print "
\n";
}
// LDAP DN
@@ -170,7 +170,7 @@ print '\n";
@@ -194,36 +194,36 @@ $ldap=new Ldap();
$result=$ldap->connect_bind();
if ($result > 0)
{
- $info=$fuser->_load_ldap_info();
- $dn=$fuser->_load_ldap_dn($info,1);
- $search = "(".$fuser->_load_ldap_dn($info,2).")";
- $records=$ldap->getAttribute($dn,$search);
+ $info=$fuser->_load_ldap_info();
+ $dn=$fuser->_load_ldap_dn($info,1);
+ $search = "(".$fuser->_load_ldap_dn($info,2).")";
+ $records=$ldap->getAttribute($dn,$search);
- //print_r($records);
+ //print_r($records);
- // Affichage arbre
- if (sizeof($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
- {
- if (! is_array($records))
- {
- print '| '.$langs->trans("ErrorFailedToReadLDAP").' |
';
- }
- else
- {
- $result=show_ldap_content($records,0,$records['count'],true);
- }
- }
- else
- {
- print '| '.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.') |
';
- }
+ // Affichage arbre
+ if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
+ {
+ if (! is_array($records))
+ {
+ print '| '.$langs->trans("ErrorFailedToReadLDAP").' |
';
+ }
+ else
+ {
+ $result=show_ldap_content($records,0,$records['count'],true);
+ }
+ }
+ else
+ {
+ print '| '.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.') |
';
+ }
- $ldap->unbind();
- $ldap->close();
+ $ldap->unbind();
+ $ldap->close();
}
else
{
- dol_print_error('',$ldap->error);
+ dol_print_error('',$ldap->error);
}
print '';
@@ -233,5 +233,5 @@ print '';
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.30 $');
?>
diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php
index 5c309faae9b..e938755bf55 100644
--- a/htdocs/user/param_ihm.php
+++ b/htdocs/user/param_ihm.php
@@ -20,7 +20,7 @@
/**
* \file htdocs/user/param_ihm.php
* \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");
@@ -39,9 +39,9 @@ $canreaduser=($user->admin || $user->rights->user->user->lire);
if ($_REQUEST["id"])
{
- // $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)
- || (($user->id != $_REQUEST["id"]) && $user->rights->user->user->creer));
+ // $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)
+ || (($user->id != $_REQUEST["id"]) && $user->rights->user->user->creer));
}
// Security check
@@ -50,8 +50,8 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
if ($user->id == $_REQUEST["id"]) // A user can always read its own card
{
- $feature2='';
- $canreaduser=1;
+ $feature2='';
+ $canreaduser=1;
}
$result = restrictedArea($user, 'user', $_REQUEST["id"], '', $feature2);
if ($user->id <> $_REQUEST["id"] && ! $canreaduser) accessforbidden();
@@ -237,21 +237,21 @@ else
print '';
print '';
@@ -259,5 +259,5 @@ else
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/07/08 18:49:17 $ - $Revision: 1.52 $');
?>
diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php
index 8ca37c7cbe9..02a4318c340 100644
--- a/htdocs/user/passwordforgotten.php
+++ b/htdocs/user/passwordforgotten.php
@@ -20,7 +20,7 @@
/**
* \file htdocs/user/passwordforgotten.php
* \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.
@@ -38,8 +38,8 @@ $langs->load("ldap");
// Security check
if ($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)
{
- header("Location: ".DOL_URL_ROOT.'/');
- exit;
+ header("Location: ".DOL_URL_ROOT.'/');
+ exit;
}
$action=GETPOST('action');
@@ -60,82 +60,82 @@ if ($action == 'validatenewpassword' && $username && $passwordmd5)
{
$edituser = new User($db);
$result=$edituser->fetch('',$_GET["username"]);
- if ($result < 0)
- {
+ if ($result < 0)
+ {
$message = ''.$langs->trans("ErrorLoginDoesNotExists",$username).'
';
- }
- else
- {
- if (md5($edituser->pass_temp) == $passwordmd5)
- {
- $newpassword=$edituser->setPassword($user,$edituser->pass_temp,0);
- dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
- //session_start();
- //$_SESSION["loginmesg"]=$langs->trans("PasswordChanged");
- header("Location: ".DOL_URL_ROOT.'/');
- exit;
- }
- else
- {
- $message = ''.$langs->trans("ErrorFailedToValidatePassword").'
';
- }
- }
+ }
+ else
+ {
+ if (md5($edituser->pass_temp) == $passwordmd5)
+ {
+ $newpassword=$edituser->setPassword($user,$edituser->pass_temp,0);
+ dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
+ //session_start();
+ //$_SESSION["loginmesg"]=$langs->trans("PasswordChanged");
+ header("Location: ".DOL_URL_ROOT.'/');
+ exit;
+ }
+ else
+ {
+ $message = ''.$langs->trans("ErrorFailedToValidatePassword").'
';
+ }
+ }
}
// Action modif mot de passe
if ($action == 'buildnewpassword' && $username)
{
- require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
- require_once ARTICHOW."/AntiSpam.class.php";
+ require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
+ require_once ARTICHOW."/AntiSpam.class.php";
- // We create anti-spam object
- $object = new AntiSpam();
+ // We create anti-spam object
+ $object = new AntiSpam();
- // Verify code
- if (! $object->check('dol_antispam_value',$_POST['code'],true))
- {
- $message = ''.$langs->trans("ErrorBadValueForCode").'
';
- }
- else
- {
- $edituser = new User($db);
- $result=$edituser->fetch('',$username,'',1);
- if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
- {
- $message = ''.$langs->trans("ErrorLoginDoesNotExists",$username).'
';
- $username='';
- }
- else
- {
- if (! $edituser->email)
- {
- $message = ''.$langs->trans("ErrorLoginHasNoEmail").'
';
- }
- else
- {
- $newpassword=$edituser->setPassword($user,'',1);
- if ($newpassword < 0)
- {
- // Failed
- $message = ''.$langs->trans("ErrorFailedToChangePassword").'
';
- }
- else
- {
- // Success
- if ($edituser->send_password($user,$newpassword,1) > 0)
- {
- $message = ''.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'
';
- //$message.=$newpassword;
- $username='';
- }
- else
- {
- //$message = ''.$langs->trans("PasswordChangedTo",$newpassword).'
';
- $message.= ''.$edituser->error.'
';
- }
- }
- }
- }
- }
+ // Verify code
+ if (! $object->check('dol_antispam_value',$_POST['code'],true))
+ {
+ $message = ''.$langs->trans("ErrorBadValueForCode").'
';
+ }
+ else
+ {
+ $edituser = new User($db);
+ $result=$edituser->fetch('',$username,'',1);
+ if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
+ {
+ $message = ''.$langs->trans("ErrorLoginDoesNotExists",$username).'
';
+ $username='';
+ }
+ else
+ {
+ if (! $edituser->email)
+ {
+ $message = ''.$langs->trans("ErrorLoginHasNoEmail").'
';
+ }
+ else
+ {
+ $newpassword=$edituser->setPassword($user,'',1);
+ if ($newpassword < 0)
+ {
+ // Failed
+ $message = ''.$langs->trans("ErrorFailedToChangePassword").'
';
+ }
+ else
+ {
+ // Success
+ if ($edituser->send_password($user,$newpassword,1) > 0)
+ {
+ $message = ''.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'
';
+ //$message.=$newpassword;
+ $username='';
+ }
+ else
+ {
+ //$message = ''.$langs->trans("PasswordChangedTo",$newpassword).'
';
+ $message.= ''.$edituser->error.'
';
+ }
+ }
+ }
+ }
+ }
}
@@ -155,18 +155,18 @@ if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_A
// Select templates
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
{
- if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php"))
- {
- $template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
- }
- else
- {
- $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
- }
+ if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php"))
+ {
+ $template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/";
+ }
+ else
+ {
+ $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
+ }
}
$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'))
{
- $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
{
- $login_background = DOL_URL_ROOT.'/theme/login_background.png';
+ $login_background = DOL_URL_ROOT.'/theme/login_background.png';
}
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))
{
- $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))
{
- $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo);
- $width=128;
+ $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo);
+ $width=128;
}
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
$select_entity='';
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX) && ! $disabled)
{
- $rowspan++;
- $lastuser='';
- $lastentity = GETPOST('entity');
+ $rowspan++;
+ $lastuser='';
+ $lastentity = GETPOST('entity');
- if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
- {
- $prefix=dol_getprefix();
- $entityCookieName = 'DOLENTITYID_'.$prefix;
- if (isset($_COOKIE[$entityCookieName]))
- {
- include_once(DOL_DOCUMENT_ROOT . "/core/class/cookie.class.php");
+ if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
+ {
+ $prefix=dol_getprefix();
+ $entityCookieName = 'DOLENTITYID_'.$prefix;
+ if (isset($_COOKIE[$entityCookieName]))
+ {
+ 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);
- $cookieValue = $entityCookie->_getCookie($entityCookieName);
- list($lastuser, $lastentity) = explode('|', $cookieValue);
- }
- }
+ $entityCookie = new DolCookie($cryptkey);
+ $cookieValue = $entityCookie->_getCookie($entityCookieName);
+ list($lastuser, $lastentity) = explode('|', $cookieValue);
+ }
+ }
- $res=dol_include_once('/multicompany/class/actions_multicompany.class.php');
- if ($res)
- {
- $mc = new ActionsMulticompany($db);
- $select_entity = $mc->select_entities($lastentity,'tabindex="2"');
- }
+ $res=dol_include_once('/multicompany/class/actions_multicompany.class.php');
+ if ($res)
+ {
+ $mc = new ActionsMulticompany($db);
+ $select_entity = $mc->select_entities($lastentity,'tabindex="2"');
+ }
}
// Security graphical code
if (function_exists("imagecreatefrompng") && ! $disabled)
{
- $captcha = 1;
- $captcha_refresh = img_refresh();
+ $captcha = 1;
+ $captcha_refresh = img_refresh();
}
include($template_dir.'passwordforgotten.tpl.php'); // To use native PHP
diff --git a/test/codesniffer/ruleset.xml b/test/codesniffer/ruleset.xml
index 8b2b2e5b28b..445aa112bfe 100755
--- a/test/codesniffer/ruleset.xml
+++ b/test/codesniffer/ruleset.xml
@@ -176,7 +176,10 @@
-
+
+ 0
+
+