mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 22:11:36 +01:00
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
@@ -34,42 +34,42 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
// Load translation files required by page
|
||||
$langs->loadLangs(array('users', 'other'));
|
||||
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
$id=(GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('id', 'int'));
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm');
|
||||
$id = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('id', 'int'));
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userdoc'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userdoc'; // To manage different context of search
|
||||
|
||||
// Define value to know what current user can do on users
|
||||
$canadduser=(! empty($user->admin) || $user->rights->user->user->creer);
|
||||
$canreaduser=(! empty($user->admin) || $user->rights->user->user->lire);
|
||||
$canedituser=(! empty($user->admin) || $user->rights->user->user->creer);
|
||||
$candisableuser=(! empty($user->admin) || $user->rights->user->user->supprimer);
|
||||
$canreadgroup=$canreaduser;
|
||||
$caneditgroup=$canedituser;
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
|
||||
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
|
||||
$canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
|
||||
$candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer);
|
||||
$canreadgroup = $canreaduser;
|
||||
$caneditgroup = $canedituser;
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
{
|
||||
$canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read);
|
||||
$caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write);
|
||||
$canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read);
|
||||
$caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write);
|
||||
}
|
||||
// Define value to know what current user can do on properties of edited user
|
||||
if ($id)
|
||||
{
|
||||
// $user est le user qui edite, $id est l'id de l'utilisateur edite
|
||||
$caneditfield=((($user->id == $id) && $user->rights->user->self->creer)
|
||||
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $id) && $user->rights->user->user->creer));
|
||||
$caneditpassword=((($user->id == $id) && $user->rights->user->self->password)
|
||||
$caneditpassword = ((($user->id == $id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $id) && $user->rights->user->user->password));
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) $socid = $user->socid;
|
||||
$feature2='user';
|
||||
$feature2 = 'user';
|
||||
|
||||
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
||||
|
||||
if ($user->id <> $id && ! $canreaduser) accessforbidden();
|
||||
if ($user->id <> $id && !$canreaduser) accessforbidden();
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@@ -79,29 +79,29 @@ if (empty($page) || $page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="position_name";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) $sortfield = "position_name";
|
||||
|
||||
$object = new User($db);
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
$result = $object->fetch($id, $ref, '', 1);
|
||||
$object->getrights();
|
||||
//$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ;
|
||||
// For users, the upload_dir is always $conf->user->entity for the moment
|
||||
$upload_dir = $conf->user->dir_output. "/" . $object->id ;
|
||||
$upload_dir = $conf->user->dir_output."/".$object->id;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('usercard','userdoc','globalcard'));
|
||||
$hookmanager->initHooks(array('usercard', 'userdoc', 'globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('id'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook)) {
|
||||
@@ -122,10 +122,10 @@ if ($object->id)
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
if (!empty($conf->notification->enabled)) $langs->load("mails");
|
||||
$head = user_prepare_head($object);
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
dol_fiche_head($head, 'document', $langs->trans("User"), -1, 'user');
|
||||
|
||||
@@ -140,11 +140,11 @@ if ($object->id)
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
// Build file list
|
||||
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize = 0;
|
||||
foreach ($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
|
||||
@@ -168,8 +168,8 @@ if ($object->id)
|
||||
$modulepart = 'user';
|
||||
$permission = $user->rights->user->user->creer;
|
||||
$permtoedit = $user->rights->user->user->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
$param = '&id='.$object->id;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user